Skip to content
Snippets Groups Projects
Commit 668923c4 authored by Kevin Ditscheid's avatar Kevin Ditscheid
Browse files

[BUGFIX] Remove unused function call

parent 349ed88a
No related branches found
No related tags found
2 merge requests!13Feature remove sg news ajax plugin,!8Feature upgrade to9 lts
......@@ -100,6 +100,7 @@ class BackendNewsUtility {
if ($pageInfo) {
$options[] = self::getOptionPageInfo($pageInfo);
}
$categories = self::getCategoriesForSiteRoot((int) $row['uid']);
/** @var int $categoryUid */
foreach ($categories as $categoryUid => $categoryTitle) {
......@@ -114,6 +115,7 @@ class BackendNewsUtility {
}
}
}
return $options;
}
......@@ -131,10 +133,12 @@ class BackendNewsUtility {
foreach ($rootline as $page) {
$path .= '/p' . dechex($page['uid']);
}
$pageInfo['path'] = $path;
$pageInfo['_thePathFull'] = substr($pageInfo['_thePathFull'], 1);
$pageInfo['_thePathFull'] = substr($pageInfo['_thePathFull'], 0, -1);
}
return $pageInfo;
}
......@@ -193,6 +197,7 @@ class BackendNewsUtility {
$GLOBALS['TSFE'] = new \stdClass();
$GLOBALS['TSFE']->gr_list = '';
}
$pageUid = (int) $pageUid;
$languageUid = (int) $languageUid;
$tags = [];
......@@ -212,18 +217,22 @@ class BackendNewsUtility {
if (isset($pageTS['TCEFORM.']['pages.']['tx_sgnews_tags.']['PAGE_TSCONFIG_ID'])) {
$tagsPid = (int) $pageTS['TCEFORM.']['pages.']['tx_sgnews_tags.']['PAGE_TSCONFIG_ID'];
}
if ($tagsPid) {
$query->matching($query->equals('pid', $tagsPid));
}
}
$query->setOrderings(['title' => QueryInterface::ORDER_ASCENDING]);
$resultTags = $query->execute(TRUE);
if ($temporaryTSFEInstance) {
unset($GLOBALS['TSFE']);
}
foreach ($resultTags as $tag) {
$tags[(int) $tag['uid']] = trim($tag['title']);
}
return $tags;
}
......@@ -243,6 +252,7 @@ class BackendNewsUtility {
$GLOBALS['TSFE'] = new \stdClass();
$GLOBALS['TSFE']->gr_list = '';
}
$newsItemUid = (int) $newsItemUid;
$languageUid = (int) $languageUid;
$tags = [];
......@@ -257,17 +267,20 @@ class BackendNewsUtility {
if ($newsItemUid) {
$query->matching($query->equals('uid', $newsItemUid));
}
/** @var News $newsItem */
$newsItem = $query->execute()->getFirst();
if ($temporaryTSFEInstance) {
unset($GLOBALS['TSFE']);
}
if ($newsItem) {
/** @var Tag $tag */
foreach ($newsItem->getTags() as $tag) {
$tags[(int) $tag->getUid()] = trim($tag->getTitle());
}
}
return $tags;
}
......@@ -287,6 +300,7 @@ class BackendNewsUtility {
if (!$rootPageUid) {
return $out;
}
$categories = [];
if (!isset($filters['categories']) || !is_array($filters['categories']) || !count($filters['categories'])) {
$rootCategories = self::getCategoriesForSiteRoot($rootPageUid);
......@@ -305,9 +319,11 @@ class BackendNewsUtility {
}
}
}
if (!count($categories)) {
return $out;
}
$queryGenerator = GeneralUtility::makeInstance(QueryGenerator::class);
$allowedUids = [];
foreach ($categories as $categoryUid) {
......@@ -318,12 +334,8 @@ class BackendNewsUtility {
);
$allowedUids = array_unique(array_merge($allowedUids, $allowedUidsTemp));
}
if (!count($allowedUids)) {
return $out;
}
list($select, $tables, $where) = self::getNewsQueryParts($allowedUids, $filters, $languageUid);
if ($tables === '') {
if (!count($allowedUids)) {
return $out;
}
......@@ -361,6 +373,7 @@ class BackendNewsUtility {
);
}
}
if (isset($filters['tags']) && is_array($filters['tags']) && count($filters['tags'])) {
$queryBuilder->innerJoin('p', 'sys_category_record_mm', 'tag',
$queryBuilder->expr()->andX(
......@@ -385,6 +398,7 @@ class BackendNewsUtility {
$expressions[] = $queryBuilder->expr()->like('translation.author', $queryBuilder->createNamedParameter('%' . trim($filters['search']) . '%'));
$expressions[] = $queryBuilder->expr()->like('translation.abstract', $queryBuilder->createNamedParameter('%' . trim($filters['search']) . '%'));
}
$queryBuilder->andWhere(
$queryBuilder->expr()->orX(
$expressions
......@@ -410,10 +424,12 @@ class BackendNewsUtility {
if (isset($pageTS['mod.']['SHARED.']['defaultLanguageLabel'])) {
$defaultLanguage = $pageTS['mod.']['SHARED.']['defaultLanguageLabel'] . ' (' . $defaultLanguage . ')';
}
$defaultLanguageFlag = 'empty-empty';
if (isset($pageTS['mod.']['SHARED.']['defaultLanguageFlag'])) {
$defaultLanguageFlag = 'flags-' . $pageTS['mod.']['SHARED.']['defaultLanguageFlag'];
}
$languages = [
0 => ['title' => $defaultLanguage, 'flag' => $defaultLanguageFlag]
];
......@@ -434,6 +450,7 @@ class BackendNewsUtility {
}
}
}
return $languages;
}
......@@ -500,6 +517,7 @@ class BackendNewsUtility {
return $queryBuilder->execute()->fetchAll();
}
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