function load_data($error_msg = '')
 {
     global $global_form_data;
     $array_tmp = array();
     $this->categories = Category::build_root_list();
     if (is_array($this->categories)) {
         foreach ($this->categories as $category) {
             $array_tmp[] = array('category_id' => $category->category_id, 'name' => $category->name);
         }
         $this->categories = $array_tmp;
     }
     if (!empty($error_msg)) {
         $this->error_msg = $error_msg;
     }
     if ($this->id == 0) {
         $this->title = 'Create Group';
     } else {
         $this->title = 'Change Group Settings';
         $group = ContentCollection::load_collection((int) $this->id, $_SESSION['user']['id']);
         $group_tags = Tag::load_tags_for_content_collection((int) $this->id);
         $this->collection_id = (int) $this->id;
         $this->groupname = stripslashes($group->title);
         $this->body = stripslashes($group->description);
         $this->access = $group->access_type;
         $this->reg_type = $group->reg_type;
         $this->is_moderated = $group->is_moderated;
         $this->group_category = $group->category_id;
         $this->display_header_image = $group->display_header_image;
         if (count($group_tags)) {
             foreach ($group_tags as $tag) {
                 $out[] = $tag['name'];
             }
             $this->tag_entry = implode(', ', $out);
         }
         if ($group->picture) {
             $this->group_photo = $group->picture;
             $this->upfile = $group->picture;
         }
         if ($group->header_image) {
             $this->header_image = $group->header_image;
             $this->upfile = $group->picture;
             $this->header_image_action = $group->header_image_action;
         }
     }
     if (!empty($global_form_data['addgroup'])) {
         $this->collection_id = (int) $this->id;
         $this->groupname = $global_form_data['groupname'];
         $this->body = $global_form_data['groupdesc'];
         $this->access = @$global_form_data['groupaccess'];
         $this->reg_type = $global_form_data['reg_type'];
         $this->is_moderated = @$global_form_data['is_mod'];
         $this->group_category = $global_form_data['group_category'];
         $this->tag_entry = $global_form_data['group_tags'];
         $this->display_header_image = @$global_form_data['display_header_image'];
     }
     $this->tag_entry = str_replace('"', '"', @$this->tag_entry);
     return;
 }
 /**
  *  Function to get the list of categories.
  */
 function get_categories()
 {
     $category_array = array();
     $category_list = Category::build_root_list();
     if (is_array($category_list)) {
         foreach ($category_list as $category) {
             $category_array[] = array('category_id' => $category->category_id, 'name' => $category->name);
         }
     }
     return $category_array;
 }
 function render()
 {
     switch (@$_GET["type"]) {
         case 'Content':
             $this->type = 'Content';
             break;
         case 'Default':
         default:
             $this->type = 'Default';
     }
     if (@$_GET['a'] == "edit" && !empty($_GET['cat_id'])) {
         $edit_cat = new Category();
         $edit_cat->category_id = $_GET['cat_id'];
         $edit_cat->load();
         $this->edit_title = $edit_cat->name;
         $this->edit_desc = $edit_cat->description;
         $this->cat_id = $edit_cat->category_id;
         $this->type = $edit_cat->type;
         $parent_id = $edit_cat->find_parent($edit_cat->category_id);
         $this->parent_id = $parent_id ? $parent_id : 0;
         if ($this->parent_id) {
             $edit_cat->category_id = $this->parent_id;
             $edit_cat->load();
             $this->parent_name = $edit_cat->name;
         } else {
             $this->parent_name = '';
         }
     }
     $this->categories = Category::build_all_category_list('', '', '', $this->type);
     $category = Category::build_root_list(NULL, $this->type);
     if (is_array($category)) {
         foreach ($category as $catg) {
             $this->get_childs($catg);
         }
     }
     $this->inner_HTML = $this->generate_inner_html();
     $content = parent::render();
     return $content;
 }
 /** !!
  * This is the function responsible for setting up the data to be displayed
  * in the form.  If this is a new group, it gives it a title and nothing
  * else.  If it is a group that is being modified, then it loads the old 
  * data and displays it.  When the form has been submitted, it fills in 
  * the form with the data from $global_form_data
  * @param string $error_message  The error from the submit.
  * @param array $request_data   Used to determine what is being created.
  */
 function load_data($error_msg = '', $request_data = NULL)
 {
     global $global_form_data;
     $array_tmp = array();
     $this->categories = Category::build_root_list();
     if (is_array($this->categories)) {
         foreach ($this->categories as $category) {
             $array_tmp[] = array('category_id' => $category->category_id, 'name' => $category->name);
         }
         $this->categories = $array_tmp;
     }
     if (!empty($error_msg)) {
         $this->error_msg = $error_msg;
     }
     if ($this->id == 0) {
         $this->title = __('Create Group');
     } else {
         $this->title = __('Change Group Settings');
         $group = ContentCollection::load_collection((int) $this->id, PA::$login_uid);
         $group_tags = Tag::load_tags_for_content_collection((int) $this->id);
         $this->collection_id = (int) $this->id;
         $this->groupname = stripslashes($group->title);
         $this->body = stripslashes($group->description);
         $this->access = $group->access_type;
         $this->reg_type = $group->reg_type;
         $this->is_moderated = $group->is_moderated;
         $this->group_category = $group->category_id;
         $this->display_header_image = $group->display_header_image;
         $this->group_type = $group->group_type;
         $this->tag_entry = NULL;
         if (count($group_tags)) {
             foreach ($group_tags as $tag) {
                 $out[] = $tag['name'];
             }
             $this->tag_entry = implode(', ', $out);
         }
         if ($group->picture) {
             $this->group_photo = $group->picture;
             $this->upfile = $group->picture;
         }
         if ($group->header_image) {
             $this->header_image = $group->header_image;
             $this->upfile = $group->picture;
             $this->header_image_action = $group->header_image_action;
         }
     }
     // end else (existing group)
     if (!empty($global_form_data['addgroup'])) {
         $this->collection_id = (int) $this->id;
         $this->groupname = $global_form_data['groupname'];
         $this->body = $global_form_data['groupdesc'];
         $this->access = @$global_form_data['groupaccess'];
         $this->reg_type = $global_form_data['reg_type'];
         $this->is_moderated = @$global_form_data['is_mod'];
         $this->group_category = $global_form_data['group_category'];
         $this->tag_entry = $global_form_data['group_tags'];
         $this->display_header_image = @$global_form_data['display_header_image'];
         $this->group_type = @$global_form_data['group_type'];
     }
     $this->tag_entry = str_replace('"', '"', @$this->tag_entry);
     if (!empty(PA::$config->useTypedGroups)) {
         require_once 'web/includes/classes/CNDynamicFormFields.php';
         $this->gid = $this->id;
         $this->availTypes = TypedGroupEntity::get_avail_types();
         $this->selectTypes = array();
         foreach ($this->availTypes as $k => $l) {
             $this->selectTypes[] = array('label' => $l, 'value' => $k);
         }
         $this->entity = NULL;
         $type = '';
         $params = array();
         if (!empty($request_data['entityType'])) {
             $type = $request_data['entityType'];
         }
         if (!empty($request_data['type'])) {
             $type = $request_data['type'];
         }
         if ($typedEntity = TypedGroupEntity::load_for_group($this->gid)) {
             $this->entity = $typedEntity;
             // get info about what profile fields this has
             $type = $this->entity->entity_type;
             $this->entity = $typedEntity;
             $params = $this->entity->attributes;
         } else {
             if (!empty($type) && !empty($this->availTypes[$type])) {
                 $params['type'] = $type;
             }
         }
         $this->dynFields = new CNDynamicFormFields($params);
         $classname = ucfirst($type) . "TypedGroupEntity";
         include_once "api/CNEntity/CN{$classname}.php";
         if (class_exists($classname)) {
             $instance = new $classname();
         } else {
             // just get default
             $instance = new TypedGroupEntity();
         }
         $this->profilefields = $instance->get_profile_fields();
     }
     return;
 }
