diff --git a/Classes/Controller/Ajax/JoblistController.php b/Classes/Controller/Ajax/JoblistController.php deleted file mode 100644 index 20448bdaa43e7a490250f0408a5633c61b439c6c..0000000000000000000000000000000000000000 --- a/Classes/Controller/Ajax/JoblistController.php +++ /dev/null @@ -1,136 +0,0 @@ -<?php - -namespace SGalinski\SgJobs\Controller\Ajax; - -/*************************************************************** - * Copyright notice - * - * (c) sgalinski Internet Services (https://www.sgalinski.de) - * - * All rights reserved - * - * This script is part of the TYPO3 project. The TYPO3 project is - * free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * The GNU General Public License can be found at - * http://www.gnu.org/copyleft/gpl.html. - * - * This script is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * This copyright notice MUST APPEAR in all copies of the script! - ***************************************************************/ - -use SGalinski\SgAjax\Controller\Ajax\AbstractAjaxController; -use SGalinski\SgJobs\Service\FrontendFilterService; -use TYPO3\CMS\Core\Resource\ResourceFactory; -use TYPO3\CMS\Core\Utility\GeneralUtility; - -/** - * Ajax Controller - */ -class JoblistController extends AbstractAjaxController { - - /** - * @var \SGalinski\SgJobs\Domain\Repository\CompanyRepository - * @inject - */ - private $companyRepository; - - /** - * @var \SGalinski\SgJobs\Domain\Repository\JobRepository - * @inject - */ - private $jobRepository; - - /** - * Show all job offers and options to manage them - * - * @return void - * @throws \InvalidArgumentException - */ - public function filterAction() { - $recordPageId = (int) $_POST['recordPageId']; - $filters = [ - 'country' => $_POST['parameters']['country'], - 'location' => $_POST['parameters']['location'], - 'company' => $_POST['parameters']['company'], - 'area' => $_POST['parameters']['area'], - 'function' => $_POST['parameters']['function'], - ]; - - $this->assignFilterValues($recordPageId); - - // pagination logic - $jobLimit = (int) $_POST['parameters']['limit']; - $offset = 0; - $currentPageBrowserPage = (int) GeneralUtility::_GP('tx_sgjobs_pagebrowser')['currentPage']; - if ($currentPageBrowserPage && $jobLimit) { - $offset = $currentPageBrowserPage * $jobLimit; - } - - // get all jobs for the current page - $jobs = FrontendFilterService::getJobs($filters, $recordPageId, $jobLimit, $offset); - - // get the amount of all filtered jobs - $jobsCount = \count(FrontendFilterService::getJobs($filters, $recordPageId)); - - $numberOfPages = ($jobLimit <= 0 ? 0 : ceil($jobsCount / $jobLimit)); - - $this->view->assign('jobs', $jobs); - $this->view->assign('numberOfPages', $numberOfPages); - - // set default selected values - $this->view->assign('selectedCountry', $filters['country']); - $this->view->assign('selectedCompany', $filters['company']); - $this->view->assign('selectedLocation', $filters['location']); - $this->view->assign('selectedArea', $filters['area']); - $this->view->assign('selectedFunction', $filters['function']); - $this->view->assign('limit', $jobLimit); - $this->view->assign('recordPageId', $recordPageId); - } - - /** - * Delete an uploaded file from temp storage - * - * @return void - * @throws \TYPO3\CMS\Core\Resource\Exception\InsufficientFileAccessPermissionsException - * @throws \TYPO3\CMS\Core\Resource\Exception\FileOperationErrorException - * @throws \InvalidArgumentException - */ - public function deleteTempFileAction() { - $file = $_POST['file']; - $type = $_POST['type']; - $resourceFactory = GeneralUtility::makeInstance(ResourceFactory::class); - $storage = $resourceFactory->getStorageObject(1); - $fileObject = $storage->getFile('/Extension/temp/' . $GLOBALS['TSFE']->fe_user->id . '/' . $type . '/' . $file); - $storage->deleteFile($fileObject); - } - - /** - * Assign filter values - * - * @param int $rootPageId - */ - private function assignFilterValues($rootPageId) { - $countries = $this->companyRepository->getAllCountries($rootPageId); - $this->view->assign('countries', $countries); - - $cities = $this->companyRepository->getAllCities($rootPageId); - $this->view->assign('cities', $cities); - - $companies = $this->companyRepository->getAllCompanyNames($rootPageId); - $this->view->assign('companies', $companies); - - $areas = $this->jobRepository->getAllAreas($rootPageId); - $this->view->assign('areas', $areas); - - $functions = $this->jobRepository->getAllFunctions($rootPageId); - $this->view->assign('functions', $functions); - } -} diff --git a/Resources/Private/Templates/Ajax/Joblist/Filter.html b/Resources/Private/Templates/Ajax/Joblist/Filter.html deleted file mode 100644 index fe1ee7434d690aa401872ad90720547b05a12248..0000000000000000000000000000000000000000 --- a/Resources/Private/Templates/Ajax/Joblist/Filter.html +++ /dev/null @@ -1,18 +0,0 @@ -{namespace sg=SGalinski\SgJobs\ViewHelpers} -<f:render - partial="Filter" - arguments="{recordPageId: recordPageId, filters: filters, countries: countries, cities: cities, companies: companies, areas: areas, - functions: functions, selectedCountry: selectedCountry, selectedCompany: selectedCompany, - selectedLocation: selectedLocation, selectedArea: selectedArea, selectedFunction: selectedFunction, limit: limit}" -/> - -<f:for each="{jobs}" as="job"> - <f:render partial="Job" arguments="{job: job}" /> -</f:for> - - -<div id="sgjobs-pagination"> - <f:format.raw> - <sg:pageBrowser numberOfPages="{numberOfPages}" /> - </f:format.raw> -</div> diff --git a/ext_localconf.php b/ext_localconf.php index 170399efcb60fdf3b1b05fa1c676eafb81d79b93..b2b1f99c24eba8248d50c4a4182558775aa05770 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -33,14 +33,6 @@ ['PageBrowser' => '',] ); -// Configure ajax controller -\SGalinski\SgAjax\Service\AjaxRegistration::configureAjaxFrontendPlugin( - 'sg_jobs', [ - 'Ajax\Joblist' => 'filter', - 'Ajax\JobApplication' => 'deleteTempFile', - ] -); - if (TYPO3_MODE === 'BE') { $extPath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('sg_jobs'); $tsPath = $extPath . 'Configuration/TypoScript/Backend/';