Added users online list pagination
authorMarcel Werk <burntime@woltlab.com>
Mon, 23 May 2016 10:04:20 +0000 (12:04 +0200)
committerMarcel Werk <burntime@woltlab.com>
Mon, 23 May 2016 10:04:26 +0000 (12:04 +0200)
CHANGELOG.md
com.woltlab.wcf/templates/usersOnlineList.tpl
wcfsetup/install/files/lib/page/UsersOnlineListPage.class.php

index 25987b3d1d13b737b778a16a219071fb61f5ca8f..46fcc0725dd06bbe02de2fee3bd46af7a1ed6288 100644 (file)
@@ -49,6 +49,7 @@
 * `\wcf\system\condition\MultiPageControllerCondition` has been replaced by `wcf\system\condition\page\MultiPageCondition`
 * Added special CSS class to cookie policy notice (`cookiePolicyNotice`)
 * Improved confirmation messages (`<span class="confirmationObject">...</span>`)
+* Added users online list pagination
 
 #### CMS
 
index 8688e758e0c386070b885aba838e57d15fe6c602..7433466544c8116b7440379042917dc64e07ab7e 100644 (file)
@@ -1,8 +1,10 @@
+{capture assign='pageTitle'}{$__wcf->getActivePage()->getTitle()}{if $pageNo > 1} - {lang}wcf.page.pageNo{/lang}{/if}{/capture}
+
 {capture assign='headContent'}
        <link rel="canonical" href="{link controller='UsersOnlineList'}{/link}" />
        
        {if USERS_ONLINE_PAGE_REFRESH > 0}
-               <meta http-equiv="refresh" content="{@USERS_ONLINE_PAGE_REFRESH}; url={link controller='UsersOnlineList'}sortField={@$sortField}&sortOrder={@$sortOrder}{/link}" />
+               <meta http-equiv="refresh" content="{@USERS_ONLINE_PAGE_REFRESH}; url={link controller='UsersOnlineList'}{if $pageNo > 1}pageNo={@$pageNo}&{/if}sortField={@$sortField}&sortOrder={@$sortOrder}{/link}" />
        {/if}
 {/capture}
 
 
 {include file='header'}
 
+{hascontent}
+       <div class="paginationTop">
+               {content}
+                       {pages print=true assign=pagesLinks controller='UsersOnlineList' link="pageNo=%d&sortField=$sortField&sortOrder=$sortOrder"}
+               {/content}
+       </div>
+{/hascontent}
+
 {assign var=usersOnlineList value=''}
 {assign var=usersOnline value=0}
 {assign var=robotsOnlineList value=''}
        <section class="section sectionContainerList">
                <h2 class="sectionTitle">{lang}wcf.user.usersOnline.guests{/lang} <span class="badge">{#$guestsOnline}</span></h2>
                
-               <ol class="containerList">
+               <ol class="containerList userList">
                        {@$guestsOnlineList}
                </ol>
        </section>
        <section class="section sectionContainerList">
                <h2 class="sectionTitle">{lang}wcf.user.usersOnline.robots{/lang} <span class="badge">{#$robotsOnline}</span></h2>
                
-               <ol class="containerList">
+               <ol class="containerList userList">
                        {@$robotsOnlineList}
                </ol>
        </section>
 {/if}
 
 <footer class="contentFooter">
+       {hascontent}
+               <div class="paginationBottom">
+                       {content}{@$pagesLinks}{/content}
+               </div>
+       {/hascontent}
+       
        {hascontent}
                <nav class="contentFooterNavigation">
                        <ul>
index 4d9eb95fa3665c5196598194b86dbfaaceaafc3e..2527b5d6f124eb16cb473379bb3840416f12321a 100644 (file)
@@ -32,6 +32,11 @@ class UsersOnlineListPage extends SortablePage {
         */
        public $enableTracking = true;
        
+       /**
+        * @inheritDoc
+        */
+       public $itemsPerPage = 100;
+       
        /**
         * @inheritDoc
         */
@@ -137,8 +142,7 @@ class UsersOnlineListPage extends SortablePage {
         * @inheritDoc
         */
        protected function readObjects() {
-               $this->objectList->sqlLimit = 0;
-               if ($this->sqlOrderBy) $this->objectList->sqlOrderBy = ($this->sortField == 'lastActivityTime' ? 'session.' : '').$this->sqlOrderBy;
-               $this->objectList->readObjects();
+               if ($this->sqlOrderBy) $this->sqlOrderBy = ($this->sortField == 'lastActivityTime' ? 'session.' : '').$this->sqlOrderBy;
+               parent::readObjects();
        }
 }