Example #5
0
<?php

$login_required = FALSE;
include "includes/page.php";
require_once "{$path_prefix}/api/Theme/Template.php";
require_once "{$path_prefix}/api/Category/Category.php";
html_header($HTML_TITLE, '');
$arr_obj_root_categories = Category::build_root_list();
?>

<?php 
$content =& new Template(CURRENT_THEME_FSPATH . "/forums.tpl");
if ($error == TRUE) {
    $content->set('msg', $msg);
}
$content->set('login_name', $login_name);
$content->set('first_name', $first_name);
$content->set('last_name', $last_name);
$content->set('email', $email);
$header =& new Template(CURRENT_THEME_FSPATH . "/header.tpl");
$header->set('user_name', $first_name . " " . $last_name);
$content->set('header', $header);
$left_panel =& new Template(CURRENT_THEME_FSPATH . "/left_page.tpl");
$left_panel->set('img_path', $img_path);
$content->set('left_panel', $left_panel);
$content->set('arr_obj_categories', $arr_obj_root_categories);
$footer =& new Template(CURRENT_THEME_FSPATH . "/footer.tpl");
$content->set('footer', $footer);
echo $content->fetch();
function peopleaggregator_getCategories($args)
{
    $cats = Category::build_root_list("Group");
    $total_cats = sizeof($cats);
    $cats_out = array();
    foreach ($cats as $cat) {
        $cats_out[] = array("id" => "cat:" . intval($cat->category_id), "name" => $cat->name, "groupCount" => intval($cat->total_threads));
    }
    return array('success' => TRUE, 'msg' => "Retrieved " . sizeof($cats_out) . " categories", 'totalResults' => $total_cats, 'categories' => $cats_out);
}