1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 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: 22: 23: 24: 25:
26: class pApiContentAllocationSelectBox extends pApiTree {
27:
28: var $idSetter = true;
29: var $load = array();
30:
31: function pApiContentAllocationComplexList ($uuid) {
32: global $cfg;
33:
34: parent::pApiTree($uuid);
35: }
36:
37: function _buildRenderTree ($tree) {
38: global $action, $frame, $area, $sess, $idart;
39:
40: $oldIdSetter = $this->idSetter;
41: $this->idSetter = false;
42:
43: $result = '';
44:
45: $levelElms = sizeof($tree);
46: $cnt = 1;
47: foreach ($tree as $item_tmp) {
48: $item = '';
49:
50: $spacer = '|-';
51: $spacer = str_pad($spacer, (($item_tmp['level'] + 1) * 2), "--", STR_PAD_RIGHT);
52:
53: $result .= '<option value="'.$item_tmp['idpica_alloc'].'_'.$item_tmp['level'].'">'.$spacer . $item_tmp['name'].'</option>';
54:
55: if ($item_tmp['children']) {
56: $children = $this->_buildRenderTree($item_tmp['children']);
57: $result .= $children;
58: }
59: }
60:
61: return $result;
62: }
63:
64: function setChecked($load) {
65: return false;
66: }
67:
68: 69: 70: 71:
72: function renderTree ($return = true, $parentId = false, $bUseTreeStatus = false) {
73:
74: $tree = $this->fetchTree($parentId, 0, $bUseTreeStatus);
75:
76: if ($tree === false) {
77: return false;
78: }
79:
80: $tree = $this->_buildRenderTree($tree);
81:
82: if ($return === true) {
83: return $tree;
84: } else {
85: echo $tree;
86: }
87: }
88: }
89:
90: ?>