1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* TDMDownload |
4
|
|
|
* |
5
|
|
|
* You may not change or alter any portion of this comment or credits |
6
|
|
|
* of supporting developers from this source code or any supporting source code |
7
|
|
|
* which is considered copyrighted (c) material of the original comment or credit authors. |
8
|
|
|
* This program is distributed in the hope that it will be useful, |
9
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
10
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
11
|
|
|
* |
12
|
|
|
* @copyright Gregory Mage (Aka Mage) |
13
|
|
|
* @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) |
14
|
|
|
* @author Gregory Mage (Aka Mage) |
15
|
|
|
*/ |
16
|
|
|
// xoops >2.5.9 |
17
|
|
|
class TDMObjectTree extends XoopsObjectTree { |
18
|
|
|
|
19
|
|
|
protected function makeArrayTreeOptions($fieldName, $key, &$ret, $prefix_orig, $prefix_curr = '') |
20
|
|
|
{ |
21
|
|
|
if ($key > 0) { |
22
|
|
|
$value = $this->tree[$key]['obj']->getVar($this->myId); |
23
|
|
|
$ret[$value] = $prefix_curr . $this->tree[$key]['obj']->getVar($fieldName); |
24
|
|
|
$prefix_curr .= $prefix_orig; |
25
|
|
|
} |
26
|
|
|
if (isset($this->tree[$key]['child']) && !empty($this->tree[$key]['child'])) { |
27
|
|
|
foreach ($this->tree[$key]['child'] as $childKey) { |
28
|
|
|
$this->makeArrayTreeOptions($fieldName, $childKey, $ret, $prefix_orig, $prefix_curr); |
29
|
|
|
} |
30
|
|
|
} |
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
public function makeArrayTree($fieldName, $prefix = '-', $key = 0) { |
|
|
|
|
34
|
|
|
$ret = array(); |
35
|
|
|
$this->makeArrayTreeOptions($fieldName, $key, $ret, $prefix); |
36
|
|
|
|
37
|
|
|
return $ret; |
38
|
|
|
} |
39
|
|
|
} |
40
|
|
|
/* xoops 2.5.8 |
41
|
|
|
class TDMObjectTree extends XoopsObjectTree { |
42
|
|
|
|
43
|
|
|
protected function makeArrayTreeOptions($fieldName, $key, &$ret, $prefix_orig, $prefix_curr = '') |
44
|
|
|
{ |
45
|
|
|
if ($key > 0) { |
46
|
|
|
$value = $this->_tree[$key]['obj']->getVar($this->_myId); |
47
|
|
|
$ret[$value] = $prefix_curr . $this->_tree[$key]['obj']->getVar($fieldName); |
48
|
|
|
$prefix_curr .= $prefix_orig; |
49
|
|
|
} |
50
|
|
|
if (isset($this->_tree[$key]['child']) && !empty($this->_tree[$key]['child'])) { |
51
|
|
|
foreach ($this->_tree[$key]['child'] as $childKey) { |
52
|
|
|
$this->makeArrayTreeOptions($fieldName, $childKey, $ret, $prefix_orig, $prefix_curr); |
53
|
|
|
} |
54
|
|
|
} |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
public function makeArrayTree($fieldName, $prefix = '-', $key = 0) { |
58
|
|
|
$ret = array(); |
59
|
|
|
$this->makeArrayTreeOptions($fieldName, $key, $ret, $prefix); |
60
|
|
|
|
61
|
|
|
return $ret; |
62
|
|
|
} |
63
|
|
|
}*/ |
64
|
|
|
|
Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a
@return
annotation as described here.