/** *Loop inside the array of all categories to find subcats for current category *recusrive function: for each subcat found, call to function getcontent to *get partners and subcats within it * *param $categoryid - id of the current category *return array of subcats for the current category */ function get_subcats($every_categories_array, $categoryid, $level) { //global $every_categories_array; $subcatArray = array(); $level++; foreach ($every_categories_array as $subcatObj) { if ($subcatObj->parentid() == $categoryid) { $subcatArray[] = get_cat_content($every_categories_array, $subcatObj, $level); } } return $subcatArray; }
// displays commands echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&removeDef=", $thisCat['catId'], "\">", "<img src=\"../img/delete.gif\" border=\"0\" alt=\"".get_lang('Remove')."\" onclick=\"javascript:if(!confirm('".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'),ENT_QUOTES,$charset))."')) return false;\">", "</a>", "<a href=\"".api_get_self()."?".api_get_cidreq()."&editDef=", $thisCat['catId'], "\">", "<img src=\"../img/edit.gif\" border=\"0\" alt=\"".get_lang('Edit')."\" />", "</a>", "<a href=\"".api_get_self()."?".api_get_cidreq()."&moveUpDef=", $thisCat['catId'], "\">", "<img src=\"../img/up.gif\" border=\"0\" alt=\"".get_lang('MoveUp')."\">", "</a>", "<a href=\"".api_get_self()."?".api_get_cidreq()."&moveDownDef=", $thisCat['catId'], "\">", "<img src=\"../img/down.gif\" border=\"0\" alt=\"".get_lang('MoveDown')."\">", "</a>\n"; } // end for each } // end if ($catList) echo "<center>\n", "<form method=\"post\" action=\"".api_get_self()."\">", "<input type=\"submit\" name=\"addDef\" class=\"plus\" value=\"".get_lang('AddNewHeading')."\" />", "</form>\n", "<center>\n"; } elseif ($displayMode == "viewContentEdit") { /* CATEGORIES CONTENTS : EDIT */ $catToEdit = get_cat_content($userIdViewed, $_GET['editContent']); $content_heading_form = new FormValidator('content_heading_form'); $content_heading_form->addElement('hidden', 'cntId'); $content_heading_form->addElement('hidden', 'catId'); $content_heading_form->addElement('hidden', 'uInfo'); $content_heading_form->addElement('static', null, $catToEdit['title'], htmlize($catToEdit['comment'])); if ($catToEdit['nbline'] == 1) { $content_heading_form->addElement('text', 'content', null, array ('size' => 80)); } else { $content_heading_form->addElement('textarea', 'content', null, array ('cols' => 60, 'rows' => $catToEdit['nbline'])); } $content_heading_form->addElement('submit', 'submitContent', get_lang('Ok')); $defaults = $catToEdit; $defaults['cntId'] = $catToEdit['contentId']; $defaults['uInfo'] = $userIdViewed; $content_heading_form->setDefaults($defaults);