1 | <?php |
||
41 | class Bookshop_XoopsObjectTree |
||
|
|||
42 | { |
||
43 | /**#@+ |
||
44 | * @access private |
||
45 | */ |
||
46 | public $_parentId; |
||
47 | public $_myId; |
||
48 | public $_rootId = null; |
||
49 | public $_tree = array(); |
||
50 | public $_objects; |
||
51 | /**#@-*/ |
||
52 | |||
53 | /** |
||
54 | * Constructor |
||
55 | * |
||
56 | * @param array $objectArr Array of {@link XoopsObject}s |
||
57 | * @param string $myId field name of object ID |
||
58 | * @param string $parentId field name of parent object ID |
||
59 | * @param string $rootId field name of root object ID |
||
60 | **/ |
||
61 | public function __construct(&$objectArr, $myId, $parentId, $rootId = null) |
||
71 | |||
72 | /** |
||
73 | * Initialize the object |
||
74 | * |
||
75 | * @access private |
||
76 | **/ |
||
77 | public function _initialize() |
||
90 | |||
91 | /** |
||
92 | * Get the tree |
||
93 | * |
||
94 | * @return array Associative array comprising the tree |
||
95 | **/ |
||
96 | public function &getTree() |
||
100 | |||
101 | /** |
||
102 | * returns an object from the tree specified by its id |
||
103 | * |
||
104 | * @param string $key ID of the object to retrieve |
||
105 | * @return object Object within the tree |
||
106 | **/ |
||
107 | public function &getByKey($key) |
||
111 | |||
112 | /** |
||
113 | * returns an array of all the first child object of an object specified by its id |
||
114 | * |
||
115 | * @param string $key ID of the parent object |
||
116 | * @return array Array of children of the parent |
||
117 | **/ |
||
118 | public function getFirstChild($key) |
||
129 | |||
130 | /** |
||
131 | * returns an array of all child objects of an object specified by its id |
||
132 | * |
||
133 | * @param string $key ID of the parent |
||
134 | * @param array $ret (Empty when called from client) Array of children from previous recursions. |
||
135 | * @return array Array of child nodes. |
||
136 | **/ |
||
137 | public function getAllChild($key, $ret = array()) |
||
151 | |||
152 | /** |
||
153 | * returns an array of all parent objects. |
||
154 | * the key of returned array represents how many levels up from the specified object |
||
155 | * |
||
156 | * @param string $key ID of the child object |
||
157 | * @param array $ret (empty when called from outside) Result from previous recursions |
||
158 | * @param int $uplevel (empty when called from outside) level of recursion |
||
159 | * @return array Array of parent nodes. |
||
160 | **/ |
||
161 | public function getAllParent($key, $ret = array(), $uplevel = 1) |
||
173 | |||
174 | /** |
||
175 | * Make options for a select box from |
||
176 | * |
||
177 | * @param string $fieldName Name of the member variable from the |
||
178 | * node objects that should be used as the title for the options. |
||
179 | * @param string $selected Value to display as selected |
||
180 | * @param int $key ID of the object to display as the root of select options |
||
181 | * @param string $ret (reference to a string when called from outside) Result from previous recursions |
||
182 | * @param string $prefix_orig String to indent items at deeper levels |
||
183 | * @param string $prefix_curr String to indent the current item |
||
184 | * |
||
185 | * @return void |
||
186 | @access private |
||
187 | */ |
||
188 | public function _makeSelBoxOptions($fieldName, $selected, $key, &$ret, $prefix_orig, $prefix_curr = '') |
||
205 | |||
206 | /** |
||
207 | * Make a select box with options from the tree |
||
208 | * |
||
209 | * @param string $name Name of the select box |
||
210 | * @param string $fieldName Name of the member variable from the node objects that should be used as the title for the options. |
||
211 | * @param string $prefix String to indent deeper levels |
||
212 | * @param string $selected Value to display as selected |
||
213 | * @param bool|string $addEmptyOption Set TRUE to add an empty option with value "0" at the top of the hierarchy |
||
214 | * @param integer $key ID of the object to display as the root of select options |
||
215 | * @param string $additional |
||
216 | * @return string HTML select box |
||
217 | */ |
||
218 | public function makeSelBox($name, $fieldName, $prefix = '-', $selected = '', $addEmptyOption = '', $key = 0, $additional = '') |
||
232 | } |
||
233 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.