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 {
/**
* Renders the application form with an optional job
*
* @param JobApplication|NULL $applyData
* @param string|NULL $error
* @param string|NULL $folderName
* @param JobApplication $applyData
* @param string $error
* @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 !== '') {
$this->view->assign('internalError', $error);
}
......@@ -121,11 +123,10 @@ class JoblistController extends ActionController {
}
$this->view->assign('folderName', $folderName);
$jobId = $this->request->getArguments()['uid'];
$jobData = NULL;
if (!empty($jobId)) {
if (!$uid !== NULL) {
/** @var Job $jobData */
$jobData = $this->jobRepository->findByUid($jobId);
$jobData = $this->jobRepository->findByUid($uid);
$this->view->assign('job', $jobData);
}
......@@ -195,7 +196,7 @@ class JoblistController extends ActionController {
$resourceFactory = $this->objectManager->get(ResourceFactory::class);
$newName = date('Ymd-His') . '_' . $applicationData->getFirstName();
$storage = $resourceFactory->getStorageObject(1);
$applicationFilePath = str_replace('/', '', $storage->getConfiguration()['basePath']) . $folderName .
$applicationFilePath = PATH_site . $storage->getConfiguration()['basePath'] . 'JobApplication/' . $folderName .
'/' . $newName . '.csv';
$this->writeApplicationFile($applicationData, $applicationFilePath);
}
......@@ -244,14 +245,13 @@ class JoblistController extends ActionController {
$mailService->sendEmail();
// redirect to the given page id from the flexform
$redirectPageId = (int) $this->configurationManager->getConfiguration(
ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK
)['settings']['redirectPage'];
$redirectPageUid = (int) $this->settings['redirectPage'];
if ($redirectPageUid) {
$url = $this->configurationManager->getContentObject()->getTypoLink_URL($redirectPageUid);
$this->redirectToUri($url);
}
$uriBuilder = $this->uriBuilder;
$uri = $uriBuilder->reset()->setTargetPageUid($redirectPageId)->build();
$this->redirectToUri($uri);
$this->redirect('applyForm');
} catch (\Exception $exception) {
$this->forward('applyForm', NULL, NULL, ['applyData' => $applyData, 'error' => $exception->getMessage()]);
......
......@@ -37,7 +37,6 @@ class JobApplication extends AbstractEntity {
* An internal id for external purposes
*
* @var string $jobId
* @validate NotEmpty
*/
protected $jobId = '';
......@@ -45,7 +44,7 @@ class JobApplication extends AbstractEntity {
* @var string $gender
* @validate NotEmpty
*/
protected $gender = '';
protected $gender = 0;
/**
* @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 @@
<f:section name="main">
<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}">
<div class="errormessage">
......@@ -14,7 +32,8 @@
<f:if condition="{job}">
<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>
<span id="apply-title">{job.title}</span>
</p>
......
......@@ -20,4 +20,4 @@ Mobil: {application.mobile}
E-Mail Adresse: {application.email}
Nachricht: {application.message}
\ No newline at end of file
Nachricht: {application.message}
<?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
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'SGalinski.sg_jobs',
......@@ -34,7 +40,6 @@
);
if (TYPO3_MODE === 'BE') {
$extPath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('sg_jobs');
$tsPath = $extPath . 'Configuration/TypoScript/Backend/';
\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