public function get_links()
 {
     $this->Paging["count"] = Group::get_user_groups((int) $this->uid, TRUE);
     if ($this->block_type == 'usergroups') {
         $pub = 'public';
         $usergroups = Group::get_user_groups((int) $this->uid, FALSE, 5, 1, 'created', 'DESC', $pub);
     } else {
         $usergroups = Group::get_user_groups((int) $this->uid, FALSE, 5, 1);
     }
     global $base_url, $current_theme_path;
     $ids = array();
     if ($usergroups) {
         foreach ($usergroups as $groups) {
             $ids[] = array('gid' => $groups['gid'], 'access' => $groups['access']);
         }
     }
     $group_details = array();
     for ($gr = 0; $gr < count($ids); $gr++) {
         $group = ContentCollection::load_collection((int) $ids[$gr]['gid'], $_SESSION['user']['id']);
         $group_tags = Tag::load_tags_for_content_collection($ids[$gr]['gid']);
         $member_exist = Group::member_exists($ids[$gr]['gid'], $_SESSION['user']['id']);
         $picture = $group->picture;
         $cnt = Group::get_member_count($group->collection_id);
         $group_details[$gr]['id'] = $group->collection_id;
         $group_details[$gr]['title'] = stripslashes($group->title);
         $desc = stripslashes($group->description);
         $desc = substr($desc, 0, 100);
         $group_details[$gr]['desc'] = $desc;
         $group_details[$gr]['picture'] = $picture;
         $group_details[$gr]['members'] = $cnt;
         $group_details[$gr]['access'] = $ids[$gr]['access'];
     }
     $links = $group_details;
     return $links;
 }
 public function get_links()
 {
     $this->Paging["count"] = Group::get_user_groups((int) $this->uid, TRUE);
     $ids = array();
     if ($this->usergroups) {
         foreach ($this->usergroups as $groups) {
             $ids[] = array('gid' => $groups['gid'], 'access' => $groups['access']);
         }
     }
     $group_details = array();
     for ($gr = 0; $gr < count($ids); $gr++) {
         $group = ContentCollection::load_collection((int) $ids[$gr]['gid'], PA::$login_uid);
         $group_tags = Tag::load_tags_for_content_collection($ids[$gr]['gid']);
         $member_exist = Group::member_exists($ids[$gr]['gid'], PA::$login_uid);
         $picture = $group->picture;
         $cnt = Group::get_member_count($group->collection_id);
         $group_details[$gr]['id'] = $group->collection_id;
         $group_details[$gr]['title'] = stripslashes($group->title);
         $desc = stripslashes($group->description);
         $desc = substr($desc, 0, 100);
         $group_details[$gr]['desc'] = $desc;
         $group_details[$gr]['picture'] = $picture;
         $group_details[$gr]['members'] = $cnt;
         $group_details[$gr]['access'] = $ids[$gr]['access'];
     }
     return $group_details;
 }
 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('"', '&quot;', @$this->tag_entry);
     return;
 }
$group_details['picture'] = $group->picture;
$group_details['desktop_picture'] = @$group->desktop_picture;
$group_details['created'] = date("F d, Y h:i A", $group->created);
$group_details['changed'] = $group->changed;
$group_details['category_id'] = $group->category_id;
$cat_obj = new Category();
$cat_obj->set_category_id($group->category_id);
$cat_obj->load();
$cat_name = stripslashes($cat_obj->name);
$cat_description = stripslashes($cat_obj->description);
$group_details['category_name'] = $cat_name;
$group_details['category_description'] = $cat_description;
$group_details['members'] = Group::get_member_count($gid);
$group_details['access_type'] = @$access_type;
$group_details['is_admin'] = @$is_admin;
$group_tags = Tag::load_tags_for_content_collection((int) $group->collection_id);
$group_details['tag_entry'] = Tag::tag_array_to_html($group_tags, 1);
$msg1 = NULL;
// check for message arrived begins
if (!empty($_GET["msg"])) {
    $_GET["msg"] = strip_tags($_GET["msg"]);
    switch ($_GET["msg"]) {
        case "succ":
            $msg1 = "Content has been approved";
            break;
        case "dny":
            $msg1 = "Content has been denied";
            break;
        default:
            $msg1 = "";
    }
 /** !!
  * 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('"', '&quot;', @$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;
 }
示例#6
0
        $allgroups = Group::get_all();
        $heading = "All Groups";
        if (!$allgroups) {
            $error_msg = "No groups published yet.";
        }
    }
    if ($allgroups) {
        foreach ($allgroups as $groups) {
            $ids[] = $groups['group_id'];
        }
    }
}
$group_details = array();
for ($gr = 0; $gr < count($ids); $gr++) {
    $group = ContentCollection::load_collection((int) $ids[$gr], $_SESSION['user']['id']);
    $group_tags = Tag::load_tags_for_content_collection($ids[$gr]);
    $member_exist = Group::member_exists($ids[$gr], $_SESSION['user']['id']);
    if ($group_tags) {
        $t = array();
        for ($i = 0; $i < count($group_tags); $i++) {
            $name = $group_tags[$i]['name'];
            $t[] = '<a href="showgroup.php?tag=' . $group_tags[$i]['name'] . '">' . $group_tags[$i]['name'] . '</a>';
        }
        $tag_string = "<b>Tags:</b> " . implode(", ", $t);
    } else {
        $tag_string = "";
    }
    if ($group->picture) {
        $picture = "<img src=\"" . $group->picture . "\" height='50px' width='50px'/>";
    } else {
        $picture = "<img src='" . $current_theme_path . "/images/default.jpg' height='50px' width='50px'/>";
 /** !!
  * Loads and initializes teh data if the user is in a group or not.
  */
 function load_data($error_msg = '', $request_data = NULL)
 {
     global $global_form_data;
     $array_tmp = array();
     if ($this->id > 0) {
         $this->title = __('Change Family 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 (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('"', '&quot;', @$this->tag_entry);
     $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 = 'family';
     $params = array();
     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;
     }
     $this->dynFields = new DynamicFormFields($params);
     $classname = ucfirst($type) . "TypedGroupEntity";
     $instance = new $classname();
     $this->profilefields = $instance->get_profile_fields();
     return;
 }