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

Merge branch 'f_manual_sorting' into 'master'

F manual sorting

See merge request !18
parents 03b6b687 659deb84
No related branches found
No related tags found
1 merge request!18F manual sorting
......@@ -106,7 +106,6 @@ class BackendController extends ActionController {
public function indexAction(array $filters = []) {
try {
$pageUid = (int) GeneralUtility::_GP('id');
$sortingData = [];
// create docheader + buttons
$pageInfo = BackendUtility::readPageAccess($pageUid, $GLOBALS['BE_USER']->getPagePermsClause(1));
......@@ -127,19 +126,19 @@ class BackendController extends ActionController {
$this->view->assign('pages', BackendService::getPagesWithJobRecords());
$this->view->assign('pageUid', $pageUid);
if (count($filters) === 0) {
$prevUid = 0;
$sortingData = [];
/** @var Job $job */
foreach ($jobs as $job) {
if ($prevUid) {
$sortingData['prev'][$job->getUid()] = $prevUid;
$sortingData['next'][$prevUid] = $job->getUid();
}
$prevUid = $job->getUid();
}
}
$sortingData = [];
if ($GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['sg_jobs']['allowManualSorting'] && count($filters) <= 0) {
$previousUid = 0;
$sortingData = [];
foreach ($jobs as $job) {
if ($previousUid) {
$sortingData['prev'][$job->getUid()] = $previousUid;
$sortingData['next'][$previousUid] = '-' . $job->getUid();
}
$previousUid = $job->getUid();
}
}
$this->view->assign('sortingData', $sortingData);
......
......@@ -44,6 +44,8 @@ use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
use TYPO3\CMS\Extbase\Mvc\Exception\NoSuchArgumentException;
use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
use SGalinski\Lfeditor\Utility\ExtensionUtility;
/**
* The joblist plugin controller
......@@ -162,9 +164,11 @@ class JoblistController extends ActionController {
$frontendPluginSettings = $this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
$frontendPluginSettings = $frontendPluginSettings['settings'];
$isManualSortingAllowed = $GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['sg_jobs']['allowManualSorting'];
// get all jobs for the current page
$ordering = (int)$frontendPluginSettings['orderBy'];
FrontendFilterService::setAllowManualSorting($frontendPluginSettings['allowManualSorting']);
FrontendFilterService::setAllowManualSorting((bool)$isManualSortingAllowed);
$jobs = FrontendFilterService::getJobs($filters, $jobLimit, $offset, $ordering);
// get all jobs for the current page
......
......@@ -26,7 +26,7 @@
return call_user_func(
function ($extKey, $table) {
return [
$tca = [
'ctrl' => [
'title' => 'LLL:EXT:' . $extKey . '/Resources/Private/Language/locallang_db.xlf:' . $table . '',
'label' => 'title',
......@@ -76,11 +76,6 @@ return call_user_func(
'palette_apply_function' => ['showitem' => 'hide_apply_by_email, hide_apply_by_postal, featured_offer', 'canNotCollapse' => 1]
],
'columns' => [
'sorting' => [
'config' => [
'type' => 'passthrough'
]
],
'crdate' => [
'exclude' => FALSE,
'config' => [
......@@ -327,6 +322,13 @@ return call_user_func(
]
],
];
if (!$GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['sg_jobs']['allowManualSorting']) {
$tca['columns']['sorting']['config']['type'] = 'passthrough';
}
return $tca;
}, 'sg_jobs', 'tx_sgjobs_domain_model_job'
);
......@@ -13,8 +13,6 @@ plugin.tx_sgjobs {
settings {
# cat=plugin.tx_sgjobs/other; type=string; label=Mail address to send submitted applications to
applicationEmail =
# cat=plugin.tx_sgjobs/other; type=boolean; label=Enable manual sorting
allowManualSorting = 0
# cat=plugin.tx_sgjobs/other; type=string; label=Allowed file extensions for uploads in the controller (comma separated)
allowedFileExtensions = pdf
# cat=plugin.tx_sgjobs/other; type=string; label=Allowed mime types for uploads in the Fluid template (comma separated)
......
......@@ -23,7 +23,6 @@ plugin.tx_sgjobs {
settings {
allowedFileExtensions = {$plugin.tx_sgjobs.settings.allowedFileExtensions}
allowManualSorting = {$plugin.tx_sgjobs.settings.allowManualSorting}
allowedMimeTypes = {$plugin.tx_sgjobs.settings.allowedMimeTypes}
allowedMaxFileSize = {$plugin.tx_sgjobs.settings.allowedMaxFileSize}
privacyPolicyPage = {$plugin.tx_sgjobs.settings.privacyPolicyPage}
......
# cat=plugin.tx_sgjobs/other; type=boolean; label=Enable manual sorting
allowManualSorting = 0
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