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 article 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:  * Article class for content allocation
 21:  *
 22:  * @package    Plugin
 23:  * @subpackage ContentAllocation
 24:  */
 25: class pApiContentAllocationArticle extends pApiTree {
 26: 
 27:     /**
 28:      * @var object cTemplate
 29:      */
 30:     protected $_tpl = null;
 31: 
 32:     /**
 33:      * @var string
 34:      */
 35:     protected $_template = '';
 36: 
 37:     /**
 38:      * @var array
 39:      */
 40:     protected $_load = array();
 41: 
 42:     /**
 43:      * pApiContentAllocationArticle constructor
 44:      *
 45:      * @param string $uuid
 46:      *
 47:      * @throws cDbException
 48:      * @throws cException
 49:      */
 50:     public function __construct($uuid) {
 51:         $cfg = cRegistry::getConfig();
 52: 
 53:         parent::__construct($uuid);
 54:         $this->_tpl = new cTemplate();
 55:         $this->_template = $cfg['pica']['treetemplate_article'];
 56:     }
 57: 
 58:     /**
 59:      * Old constructor
 60:      *
 61:      * @deprecated [2016-02-11]
 62:      *                This method is deprecated and is not needed any longer. Please use __construct() as constructor function.
 63:      *
 64:      * @param string $uuid
 65:      *
 66:      * @return pApiContentAllocationArticle
 67:      * @throws cDbException
 68:      * @throws cException
 69:      */
 70:     public function pApiContentAllocationArticle($uuid) {
 71:         cDeprecated('This method is deprecated and is not needed any longer. Please use __construct() as constructor function.');
 72:         return $this->__construct($uuid);
 73:     }
 74: 
 75:     /**
 76:      * Builed an render tree
 77:      *
 78:      * @param $tree
 79:      * @return array
 80:      */
 81:     protected function _buildRenderTree($tree) {
 82: 
 83:         $result = array();
 84:         foreach ($tree as $item_tmp) {
 85:             $item = array();
 86: 
 87:             $expandCollapseImg = 'images/spacer.gif';
 88:             $expandCollapse = '<img class="vAlignMiddle" src="'.$expandCollapseImg.'" alt="" border="0" width="11" height="11">';
 89: 
 90:             $item['ITEMNAME'] = $expandCollapse . ' ' . $item_tmp['name'];
 91: 
 92:             $item['ITEMINDENT'] = $item_tmp['level'] * 15 + 3;
 93: 
 94:             // set checked!
 95:             $checked = '';
 96:             if (in_array($item_tmp['idpica_alloc'], $this->_load)) {
 97:                 $checked = ' checked="checked"';
 98:             }
 99:             $item['CHECKBOX'] = '<input type="checkbox" name="allocation[]" value="'.$item_tmp['idpica_alloc'].'" '.$checked.'>';
100: 
101:             array_push($result, $item);
102: 
103:             if ($item_tmp['children']) {
104:                 $children = $this->_buildRenderTree($item_tmp['children']);
105:                 $result = array_merge($result, $children);
106:             }
107:         }
108: 
109:         return $result;
110:     }
111: 
112:     /**
113:      * Set method for load
114:      *
115:      * @param array $load
116:      */
117:     public function setChecked($load) {
118:         $this->_load = $load;
119:     }
120: 
121:     /**
122:      * Render tree
123:      *
124:      * @param bool $return
125:      *
126:      * @return bool|object
127:      * @throws cDbException
128:      * @throws cInvalidArgumentException
129:      */
130:     function renderTree($return = true) {
131:         $this->_tpl->reset();
132: 
133:         $tree = $this->fetchTree();
134:         if ($tree === false) {
135:             return false;
136:         }
137: 
138:         $tree = $this->_buildRenderTree($tree);
139: 
140:         $even = true;
141:         foreach ($tree as $item) {
142:             $even = !$even;
143:             $bgcolor = ($even) ? '#FFFFFF' : '#F1F1F1';
144:             $this->_tpl->set('d', 'BACKGROUND_COLOR', $bgcolor);
145:             foreach ($item as $key => $value) {
146:                 $this->_tpl->set('d', $key, $value);
147:             }
148:             $this->_tpl->next();
149:         }
150: 
151:         $this->_tpl->set('s', "CATEGORY", i18n("Category", 'content_allocation'));
152: 
153:         if ($return === true) {
154:             return $this->_tpl->generate($this->_template, true);
155:         } else {
156:             $this->_tpl->generate($this->_template);
157:         }
158:     }
159: }
160: 
CMS CONTENIDO 4.10.1 API documentation generated by ApiGen 2.8.0