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