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 generate_group_links() { $group_info = array(); // Retrive the group details $group_data = ContentCollection::load_collection($this->gid, NULL); $group_info['members'] = Group::get_member_count($this->gid); // Loading the Group owner $user = new User(); $user->load((int) $group_data->author_id); $group_info['created'] = date("F d, Y h:i A", $group_data->created); $group_info['author_picture'] = $user->picture; $group_info['author_name'] = $user->login_name; $group_info['category_name'] = $group_data->category_name; $group_info['access_type'] = $group_data->reg_type == $group_data->REG_OPEN ? ' Open' : ' Moderated'; unset($user); unset($group_data); return $group_info; }
private function get_families() { $userfamilies = TypedGroupEntityRelation::get_relation_for_user($this->uid, 'family'); $family_details = array(); foreach ($userfamilies as $i => $fam) { $group = ContentCollection::load_collection((int) $fam->object_id, PA::$login_uid); $member_exist = Group::member_exists((int) $fam->object_id, $this->uid); $picture = $group->picture; $cnt = Group::get_member_count($group->collection_id); $family_details[$i]['id'] = $group->collection_id; $family_details[$i]['title'] = stripslashes($group->title); $desc = stripslashes($group->description); $desc = substr($desc, 0, 100); $family_details[$i]['desc'] = $desc; $family_details[$i]['picture'] = $picture; $family_details[$i]['members'] = $cnt; $family_details[$i]['access'] = $group->access_type; } return $family_details; }
function setup_module($column, $module, $obj) { global $group_data, $type, $css_data, $module_settings, $page_id; global $login_uid, $page_uid, $is_admin, $gid, $extra, $total_groups; switch ($module) { case 'GroupCustomizeUIModule': if (!$is_admin) { return 'skip'; } $obj->type = $type; $obj->data = @$extra['style']['user_json']; $obj->module_settings = $module_settings; $obj->page_id = $page_id; $obj->gid = $gid; $obj->theme = @$extra['theme']; $obj->header_image = $group_data->header_image; $obj->header_image_action = $group_data->header_image_action; $obj->display_header_image = $group_data->display_header_image; break; case 'GroupStatsModule': case 'GroupAccessModule': $obj->group_details['title'] = $group_data->title; $obj->group_details['created'] = date("F d, Y h:i A", $group_data->created); $obj->group_details['collection_id'] = $gid; $obj->group_details['is_member'] = $is_member; $obj->group_details['is_admin'] = $is_admin; $obj->group_details['picture'] = $group_data->picture; $obj->group_details['category_name'] = $group_data->category_name; $obj->group_details['members'] = Group::get_member_count($gid); if ($group_data->reg_type == $group_data->REG_OPEN) { $access_type = ' Open'; } else { $access_type = ' Moderated'; } $obj->group_details['access_type'] = $access_type; $obj->group_details['author_id'] = $group_data->author_id; $user = new User(); $user->load((int) $group_data->author_id); $obj->group_details['author_picture'] = $user->picture; $obj->group_details['author_name'] = $user->login_name; break; case 'GroupsCategoryModule': $obj->total_groups = $total_groups; break; } }
/** * get all groups * @access public * @param string search string */ public static function get_all_groups_for_admin($cnt = FALSE, $show = 'ALL', $page = 0, $sort_by = 'created', $direction = 'DESC') { Logger::log("Enter: Group::get_all_groups_for_admin() "); $order_by = $sort_by . ' ' . $direction; if ($show == 'ALL' || $cnt == TRUE) { $limit = ''; } else { $start = ($page - 1) * $show; $limit = 'LIMIT ' . $start . ',' . $show; } $res = Dal::query("SELECT * FROM {groups} AS G, {contentcollections} AS CC WHERE CC.collection_id = G.group_id AND CC.is_active = 1 ORDER BY created DESC {$limit}"); if ($cnt) { return $res->numRows(); } $groups = array(); if ($res->numRows()) { while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) { $cnt = Group::get_member_count($row->group_id); $groups[] = array('group_id' => $row->group_id, 'title' => $row->title, 'author_id' => $row->author_id, 'category_id' => $row->category_id, 'created' => $row->created, 'members' => $cnt, 'picture' => $row->picture); } } Logger::log("Exit: Group::get_all_groups_for_admin() "); return $groups; }
function pageLoadGroup($group) { $access = $group->access_type; $skip_group_modules = FALSE; $is_admin = FALSE; if ($group->access_type == $group->ACCESS_PRIVATE) { if (PA::$login_uid) { //if private group if (GROUP::member_exists($group->collection_id, PA::$login_uid)) { $skip_group_modules = FALSE; } else { // haha no way for non member of group $skip_group_modules = TRUE; } } else { //haha no way for anonymous user $skip_group_modules = TRUE; } $access_type = 'Private'; } else { $access_type = 'Public'; } if ($group->reg_type == $group->REG_OPEN) { $access_type .= ' Open'; } else { $access_type .= ' Moderated'; } if (Group::is_admin((int) $group->collection_id, (int) PA::$login_uid)) { $is_admin = TRUE; } $members = $group->get_members($cnt = FALSE, 5, 1, 'created', 'DESC', FALSE); $group_details = array(); $group_details['collection_id'] = $group->collection_id; $group_details['type'] = $group->type; $group_details['author_id'] = $group->author_id; $user = new User(); $user->load((int) $group->author_id); $login_name = $user->login_name; $first_name = $user->first_name; $last_name = $user->last_name; $group_details['author_name'] = $login_name; $group_details['author_picture'] = $user->picture; $group_details['title'] = $group->title; $group_details['description'] = $group->description; $group_details['is_active'] = $group->is_active; $group_details['picture'] = $group->picture; $group_details['desktop_picture'] = @$group->desktop_picture; $group_details['created'] = PA::datetime($group->created, 'long', 'short'); // 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($group->collection_id); $group_details['access_type'] = $access_type; $group_details['is_admin'] = $is_admin; //////////////////get details of group EOF if (is_array($members)) { $count = count($members); foreach ($members as $member) { $count_relations = Relation::get_relations($member['user_id'], APPROVED, PA::$network_info->network_id); $user = new User(); $user->load((int) $member['user_id']); $login_name = $user->login_name; $user_picture = $user->picture; $users_data[] = array('user_id' => $member['user_id'], 'picture' => $user_picture, 'login_name' => $login_name, 'no_of_relations' => count($count_relations)); } $final_array = array('users_data' => $users_data, 'total_users' => $count); } $users = $final_array; $is_member = Group::member_exists((int) $group->collection_id, (int) PA::$login_uid) ? TRUE : FALSE; $group_details['is_member'] = $is_member; $group_details['skip_group_modules'] = $skip_group_modules; $group_details['users'] = $users; return $group_details; }
private function addGroupData($group) { $owner_id = Group::get_owner_id((int) $group->group_id); $group_owner = new User(); $group_owner->load((int) $owner_id); $group_owner_info = $this->getUserProfile($group_owner, 'group.owner'); // get group owner profile info $this->template_vars = array_merge($this->template_vars, $group_owner_info); $this->template_vars["%group.icon_image%"] = uihelper_resize_mk_img($group->picture, 219, 35, DEFAULT_NETWORK_ICON, 'alt="' . $group->title . '"'); $this->template_vars["%group.name%"] = $group->title; $this->template_vars["%group.description%"] = $group->description; $this->template_vars['%group.member_count%'] = Group::get_member_count($group->group_id); $this->template_vars['%group.join_url%'] = UrlHelper::url_for(PA_ROUTE_GROUP, array('action' => 'join', 'gid' => $group->collection_id)); $this->template_vars['%group.join_link%'] = UrlHelper::link_to(PA_ROUTE_GROUP, $this->template_vars['%group.join_url%'], null, array('action' => 'join', 'gid' => $group->collection_id)); $this->template_vars["%group.url%"] = UrlHelper::url_for(PA_ROUTE_GROUP, array('gid' => $group->collection_id)); $this->template_vars["%group.link%"] = UrlHelper::link_to(PA_ROUTE_GROUP, $group->title, null, array('gid' => $group->collection_id)); $this->template_vars['%group.moderation_url%'] = UrlHelper::url_for(PA_ROUTE_GROUP_MODERATION, array('view' => 'users', 'gid' => $group->collection_id)); $this->template_vars['%group.moderation_link%'] = UrlHelper::link_to(PA_ROUTE_GROUP_MODERATION, __("Group moderation"), null, array('view' => 'users', 'gid' => $group->collection_id)); }
$group_details['description'] = $group->description; $group_details['is_active'] = $group->is_active; $group_details['picture'] = $group->picture; $group_details['desktop_picture'] = @$group->desktop_picture; $group_details['created'] = PA::datetime($group->created, 'long', 'short'); //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; //////////////////get details of group EOF if (is_array($members)) { $count = count($members); foreach ($members as $member) { $count_relations = Relation::get_relations($member['user_id'], APPROVED, PA::$network_info->network_id); $user = new User(); $user->load((int) $member['user_id']); $login_name = $user->login_name; $user_picture = $user->picture; $users_data[] = array('user_id' => $member['user_id'], 'picture' => $user_picture, 'login_name' => $login_name, 'no_of_relations' => count($count_relations)); } $final_array = array('users_data' => $users_data, 'total_users' => $count); }
private function send_approval_message_to_user($uid, $gid, $approved) { $site_name = PA::$site_name; $user = new User(); $user->load((int) $uid); $group = Group::load_group_by_id((int) $gid); $group_owner_id = Group::get_owner_id((int) $gid); $group_owner = new User(); $group_owner->load((int) $group_owner_id['user_id']); $group_name = $group->title; $network_name = PA::$network_info->name; $group_member_count = Group::get_member_count((int) $gid); $group_owner_name = $group_owner->login_name; $group_joinee = $user->login_name; $group_url = '<a href="' . PA::$url . PA_ROUTE_GROUP . '/gid=' . $gid . '">' . $group->title . '</a>'; $approved_msg = $approved ? 'has approved' : 'has not approved'; $subject = "{$group_owner_name} {$approved_msg} your request to join the \"{$group_name}\" Group"; $msg = "\n <br />Dear {$group_joinee},\n <br />\n <br />\n <b>{$group_owner_name}</b> {$approved_msg} your request to join the \"{$group_name}\" Group on the \"{$network_name}\" network.\n <br />\n To view the \"{$group_name}\" Group, click on the following link: {$group_url}\n <br />\n There are now {$group_member_count} members in the \"{$group_name}\" Group.\n <br />\n Thanks,\n The {$site_name} Team\n <br />\n <p>\n Everyone at {$site_name} respects your privacy. Your information will\n never be shared with third parties unless specifically requested by you.\n <p/>"; Message::add_message((int) $group_owner_id['user_id'], null, $group_joinee, $subject, $msg); simple_pa_mail($user->email, $subject, $msg); return; }