Skip to content
Snippets Groups Projects
Commit ee79e75a authored by Torsten Oppermann's avatar Torsten Oppermann
Browse files

[TASK] Working on filters + file upload, add alternative entry date field

parent e8a773d4
No related branches found
No related tags found
No related merge requests found
Showing
with 208 additions and 98 deletions
......@@ -33,6 +33,7 @@ use TYPO3\CMS\Core\Resource\ResourceFactory;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
use TYPO3\CMS\Core\Utility\File\ExtendedFileUtility;
use TYPO3Fluid\Fluid\View\ViewInterface;
/**
* The joblist plugin controller
......@@ -65,9 +66,12 @@ class JoblistController extends ActionController {
*/
public function indexAction() {
$pageUid = (int) GeneralUtility::_GP('id');
$rootPageId = BackendService::getRootUidByPageUid($pageUid);
$this->assignFilterValues($rootPageId);
// get all jobs for the next root page
$jobs = $this->jobRepository->findJobs(BackendService::getRootUidByPageUid($pageUid));
$jobs = $this->jobRepository->findJobs($rootPageId);
$this->view->assign('jobs', $jobs);
}
......@@ -106,6 +110,32 @@ class JoblistController extends ActionController {
}
}
/**
* @param int $rootPageId
* @param array $filterValues
*/
private function assignFilterValues($rootPageId, $filterValues = []) {
// get all countries
$countries = $this->companyRepository->getAllCountries($rootPageId);
$this->view->assign('countries', $countries);
// get all cities
$cities = $this->companyRepository->getAllCities($rootPageId);
$this->view->assign('cities', $cities);
// get all cities
$companies = $this->companyRepository->getAllCompanyNames($rootPageId);
$this->view->assign('companies', $companies);
// get all areas
$areas = $this->jobRepository->getAllAreas($rootPageId);
$this->view->assign('areas', $areas);
// get all areas
$functions = $this->jobRepository->getAllFunctions($rootPageId);
$this->view->assign('functions', $functions);
}
/**
* @param array $applyData
* @return array
......
......@@ -58,6 +58,11 @@ class Job extends AbstractEntity {
*/
protected $function = '';
/**
* @var string $alternativeStartDate
*/
protected $alternativeStartDate = '';
/**
* @var int $startDate
*/
......@@ -203,4 +208,18 @@ class Job extends AbstractEntity {
public function setFunction(string $function) {
$this->function = $function;
}
/**
* @return string
*/
public function getAlternativeStartDate() {
return $this->alternativeStartDate;
}
/**
* @param string $alternativeStartDate
*/
public function setAlternativeStartDate(string $alternativeStartDate) {
$this->alternativeStartDate = $alternativeStartDate;
}
}
......@@ -26,6 +26,7 @@ namespace SGalinski\SgJobs\Domain\Repository;
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use TYPO3\CMS\Core\Database\DatabaseConnection;
use TYPO3\CMS\Extbase\Persistence\Repository;
/**
......@@ -43,4 +44,64 @@ class CompanyRepository extends Repository {
$querySettings->setEnableFieldsToBeIgnored(['disabled']);
$this->setDefaultQuerySettings($querySettings);
}
/**
* @param int $pageUid
* @return mixed
*/
public function getAllCountries($pageUid) {
/** @var DatabaseConnection $db */
$db = $GLOBALS['TYPO3_DB'];
$result = $db->exec_SELECTquery(
'country', 'tx_sgjobs_domain_model_company', 'pid = ' . $pageUid, 'country'
)->fetch_all();
$countryArray = [];
$countryArray[] = '';
foreach($result as $country) {
$countryArray[] = $country[0];
}
return $countryArray;
}
/**
* @param int $pageUid
* @return mixed
*/
public function getAllCities($pageUid) {
/** @var DatabaseConnection $db */
$db = $GLOBALS['TYPO3_DB'];
$result = $db->exec_SELECTquery(
'city', 'tx_sgjobs_domain_model_company', 'pid = ' . $pageUid, 'city'
)->fetch_all();
$cityArray = [];
$cityArray[] = '';
foreach($result as $city) {
$cityArray[] = $city[0];
}
return $cityArray;
}
/**
* @param int $pageUid
* @return mixed
*/
public function getAllCompanyNames($pageUid) {
/** @var DatabaseConnection $db */
$db = $GLOBALS['TYPO3_DB'];
$result = $db->exec_SELECTquery(
'name', 'tx_sgjobs_domain_model_company', 'pid = ' . $pageUid, 'name'
)->fetch_all();
$namesArray = [];
$namesArray[] = '';
foreach($result as $name) {
$namesArray[] = $name[0];
}
return $namesArray;
}
}
......@@ -26,6 +26,7 @@ namespace SGalinski\SgJobs\Domain\Repository;
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use TYPO3\CMS\Core\Database\DatabaseConnection;
use TYPO3\CMS\Extbase\Persistence\QueryInterface;
use TYPO3\CMS\Extbase\Persistence\Repository;
......@@ -98,4 +99,45 @@ class JobRepository extends Repository {
return $query->execute($raw);
}
/**
* @param int $pageUid
* @return mixed
*/
public function getAllAreas($pageUid) {
/** @var DatabaseConnection $db */
$db = $GLOBALS['TYPO3_DB'];
$result = $db->exec_SELECTquery(
'area', 'tx_sgjobs_domain_model_job', 'pid = ' . $pageUid, 'area'
)->fetch_all();
$areaArray = [];
$areaArray[] = '';
foreach($result as $area) {
$areaArray[] = $area[0];
}
return $areaArray;
}
/**
* @param int $pageUid
* @return mixed
*/
public function getAllFunctions($pageUid) {
/** @var DatabaseConnection $db */
$db = $GLOBALS['TYPO3_DB'];
$result = $db->exec_SELECTquery(
'function', 'tx_sgjobs_domain_model_job', 'pid = ' . $pageUid, 'function'
)->fetch_all();
$functionArray = [];
$functionArray[] = '';
foreach($result as $function) {
$functionArray[] = $function[0];
}
return $functionArray;
}
}
......@@ -8,7 +8,7 @@ return [
'crdate' => 'crdate',
'cruser_id' => 'cruser_id',
'dividers2tabs' => TRUE,
'searchFields' => 'title, start_date, company, contact, area, function',
'searchFields' => 'title, start_date, alternative_start_date, company, contact, area, function',
'versioningWS' => 2,
'versioning_followPages' => TRUE,
'origUid' => 't3_origuid',
......@@ -26,12 +26,12 @@ return [
'Resources/Public/Icons/tx_sgjobs_domain_model_job.svg'
],
'interface' => [
'showRecordFieldList' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, pid, title, area, function, start_date,
'showRecordFieldList' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, pid, title, area, function, start_date, alternative_start_date,
company, task, qualification, description, contact',
],
'types' => [
'1' => [
'showitem' => '--palette--;;sysLanguageAndHidden,--palette--;;pallete_title_start,,--palette--;;pallete_area_function,
'showitem' => '--palette--;;sysLanguageAndHidden,title, --palette--;;pallete_title_start,,--palette--;;pallete_area_function,
--palette--;;pallete_location_contact, description, --div--; LLL:EXT:sg_jobs/Resources/Private/Language/locallang_db.xlf:tca.qualification_tab, task, qualification, div;;richtext[*]:rte_transform[mode=ts],
--div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access, starttime, endtime',
],
......@@ -41,7 +41,7 @@ return [
'showitem' => 'sys_language_uid;;;;1-1-1, l10n_diffsource, hidden;;1, ',
'canNotCollapse' => 1,
],
'pallete_title_start' => ['showitem' => 'title, start_date', 'canNotCollapse' => 1],
'pallete_title_start' => ['showitem' => 'start_date, alternative_start_date', 'canNotCollapse' => 1],
'pallete_area_function' => ['showitem' => 'area, function', 'canNotCollapse' => 1],
'pallete_location_contact' => ['showitem' => 'company, contact', 'canNotCollapse' => 1]
],
......@@ -167,6 +167,15 @@ return [
],
],
],
'alternative_start_date' => [
'exclude' => 0,
'label' => 'LLL:EXT:sg_jobs/Resources/Private/Language/locallang_db.xlf:tx_sgjobs_domain_model_job.alternative_start_date',
'config' => [
'type' => 'input',
'size' => 30,
'eval' => 'trim'
],
],
'task' => [
'exclude' => 0,
'label' => 'LLL:EXT:sg_jobs/Resources/Private/Language/locallang_db.xlf:tx_sgjobs_domain_model_job.task',
......
......@@ -7,7 +7,7 @@
1: '{f:if(condition: \'{typo3Version} < 8000000 \', then: \'TYPO3/CMS/Backend/ClickMenu\', else: \'TYPO3/CMS/Backend/ContextMenu\')}',
2: 'TYPO3/CMS/Backend/Tooltip'}"
includeJsFiles="{
0: '{f:uri.resource(path: \'Scripts/Backend.js\')}'
0: '{f:uri.resource(path: \'JavaScript/backend.js\')}'
}">
<div class="module" data-module-id="" data-module-name="">
......
......@@ -101,6 +101,10 @@
<source>Job offer</source>
<target>Stellenanzeige</target>
</trans-unit>
<trans-unit id="tx_sgjobs_domain_model_job.alternative_start_date" approved="yes">
<source>Alternative start date</source>
<target>Alternatives Eintrittszeitpunkt</target>
</trans-unit>
<trans-unit id="tx_sgjobs_domain_model_job.area" approved="yes">
<source>Area</source>
<target>Bereich</target>
......
......@@ -78,6 +78,9 @@
<trans-unit id="tx_sgjobs_domain_model_job">
<source>Job offer</source>
</trans-unit>
<trans-unit id="tx_sgjobs_domain_model_job.alternative_start_date">
<source>Alternative start date</source>
</trans-unit>
<trans-unit id="tx_sgjobs_domain_model_job.area">
<source>Area</source>
</trans-unit>
......
<f:form id="sgjobs-filter" action="index" controller="Joblist" method="post" objectName="filters" object="{filters}">
<f:form.select class="sgjobs-select form-control" multiple="0" size="1" property="filterCountry" optionValueField="key" options="{countries}" id="filter-countries" />
<f:form.select class="sgjobs-select form-control" multiple="0" size="1" property="filterLocation" optionValueField="key" options="{locations}" id="filter-locations" />
<f:form.select class="sgjobs-select form-control" multiple="0" size="1" property="filterLocation" optionValueField="key" options="{cities}" id="filter-locations" />
<f:form.select class="sgjobs-select form-control" multiple="0" size="1" property="filterCompany" optionValueField="key" options="{companies}" id="filter-companies" />
<f:form.select class="sgjobs-select form-control" multiple="0" size="1" property="filterArea" optionValueField="key" options="{areas}" id="filter-areas" />
<f:form.select class="sgjobs-select form-control" multiple="0" size="1" property="filterFunction" optionValueField="key" options="{functions}" id="filter-functions" />
......
<div>
<h3>{job.title}</h3>
<h4>
<f:format.date date="{job.startDate}" format="d.m.Y" />
<f:if condition="{job.alternativeStartDate}">
<f:then>
{job.alternativeStartDate}
</f:then>
<f:else>
<f:format.date date="{job.startDate}" format="d.m.Y" />
</f:else>
</f:if>
- {job.company.0.city}
</h4>
</div>
......@@ -45,7 +52,14 @@
<f:translate key="frontend.entry_date" />
</td>
<td>
<f:format.date date="{job.startDate}" format="d.m.Y" />
<f:if condition="{job.alternativeStartDate}">
<f:then>
{job.alternativeStartDate}
</f:then>
<f:else>
<f:format.date date="{job.startDate}" format="d.m.Y" />
</f:else>
</f:if>
</td>
</tr>
</table>
......
......@@ -2,7 +2,10 @@
<f:section name="main">
<f:render partial="Filter" arguments="{filters: filters}" />
<f:render
partial="Filter"
arguments="{filters: filters, countries: countries, cities: cities, companies: companies, areas: areas, functions: functions}"
/>
<div id="job-offer">
<f:for each="{jobs}" as="job">
......
module.exports = function() {
'use strict';
const $ = require('jquery');
let SgJobs = {};
SgJobs.init = function() {
}
};
(function($) {
function deleteAllListener(_event) {
_event.preventDefault();
var confirm = SG.lang.SgRoutes['backend.delete_all'];
if (window.confirm(confirm)) {
window.location = $(_event.currentTarget).attr('href');
}
}
$(document).ready(function() {
$('.btn-delete-all').on('click', deleteAllListener);
});
})(TYPO3.jQuery);
// functions for backend docheader functionality
function jumpExt(URL, anchor) { //
var anc = anchor ? anchor : "";
window.location.href = URL + (T3_THIS_LOCATION ? "&returnUrl=" + T3_THIS_LOCATION : "") + anc;
return false;
}
function jumpSelf(URL) { //
window.location.href = URL + (T3_RETURN_URL ? "&returnUrl=" + T3_RETURN_URL : "");
return false;
}
function jumpToUrl(URL) {
window.location.href = URL;
return false;
}
function setHighlight(id) { //
top.fsMod.recentIds["web"] = id;
top.fsMod.navFrameHighlightedID["web"] = "pages" + id + "_" + top.fsMod.currentBank; // For highlighting
if (top.content && top.content.nav_frame && top.content.nav_frame.refresh_nav) {
top.content.nav_frame.refresh_nav();
}
}
/**
* Switches to the spefied page in the BE
*
* @param {number} uid
* @param {string} path
*/
function sgJobsGoToPage(uid, path) {
if (top.nav) {
top.nav.invokePageId(uid, gotToPageCallback);
} else {
var tree = top.Ext.getCmp('typo3-pagetree');
if (tree) {
tree.activeTree.selectPath(path);
}
var separator = '?';
if (top.currentSubScript.indexOf('?') !== -1) {
separator = '&';
}
top.TYPO3.Backend.ContentContainer.setUrl(
top.currentSubScript + separator + 'id=' + uid
);
}
}
/**
* Callback for page selection in the pagetree
*/
function gotToPageCallback(path) {
var callback = top.Ext.createDelegate(top.nav.mainTree.selectPath, top.nav.mainTree);
callback.apply(this, arguments);
var node = top.nav.getSelected();
if (node) {
top.TYPO3.Components.PageTree.Actions.singleClick(node, top.TYPO3.Components.PageTree.Tree);
}
}
/**
* opens the selected category edit form
*
* @return {boolean}
*/
function editSelectedLocation() {
var selected = TYPO3.jQuery('#filter-locations').val();
if (selected && LocationEditLinks[selected[0]]) {
jumpToUrl(LocationEditLinks[selected[0]] + '&returnUrl=' + T3_THIS_LOCATION);
}
return false;
}
......@@ -6,6 +6,7 @@ CREATE TABLE tx_sgjobs_domain_model_job (
title text DEFAULT '' NOT NULL,
task text DEFAULT '' NOT NULL,
qualification text DEFAULT '' NOT NULL,
alternative_start_date text DEFAULT '' NOT NULL,
start_date int(11) unsigned DEFAULT '0' NOT NULL,
company text DEFAULT '' NOT NULL,
description 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