Overview

Packages

  • Core
    • Authentication
    • Backend
    • Cache
    • CEC
    • Chain
    • ContentType
    • Database
    • Datatype
    • Debug
    • Exception
    • Frontend
      • Search
      • URI
      • Util
    • GenericDB
      • Model
    • GUI
      • HTML
    • I18N
    • LayoutHandler
    • Log
    • Security
    • Session
    • Util
    • Validation
    • Versioning
    • XML
  • Module
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationMain
    • NavigationTop
  • 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 tree view class for the plugin content allocation.
  4:  *
  5:  * @package    Plugin
  6:  * @subpackage ContentAllocation
  7:  * @version    SVN Revision $Rev:$
  8:  *
  9:  * @author     Marco Jahn
 10:  * @copyright  four for business AG <www.4fb.de>
 11:  * @license    http://www.contenido.org/license/LIZENZ.txt
 12:  * @link       http://www.4fb.de
 13:  * @link       http://www.contenido.org
 14:  */
 15: 
 16: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
 17: 
 18: plugin_include('repository', 'custom/FrontendNavigation.php');
 19: 
 20: /**
 21:  * Tree view class for content allocation
 22:  *
 23:  * @package    Plugin
 24:  * @subpackage ContentAllocation
 25:  */
 26: class pApiContentAllocationTreeView extends pApiTree {
 27: 
 28:     /**
 29:      */
 30:     var $tpl = null;
 31: 
 32:     /**
 33:      */
 34:     var $template = '';
 35: 
 36:     /**
 37:      */
 38:     function pApiContentAllocationTreeView($uuid) {
 39:         global $cfg;
 40: 
 41:         parent::pApiTree($uuid);
 42:         $this->tpl = new cTemplate();
 43:         $this->template = $cfg['pica']['treetemplate'];
 44:     }
 45: 
 46:     /**
 47:      */
 48:     function _buildRenderTree($tree) {
 49:         global $action, $frame, $area, $sess;
 50:         $result = array();
 51:         foreach ($tree as $item_tmp) {
 52:             $item = array();
 53:             // update item
 54:             if ($_GET['step'] == 'rename' && $item_tmp['idpica_alloc'] == $_GET['idpica_alloc']) {
 55:                 $item = array();
 56:                 $item['ITEMNAME'] = '
 57:                     <table cellspacing="0" cellpaddin="0" border="0">
 58:                     <form name="rename" action="main.php" method="POST" onsubmit="return fieldCheck();">
 59:                     <input type="hidden" name="action" value="' . $action . '">
 60:                     <input type="hidden" name="frame" value="' . $frame . '">
 61:                     <input type="hidden" name="contenido" value="' . $sess->id . '">
 62:                     <input type="hidden" name="area" value="' . $area . '">
 63:                     <input type="hidden" name="step" value="storeRename">
 64:                     <input type="hidden" name="treeItemPost[idpica_alloc]" value="' . $item_tmp['idpica_alloc'] . '">
 65:                     <tr>
 66:                     <td class="text_medium"><input id="itemname" class="text_medium" type="text" name="treeItemPost[name]" value="' . conHtmlentities($item_tmp['name']) . '"></td>
 67:                     <td>&nbsp;
 68:                     <a href="main.php?action=' . $action . '&frame=' . $frame . '&area=' . $area . '&contenido=' . $sess->id . '"><img src="images/but_cancel.gif" border="0"></a>
 69:                     <input type="image" src="images/but_ok.gif">
 70:                     </td></tr>
 71:                     </form>
 72:                     </table>
 73:                     <script type="text/javascript">
 74:                         controller = document.getElementById("itemname");
 75:                         controller.focus();
 76:                         function fieldCheck() {
 77:                             if (controller.value == "") {
 78:                                 alert("' . i18n("Please enter a category name", 'content_allocation') . '");
 79:                                 controller.focus();
 80:                                 return false;
 81:                             }
 82:                         return true;
 83:                         }
 84:                     </script>';
 85:             } else {
 86:                echo '<pre>';
 87:                 if ($item_tmp['children'] || $item_tmp['status'] == 'collapsed') {
 88:                     $expandCollapseImg = 'images/close_all.gif';
 89:                     if ($item_tmp['status'] == 'collapsed') {
 90:                         $expandCollapseImg = 'images/open_all.gif';
 91:                     }
 92: 
 93:                     $expandCollapse = '<a href="main.php?contenido=' . $sess->id . '&idart=' . $idart . '&action=' . $action . '&frame=' . $frame . '&area=' . $area .  '&oldstate=' . 'huhu' . '&step=collapse&idpica_alloc=' . $item_tmp['idpica_alloc'] . '"><img src="' . $expandCollapseImg . '" border="0" class="vAlignMiddle" width="7" height="7"></a>';
 94:                 } else {
 95:                     $expandCollapseImg = 'images/spacer.gif';
 96:                     $expandCollapse = '<img src="' . $expandCollapseImg . '" border="0" class="vAlignMiddle" width="11" height="11">';
 97:                 }
 98: 
 99:                 if($item_tmp['status'] == 'collapsed'){
100:                     $expandCollapse = '<a href="main.php?contenido=' . $sess->id . '&idart=' . $idart . '&action=' . $action . '&frame=' . $frame . '&area=' . $area . '&step=expanded&idpica_alloc=' . $item_tmp['idpica_alloc'] . '"><img src="' . $expandCollapseImg . '" border="0" class="vAlignMiddle" width="7" height="7"></a>';
101:                 }
102:                 $item['ITEMNAME'] = $expandCollapse . ' ' . $item_tmp['name'];
103:             }
104:             echo '</pre>';
105:             $item['ITEMINDENT'] = $item_tmp['level'] * 15 + 3;
106:             $item['ACTION_CREATE'] = '<a href="main.php?contenido=' . $sess->id . '&action=' . $action . '&frame=' . $frame . '&area=' . $area . '&step=add&parentid=' . $item_tmp['idpica_alloc'] . '"><img src="images/folder_new.gif" border="0" title="' . i18n("New category", 'content_allocation') . '" alt="' . i18n("New category", 'content_allocation') . '"></a>';
107: 
108:             $item['ACTION_RENAME'] = '<a href="main.php?contenido=' . $sess->id . '&action=' . $action . '&frame=' . $frame . '&area=' . $area . '&step=rename&idpica_alloc=' . $item_tmp['idpica_alloc'] . '"><img src="images/but_todo.gif" width="16" height="16" border="0" alt="' . i18n("Rename category", 'content_allocation') . '" title="' . i18n("Rename category", 'content_allocation') . '"></a>';
109:             $item['ACTION_MOVE_UP'] = (count($result) >= 1)? '<a href="main.php?contenido=' . $sess->id . '&action=' . $action . '&frame=' . $frame . '&area=' . $area . '&step=moveup&idpica_alloc=' . $item_tmp['idpica_alloc'] . '"><img src="images/folder_moveup.gif" border="0" alt="' . i18n("Move category up", 'content_allocation') . '" title="' . i18n("Move category up", 'content_allocation') . '"></a>' : '<img src="images/spacer.gif" width="16" height="16"></a>';
110:             $item['ACTION_MOVE_DOWN'] = (count($result) >= 1)? '<img src="images/folder_movedown.gif" border="0" alt="' . i18n("Move category down", 'content_allocation') . '" title="' . i18n("Move category down", 'content_allocation') . '">' : '<img src="images/spacer.gif" width="16" height="16">';
111:             $item['ACTION_MOVE_DOWN'] = '';
112: 
113:             if ($item_tmp['online'] == 1) { // set offline
114:                 $item['ACTION_ONOFFLINE'] = '<a href="main.php?contenido=' . $sess->id . '&action=' . $action . '&frame=' . $frame . '&area=' . $area . '&step=offline&idpica_alloc=' . $item_tmp['idpica_alloc'] . '""><img src="images/online.gif" alt="' . i18n("Set category offline", 'content_allocation') . '" title="' . i18n("Set category offline", 'content_allocation') . '"></a>';
115:             } else {
116:                 $item['ACTION_ONOFFLINE'] = '<a href="main.php?contenido=' . $sess->id . '&action=' . $action . '&frame=' . $frame . '&area=' . $area . '&step=online&idpica_alloc=' . $item_tmp['idpica_alloc'] . '""><img src="images/offline.gif" alt="' . i18n("Set category online", 'content_allocation') . '" title="' . i18n("Set category online", 'content_allocation') . '"></a>';
117:             }
118: 
119:             if ($item_tmp['children']) {
120:                 $item['ACTION_DELETE'] = '<img src="images/delete_inact.gif" border="0" alt="' . i18n("One or more subcategories exist, unable to delete", 'content_allocation') . '" title="' . i18n("One or more subcategories exist, unable to delete", 'content_allocation') . '">';
121:             } else {
122:                 $name = str_replace("\"", "&amp;quot;", str_replace("'", "\'", $item_tmp['name']));
123:                 $item['ACTION_DELETE'] = '<a href="javascript:void(0)" onclick="showConfirmation(&quot;' . i18n("Are you sure to delete the following category", 'content_allocation') . '&quot;, function() { deleteCategory(' . $item_tmp['idpica_alloc'] . '); });return false;"><img src="images/delete.gif" border="0" alt="' . i18n("Delete category") . '" title="' . i18n("Delete category", 'content_allocation') . '"></a>';
124:             }
125: 
126:             $result[] = $item;
127: 
128:             if ($item_tmp['children']) {
129:                 $children = $this->_buildRenderTree($item_tmp['children']);
130:                 $result = array_merge($result, $children);
131:             }
132: 
133:             // add new item -> show formular
134:             if ($_GET['step'] == 'add' && $item_tmp['idpica_alloc'] == $_GET['parentid']) {
135:                 $item = array();
136: 
137:                 $item['ITEMNAME'] = '
138:                     <table cellspacing="0" cellpaddin="0" border="0">
139:                     <form name="create" action="main.php" method="POST" onsubmit="return fieldCheck();">
140:                     <input type="hidden" name="action" value="' . $action . '">
141:                     <input type="hidden" name="frame" value="' . $frame . '">
142:                     <input type="hidden" name="contenido" value="' . $sess->id . '">
143:                     <input type="hidden" name="area" value="' . $area . '">
144:                     <input type="hidden" name="step" value="store">
145:                     <input type="hidden" name="treeItemPost[parentid]" value="' . $_GET['parentid'] . '">
146:                     <tr>
147:                     <td class="text_medium"><input id="itemname" class="text_medium" type="text" name="treeItemPost[name]" value=""></td>
148:                     <td>&nbsp;
149:                     <a href="main.php?action=' . $action . '&frame=' . $frame . '&area=' . $area . '&contenido=' . $sess->id . '"><img src="images/but_cancel.gif" border="0"></a>
150:                     <input type="image" src="images/but_ok.gif">
151:                     </td></tr>
152:                     </form>
153:                     </table>
154:                     <script type="text/javascript">
155:                         controller = document.getElementById("itemname");
156:                         controller.focus();
157:                         function fieldCheck() {
158:                             if (controller.value == "") {
159:                                 alert("' . i18n("Please enter a category name", 'content_allocation') . '");
160:                                 controller.focus();
161:                                 return false;
162:                             }
163:                         return true;
164:                         }
165:                     </script>';
166:                 $item['ITEMINDENT'] = ($item_tmp['level'] + 1) * 15;
167:                 $item['ACTION_CREATE'] = '<img src="images/spacer.gif" width="15" height="13">';
168:                 $item['ACTION_RENAME'] = '<img src="images/spacer.gif" width="23" height="14">';
169:                 $item['ACTION_MOVE_UP'] = '<img src="images/spacer.gif" width="15" height="13">';
170:                 $item['ACTION_MOVE_DOWN'] = '<img src="images/spacer.gif" width="15" height="13">';
171:                 $item['ACTION_MOVE_DOWN'] = '';
172:                 $item['ACTION_DELETE'] = '<img src="images/spacer.gif" width="14" height="13">';
173:                 $item['ACTION_ONOFFLINE'] = '<img src="images/spacer.gif" width="11" height="12">';
174: 
175:                 array_push($result, $item);
176:             }
177:         }
178:         return $result;
179:     }
180: 
181:     /**
182:      */
183:     function renderTree($return = true) {
184:         $this->tpl->reset();
185: 
186:         $tree = $this->fetchTree(false, 0, true); // modified 27.10.2005
187: 
188:         if ($tree === false) {
189:             return false;
190:         }
191: 
192:         $tree = $this->_buildRenderTree($tree);
193: 
194:         $even = true;
195:         foreach ($tree as $item) {
196:             $even = !$even;
197:             $bgcolor = ($even)? '#FFFFFF' : '#F1F1F1';
198:             $this->tpl->set('d', 'BACKGROUND_COLOR', $bgcolor);
199:             foreach ($item as $key => $value) {
200:                 $this->tpl->set('d', $key, $value);
201:             }
202:             $this->tpl->next();
203:         }
204: 
205:         $this->tpl->set('s', 'CATEGORY', i18n("Category", 'content_allocation'));
206:         $this->tpl->set('s', 'ACTIONS', i18n("Actions", 'content_allocation'));
207: 
208:         if ($return === true) {
209:             return $this->tpl->generate($this->template, true);
210:         } else {
211:             $this->tpl->generate($this->template);
212:         }
213:     }
214: 
215: }
216: 
CMS CONTENIDO 4.9.0 API documentation generated by ApiGen 2.8.0