Skip to content
Snippets Groups Projects
Commit bd5bb4f7 authored by Johannes Kreiner's avatar Johannes Kreiner
Browse files

[TASK] Add attachment field to Job model

parent 201d46be
No related branches found
No related tags found
No related merge requests found
......@@ -27,11 +27,20 @@ namespace SGalinski\SgJobs\Domain\Model;
***************************************************************/
use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
use TYPO3\CMS\Extbase\Persistence\Generic\LazyLoadingProxy;
use TYPO3\CMS\Extbase\Persistence\ObjectStorage;
/**
* The Job model
*/
class Job extends AbstractEntity {
/**
* Job constructor.
*/
public function __construct() {
$this->attachment = new ObjectStorage();
}
/**
* @var string $title
*/
......@@ -42,6 +51,12 @@ class Job extends AbstractEntity {
*/
protected $jobId = '';
/**
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<TYPO3\CMS\Extbase\Domain\Model\FileReference>
* @lazy
*/
protected $attachment;
/**
* @var string $task
*/
......@@ -180,6 +195,24 @@ class Job extends AbstractEntity {
$this->jobId = $jobId;
}
/**
* @return ObjectStorage
*/
public function getAttachment(): ObjectStorage {
if ($this->attachment instanceof LazyLoadingProxy) {
$this->attachment->_loadRealInstance();
}
return $this->attachment;
}
/**
* @param ObjectStorage $attachment
*/
public function setAttachment(ObjectStorage $attachment): void {
$this->attachment = $attachment;
}
/**
* @return string
*/
......
......@@ -64,6 +64,7 @@ return call_user_func(
company,
contact,
description,
attachment,
--div--; LLL:EXT:' . $extKey . '/Resources/Private/Language/locallang_db.xlf:tca.qualification_tab, task, qualification,
--div--; LLL:EXT:' . $extKey . '/Resources/Private/Language/locallang_db.xlf:tca.seo_tab,
--palette--;;palette_location_specifications,
......@@ -219,6 +220,15 @@ return call_user_func(
'eval' => 'trim'
],
],
'attachment' => [
'exclude' => TRUE,
'label' => 'LLL:EXT:' . $extKey . '/Resources/Private/Language/locallang_db.xlf:' . $table . '.attachment',
'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig(
'attachment',
['maxitems' => 1],
'pdf'
)
],
'department' => [
'exclude' => TRUE,
'l10n_mode' => 'exclude',
......
......@@ -294,6 +294,10 @@
<source><![CDATA[Apply by mail]]></source>
<target><![CDATA[Bewerbung per Post]]></target>
</trans-unit>
<trans-unit id="frontend.attachment" approved="yes">
<source><![CDATA[Download job advertisement]]></source>
<target><![CDATA[Stellenanzeige herunterladen]]></target>
</trans-unit>
<trans-unit id="frontend.department" approved="yes">
<source><![CDATA[Department]]></source>
<target><![CDATA[Bereich]]></target>
......
......@@ -181,6 +181,10 @@
<source><![CDATA[Display apply by postal service section]]></source>
<target><![CDATA[Bewerbung per Post einblenden]]></target>
</trans-unit>
<trans-unit id="tx_sgjobs_domain_model_job.attachment" approved="yes">
<source><![CDATA[Attachment]]></source>
<target><![CDATA[Anhang]]></target>
</trans-unit>
<trans-unit id="tx_sgjobs_domain_model_job.base_salary" approved="yes">
<source><![CDATA[Minimal/Base salary per pay period. Must be set greater than 0 for salary information to be embedded.]]></source>
<target><![CDATA[Minimal-/Basisgehalt pro Gehaltsperiode. Muss größer 0 gesetzt werden, damit Gehaltsinformationen hinterlegt werden.]]></target>
......
......@@ -222,6 +222,9 @@
<trans-unit id="frontend.apply_by_mail">
<source><![CDATA[Apply by mail]]></source>
</trans-unit>
<trans-unit id="frontend.attachment">
<source><![CDATA[Download job advertisement]]></source>
</trans-unit>
<trans-unit id="frontend.department">
<source><![CDATA[Department]]></source>
</trans-unit>
......
......@@ -141,6 +141,9 @@
<trans-unit id="tx_sgjobs_domain_model_job.applyByPostal">
<source><![CDATA[Display apply by postal service section]]></source>
</trans-unit>
<trans-unit id="tx_sgjobs_domain_model_job.attachment">
<source><![CDATA[Attachment]]></source>
</trans-unit>
<trans-unit id="tx_sgjobs_domain_model_job.base_salary">
<source><![CDATA[Minimal/Base salary per pay period. Must be set greater than 0 for salary information to be embedded.]]></source>
</trans-unit>
......
......@@ -65,6 +65,20 @@
</p>
</f:if>
<f:if condition="{job.attachment}">
<hr>
<div class="default-content-element downloads">
<f:link.typolink target="_blank" parameter="{job.attachment.0.originalResource.publicUrl}" class="download-link">
<span class="download-icon download-pdf">
</span>
<span class="download-link__file-description">
<f:translate key="frontend.attachment" extensionName="SgJobs"/>
<span class="download-link__file-properties">(PDF, {job.attachment.0.originalResource.size -> f:format.bytes()})</span>
</span>
</f:link.typolink>
</div>
</f:if>
<p><f:format.raw><f:translate key="frontend.job.suggestForm" extensionName="project_theme" /></f:format.raw></p>
<div class="default-content-element sg-cta sg-cta-with-icon">
<a href="#apply" class="btn btn-warning btn-lg">
......
......@@ -6,6 +6,7 @@ CREATE TABLE tx_sgjobs_domain_model_job (
path_segment text DEFAULT '' NOT NULL,
title text DEFAULT '' NOT NULL,
job_id varchar(30) DEFAULT '' NOT NULL,
attachment int(11) DEFAULT '0' NOT NULL,
task text DEFAULT '' NOT NULL,
qualification text DEFAULT '' NOT NULL,
alternative_start_date text DEFAULT '' NOT NULL,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment