Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix page uid issues in itemsProcFunc_* #1

Merged
merged 1 commit into from
May 15, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 42 additions & 31 deletions Classes/Hooks/FormEngine.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function displayThumbnail(&$params, &$pObj) {
* @return void
*/
public function itemsProcFunc_collectionList(&$params, &$pObj) {
$pages = $params['row']['pages'];
$pages = self::fixPageUid($params['row']['pages']);
if (!empty($pages)) {
foreach ($pages as $page) {
if ($page['uid'] > 0) {
Expand Down Expand Up @@ -87,7 +87,7 @@ public function itemsProcFunc_collectionList(&$params, &$pObj) {
* @return void
*/
public function itemsProcFunc_extendedSearchList(&$params, &$pObj) {
$pages = $params['row']['pages'];
$pages = self::fixPageUid($params['row']['pages']);
if (!empty($pages)) {
foreach ($pages as $page) {
if ($page['uid'] > 0) {
Expand Down Expand Up @@ -123,7 +123,7 @@ public function itemsProcFunc_extendedSearchList(&$params, &$pObj) {
* @return void
*/
public function itemsProcFunc_facetsList(&$params, &$pObj) {
$pages = $params['row']['pages'];
$pages = self::fixPageUid($params['row']['pages']);
if (!empty($pages)) {
foreach ($pages as $page) {
if ($page['uid'] > 0) {
Expand Down Expand Up @@ -159,22 +159,24 @@ public function itemsProcFunc_facetsList(&$params, &$pObj) {
* @return void
*/
public function itemsProcFunc_libraryList(&$params, &$pObj) {
$page = $params['row']['pages'];
if (!empty($page)) {
if ($page > 0) {
$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'label,uid',
'tx_dlf_libraries',
'pid='.intval($page)
$pages = self::fixPageUid($params['row']['pages']);
if (!empty($pages)) {
foreach ($pages as $page) {
if ($page['uid'] > 0) {
$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'label,uid',
'tx_dlf_libraries',
'pid='.intval($page['uid'])
.' AND (sys_language_uid IN (-1,0) OR l18n_parent=0)'
.Helper::whereClause('tx_dlf_libraries'),
'',
'label',
''
);
if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) {
while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_row($result)) {
$params['items'][] = $resArray;
'',
'label',
''
);
if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) {
while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_row($result)) {
$params['items'][] = $resArray;
}
}
}
}
Expand All @@ -192,21 +194,23 @@ public function itemsProcFunc_libraryList(&$params, &$pObj) {
* @return void
*/
public function itemsProcFunc_solrList(&$params, &$pObj) {
$page = $params['row']['pages'];
if (!empty($page)) {
if ($page > 0) {
$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'label,uid',
'tx_dlf_solrcores',
'pid IN ('.intval($page).',0)'
$pages = self::fixPageUid($params['row']['pages']);
if (!empty($pages)) {
foreach ($pages as $page) {
if ($page['uid'] > 0) {
$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'label,uid',
'tx_dlf_solrcores',
'pid IN ('.intval($page['uid']).',0)'
.Helper::whereClause('tx_dlf_solrcores'),
'',
'label',
''
);
if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) {
while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_row($result)) {
$params['items'][] = $resArray;
'',
'label',
''
);
if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) {
while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_row($result)) {
$params['items'][] = $resArray;
}
}
}
}
Expand All @@ -228,4 +232,11 @@ public function itemsProcFunc_toolList(&$params, &$pObj) {
$params['items'][] = [$GLOBALS['LANG']->sL($label), $class];
}
}

private function fixPageUid(&$pages) {
if (!is_array($pages)) {
return array( array( 'uid' => $pages ));
}
return $pages;
}
}