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