本文整理匯總了PHP中Group::get_user_groups方法的典型用法代碼示例。如果您正苦於以下問題:PHP Group::get_user_groups方法的具體用法?PHP Group::get_user_groups怎麽用?PHP Group::get_user_groups使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Group
的用法示例。
在下文中一共展示了Group::get_user_groups方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: get_links
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;
}
示例2: get_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;
}
示例3: render
function render()
{
$groups = Group::get_user_groups($_SESSION['user']['id'], FALSE, 'ALL');
for ($i = 0; $i < count($groups); $i++) {
$this->user_groups[] = array('gid' => $groups[$i]['gid'], 'name' => stripslashes($groups[$i]['name']));
}
$this->inner_HTML = $this->generate_inner_html();
$content = parent::render();
return $content;
}
示例4: initializeModule
public function initializeModule($request_method, $request_data)
{
if (empty(PA::$login_uid)) {
return 'skip';
} else {
if ($this->page_id == PAGE_GROUP_INVITE) {
$groups = Group::get_user_groups(PA::$login_uid, FALSE, 'ALL');
$user_groups = array();
$groups_count = count($groups);
for ($i = 0; $i < $groups_count; $i++) {
$user_groups[] = $groups[$i]['gid'];
}
$user_groups = array();
if (!empty($request_data['gid'])) {
$this->collection_id_array = array($request_data['gid']);
} else {
if (!empty($user_groups)) {
$this->collection_id_array = array(current($user_groups));
}
}
}
}
}
示例5: setup_module
function setup_module($column, $module, $obj)
{
global $login_uid, $entered_people;
switch ($column) {
case 'middle':
$obj->mode = PUB;
$obj->uid = $login_uid;
$obj->block_type = 'media_management';
if ($module == 'InvitationStatusModule') {
$groups = Group::get_user_groups($login_uid, FALSE, 'ALL');
$user_groups = array();
for ($i = 0; $i < count($groups); $i++) {
$user_groups[] = $groups[$i]['gid'];
}
if (!empty($_REQUEST['gid'])) {
$obj->collection_id_array = array($_REQUEST['gid']);
} else {
$obj->collection_id_array = array($user_groups[0]);
}
}
break;
}
}
示例6: render_groups
function render_groups() {
$page = 1;
$group_state =& $this->state['groups'];
$showing = $this->make_showing_link($group_state, "groups", "");
$facewall = "";
foreach (Group::get_user_groups($this->user->user_id, FALSE, $this->friends_per_page, $page) as $grp) {
$facewall .= '<div id="group_'.$grp['gid'].'">'.$this->render_group_image($grp).'</div>';
}
return <<<ENS
<p>$showing</p>
<div>
$facewall
<div style="clear: both"></div>
</div>
ENS;
}
示例7: __construct
/**
Purpose : this function is used to get navigation links for the whole page.
Scope : public
@param - it needs no direct input. But works only on the basis of current page initialized in __construct()
@return - array of links
**/
public function get_links($optional = NULL)
{
//initialization
global $page_uid, $login_uid;
if (isset($_SESSION['user']['id'])) {
$extra = unserialize($this->network_info->extra);
if (@$extra['reciprocated_relationship'] == NET_YES) {
$status = APPROVED;
} else {
$status = FALSE;
}
$relations_ids = Relation::get_relations((int) $_SESSION['user']['id'], $status);
$user_groups = Group::get_user_groups((int) $_SESSION['user']['id']);
/* $gid isn't defined in this function, so the following call
* will probably always return FALSE. To get rid of the warning
* under E_ALL, I've replaced the following expression with
* FALSE. Maybe $gid should be get_group_id()? */
$is_owner_of_group = FALSE;
//Group::is_admin($gid,(int)$_SESSION['user']['id']) ;
}
if (isset($relations_ids) && sizeof($relations_ids)) {
$this->set_friend_uid($relations_ids[0]);
}
if (isset($user_groups) && sizeof($user_groups)) {
$this->users_first_group_id($user_groups[0]['gid']);
}
if ($login_uid) {
$this->set_uid($login_uid);
} else {
$this->set_anonymous();
}
$is_group_content = FALSE;
if (@$_GET['gid']) {
$this->set_group_id($_GET['gid']);
} else {
if ((FILE_FORUM_MESSAGES == $this->current_page || FILE_CONTENT == $this->current_page) && !empty($_REQUEST['ccid'])) {
$this->set_group_id($_REQUEST['ccid']);
$is_group_content = TRUE;
} else {
if (FILE_CONTENT == $this->current_page && !empty($_GET['cid'])) {
try {
$content_data = Content::load_content($_GET['cid'], $this->get_uid());
} catch (PAException $e) {
if ($e->getCode() != CONTENT_NOT_FOUND) {
throw $e;
}
}
if (isset($content_data)) {
if ($content_data->parent_collection_id > 0) {
$content_collection_data = ContentCollection::load_collection($content_data->parent_collection_id, $this->get_uid());
if ($content_collection_data->type == GROUP_COLLECTION_TYPE) {
$this->set_group_id($content_data->parent_collection_id);
$is_group_content = TRUE;
}
}
}
}
}
}
//test
//$this->current_page='test.php';
// make links for current page
$this->make_links();
$level_1 = $this->get_level_1();
$level_2 = $this->get_level_2();
$level_3 = NULL;
$left_user_public_links = NULL;
if (Network::is_admin($this->network_info->network_id, (int) @$_SESSION['user']['id'])) {
$level_3 = $this->get_level_3('network');
} else {
if (!$this->network_info && $_SESSION['user']['id'] == SUPERUSER) {
$level_3 = $this->get_level_3('network');
}
}
$level_3 = NULL;
switch ($this->current_page) {
/*----------------------------------------------------*/
case FILE_HOMEPAGE:
$level_3 = NULL;
$level_2['highlight'] = 'home';
break;
case FILE_LOGIN:
$level_2['highlight'] = 'home';
break;
case FILE_SEARCH_HOME:
$level_2['highlight'] = 'search';
break;
case FILE_TAG_SEARCH:
$level_2['highlight'] = 'tag_search';
break;
/*----------------------------------------------------*/
/*----------------------------------------------------*/
case FILE_USER:
case FILE_USER_BLOG:
//.........這裏部分代碼省略.........
示例8: serialize
//for rivers of people
$activity_extra['info'] = $login_name . ' uploaded a video in album id = ' . $upload['album_id'];
$activity_extra['content_id'] = $upload[4];
$extra = serialize($activity_extra);
$object = $upload['album_id'];
Activities::save(PA::$login_uid, $activity, $object, $extra);
$ret_url = PA::$url . PA_ROUTE_MEDIA_GALLEY_VIDEOS . "/uid=" . PA::$login_uid . "&msg_id={$msg_id}" . $album;
header("Location: " . $ret_url);
exit;
break;
}
}
$setting_data = array('middle' => array('UploadMediaModule'));
if (!empty($_GET['gid']) && $_GET['gid']) {
// here we calculating the groups of that User
$group_ids = Group::get_user_groups(PA::$login_uid);
$group_ids_array = array();
if (!empty($group_ids)) {
for ($i = 0; $i < count($group_ids); $i++) {
$group_ids_array[] = $group_ids[$i]['gid'];
}
}
if (!in_array($_GET['gid'], $group_ids_array)) {
header("Location: " . PA::$url . PA_ROUTE_GROUP . "/gid=" . $_GET['gid'] . '&msg_id=13003');
exit;
}
}
/* This function is a Callback function which initialize the value for the BLOCK MODULES */
function setup_module($column, $moduleName, $obj)
{
/* in this module we have to set user_id , group_id, as well as netwrok_id */
示例9: handleAJAX_sort
/** !!
* This is called by the template to organize the feed based on the page type and
* the type of feed.
*
* @param array $request_data Information to determine which group page it is on
*/
private function handleAJAX_sort($request_data)
{
$types = array('network', 'group', 'user_friends', 'user_public');
filter_all_post($request_data);
if (isset($request_data['sort_by'])) {
$this->selected = $request_data['sort_by'];
$this->page_type = $types[$this->selected];
switch ($this->page_type) {
case 'user_public':
$this->subject = PA::$login_uid;
break;
case 'group':
if (empty($request_data['gid'])) {
if (PA::$login_uid) {
$user_groups = Group::get_user_groups((int) PA::$login_uid, FALSE, 1, 1, 'created', 'DESC', 'public');
if (count($user_groups) > 0) {
// echo "<pre>" . print_r($user_groups, 1) . "</pre>";
$this->subject = $user_groups[0]['gid'];
} else {
print '<div style="margin:8px">No Feeds</div>';
exit;
}
} else {
print '<div style="margin:8px">No Feeds</div>';
exit;
}
} else {
$this->subject = $request_data['gid'];
}
break;
default:
//by default network activity will be shown on all the pages.
}
$this->inner_HTML = $this->generate_inner_html();
print $this->inner_HTML;
}
exit;
}
示例10: render
public function render()
{
$groups = Group::get_user_groups(PA::$login_uid, FALSE, 'ALL');
$groups_count = count($groups);
for ($i = 0; $i < $groups_count; $i++) {
$this->user_groups[] = array('gid' => $groups[$i]['gid'], 'name' => stripslashes($groups[$i]['name']));
}
//getting the relations of user.
$relations = Relation::get_relations(PA::$login_uid, APPROVED, PA::$network_info->network_id);
$friends = array();
if (count($relations)) {
foreach ($relations as $relation) {
$User = new User();
$relation = (int) $relation;
$User->load($relation);
//$friends[] = array('id'=>$relation, 'login_name'=>$User->login_name);
$friends[$User->display_name] = $User->login_name;
}
//key of the array will the login_name and value will be the login_id
//sorting the array on the basis of login_name
ksort($friends);
}
$this->user_friends = $friends;
$this->inner_HTML = $this->generate_inner_html();
$content = parent::render();
return $content;
}
示例11: array
$selected_role = null;
$sel_role_id = !empty($_REQUEST['role_id']) ? $_REQUEST['role_id'] : null;
$group_id = !empty($_REQUEST['gid']) && $_REQUEST['gid'] != '-1' ? $_REQUEST['gid'] : null;
$user_id = (int) $_REQUEST['uid'];
$roles_list = array();
$user_roles = array();
$user = new User();
$user->load($user_id);
$role = new Roles();
$params = $group_id ? array('condition' => 'type = \'group\'', 'cnt' => false) : array('condition' => 'type <> \'null\'', 'cnt' => false);
$all_roles = $role->get_multiple($params, DB_FETCHMODE_ASSOC);
foreach ($all_roles as $a_role) {
$roles_list[$a_role['id']] = $a_role['name'];
}
$user_groups = array();
$u_groups = Group::get_user_groups($user_id);
if (count($u_groups) < 1) {
$u_groups = Group::get_all_groups_for_admin(FALSE);
foreach ($u_groups as $group) {
$user_groups[$group['group_id']] = $group['title'];
}
} else {
foreach ($u_groups as $group) {
$user_groups[$group['gid']] = $group['name'];
}
}
if ($group_id) {
// show only Group roles
$u_roles = Roles::get_user_roles($user_id, DB_FETCHMODE_ASSOC, array('type' => 'group', 'gid' => $group_id));
} else {
// show network and user personal pages roles
示例12: array
//$contents[$i]['create_time'] = content_date($contents[$i]['changed']);
$contents[$i]['trackback_url'] = "{$base_url}/pa_trackback.php?cid=" . $contents[$i]['content_id'];
$tags = Tag::load_tags_for_content($contents[$i]['content_id']);
if ($tags) {
$t = array();
for ($j = 0; $j < count($tags); $j++) {
$t_name = $tags[$j]['name'];
$uid = $_SESSION['user']['id'];
$t[] = "<a href=\"content_all.php?uid={$uid}&tag={$t_name}\">" . $tags[$j]['name'] . "</a>";
}
$contents[$i]['tag_entry'] = "<b>Tags : </b>" . implode(", ", $t);
} else {
$contents[$i]['tag_entry'] = "";
}
}
$allgroups = Group::get_user_groups((int) $_SESSION['user']['id']);
$heading = "My Recent Groups";
if (!$allgroups) {
$error_msg = "Not a member of any group yet.";
}
if ($allgroups) {
foreach ($allgroups as $groups) {
$gids[] = $groups['gid'];
}
}
$group_details = array();
for ($gr = 0; $gr < count($gids); $gr++) {
$group = ContentCollection::load_collection($gids[$gr], $_SESSION['user']['id']);
$group_tags = Tag::load_tags_for_content_collection($gids[$gr]);
$member_exist = Group::member_exists($gids[$gr], $_SESSION['user']['id']);
if ($group_tags) {
示例13: delete_user_groups
/**
* function used to delete a group or groups.
* @param $user_id and $group_id
*/
public function delete_user_groups($user_id, $group_id = NULL)
{
//getting user groups
$group_users = Group::get_user_groups($user_id);
if (count($group_users) > 0) {
foreach ($group_users as $group) {
$this->collection_id = $group['gid'];
if ($group['access'] == OWNER) {
//delete all data related to that group
//deleting content posted by other users in that group
$this->delete();
} else {
if ($group['access'] == MEMBER) {
$MessageBoard = new MessageBoard();
$MessageBoard->user_id = $user_id;
$MessageBoard->delete_user_forums();
//voiding user membership
$this->leave($user_id);
}
}
}
}
}
示例14: User
} else {
$uid = $_GET['uid'];
}
$user = new User();
if ($_SESSION['user']['id']) {
$user_details = $user->load((int) $uid);
}
if ($user->picture) {
$img_path = $base_url . "/files/" . $user->picture;
} else {
$img_path = $base_url . "/images/default.jpg";
}
$output = '';
if ($_GET['uid']) {
//get user's groups
$usergroups = Group::get_user_groups((int) $_GET['uid']);
$u = new User();
$u->load((int) $_GET['uid']);
$heading = "{$u->first_name}'s Group(s)";
if ($usergroups) {
foreach ($usergroups as $groups) {
$ids[] = $groups['gid'];
}
} else {
$error_msg = "You are not a member of any group yet.";
}
} elseif ($_GET['tag']) {
$heading = 'Search Result';
$collection = Tag::get_associated_contentcollectionids($_GET['tag'], 1);
if ($collection) {
foreach ($collection as $groups) {
示例15: js_quote
$html .= "</td>";
}
$html .= "</tr>";
}
$show_all_url = "{$base_url}/view_all_members.php?view_type=relations&uid={$user->user_id}";
$html .= "<tr>";
for ($i = 0; $i < $cols - 1; ++$i) {
$html .= '<td style="background-color: white"></td>';
}
$html .= "<td><a target=\"_blank\" href=\"{$show_all_url}\">show all</a></td></tr>";
$html .= "</table>";
break;
case 'groups':
$perpage = (int) $param;
$html .= "<ul>";
$groups = Group::get_user_groups($user->user_id, FALSE, $param, $page);
foreach ($groups as $g) {
$html .= '<li><a target="_blank" href="' . $base_url . '/group.php?gid=' . $g['gid'] . '">' . htmlspecialchars($g['name']) . '</a></li>';
}
$html .= "</ul>";
break;
}
}
$html .= '<p><a target="_blank" href="' . $base_url . '/"><img border="0" src="' . $base_url . '/images/pa-on-white.png" width="141" height="27" /></a></p>';
$html .= "</div>";
} else {
$html = "Error parsing URL ({$path}).";
}
function js_quote($html)
{
return "'" . str_replace("\n", "\\n", str_replace("'", "\\'", $html)) . "'";