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

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