本文整理匯總了PHP中Group::get_members方法的典型用法代碼示例。如果您正苦於以下問題:PHP Group::get_members方法的具體用法?PHP Group::get_members怎麽用?PHP Group::get_members使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Group
的用法示例。
在下文中一共展示了Group::get_members方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: get_links
/**
Get data for moderation option ie group moderation
**/
private function get_links()
{
$Group = new Group();
$Group->collection_id = $this->set_id;
$Group->is_active = 1;
$this->Paging["count"] = $Group->get_members($cnt = TRUE, '', '', '', '', TRUE);
$members = $Group->get_members($cnt = FALSE, $this->Paging["show"], $this->Paging["page"], '', '', TRUE);
$User = new User();
foreach ($members as $membersDetails) {
$User->load((int) $membersDetails["user_id"]);
$this->members_data[] = array('user_id' => $membersDetails["user_id"], 'first_name' => $User->first_name, 'last_name' => $User->last_name, 'email' => $User->email, 'created' => $membersDetails['join_date'], 'picture' => $User->picture, 'user_type' => $membersDetails["user_type"], 'login_name' => $User->login_name);
}
return;
}
示例2: setup_module
function setup_module($column, $module, $obj)
{
global $is_member, $is_admin, $group_data, $gid;
$obj->gid = $gid;
switch ($module) {
case 'MembersFacewallModule':
$group = new Group();
$group->collection_id = $gid;
$group->is_active = ACTIVE;
$members = $group->get_members($cnt = FALSE, 5, 1, 'created', 'DESC', FALSE);
if (is_array($members)) {
$count = count($members);
$group_members = members_to_array($members);
$users_data = array();
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));
}
$users = array('users_data' => $users_data, 'total_users' => $count);
}
$obj->links = $users;
$obj->gid = $gid;
break;
case 'ImagesModule':
$obj->block_type = 'Gallery';
$obj->page = 'grouppage';
$obj->title = 'Group Gallery';
$obj->group_details['collection_id'] = $group_data->collection_id;
break;
case 'GroupForumModule':
if ($group_data->reg_type == REG_INVITE) {
if (!$is_member && !$is_admin) {
return "skip";
}
}
$obj->is_member = $is_member;
$obj->is_admin = $is_admin;
$obj->group_details = $group_data;
break;
case 'RecentPostModule':
$obj->type = 'group';
$obj->gid = $_REQUEST['gid'];
break;
}
}
示例3: setup_module
function setup_module($column, $module, $obj)
{
global $group_data, $gid, $request_info, $is_edit, $edit_data, $member_type;
$obj->gid = $gid;
switch ($module) {
case 'MembersFacewallModule':
$group = new Group();
$group->collection_id = $gid;
$group->is_active = 1;
$members = $group->get_members($cnt = FALSE, 5, 1, 'created', 'DESC', FALSE);
if (is_array($members)) {
$count = count($members);
foreach ($members as $member) {
$count_relations = Relation::get_relations($member['user_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));
}
$users = array('users_data' => $users_data, 'total_users' => $count);
}
$obj->links = $users;
$obj->gid = $gid;
break;
case 'ImagesModule':
$obj->block_type = 'Gallery';
$obj->page = 'grouppage';
$obj->title = 'Group Gallery';
break;
case 'CreateForumTopicModule':
if (!$is_edit) {
return 'skip';
}
$obj->edit_data = $edit_data;
$obj->is_edit = $is_edit;
break;
}
}
示例4: listAction
function listAction()
{
$ids = sql_select('group', 'id');
$this->groups = array();
if (is_array($ids)) {
foreach ($ids as $group) {
$group = new Group($group['id']);
$this->groups[$group->id]['name'] = $group->name;
$members = $group->get_members();
$this->groups[$group->id]['members'] = is_array($members) ? count($members) : 0;
$feeds_res = sql_query('SELECT COUNT(id) as feeds FROM `feed` WHERE `group_id` = ' . $group->id);
$this->groups[$group->id]['controls'] = NULL;
if ($feeds_res) {
$num_feeds = sql_row_keyed($feeds_res, 0);
$num_feeds = $num_feeds['feeds'];
if ($num_feeds == 1) {
$this->groups[$group->id]['controls'][] = "1 feed";
} else {
if ($num_feeds > 1) {
$this->groups[$group->id]['controls'][] = $num_feeds . " feeds";
}
}
}
$screens_res = sql_query('SELECT COUNT(id) as screens FROM `screen` WHERE `group_id` = ' . $group->id);
if ($screens_res) {
$num_screens = sql_row_keyed($screens_res, 0);
$num_screens = $num_screens['screens'];
if ($num_screens == 1) {
$this->groups[$group->id]['controls'][] = "1 screen";
} else {
if ($num_screens > 1) {
$this->groups[$group->id]['controls'][] = $num_screens . " screens";
}
}
}
}
}
}
示例5: get_links
/**
Get data for moderation option ie group moderation
**/
private function get_links()
{
$this->Paging["querystring"] = "view=members&gid={$this->set_id}";
$Group = new Group();
$Group->collection_id = $this->set_id;
$Group->is_active = 1;
$this->Paging["count"] = $Group->get_members($cnt = TRUE, '', '', '', '', FALSE);
$members = $Group->get_members($cnt = FALSE, $this->Paging["show"], $this->Paging["page"], '', '', FALSE);
$User = new User();
foreach ($members as $membersDetails) {
if ($membersDetails["user_type"] != 'owner') {
$User->load((int) $membersDetails["user_id"]);
$this->members_data[] = array('user_id' => $membersDetails["user_id"], 'first_name' => $User->first_name, 'last_name' => $User->last_name, 'email' => $User->email, 'created' => $membersDetails['join_date'], 'picture' => $User->picture, 'user_type' => $membersDetails["user_type"], 'login_name' => $User->login_name);
}
}
// echo "<pre>".print_r($this->members_data,1)."</pre>";
return;
}
示例6: print_group_selectbox
/**
* print_group_selectbox
*
* prints selectbox with group name and with members list
*
* usage:
* print_group_selectbox(array(
* "group_id" => $top_group
* ));
*/
function print_group_selectbox()
{
global $site;
global $read_allowed_groups;
global $all_levels;
global $selected_parents;
global $column_count;
$args = func_get_arg(0);
#printr($read_allowed_groups);
#printr($selected_parents);
$group_id = $args['group_id'];
# group ID
$level = $args['level'];
# group ID
###### PERMISSIONS: show group selectbox if READ is allowed OR is superuser
if ($group_id == '' || in_array($group_id, $read_allowed_groups) || $site->user->is_superuser) {
###### get group itself
$group = new Group(array(group_id => $group_id));
###### get subgroups html
#printr($all_levels[$level]);
if (is_array($all_levels[$level])) {
foreach ($all_levels[$level] as $tmpgroup) {
# check parent (don-t check parent for evreybody) AND permission to read
if ((in_array($tmpgroup['id'], $read_allowed_groups) || $site->user->is_superuser) && (!$tmpgroup['parent'] || in_array($tmpgroup['parent'], $selected_parents))) {
$role_selected = $level == 1 && $site->fdat['role_id'] ? true : false;
$options_html .= '<option value="group_id:' . $tmpgroup['id'] . '"' . ($group_id == $tmpgroup['id'] && !$role_selected ? ' selected' : '') . ">" . $tmpgroup['name'] . "</option>";
}
# if is child of selected parent
}
# is array
}
# foreach group in this level
########## members
# get previous level (min is 1):
$prev_level = $level > 1 ? $level - 1 : 1;
###### get members list of previous group (group in preceeding selectbox)
$prev_group_id = $selected_parents[$prev_level - 1];
if ($prev_group_id) {
$prev_group = new Group(array(group_id => $prev_group_id));
$members = $prev_group->get_members();
}
# print cell if found any subgroup OR any member
if ($options_html || sizeof($members) > 0) {
# keep record of global column count
if ($column_count < $level) {
$column_count = $level;
}
?>
<TD>
<SELECT NAME="tmp_<?php
echo $group_id;
?>
" class="scms_flex_input" style="width:160px" onchange="javascript:select_acl(this.options[this.selectedIndex].value)">
<?php
# print empty select (not for everybody)
########### CHOOSE
if ($level != '1') {
?>
<option value="">--- <?php
echo $site->sys_sona(array(sona => "vali", tyyp => "admin"));
?>
---</option>
<?php
}
########### 1) ROLES: print roles only in the first selectbox (everybody)
if ($level == '1') {
$sqltmp = $site->db->prepare("SELECT * FROM roles ORDER BY name");
$sthtmp = new SQL($sqltmp);
?>
<optgroup label="<?php
echo $site->sys_sona(array(sona => "roles", tyyp => "kasutaja"));
?>
">
<?php
while ($role = $sthtmp->fetch()) {
?>
<option value="role_id:<?php
echo $role['role_id'];
?>
" <?php
echo $site->fdat['role_id'] == $role['role_id'] ? ' selected' : '';
?>
><?php
echo $role['name'];
?>
</option>
<?php
}
//.........這裏部分代碼省略.........
示例7: render
function render()
{
$login_uid = @PA::$login_user->user_id;
$this->gid = @$this->params['blog_id'];
$this->blog_name = @$this->params['blog_name'];
$this->note = '';
if ($this->blog_name) {
$this->find_or_create_blog();
}
if ($this->gid) {
$this->type == 'group';
$group = new Group();
$group->collection_id = $this->gid;
$group->load($this->gid);
$this->group_member = Group::member_exists($group->collection_id, $login_uid) ? TRUE : FALSE;
switch ($this->view) {
case "recent_post":
// load content
$this->contents = $group->get_contents_for_collection($type = 'all', $cnt = FALSE, 1, 1, 'created', 'DESC');
$this->inner_template = 'recent_post.tpl';
break;
case 'user':
// load content
if (@$this->params['cid']) {
// permalink, load only this one
$bp = new BlogPost();
try {
$bp->load((int) $this->params['cid']);
$this->count = 1;
$content = array();
foreach ($bp as $k => $v) {
$content[$k] = $v;
}
$this->contents[] = $content;
} catch (PAException $e) {
$this->err = __("Couldn't load BlogPost. ") . $e->getMessage();
}
} else {
$this->count = $group->get_contents_for_collection($type = 'all', $cnt = TRUE, 'all', 0, $sort_by = 'created', $direction = 'DESC');
$this->contents = $group->get_contents_for_collection($type = 'all', $cnt = FALSE, $this->show, $this->page, 'created', 'DESC');
}
break;
case "admin":
$this->title = "Managing authors for " . $this->blog_name;
$this->inner_template = 'manageauthors.tpl';
// find members
$this->members = $group->get_members();
$this->member_count = count($this->members);
break;
}
// load Items for all BlogPosts -> for Comments to work
foreach ($this->contents as $i => $post) {
$item_params = array("type" => 'blogpost', "id" => $post['content_id'], "name" => $post['content_id'], "thumbnail" => "", "thumbnail_w" => "0", "thumbnail_h" => "0", "genres" => "blog", "url" => $this->blog_url . "?b_cid=" . $post['content_id']);
Item::sync($item_params);
// create or update row in 'items' database table
$item = Item::find_by_subject('blogpost', $post['content_id']);
$this->contents[$i]['comment_count'] = $item->comment_count;
}
} else {
$this->err = __("No Blog found.");
}
$tmp_file = dirname(__FILE__) . "/" . $this->skin . "_" . $this->inner_template;
$inner_html_gen =& new Template($tmp_file, $this);
$this->inner_HTML = $inner_html_gen->fetch();
$content = parent::render();
return $content;
}
示例8: initializeModule
function initializeModule($request_method, $request_data)
{
if (empty($this->shared_data['group_info'])) {
return 'skip';
}
$this->group_details = $this->shared_data['group_info'];
if (empty($request_data['gid'])) {
return 'skip';
}
// sanity check
// we do this check only if the user is not already permitted to manage ads
$gp_access = PermissionsHandler::can_group_user(PA::$login_uid, $request_data['gid'], array('permissions' => 'manage_groups'));
if (!$gp_access) {
return 'skip';
}
// user shoudn't have gotten here in the first place, just don't show anything
$error_msg = false;
if ($request_method == 'POST') {
$value_to_validate = array('title' => 'Title', 'bulletin_body' => 'Bulletin body');
foreach ($value_to_validate as $key => $value) {
$request_data[$key] = trim($request_data[$key]);
if (empty($request_data[$key])) {
$error_msg .= $value . ' can not be empty<br>';
}
}
if (!$error_msg) {
// if no errors yet
$subject = $request_data['title'];
$bull_message = $request_data['bulletin_body'];
$group = new Group();
$group->load($request_data['gid']);
if (!empty($request_data['bulletins'])) {
// send to all members
$gms = $group->get_members();
foreach ($gms as $i => $m) {
$u = new User();
$u->load((int) $m['user_id']);
$to_members[] = $u;
}
} else {
if (!empty($request_data['send_to_me_only'])) {
// test send to admin user
$to_members = array(PA::$login_user);
}
}
$this->sent_to = array();
// send it
if (!empty($to_members)) {
foreach ($to_members as $recipient) {
$this->sent_to[] = $recipient->display_name;
PANotify::send("group_bulletin_sent", $recipient, $group, array('bulletin.message' => $bull_message, 'bulletin.subject' => $subject));
}
}
// wannt a preview with that?
if (!empty($request_data['preview'])) {
// if preview is selected.
$container_html = 'default_email_container.tpl';
$email_container = new Template('config/email_containers/' . $container_html);
$email_container->set('subject', $subject);
$email_container->set('message', $bull_message);
$this->preview_msg = $email_container->fetch();
}
}
}
}