Skip to content
Snippets Groups Projects
Verified Commit 31d96cf2 authored by Kevin Ditscheid's avatar Kevin Ditscheid
Browse files

[TASK] Rector, ECS

parent 09b54687
No related branches found
No related tags found
1 merge request!48[TASK] Require TYPO3 12
......@@ -29,7 +29,6 @@ use SGalinski\SgJobs\Preview\PreviewService;
use TYPO3\CMS\Backend\View\Event\PageContentPreviewRenderingEvent;
class PageContentPreviewRenderingEventListener {
protected PreviewService $previewService;
public function __construct(PreviewService $previewService) {
......
<?php
/***************************************************************
* 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!
***************************************************************/
namespace SGalinski\SgJobs\ViewHelpers;
use TYPO3\CMS\Fluid\ViewHelpers\Be\AbstractBackendViewHelper;
/**
* Abstract view helper
*/
class AbstractViewHelper extends AbstractBackendViewHelper {
/**
* Returns the base url of the site
*
* Note: Works only in frontend mode
*
* @return string
*/
public function getBaseUrl(): string {
if ($GLOBALS['TSFE']->absRefPrefix !== '') {
$baseUrl = $GLOBALS['TSFE']->absRefPrefix;
} else {
$baseUrl = $GLOBALS['TSFE']->baseUrl;
}
return $baseUrl;
}
}
......@@ -26,6 +26,7 @@
namespace SGalinski\SgJobs\ViewHelpers\Backend;
use Doctrine\DBAL\Exception;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
......@@ -47,6 +48,7 @@ class CompanyLabelViewHelper extends AbstractViewHelper {
* Renders the control buttons for the specified record
*
* @return string
* @throws Exception
*/
public function render(): string {
$addedCompanies = explode(',', $this->arguments['companyraw']);
......@@ -59,8 +61,8 @@ class CompanyLabelViewHelper extends AbstractViewHelper {
$queryBilder->expr()->in('uid', $addedCompanies)
)
->setMaxResults(1)
->execute()
->fetch();
->executeQuery()
->fetchAssociative();
return $firstJob ? $firstJob['name'] . ', ' . $firstJob['city'] : '';
}
......
......@@ -27,12 +27,12 @@
namespace SGalinski\SgJobs\ViewHelpers\Backend;
use SGalinski\SgJobs\Domain\Model\Job;
use TYPO3\CMS\Backend\RecordList\DatabaseRecordList;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Localization\LanguageService;
use TYPO3\CMS\Core\Page\PageRenderer;
use TYPO3\CMS\Core\Type\Bitmask\Permission;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Backend\RecordList\DatabaseRecordList;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
/**
......@@ -76,7 +76,7 @@ class ControlViewHelper extends AbstractViewHelper {
$languageService = GeneralUtility::makeInstance(LanguageService::class);
$languageService->includeLLFile('EXT:backend/Resources/Private/Language/locallang_alt_doc.xlf');
// DatabaseRecordList has a $prevPrevUid, which might track back a page. We wont do that, 1st+last record are always
// DatabaseRecordList has a $prevPrevUid, which might track back a page. We won't do that, 1st+last record are
// not sortable in one direction
$uidPrev = FALSE;
$uidNext = FALSE;
......
......@@ -58,7 +58,7 @@ class IconViewHelper extends AbstractViewHelper {
$table = $this->arguments['table'];
$clickMenu = $this->arguments['clickMenu'];
$iconFactory = GeneralUtility::makeInstance(IconFactory::class);
$toolTip = BackendUtility::getRecordToolTip($row, $table);
$toolTip = BackendUtility::getRecordIconAltText($row, $table);
$iconImg = '<span ' . $toolTip . '>'
. $iconFactory->getIconForRecord($table, $row, Icon::SIZE_SMALL)->render()
. '</span>';
......
......@@ -27,12 +27,11 @@
namespace SGalinski\SgJobs\ViewHelpers;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
/**
* Takes a string containing multiple values separated by a delimiter and returns an array of these values.
*
* @TODO: Replace this ViewHelper with a VHS ViewHelper when updating to TYPO3 11!
*
* Example:
* {namespace jobs=SGalinski\SgJobs\ViewHelpers}
* <jobs:explodeString string="1,2,3,4" delimiter=","/>
......
......@@ -79,7 +79,7 @@ class UploadViewHelper extends AbstractFormFieldViewHelper {
$this->registerTagAttribute('disabled', 'string', 'Specifies that the input element should be disabled when the page loads');
$this->registerTagAttribute('multiple', 'string', 'Specifies that the file input element should allow multiple selection of files');
$this->registerTagAttribute('accept', 'string', 'Specifies the allowed file extensions to upload via comma-separated list, example ".png,.gif"');
$this->registerArgument('errorClass', 'string', 'CSS class to set if there are errors for this ViewHelper', false, 'f3-form-error');
$this->registerArgument('errorClass', 'string', 'CSS class to set if there are errors for this ViewHelper', FALSE, 'f3-form-error');
$this->registerUniversalTagAttributes();
$this->registerArgument('resourceName', 'string', 'The name of the resource', FALSE, 'resource');
}
......@@ -136,5 +136,4 @@ class UploadViewHelper extends AbstractFormFieldViewHelper {
$this->respectSubmittedDataValue = TRUE;
return $this->getValueAttribute();
}
}
......@@ -26,6 +26,7 @@
namespace SGalinski\SgJobs\ViewHelpers;
use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Core\TypoScript\TypoScriptService;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Fluid\View\StandaloneView;
......@@ -76,7 +77,9 @@ class PageBrowserViewHelper extends AbstractViewHelper {
$view->setTemplate('PageBrowser/Index');
$currentPage = 0;
$pageBrowserVars = GeneralUtility::_GP('tx_sgjobs_pagebrowser');
/** @var ServerRequestInterface $request */
$request = $GLOBALS['TYPO3_REQUEST'];
$pageBrowserVars = $request->getQueryParams()['tx_sgjobs_pagebrowser'] ?? [];
if (isset($pageBrowserVars['currentPage']) && (int) $pageBrowserVars['currentPage'] > 0) {
$currentPage = (int) $pageBrowserVars['currentPage'];
}
......
......@@ -54,10 +54,12 @@ class SetViewHelper extends AbstractViewHelper {
if (NULL === $value) {
$value = $this->renderChildren();
}
if (FALSE === \strpos($name, '.')) {
if (!str_contains($name, '.')) {
if (TRUE === $this->templateVariableContainer->exists($name)) {
$this->templateVariableContainer->remove($name);
}
$this->templateVariableContainer->add($name, $value);
} elseif (1 === \substr_count($name, '.')) {
$parts = \explode('.', $name);
......@@ -76,6 +78,7 @@ class SetViewHelper extends AbstractViewHelper {
return NULL;
}
}
return 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