@@ 236-261 (lines=26) @@ | ||
233 | * @param string $ret |
|
234 | * @return string |
|
235 | */ |
|
236 | public static function sf_addCategoryOption($categoryObj, $selectedid = 0, $level = 0, $ret = '') |
|
237 | { |
|
238 | // Creating the category handler object |
|
239 | $categoryHandler = sf_gethandler('category'); |
|
240 | ||
241 | $spaces = ''; |
|
242 | for ($j = 0; $j < $level; ++$j) { |
|
243 | $spaces .= '--'; |
|
244 | } |
|
245 | ||
246 | $ret .= "<option value='" . $categoryObj->categoryid() . "'"; |
|
247 | if ($selectedid == $categoryObj->categoryid()) { |
|
248 | $ret .= ' selected'; |
|
249 | } |
|
250 | $ret .= '>' . $spaces . $categoryObj->name() . "</option>\n"; |
|
251 | ||
252 | $subCategoriesObj = $categoryHandler->getCategories(0, 0, $categoryObj->categoryid()); |
|
253 | if (count($subCategoriesObj) > 0) { |
|
254 | ++$level; |
|
255 | foreach ($subCategoriesObj as $catID => $subCategoryObj) { |
|
256 | $ret .= sf_addCategoryOption($subCategoryObj, $selectedid, $level); |
|
257 | } |
|
258 | } |
|
259 | ||
260 | return $ret; |
|
261 | } |
|
262 | ||
263 | /** |
|
264 | * @param int $selectedid |
@@ 96-121 (lines=26) @@ | ||
93 | * @param string $ret |
|
94 | * @return string |
|
95 | */ |
|
96 | function sf_addCategoryOption($categoryObj, $selectedid = 0, $level = 0, $ret = '') |
|
97 | { |
|
98 | // Creating the category handler object |
|
99 | $categoryHandler = sf_gethandler('category'); |
|
100 | ||
101 | $spaces = ''; |
|
102 | for ($j = 0; $j < $level; ++$j) { |
|
103 | $spaces .= '--'; |
|
104 | } |
|
105 | ||
106 | $ret .= "<option value='" . $categoryObj->categoryid() . "'"; |
|
107 | if ($selectedid == $categoryObj->categoryid()) { |
|
108 | $ret .= ' selected'; |
|
109 | } |
|
110 | $ret .= '>' . $spaces . $categoryObj->name() . "</option>\n"; |
|
111 | ||
112 | $subCategoriesObj = $categoryHandler->getCategories(0, 0, $categoryObj->categoryid()); |
|
113 | if (count($subCategoriesObj) > 0) { |
|
114 | ++$level; |
|
115 | foreach ($subCategoriesObj as $catID => $subCategoryObj) { |
|
116 | $ret .= sf_addCategoryOption($subCategoryObj, $selectedid, $level); |
|
117 | } |
|
118 | } |
|
119 | ||
120 | return $ret; |
|
121 | } |
|
122 | ||
123 | /** |
|
124 | * @param int $selectedid |