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

[TASK] Filtering options

parent 07ecd441
No related branches found
No related tags found
1 merge request!2Feature be module
......@@ -120,11 +120,11 @@ class Utility {
$databaseConnection = $GLOBALS['TYPO3_DB'];
$where = 'doktype = ' . self::CATEGORY_DOKTYPE . ' AND uid in (' . $childPids . ')';
$result = $databaseConnection->exec_SELECTquery('uid', 'pages', $where)->fetch_all();
$result = $databaseConnection->exec_SELECTquery('uid, title', 'pages', $where)->fetch_all();
$categories = [];
/** @var array $result */
foreach ($result as $item) {
$categories[] = $item[0];
$categories[$item[0]] = $item[1];
}
return $categories;
......@@ -140,6 +140,6 @@ class Utility {
$objectManager = GeneralUtility::makeInstance(ObjectManager::class);
/** @var NewsRepository $newsRepository */
$newsRepository = $objectManager->get(NewsRepository::class);
return $newsRepository->findAllSortedNewsByCategories($categories, 0, 0, 'date', NULL, $raw = TRUE);
return $newsRepository->findAllSortedNewsByCategories(array_keys($categories), 0, 0, 'date', NULL, $raw = TRUE);
}
}
<f:form action="index" controller="Backend" method="post" objectName="filters" object="{filters}">
<div class="row">
<div class="col-xs-5">
<div class="form-group">
<label for="filter-category">
<f:translate key="backend.filters.category" />
<small><f:translate key="backend.filters.categories.description" /></small>
</label>
<f:form.select class="form-control" multiple="1" size="4" property="categories" options="{categories}" id="filter-category" />
</div>
</div>
<div class="col-xs-4">
<div class="form-group">
<label for="filter-search"><f:translate key="backend.filters.search" /></label>
<f:form.textfield class="form-control" property="search" id="filter-search" />
</div>
</div>
<div class="col-xs-3">
<div class="form-group">
<label>&nbsp;</label><br />
<f:form.button class="btn btn-success form-group col-xs-12" type="submit">Filter</f:form.button>
</div>
</div>
</div>
</f:form>
......@@ -11,6 +11,7 @@
<p>
<f:translate key="backend.message" />
</p>
<f:render partial="Backend/Filter" arguments="{categories: categories, filters: filters}" />
<f:if condition="{news}">
<div class="panel panel-default recordlist">
......
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