function get_childs($catg, $parent = NULL)
 {
     if ($parent) {
         $catg->parent_name = $parent->name;
     } else {
         $catg->parent_name = '';
     }
     $this->category[] = $catg;
     $childs = Category::build_children_list($catg->category_id, NULL, $this->type);
     if ($childs) {
         foreach ($childs as $chd) {
             $this->get_childs($chd, $catg);
         }
     }
 }
Example #2
0
require_once '../api/MessageBoard/MessageBoard.php';
require_once '../ext/Group/Group.php';
require_once 'uihelper.php';
require_once './includes/application_top.php';
require_once './includes/functions/html_generate.php';
$parent_id = (int) $_GET['cid'];
if (empty($parent_id)) {
    $redirect_msg = "Required parameters missing in URL.";
    $back_to_page = $base_url . '/forums.php';
    header("Location: {$base_url}/generic_error.php?msg={$redirect_msg}&back_to_page={$back_to_page}");
    exit;
}
if ($parent_id) {
    $group_id = '';
    $parent_cat_obj = new Category();
    $arr_obj_categories = Category::build_children_list($parent_id);
    $parent_cat_obj = new Category();
    $parent_cat_obj->set_category_id($parent_id);
    try {
        $parent_cat_obj->load();
        $parent_cat_name = stripslashes($parent_cat_obj->name);
        $parent_cat_description = stripslashes($parent_cat_obj->description);
    } catch (PAException $e) {
        $msg = "Error occured in retreiving category information\n";
        $msg .= "<br><center><font color=\"red\">" . $e->message . "</font></center>";
        $error_code = $e->code;
        $error = TRUE;
    }
    if ($error) {
        $redirect_msg = "Category does not exist.";
        $back_to_page = $base_url . '/forums.php';