diff --git a/Classes/Controller/ProjectController.php b/Classes/Controller/ProjectController.php index f3e210b..2bb5bfd 100644 --- a/Classes/Controller/ProjectController.php +++ b/Classes/Controller/ProjectController.php @@ -21,6 +21,8 @@ public function __construct( public function listAction(?ProjectFilter $filter = null): ResponseInterface { + $hideCompletedProjects = true; + if (!$filter) { $filter = new ProjectFilter(); @@ -29,7 +31,12 @@ public function listAction(?ProjectFilter $filter = null): ResponseInterface } } + if (isset($this->settings['hide_completed_projects'])) { + $hideCompletedProjects = (bool)$this->settings['hide_completed_projects']; + } + $projects = $this->projectRepository->findByFilter( + $hideCompletedProjects, $filter, GeneralUtility::intExplode( ',', @@ -39,7 +46,7 @@ public function listAction(?ProjectFilter $filter = null): ResponseInterface ) ); - $categories =$this->categoryRepository->findAllApplicable($projects); + $categories = $this->categoryRepository->findAllApplicable($projects); $assignedValues = [ 'projects' => $projects, diff --git a/Classes/Domain/Repository/ProjectRepository.php b/Classes/Domain/Repository/ProjectRepository.php index 2276717..a369f58 100644 --- a/Classes/Domain/Repository/ProjectRepository.php +++ b/Classes/Domain/Repository/ProjectRepository.php @@ -18,6 +18,7 @@ class ProjectRepository extends Repository * @throws InvalidEnumerationValueException */ public function findByFilter( + bool $hideCompletedProjects, ?ProjectFilter $filter = null, array $pages = [] ): QueryResult { @@ -36,9 +37,20 @@ public function findByFilter( } } - $query->matching( - $query->logicalAnd($constraints) - ); + if ($hideCompletedProjects) { + $constraints[] = $query->logicalOr( + $query->greaterThanOrEqual('tx_academicprojects_end_date', new \DateTime()), + $query->equals('tx_academicprojects_end_date', 0) + ); + } else { + $query->getQuerySettings()->setIgnoreEnableFields(true); + } + + if (!empty($constraints)) { + $query->matching( + $query->logicalAnd($constraints) + ); + } [$sortingField, $sortingDirection] = explode(' ', SortingOptions::__default); if ($filter && $filter->getSorting()) { diff --git a/Configuration/FlexForms/ProjectSettings.xml b/Configuration/FlexForms/ProjectSettings.xml index 3b95a04..ba9c4a2 100644 --- a/Configuration/FlexForms/ProjectSettings.xml +++ b/Configuration/FlexForms/ProjectSettings.xml @@ -14,6 +14,16 @@ + + + + LLL:EXT:academic_projects/Resources/Private/Language/locallang_be.xlf:flexform.filter.options.hide_completed_projects.description + + check + 1 + + + diff --git a/Resources/Private/Language/de.locallang_be.xlf b/Resources/Private/Language/de.locallang_be.xlf new file mode 100644 index 0000000..311855e --- /dev/null +++ b/Resources/Private/Language/de.locallang_be.xlf @@ -0,0 +1,80 @@ + + + +
+ PhpStorm +
+ + + Deactivate filtering + Filterung deaktivieren + + + If the option is enabled, options with filters will not be visible in the frontend + Wenn die Option aktiviert ist, sind Optionen mit Filtern im Frontend nicht sichtbar + + + Hide completed projects + Abgeschlossene Projekte ausblenden + + + Hide projects that have passed their end date from the overview. + Projekte, deren Enddatum überschritten ist, in der Übersicht ausblenden. + + + Sorting + Sortierung + + + Define sorting in frontend. Sort by page sorting doesn't respect multiple mounts as sort + Definieren Sie die Sortierung im Frontend. Die Seitensortierung berücksichtigt mehrere Mounts nicht als Sortierung + + + + Last updated (latest first) + Zuletzt aktualisiert (neueste zuerst) + + + Last updated (latest last) + Zuletzt aktualisiert (neueste zuletzt) + + + Page sorting (Result may be unexpected) + Seitensortierung (Ergebnis kann unerwartet sein) + + + Page sorting (Result may be unexpected) + Seitensortierung (Ergebnis kann unerwartet sein) + + + Title A-Z + Titel A-Z + + + Title Z-A + Titel Z-A + + + Budget (low to high) + Budget (niedrig bis hoch) + + + Budget (high to low) + Budget (hoch bis niedrig) + + + Start date (oldest first) + Startdatum (älteste zuerst) + + + Start date (newest first) + Startdatum (neueste zuerst) + + + Select categories. Main categories will select all subcategories by OR, multiple categories selects by AND + Wählen Sie Kategorien aus. Hauptkategorien wählen alle Unterkategorien durch ODER aus, mehrere Kategorien wählen durch UND aus + + +
+
diff --git a/Resources/Private/Language/locallang_be.xlf b/Resources/Private/Language/locallang_be.xlf index 836a40d..f42e0e9 100644 --- a/Resources/Private/Language/locallang_be.xlf +++ b/Resources/Private/Language/locallang_be.xlf @@ -12,7 +12,12 @@ If the option is enabled, options with filters will not be visible in the frontend - + + Hide completed projects + + + Hide projects that have passed their end date from the overview. + Sorting @@ -50,7 +55,6 @@ Start date (newest first) - Select categories. Main categories will select all subcategories by OR, multiple categories selects by AND