Fixed column 'items' in menu list
authorMarcel Werk <burntime@woltlab.com>
Fri, 15 Apr 2016 20:05:40 +0000 (22:05 +0200)
committerMarcel Werk <burntime@woltlab.com>
Fri, 15 Apr 2016 20:05:40 +0000 (22:05 +0200)
wcfsetup/install/files/acp/templates/menuList.tpl
wcfsetup/install/files/lib/acp/page/MenuListPage.class.php

index 38eb665d9f99f78377442f7925a0eddd387b9978..73807825735caaf90d52d93e8f5d87c5fa8bf786 100644 (file)
@@ -35,7 +35,7 @@
                                <tr>
                                        <th class="columnPageID{if $sortField == 'menuID'} active {@$sortOrder}{/if}" colspan="2"><a href="{link controller='MenuList'}pageNo={@$pageNo}&sortField=menuID&sortOrder={if $sortField == 'menuID' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">{lang}wcf.global.objectID{/lang}</a></th>
                                        <th class="columnTitle{if $sortField == 'title'} active {@$sortOrder}{/if}"><a href="{link controller='MenuList'}pageNo={@$pageNo}&sortField=title&sortOrder={if $sortField == 'title' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">{lang}wcf.global.name{/lang}</a></th>
-                                       <th class="columnDigits columnItems{if $sortField == 'customURL'} active {@$sortOrder}{/if}"><a href="{link controller='MenuList'}pageNo={@$pageNo}&sortField=items&sortOrder={if $sortField == 'items' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">{lang}wcf.acp.menu.items{/lang}</a></th>
+                                       <th class="columnDigits columnItems{if $sortField == 'items'} active {@$sortOrder}{/if}"><a href="{link controller='MenuList'}pageNo={@$pageNo}&sortField=items&sortOrder={if $sortField == 'items' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">{lang}wcf.acp.menu.items{/lang}</a></th>
                                        
                                        {event name='columnHeads'}
                                </tr>
index 11c7d9a79f743ffdcfa2722518f07949e3bb73e0..aebc64d68fa36dc7f6cc7961b0907bf3880be9cc 100644 (file)
@@ -15,27 +15,36 @@ use wcf\page\SortablePage;
  */
 class MenuListPage extends SortablePage {
        /**
-        * @see \wcf\page\AbstractPage::$activeMenuItem
+        * @inheritDoc
         */
        public $activeMenuItem = 'wcf.acp.menu.link.cms.menu.list';
        
        /**
-        * @see \wcf\page\MultipleLinkPage::$objectListClassName
+        * @inheritDoc
         */
        public $objectListClassName = 'wcf\data\menu\MenuList';
        
        /**
-        * @see \wcf\page\AbstractPage::$neededPermissions
+        * @inheritDoc
         */
-       public $neededPermissions = array('admin.content.cms.canManageMenu');
+       public $neededPermissions = ['admin.content.cms.canManageMenu'];
        
        /**
-        * @see \wcf\page\SortablePage::$defaultSortField
+        * @inheritDoc
         */
        public $defaultSortField = 'title';
        
        /**
-        * @see \wcf\page\SortablePage::$validSortFields
+        * @inheritDoc
         */
-       public $validSortFields = array('menuID', 'title', 'items');
+       public $validSortFields = ['menuID', 'title', 'items'];
+       
+       /**
+        * @inheritDoc
+        */
+       protected function initObjectList() {
+               parent::initObjectList();
+               
+               $this->objectList->sqlSelects .= '(SELECT COUNT(*) FROM wcf'.WCF_N.'_menu_item WHERE menuID = menu.menuID) AS items';
+       }
 }