Overview

Packages

  • CONTENIDO
  • Core
    • Authentication
    • Backend
    • Cache
    • CEC
    • Chain
    • ContentType
    • Database
    • Debug
    • Exception
    • Frontend
      • Search
      • URI
      • Util
    • GenericDB
      • Model
    • GUI
      • HTML
    • I18N
    • LayoutHandler
    • Log
    • Security
    • Session
    • Util
    • Validation
    • Versioning
    • XML
  • Module
    • ContentRssCreator
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
    • ScriptCookieDirective
  • mpAutoloaderClassMap
  • None
  • Plugin
    • ContentAllocation
    • CronjobOverview
    • FormAssistant
    • FrontendLogic
    • FrontendUsers
    • Linkchecker
    • ModRewrite
    • Newsletter
    • Repository
      • FrontendNavigation
      • KeywordDensity
    • SearchSolr
    • SmartyWrapper
    • UrlShortener
    • UserForum
    • Workflow
  • PluginManager
  • Setup
    • Form
    • GUI
    • Helper
      • Environment
      • Filesystem
      • MySQL
      • PHP
    • UpgradeJob

Classes

  • cGuiBackendHelpbox
  • cGuiFileOverview
  • cGuiFoldingRow
  • cGuiList
  • cGuiMenu
  • cGuiNavigation
  • cGuiNotification
  • cGuiObjectPager
  • cGuiPage
  • cGuiScrollList
  • cGuiSourceEditor
  • cGuiTableForm
  • cGuiTree
  • cPager
  • cTemplate
  • cTree
  • cTreeItem
  • NoteLink
  • NoteList
  • NoteListItem
  • NoteView
  • TODOLink
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo
  1: <?php
  2: 
  3: /**
  4:  * This file contains the foldable pager for menus GUI class.
  5:  *
  6:  * @package          Core
  7:  * @subpackage       GUI
  8:  *
  9:  * @author           Timo Hummel
 10:  * @copyright        four for business AG <www.4fb.de>
 11:  * @license          http://www.contenido.org/license/LIZENZ.txt
 12:  * @link             http://www.4fb.de
 13:  * @link             http://www.contenido.org
 14:  */
 15: 
 16: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
 17: 
 18: /**
 19:  * Class for foldable pager for menus.
 20:  *
 21:  * @package    Core
 22:  * @subpackage GUI
 23:  */
 24: class cGuiObjectPager extends cGuiFoldingRow {
 25: 
 26:     /**
 27:      *
 28:      * @var cHTMLLink
 29:      */
 30:     public $_pagerLink;
 31: 
 32:     /**
 33:      *
 34:      * @var string
 35:      */
 36:     public $_parameterToAdd;
 37: 
 38:     /**
 39:      * @var cPager
 40:      */
 41:     protected $_cPager;
 42: 
 43:     /**
 44:      * Constructor to create an instance of this class.
 45:      *
 46:      * @param string $uuid
 47:      * @param int $items
 48:      *         Amount of items
 49:      * @param int $itemsperpage
 50:      *         Items displayed per page
 51:      * @param int $currentpage
 52:      *         Defines the current page
 53:      * @param cHTMLLink $link
 54:      * @param string $parameterToAdd
 55:      * @param string $id [optional]
 56:      * @throws cException if the given link is not an object
 57:      */
 58:     public function __construct($uuid, $items, $itemsperpage, $currentpage, $link, $parameterToAdd, $id = '') {
 59:         if ((int) $currentpage == 0) {
 60:             $currentpage = 1;
 61:         }
 62: 
 63:         if ($id == '') {
 64:             parent::__construct($uuid, i18n("Paging"));
 65:         } else {
 66:             parent::__construct($uuid, i18n("Paging"), $id);
 67:         }
 68: 
 69:         if (!is_object($link)) {
 70:             throw new cException('Parameter link is not an object');
 71:         }
 72:         
 73:         $this->_cPager = new cPager($items, $itemsperpage, $currentpage);
 74:         $this->_pagerLink = $link;
 75:         $this->_parameterToAdd = $parameterToAdd;
 76:     }
 77: 
 78:     /**
 79:      *
 80:      * @see cGuiFoldingRow::render()
 81:      * @param bool $bContentOnly [optional]
 82:      * @return string
 83:      *         Generated markup
 84:      */
 85:     public function render($bContentOnly = false) {
 86:         // Do not display Page navigation if there is only one Page
 87:         // and we are not in newsletter section.
 88:         if ($this->_cPager->getMaxPages() == 1) {
 89:             $this->_headerRow->setStyle("display:none");
 90:             $this->_contentRow->setStyle("display:none");
 91:         }
 92: 
 93:         $items = $this->_cPager->getPagesInRange();
 94:         $link = $this->_pagerLink;
 95: 
 96:         $output = '';
 97: 
 98:         if (!$this->_cPager->isFirstPage()) {
 99:             $img = new cHTMLImage("images/paging/first.gif");
100: 
101:             $link->setAlt(i18n("First page"));
102:             $link->setContent($img);
103:             $link->setCustom($this->_parameterToAdd, 1);
104:             $output .= $link->render();
105:             $output .= " ";
106: 
107:             $img = new cHTMLImage("images/paging/previous.gif");
108:             $link->setAlt(i18n("Previous page"));
109:             $link->setContent($img);
110: 
111:             $link->setCustom($this->_parameterToAdd, $this->_cPager->getCurrentPage() - 1);
112: 
113:             $output .= $link->render();
114:             $output .= " ";
115:         } else {
116:             $output .= '<img src="images/spacer.gif" alt="" width="8"> ';
117:             $output .= '<img src="images/spacer.gif" alt="" width="8">';
118:         }
119: 
120:         foreach ($items as $key => $item) {
121:             $link->setContent($key);
122:             $link->setAlt(sprintf(i18n("Page %s"), $key));
123:             $link->setCustom($this->_parameterToAdd, $key);
124: 
125:             switch ($item) {
126:                 case "|": $output .= "...";
127:                     break;
128:                 case "current": $output .= '<span class="cpager_currentitem">' . $key . "</span>";
129:                     break;
130:                 default: $output .= $link->render();
131:             }
132: 
133:             $output .= " ";
134:         }
135: 
136:         if (!$this->_cPager->isLastPage()) {
137:             $img = new cHTMLImage("images/paging/next.gif");
138:             $link->setAlt(i18n("Next page"));
139:             $link->setContent($img);
140:             $link->setCustom($this->_parameterToAdd, $this->_cPager->getCurrentPage() + 1);
141: 
142:             $output .= $link->render();
143:             $output .= " ";
144: 
145:             $img = new cHTMLImage("images/paging/last.gif");
146: 
147:             $link->setCustom($this->_parameterToAdd, $this->_cPager->getMaxPages());
148:             $link->setAlt(i18n("Last page"));
149:             $link->setContent($img);
150: 
151:             $output .= $link->render();
152:             $output .= " ";
153:         } else {
154:             $output .= '<img src="images/spacer.gif" alt="" width="8"> ';
155:             $output .= '<img src="images/spacer.gif" alt="" width="8">';
156:         }
157: 
158:         $this->_contentData->setAlignment("center");
159:         $this->_contentData->setClass("foldingrow_content");
160: 
161:         // Do not display Page navigation if there is only one Page
162:         // and we are not in newsletter section.
163:         if ($this->_cPager->getMaxPages() == 1) {
164:             $output = '';
165:         }
166: 
167:         $this->_contentData->setContent($output);
168: 
169:         if ($bContentOnly) {
170:             return $output;
171:         } else {
172:             return parent::render();
173:         }
174:     }
175: 
176: }
177: 
CMS CONTENIDO 4.9.11 API documentation generated by ApiGen 2.8.0