Add template scripting support for permission ACP search results
authorMatthias Schmidt <gravatronics@live.com>
Mon, 7 Aug 2017 17:01:17 +0000 (19:01 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Mon, 7 Aug 2017 17:01:17 +0000 (19:01 +0200)
wcfsetup/install/files/lib/system/search/acp/UserGroupOptionACPSearchResultProvider.class.php

index 4e6855de9d3cd6294346f49fd7ac5c3ad3b350fa..647183a972449ead641b20a9d4c7c5fbc5788c27 100644 (file)
@@ -33,21 +33,21 @@ class UserGroupOptionACPSearchResultProvider extends AbstractCategorizedACPSearc
                $conditions->add("languageItem LIKE ?", ['wcf.acp.group.option.%']);
                $conditions->add("languageItemValue LIKE ?", ['%'.$query.'%']);
                
-               $sql = "SELECT          languageItem, languageItemValue
+               $sql = "SELECT          languageItem
                        FROM            wcf".WCF_N."_language_item
                        ".$conditions."
                        ORDER BY        languageItemValue ASC";
                $statement = WCF::getDB()->prepareStatement($sql); // don't use a limit here
                $statement->execute($conditions->getParameters());
                $languageItems = [];
-               while ($row = $statement->fetchArray()) {
+               while ($languageItem = $statement->fetchColumn()) {
                        // ignore descriptions
-                       if (substr($row['languageItem'], -12) == '.description') {
+                       if (substr($languageItem, -12) == '.description') {
                                continue;
                        }
                        
-                       $itemName = preg_replace('~^([a-z]+)\.acp\.group\.option\.~', '', $row['languageItem']);
-                       $languageItems[$itemName] = $row['languageItemValue'];
+                       $itemName = preg_replace('~^([a-z]+)\.acp\.group\.option\.~', '', $languageItem);
+                       $languageItems[$itemName] = $languageItem;
                }
                
                if (empty($languageItems)) {
@@ -85,9 +85,11 @@ class UserGroupOptionACPSearchResultProvider extends AbstractCategorizedACPSearc
                                $categoryName = $optionCategories[$categoryName]->parentCategoryName;
                        }
                        
-                       $results[] = new ACPSearchResult($languageItems[$userGroupOption->optionName], $link, WCF::getLanguage()->getDynamicVariable('wcf.acp.search.result.subtitle', [
-                               'pieces' => $parentCategories
-                       ]));
+                       $results[] = new ACPSearchResult(
+                               WCF::getLanguage()->getDynamicVariable($languageItems[$userGroupOption->optionName]),
+                               $link,
+                               WCF::getLanguage()->getDynamicVariable('wcf.acp.search.result.subtitle', ['pieces' => $parentCategories])
+                       );
                }
                
                return $results;