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
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
    • ScriptCookieDirective
  • mpAutoloaderClassMap
  • None
  • PHP
  • Plugin
    • ContentAllocation
    • CronjobOverview
    • FormAssistant
    • FrontendLogic
    • FrontendUsers
    • Linkchecker
    • ModRewrite
    • Newsletter
    • Repository
      • FrontendNavigation
      • KeywordDensity
    • 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:      *
 57:      * @throws cException if the given link is not an object
 58:      */
 59:     public function __construct($uuid, $items, $itemsperpage, $currentpage, $link, $parameterToAdd, $id = '') {
 60:         if ((int) $currentpage == 0) {
 61:             $currentpage = 1;
 62:         }
 63: 
 64:         if ($id == '') {
 65:             parent::__construct($uuid, i18n("Paging"));
 66:         } else {
 67:             parent::__construct($uuid, i18n("Paging"), $id);
 68:         }
 69: 
 70:         if (!is_object($link)) {
 71:             throw new cException('Parameter link is not an object');
 72:         }
 73:         
 74:         $this->_cPager = new cPager($items, $itemsperpage, $currentpage);
 75:         $this->_pagerLink = $link;
 76:         $this->_parameterToAdd = $parameterToAdd;
 77:     }
 78: 
 79:     /**
 80:      *
 81:      * @see cGuiFoldingRow::render()
 82:      * @param bool $bContentOnly [optional]
 83:      * @return string
 84:      *         Generated markup
 85:      */
 86:     public function render($bContentOnly = false) {
 87:         // Do not display Page navigation if there is only one Page
 88:         // and we are not in newsletter section.
 89:         if ($this->_cPager->getMaxPages() == 1) {
 90:             $this->_headerRow->setStyle("display:none");
 91:             $this->_contentRow->setStyle("display:none");
 92:         }
 93: 
 94:         $items = $this->_cPager->getPagesInRange();
 95:         $link = $this->_pagerLink;
 96: 
 97:         $output = '';
 98: 
 99:         if (!$this->_cPager->isFirstPage()) {
100:             $img = new cHTMLImage("images/paging/first.gif");
101: 
102:             $link->setAlt(i18n("First page"));
103:             $link->setContent($img);
104:             $link->setCustom($this->_parameterToAdd, 1);
105:             $output .= $link->render();
106:             $output .= " ";
107: 
108:             $img = new cHTMLImage("images/paging/previous.gif");
109:             $link->setAlt(i18n("Previous page"));
110:             $link->setContent($img);
111: 
112:             $link->setCustom($this->_parameterToAdd, $this->_cPager->getCurrentPage() - 1);
113: 
114:             $output .= $link->render();
115:             $output .= " ";
116:         } else {
117:             $output .= '<img src="images/spacer.gif" alt="" width="8"> ';
118:             $output .= '<img src="images/spacer.gif" alt="" width="8">';
119:         }
120: 
121:         foreach ($items as $key => $item) {
122:             $link->setContent($key);
123:             $link->setAlt(sprintf(i18n("Page %s"), $key));
124:             $link->setCustom($this->_parameterToAdd, $key);
125: 
126:             switch ($item) {
127:                 case "|": $output .= "...";
128:                     break;
129:                 case "current": $output .= '<span class="cpager_currentitem">' . $key . "</span>";
130:                     break;
131:                 default: $output .= $link->render();
132:             }
133: 
134:             $output .= " ";
135:         }
136: 
137:         if (!$this->_cPager->isLastPage()) {
138:             $img = new cHTMLImage("images/paging/next.gif");
139:             $link->setAlt(i18n("Next page"));
140:             $link->setContent($img);
141:             $link->setCustom($this->_parameterToAdd, $this->_cPager->getCurrentPage() + 1);
142: 
143:             $output .= $link->render();
144:             $output .= " ";
145: 
146:             $img = new cHTMLImage("images/paging/last.gif");
147: 
148:             $link->setCustom($this->_parameterToAdd, $this->_cPager->getMaxPages());
149:             $link->setAlt(i18n("Last page"));
150:             $link->setContent($img);
151: 
152:             $output .= $link->render();
153:             $output .= " ";
154:         } else {
155:             $output .= '<img src="images/spacer.gif" alt="" width="8"> ';
156:             $output .= '<img src="images/spacer.gif" alt="" width="8">';
157:         }
158: 
159:         $this->_contentData->setAlignment("center");
160:         $this->_contentData->setClass("foldingrow_content");
161: 
162:         // Do not display Page navigation if there is only one Page
163:         // and we are not in newsletter section.
164:         if ($this->_cPager->getMaxPages() == 1) {
165:             $output = '';
166:         }
167: 
168:         $this->_contentData->setContent($output);
169: 
170:         if ($bContentOnly) {
171:             return $output;
172:         } else {
173:             return parent::render();
174:         }
175:     }
176: 
177: }
178: 
CMS CONTENIDO 4.10.0 API documentation generated by ApiGen 2.8.0