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 table row GUI class.
  5:  *
  6:  * @package          Core
  7:  * @subpackage       GUI
  8:  * @version          SVN Revision $Rev:$
  9:  *
 10:  * @author           Bjoern Behrens
 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:  * Foldable table row GUI class
 21:  *
 22:  * @package    Core
 23:  * @subpackage GUI
 24:  */
 25: class cGuiFoldingRow extends cHTML {
 26: 
 27:     /**
 28:      * Table row with the header
 29:      * @var cHTMLTableRow
 30:      */
 31:     protected $_headerRow;
 32: 
 33:     /**
 34:      * Table header data
 35:      * @var cHTMLTableHead
 36:      */
 37:     protected $_headerData;
 38: 
 39:     /**
 40:      * Table row with the content
 41:      * @var cHTMLTableRow
 42:      */
 43:     protected $_contentRow;
 44: 
 45:     /**
 46:      * ID for link that triggers expandCollapse
 47:      * @var string
 48:      */
 49:     protected $_linkId;
 50: 
 51:     /**
 52:      * Link
 53:      * @var cHTMLLink
 54:      */
 55:     protected $_link;
 56: 
 57:     /**
 58:      * Table content data
 59:      * @var cHTMLTableData
 60:      */
 61:     protected $_contentData;
 62: 
 63:     /**
 64:      *
 65:      * @param string $uuid
 66:      * @param string $caption [optional]
 67:      * @param string $linkId [optional]
 68:      * @param bool|NULL $bExpanded [optional]
 69:      */
 70:     public function __construct($uuid, $caption = "", $linkId = "", $bExpanded = NULL) {
 71:         global $auth;
 72: 
 73:         $this->setCaption($caption);
 74: 
 75:         $this->_headerRow = new cHTMLTableRow();
 76:         $this->_headerData = new cHTMLTableHead();
 77:         $this->_contentRow = new cHTMLTableRow();
 78:         $this->_contentRow->updateAttributes(array("id" => $uuid));
 79:         $this->_contentData = new cHTMLTableData();
 80:         $this->_uuid = $uuid;
 81:         $this->_link = new cHTMLLink();
 82:         $this->_linkId = $linkId;
 83: 
 84:         $this->_headerData->setClass("foldingrow");
 85: 
 86:         $this->_hiddenField = new cHTMLHiddenField("expandstate_" . $this->_contentRow->getID());
 87: 
 88:         $this->_foldingImage = new cHTMLImage();
 89: 
 90:         $this->setExpanded(false);
 91: 
 92:         $this->addRequiredScript("parameterCollector.js");
 93:         $this->addRequiredScript("cfoldingrow.js");
 94: 
 95:         $user = new cApiUser($auth->auth["uid"]);
 96: 
 97:         if ($bExpanded == NULL) {
 98:             // Check for expandstate
 99:             if ($user->isLoaded()) {
100:                 if ($user->getProperty("expandstate", $uuid) == "true") {
101:                     $this->setExpanded($user->getProperty("expandstate", $uuid));
102:                 }
103:             }
104:         } else {
105:             if ($bExpanded) {
106:                 $this->setExpanded(true);
107:             } else {
108:                 $this->setExpanded(false);
109:             }
110:         }
111:     }
112: 
113:     /**
114:      *
115:      * @param bool $expanded [optional]
116:      */
117:     public function setExpanded($expanded = false) {
118:         if ($expanded == true) {
119:             $this->_foldingImage->setSrc("images/widgets/foldingrow/expanded.gif");
120:             $this->_foldingImage->updateAttributes(array("data-state" => "expanded"));
121:             $this->_contentRow->setStyle("display: ;");
122:             $this->_hiddenField->setValue('expanded');
123:         } else {
124:             $this->_foldingImage->setSrc("images/widgets/foldingrow/collapsed.gif");
125:             $this->_foldingImage->updateAttributes(array("data-state" => "collapsed"));
126:             $this->_contentRow->setStyle("display: none;");
127:             $this->_hiddenField->setValue('collapsed');
128:         }
129:         $this->_expanded = $expanded;
130:     }
131: 
132:     /**
133:      *
134:      * @param string $caption
135:      */
136:     public function setCaption($caption) {
137:         $this->_caption = $caption;
138:     }
139: 
140:     /**
141:      * Unused.
142:      *
143:      * @param mixed $context [optional]
144:      */
145:     public function setHelpContext($context = false) {
146:         $this->_helpContext = $context;
147:     }
148: 
149:     /**
150:      * Unused.
151:      *
152:      * @param int $indent [optional]
153:      */
154:     public function setIndent($indent = 0) {
155:         $this->_indent = $indent;
156:     }
157: 
158:     /**
159:      *
160:      * @param string|object|array $content
161:      */
162:     function setContentData($content) {
163:         $this->_contentData->setContent($content);
164:     }
165: 
166:     /**
167:      * @see cHTML::render()
168:      * @return string
169:      *         Generated markup
170:      */
171:     public function render() {
172:         // Build the expand/collapse link
173:         $this->_link->setClass("foldingrow");
174:         if ($this->_linkId != NULL) {
175:             $this->_link->setID($this->_linkId);
176:         }
177: 
178:         $imgid = $this->_foldingImage->getID();
179:         $rowid = $this->_contentRow->getID();
180:         $hiddenid = $this->_hiddenField->getID();
181:         $uuid = $this->_uuid;
182: 
183:         $this->_link->setLink("javascript:void(0);");
184:         $this->_link->setContent($this->_foldingImage->render() . $this->_caption);
185: 
186:         $this->_headerData->setContent(array($this->_hiddenField, $this->_link));
187:         $this->_headerRow->setContent($this->_headerData);
188: 
189:         $this->_contentRow->setContent($this->_contentData);
190: 
191:         $output = $this->_headerRow->render();
192:         $output .= $this->_contentRow->render();
193: 
194: $output = <<<HTML
195: <!-- cGuiFoldingRow -->
196: {$output}
197: <script type="text/javascript">
198: (function(Con, $) {
199:     $(function() {
200:         $("#{$this->_linkId}").click(function() {
201:             Con.FoldingRow.toggle("{$imgid}", "{$rowid}", "{$hiddenid}", "{$uuid}");
202:         });
203:     });
204: })(Con, Con.$);
205: </script>
206: <!-- /cGuiFoldingRow -->
207: HTML;
208: 
209:         return $output;
210:     }
211: 
212: }
213: 
CMS CONTENIDO 4.9.8 API documentation generated by ApiGen 2.8.0