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

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