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 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:      * @throws cDbException
 90:      * @throws cException
 91:      */
 92:     public function __construct($uuid, $caption = "", $linkId = "", $bExpanded = NULL) {
 93:         global $auth;
 94: 
 95:         $this->_uuid = $uuid;
 96: 
 97:         $this->setCaption($caption);
 98: 
 99:         $this->_headerRow = new cHTMLTableRow();
100: 
101:         $this->_headerData = new cHTMLTableHead();
102:         $this->_headerData->setClass("foldingrow");
103: 
104:         $this->_contentRow = new cHTMLTableRow();
105:         $this->_contentRow->updateAttributes(array("id" => $uuid));
106: 
107:         $this->_contentData = new cHTMLTableData();
108: 
109:         $this->_link = new cHTMLLink();
110: 
111:         $this->_linkId = $linkId;
112: 
113:         $this->_hiddenField = new cHTMLHiddenField("expandstate_" . $this->_contentRow->getID());
114: 
115:         $this->_foldingImage = new cHTMLImage();
116: 
117:         $this->setExpanded(false);
118: 
119:         $this->addRequiredScript("parameterCollector.js");
120:         $this->addRequiredScript("cfoldingrow.js");
121: 
122:         $user = new cApiUser($auth->auth["uid"]);
123: 
124:         if ($bExpanded == NULL) {
125:             // Check for expandstate
126:             if ($user->isLoaded()) {
127:                 if ($user->getProperty("expandstate", $uuid) == "true") {
128:                     $this->setExpanded($user->getProperty("expandstate", $uuid));
129:                 }
130:             }
131:         } else {
132:             if ($bExpanded) {
133:                 $this->setExpanded(true);
134:             } else {
135:                 $this->setExpanded(false);
136:             }
137:         }
138:     }
139: 
140:     /**
141:      *
142:      * @param bool $expanded [optional]
143:      */
144:     public function setExpanded($expanded = false) {
145:         if ($expanded == true) {
146:             $this->_foldingImage->setSrc("images/widgets/foldingrow/expanded.gif");
147:             $this->_foldingImage->updateAttributes(array("data-state" => "expanded"));
148:             $this->_contentRow->setStyle("display: ;");
149:             $this->_hiddenField->setValue('expanded');
150:         } else {
151:             $this->_foldingImage->setSrc("images/widgets/foldingrow/collapsed.gif");
152:             $this->_foldingImage->updateAttributes(array("data-state" => "collapsed"));
153:             $this->_contentRow->setStyle("display: none;");
154:             $this->_hiddenField->setValue('collapsed');
155:         }
156:         $this->_expanded = $expanded;
157:     }
158: 
159:     /**
160:      *
161:      * @param string $caption
162:      */
163:     public function setCaption($caption) {
164:         $this->_caption = $caption;
165:     }
166: 
167:     /**
168:      * Unused.
169:      *
170:      * @param mixed $context [optional]
171:      */
172:     public function setHelpContext($context = false) {
173:         $this->_helpContext = $context;
174:     }
175: 
176:     /**
177:      * Unused.
178:      *
179:      * @param int $indent [optional]
180:      */
181:     public function setIndent($indent = 0) {
182:         $this->_indent = $indent;
183:     }
184: 
185:     /**
186:      *
187:      * @param string|object|array $content
188:      */
189:     function setContentData($content) {
190:         $this->_contentData->setContent($content);
191:     }
192: 
193:     /**
194:      * @see cHTML::render()
195:      * @return string
196:      *         Generated markup
197:      */
198:     public function render() {
199:         // Build the expand/collapse link
200:         $this->_link->setClass("foldingrow");
201:         if ($this->_linkId != NULL) {
202:             $this->_link->setID($this->_linkId);
203:         }
204: 
205:         $imgid = $this->_foldingImage->getID();
206:         $rowid = $this->_contentRow->getID();
207:         $hiddenid = $this->_hiddenField->getID();
208:         $uuid = $this->_uuid;
209: 
210:         $this->_link->setLink("javascript:void(0);");
211:         $this->_link->setContent($this->_foldingImage->render() . $this->_caption);
212: 
213:         $this->_headerData->setContent(array($this->_hiddenField, $this->_link));
214:         $this->_headerRow->setContent($this->_headerData);
215: 
216:         $this->_contentRow->setContent($this->_contentData);
217: 
218:         $output = $this->_headerRow->render();
219:         $output .= $this->_contentRow->render();
220: 
221:         $output = <<<HTML
222: <!-- cGuiFoldingRow -->
223: {$output}
224: <script type="text/javascript">
225: (function(Con, $) {
226:     $(function() {
227:         $("#{$this->_linkId}").click(function() {
228:             Con.FoldingRow.toggle("{$imgid}", "{$rowid}", "{$hiddenid}", "{$uuid}");
229:         });
230:     });
231: })(Con, Con.$);
232: </script>
233: <!-- /cGuiFoldingRow -->
234: HTML;
235: 
236:         return $output;
237:     }
238: 
239: }
240: 
CMS CONTENIDO 4.10.0 API documentation generated by ApiGen 2.8.0