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
    • SIWECOS
    • SmartyWrapper
    • UrlShortener
    • UserForum
    • Workflow
  • PluginManager
  • Setup
    • Form
    • GUI
    • Helper
      • Environment
      • Filesystem
      • MySQL
      • PHP
    • UpgradeJob

Classes

  • pApiContentAllocation
  • pApiContentAllocationArticle
  • pApiContentAllocationComplexList
  • pApiContentAllocationSelectBox
  • pApiContentAllocationTreeView
  • pApiTree

Functions

  • pica_ArticleListActions
  • pica_GetCustomTabProperties
  • pica_RegisterCustomTab
  • pica_RenderArticleAction
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo
  1: <?php
  2: 
  3: /**
  4:  * This file contains the complex list class for the plugin content allocation.
  5:  *
  6:  * @package    Plugin
  7:  * @subpackage ContentAllocation
  8:  * @author     Marco Jahn
  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: plugin_include('repository', 'custom/FrontendNavigation.php');
 18: 
 19: /**
 20:  * Complex list class for content allocation
 21:  *
 22:  * @package    Plugin
 23:  * @subpackage ContentAllocation
 24:  */
 25: class pApiContentAllocationComplexList extends pApiTree {
 26: 
 27:     /**
 28:      * @var bool
 29:      */
 30:     protected $_idSetter = true;
 31: 
 32:     /**
 33:      * @var array
 34:      */
 35:     protected $_load = array();
 36: 
 37:     /**
 38:      * pApiContentAllocationComplexList constructor
 39:      *
 40:      * @param string $uuid
 41:      *
 42:      * @throws cDbException
 43:      * @throws cException
 44:      */
 45:     public function __construct($uuid) {
 46:         parent::__construct($uuid);
 47:     }
 48: 
 49:     /**
 50:      * Old constructor
 51:      *
 52:      * @deprecated [2016-02-11]
 53:      *                This method is deprecated and is not needed any longer. Please use __construct() as constructor function.
 54:      *
 55:      * @param string $uuid
 56:      *
 57:      * @return pApiContentAllocationComplexList
 58:      * @throws cDbException
 59:      * @throws cException
 60:      */
 61:     public function pApiContentAllocationComplexList($uuid) {
 62:         cDeprecated('This method is deprecated and is not needed any longer. Please use __construct() as constructor function.');
 63:         return $this->__construct($uuid);
 64:     }
 65: 
 66:     /**
 67:      * Builed an render tree
 68:      *
 69:      * @param $tree
 70:      * @return string
 71:      */
 72:     protected function _buildRenderTree($tree) {
 73: 
 74:         $oldIdSetter = $this->_idSetter;
 75:         $this->_idSetter = false;
 76: 
 77:         $result = '';
 78: 
 79:         $even = true;
 80: 
 81:         $levelElms = sizeof($tree);
 82:         $cnt = 1;
 83:         foreach ($tree as $item_tmp) {
 84:             if (in_array($item_tmp['idpica_alloc'], $this->_load)) {
 85:                 $checked = ' checked="checked"';
 86:             } else {
 87:                 $checked = '';
 88:             }
 89: 
 90:             $li_closeElm = '';
 91:             if ($cnt == $levelElms) {
 92:                 $li_closeElm = 'class="lastElem"';
 93:             }
 94:             $cnt++;
 95: 
 96:             $even = !$even;
 97:             $bgcolor = ($even) ? 'bright' : 'dark';
 98: 
 99:             // for wrapping purposes
100:             $item_tmp['name'] = str_replace('-', '- ', $item_tmp['name']);
101: 
102:             $checkbox = '<input type="checkbox" name="allocation[]" onClick="addToList(this);" ' . $checked . '" id="e'.$item_tmp['idpica_alloc'].'" value="'.$item_tmp['idpica_alloc'].'">';
103:             $item = "\n<li baseClass=\"" . $bgcolor . "\" ".$li_closeElm.">" . $checkbox . " " . $item_tmp['name'];
104: 
105:             $result .= $item;
106: 
107:             if ($item_tmp['children']) {
108:                 $children = $this->_buildRenderTree($item_tmp['children']);
109:                 $result .= "\n<ul>" . $children . "</li>";
110:             } else {
111:                 $result .= "\n</li>";
112:             }
113:         }
114: 
115:         if ($oldIdSetter === true) {
116:             return "\n<ul id=\"finder\">" . $result . "\n</ul>";
117:         } else {
118:             return $result . "\n</ul>";
119:         }
120:     }
121: 
122:     /**
123:      * Set method for load
124:      *
125:      * @param array $load
126:      */
127:     public function setChecked($load) {
128:         $this->_load = $load;
129:     }
130: 
131:     /**
132:      * Render tree
133:      *
134:      * @param bool $return
135:      *
136:      * @return bool|string
137:      * @throws cDbException
138:      */
139:     public function renderTree($return = true) {
140:         $tree = $this->fetchTree();
141:         if ($tree === false) {
142:             return false;
143:         }
144: 
145:         $tree = $this->_buildRenderTree($tree);
146:         if ($return === true) {
147:             return $tree;
148:         }
149:     }
150: }
151: 
CMS CONTENIDO 4.10.1 API documentation generated by ApiGen 2.8.0