Skip to content
Snippets Groups Projects
Commit d7fb57e9 authored by Stefan Galinski's avatar Stefan Galinski :video_game:
Browse files

[FEATURE] The whole foo should work now (let's start the fine tuning)

parent 92a2a4bb
No related branches found
No related tags found
No related merge requests found
...@@ -107,11 +107,13 @@ class JoblistController extends ActionController { ...@@ -107,11 +107,13 @@ class JoblistController extends ActionController {
/** /**
* Renders the application form with an optional job * Renders the application form with an optional job
* *
* @param JobApplication|NULL $applyData * @param JobApplication $applyData
* @param string|NULL $error * @param string $error
* @param string|NULL $folderName * @param string $folderName
* @param int $uid
* @throws \TYPO3\CMS\Extbase\Mvc\Exception\NoSuchArgumentException
*/ */
public function applyFormAction(JobApplication $applyData = NULL, $error = NULL, $folderName = NULL) { public function applyFormAction(JobApplication $applyData = NULL, $error = NULL, $folderName = NULL, $uid = NULL) {
if ($error !== NULL && $error !== '') { if ($error !== NULL && $error !== '') {
$this->view->assign('internalError', $error); $this->view->assign('internalError', $error);
} }
...@@ -121,11 +123,10 @@ class JoblistController extends ActionController { ...@@ -121,11 +123,10 @@ class JoblistController extends ActionController {
} }
$this->view->assign('folderName', $folderName); $this->view->assign('folderName', $folderName);
$jobId = $this->request->getArguments()['uid'];
$jobData = NULL; $jobData = NULL;
if (!empty($jobId)) { if (!$uid !== NULL) {
/** @var Job $jobData */ /** @var Job $jobData */
$jobData = $this->jobRepository->findByUid($jobId); $jobData = $this->jobRepository->findByUid($uid);
$this->view->assign('job', $jobData); $this->view->assign('job', $jobData);
} }
...@@ -195,7 +196,7 @@ class JoblistController extends ActionController { ...@@ -195,7 +196,7 @@ class JoblistController extends ActionController {
$resourceFactory = $this->objectManager->get(ResourceFactory::class); $resourceFactory = $this->objectManager->get(ResourceFactory::class);
$newName = date('Ymd-His') . '_' . $applicationData->getFirstName(); $newName = date('Ymd-His') . '_' . $applicationData->getFirstName();
$storage = $resourceFactory->getStorageObject(1); $storage = $resourceFactory->getStorageObject(1);
$applicationFilePath = str_replace('/', '', $storage->getConfiguration()['basePath']) . $folderName . $applicationFilePath = PATH_site . $storage->getConfiguration()['basePath'] . 'JobApplication/' . $folderName .
'/' . $newName . '.csv'; '/' . $newName . '.csv';
$this->writeApplicationFile($applicationData, $applicationFilePath); $this->writeApplicationFile($applicationData, $applicationFilePath);
} }
...@@ -244,14 +245,13 @@ class JoblistController extends ActionController { ...@@ -244,14 +245,13 @@ class JoblistController extends ActionController {
$mailService->sendEmail(); $mailService->sendEmail();
// redirect to the given page id from the flexform $redirectPageUid = (int) $this->settings['redirectPage'];
$redirectPageId = (int) $this->configurationManager->getConfiguration( if ($redirectPageUid) {
ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK $url = $this->configurationManager->getContentObject()->getTypoLink_URL($redirectPageUid);
)['settings']['redirectPage']; $this->redirectToUri($url);
}
$uriBuilder = $this->uriBuilder; $this->redirect('applyForm');
$uri = $uriBuilder->reset()->setTargetPageUid($redirectPageId)->build();
$this->redirectToUri($uri);
} catch (\Exception $exception) { } catch (\Exception $exception) {
$this->forward('applyForm', NULL, NULL, ['applyData' => $applyData, 'error' => $exception->getMessage()]); $this->forward('applyForm', NULL, NULL, ['applyData' => $applyData, 'error' => $exception->getMessage()]);
......
...@@ -37,7 +37,6 @@ class JobApplication extends AbstractEntity { ...@@ -37,7 +37,6 @@ class JobApplication extends AbstractEntity {
* An internal id for external purposes * An internal id for external purposes
* *
* @var string $jobId * @var string $jobId
* @validate NotEmpty
*/ */
protected $jobId = ''; protected $jobId = '';
...@@ -45,7 +44,7 @@ class JobApplication extends AbstractEntity { ...@@ -45,7 +44,7 @@ class JobApplication extends AbstractEntity {
* @var string $gender * @var string $gender
* @validate NotEmpty * @validate NotEmpty
*/ */
protected $gender = ''; protected $gender = 0;
/** /**
* @var string $firstName * @var string $firstName
......
config.tx_extbase {
persistence {
classes {
SGalinski\SgJobs\Domain\Model\JobApplication {
mapping {
tableName = tx_sgjobs_domain_model_job_application
}
}
}
}
}
...@@ -4,7 +4,25 @@ ...@@ -4,7 +4,25 @@
<f:section name="main"> <f:section name="main">
<f:form action="apply" controller="Joblist" method="post" name="applyData" object="{applyData}" enctype="multipart/form-data"> <f:form action="apply" controller="Joblist" method="post" name="applyData" object="{applyData}" enctype="multipart/form-data">
<f:form.hidden name="folderName" value="{folderName}" /> <input type="hidden" name="tx_sgjobs_jobapplication[folderName]" value="{folderName}" />
<f:comment><!-- To output all validation errors
<f:form.validationResults>
<f:if condition="{validationResults.flattenedErrors}">
<ul class="errors">
<f:for each="{validationResults.flattenedErrors}" as="errors" key="propertyPath">
<li>{propertyPath}
<ul>
<f:for each="{errors}" as="error">
<li>{error.code}: {error}</li>
</f:for>
</ul>
</li>
</f:for>
</ul>
</f:if>
</f:form.validationResults>
--></f:comment>
<f:if condition="{internalError}"> <f:if condition="{internalError}">
<div class="errormessage"> <div class="errormessage">
...@@ -14,7 +32,8 @@ ...@@ -14,7 +32,8 @@
<f:if condition="{job}"> <f:if condition="{job}">
<p> <p>
<f:form.hidden value="{applyData.jobId}" property="jobId" /> <input type="hidden" name="tx_sgjobs_jobapplication[applyData][jobId]" value="{job.jobId}" />
<input type="hidden" name="tx_sgjobs_jobapplication[applyData][jobTitle]" value="{job.title}" />
<label for="apply-title"><f:translate key="frontend.apply.title" /></label> <label for="apply-title"><f:translate key="frontend.apply.title" /></label>
<span id="apply-title">{job.title}</span> <span id="apply-title">{job.title}</span>
</p> </p>
......
...@@ -20,4 +20,4 @@ Mobil: {application.mobile} ...@@ -20,4 +20,4 @@ Mobil: {application.mobile}
E-Mail Adresse: {application.email} E-Mail Adresse: {application.email}
Nachricht: {application.message} Nachricht: {application.message}
\ No newline at end of file
<?php <?php
$extPath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('sg_jobs');
// common typoscript configuration
$tsPath = $extPath . 'Configuration/TypoScript/Common/';
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTypoScriptSetup(file_get_contents($tsPath . 'setup.txt'));
// Configure frontend plugins // Configure frontend plugins
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin( \TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'SGalinski.sg_jobs', 'SGalinski.sg_jobs',
...@@ -34,7 +40,6 @@ ...@@ -34,7 +40,6 @@
); );
if (TYPO3_MODE === 'BE') { if (TYPO3_MODE === 'BE') {
$extPath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('sg_jobs');
$tsPath = $extPath . 'Configuration/TypoScript/Backend/'; $tsPath = $extPath . 'Configuration/TypoScript/Backend/';
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTypoScriptConstants( \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTypoScriptConstants(
......
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