本文整理汇总了PHP中Group::get_user_type方法的典型用法代码示例。如果您正苦于以下问题:PHP Group::get_user_type方法的具体用法?PHP Group::get_user_type怎么用?PHP Group::get_user_type使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Group
的用法示例。
在下文中一共展示了Group::get_user_type方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generate_group_links
function generate_group_links()
{
global $login_uid;
// Getting all the information about that group
$group_data = array();
$group_info = array();
$group_info['is_member'] = FALSE;
$group_join_string = 'Join This Group';
$group_data = ContentCollection::load_collection($this->gid, NULL);
// Calculating user's type
if (!empty($login_uid)) {
$usr_type = Group::get_user_type($login_uid, $this->gid);
$group_info['is_member'] = $usr_type == MEMBER ? TRUE : FALSE;
if ($usr_type == OWNER) {
$group_info['is_admin'] = TRUE;
$group_info['is_member'] = TRUE;
}
}
if ($group_data->reg_type == REG_MODERATED) {
$group_join_string = "Request to join this group";
}
$group_info['title'] = $group_data->title;
$group_info['description'] = $group_data->description;
$group_info['picture'] = $group_data->picture;
$group_info['collection_id'] = $group_data->collection_id;
$group_info['join_str'] = $group_join_string;
unset($group_data);
return $group_info;
}
示例2: setup_module
function setup_module($column, $module, $obj)
{
$group_var = new Group();
$group_var->load($_REQUEST['gid']);
$obj->title = sprintf(__('%s Events'), PA::$group_noun);
$obj->assoc_type = 'group';
$obj->assoc_id = $_REQUEST['gid'];
$obj->assoc_title = $group_var->title;
$is_member = Group::get_user_type((int) $_SESSION['user']['id'], (int) $_REQUEST['gid']);
if ($is_member == NOT_A_MEMBER) {
$obj->may_edit = false;
} else {
$obj->may_edit = true;
}
}
示例3: generate_group_links
public function generate_group_links()
{
$user_type = FALSE;
if (!empty(PA::$login_uid)) {
$user_type = Group::get_user_type(PA::$login_uid, $this->group_details->collection_id);
$this->is_member = $user_type == MEMBER ? TRUE : FALSE;
if ($user_type == OWNER) {
$this->is_member = TRUE;
$this->is_admin = TRUE;
}
}
if (!$this->is_member) {
if ((!empty($this->group_details) ? $this->group_details->reg_type : NULL) && $this->group_details->reg_type == REG_MODERATED) {
$this->join_this_group_string = __('Request to join this group');
} else {
$this->join_this_group_string = __('Join This Group');
}
}
}
示例4: setup_module
function setup_module($column, $module, $obj)
{
$group_var = new Group();
$group_var->load($_REQUEST['gid']);
switch ($module) {
case 'EventCalendarModule':
$obj->title = 'Group Events';
$obj->assoc_type = 'group';
$obj->assoc_id = $_REQUEST['gid'];
$obj->assoc_title = $group_var->title;
$is_member = Group::get_user_type((int) $_SESSION['user']['id'], (int) $_REQUEST['gid']);
if ($is_member == NOT_A_MEMBER) {
$obj->may_edit = false;
} else {
$obj->may_edit = true;
}
break;
}
$obj->mode = PUB;
}
示例5: initializeModule
public function initializeModule($request_method, $request_data)
{
if (empty($request_data['gid'])) {
return 'skip';
}
$this->gid = $request_data['gid'];
// NOTE:
// The code bellow is temporrary solution and should be removed
// when refactoring of all other pages that using this module
// will be done!
// ----------------------------------------------------------------------
if (empty($this->shared_data['group_info']) && !empty($request_data['gid'])) {
$group = ContentCollection::load_collection((int) $this->gid);
$member_type = Group::get_user_type(PA::$login_uid, (int) $this->gid);
$this->shared_data['member_type'] = $member_type;
$this->shared_data['group_info'] = $group;
$this->shared_data['members'] = Group::get_member_count((int) $this->gid);
$owner = new User();
$owner->load((int) Group::get_owner_id((int) $this->gid));
$this->shared_data['author_picture'] = $owner->picture;
$this->shared_data['author_name'] = $owner->login_name;
$this->shared_data['access_type'] = $this->shared_data['group_info']->reg_type == $this->shared_data['group_info']->REG_OPEN ? ' Open' : ' Moderated';
}
// ----------------------------------------------------------------------
switch ($this->page_id) {
case PAGE_GROUP_THEME:
case PAGE_GROUP_MODERATION:
case PAGE_GROUP:
case PAGE_SHOWCONTENT:
case PAGE_PERMALINK:
$this->group_details = $this->shared_data['group_info'];
$this->group_details->author_picture = $this->shared_data['author_picture'];
$this->group_details->author_name = $this->shared_data['author_name'];
$this->group_details->members = $this->shared_data['members'];
$this->access_type = $this->shared_data['access_type'];
break;
default:
$this->group_details = $this->generate_group_links();
}
}
示例6: can_manage_forum
private function can_manage_forum($params, $type)
{
$board_type = $params['board']->get_type();
if ($board_type == 'group' && !empty($params['gid'])) {
// it is a group forum
$user_type = Group::get_user_type($params['user_id'], $params['gid']);
if ($user_type == MODERATOR || $user_type == OWNER) {
return true;
}
$group_permiss = @$this->user_permissions['groups'][$params['gid']];
if (!empty($group_permiss)) {
if (in_array('manage_content', $group_permiss)) {
return true;
}
}
}
if ($board_type == 'network') {
$is_net_admin = Network::is_admin($params['board']->get_network_id(), $params['user_id']);
if ($is_net_admin) {
return true;
}
$net_permiss = @$this->user_permissions['network'];
if (!empty($net_permiss)) {
if (in_array('manage_content', $net_permiss)) {
return true;
}
}
}
if ($board_type == 'user') {
if ($params['user_id'] == $params['board']->get_owner_id()) {
return true;
}
}
return false;
}
示例7: group_user_authentication
function group_user_authentication($group_id)
{
global $login_uid;
$access_array = array();
$access_array['style'] = "";
if (!empty($login_uid)) {
$user_type = Group::get_user_type($login_uid, $group_id);
$group_var = new Group();
$group_var->load($group_id);
switch (trim($user_type)) {
case NOT_A_MEMBER:
if ($group_var->reg_type == REG_MODERATED) {
$access_array['hyper_link'] = PA::$url . PA_ROUTE_GROUP . "/action=join&gid={$group_id}";
$access_array['caption'] = 'Request to join';
$access_array['style'] = "style=\"width:160px;\"";
} else {
$access_array['hyper_link'] = PA::$url . PA_ROUTE_GROUP . "/action=join&gid={$group_id}";
$access_array['caption'] = 'Join';
}
break;
case MEMBER:
$access_array['hyper_link'] = PA::$url . PA_ROUTE_GROUP . "/action=leave&gid={$group_id}";
$access_array['caption'] = 'Unjoin';
break;
case OWNER:
$access_array['hyper_link'] = PA::$url . "/cnaddgroup.php?gid={$group_id}";
$access_array['caption'] = 'Edit';
break;
case MODERATOR:
$access_array['hyper_link'] = PA::$url . PA_ROUTE_GROUP_MODERATION . "/view=content&gid={$group_id}";
$access_array['caption'] = 'Moderate';
$access_array['style'] = "style=\"width:80px;\"";
break;
}
} else {
$access_array['hyper_link'] = PA::$url . PA_ROUTE_GROUP . "/action=join&gid={$group_id}";
$access_array['caption'] = 'Join';
}
return $access_array;
}
示例8: handleGET_leave
private function handleGET_leave($request_data)
{
global $error_msg;
if (PA::$login_uid && !empty($this->shared_data['group_info'])) {
$group = $this->shared_data['group_info'];
$user = PA::$login_user;
$user_type = Group::get_user_type(PA::$login_uid, (int) $request_data['gid']);
if (Group::is_admin((int) $request_data['gid'], (int) PA::$login_uid) && $user_type == OWNER) {
// admin can leave a group but owner can't
$error_msg = __("You can't leave your own group.");
} else {
if (Group::member_exists((int) $request_data['gid'], (int) PA::$login_uid)) {
try {
$x = $group->leave((int) PA::$login_uid);
} catch (PAException $e) {
$error_msg = "Operation failed (" . $e->message . "). Please try again";
}
} else {
$error_msg = sprintf(__("You are not member of \"%s\"."), stripslashes($group->title));
}
}
if (@$x) {
$error_msg = sprintf(__("You have left \"%s\" successfully."), stripslashes($group->title));
// also delete Family relation
require_once 'api/Entity/TypedGroupEntityRelation.php';
TypedGroupEntityRelation::delete_relation(PA::$login_uid, $request_data['gid'], PA::$network_info->network_id);
}
}
}
示例9: is_author_group_member
function is_author_group_member($author_id, $gid)
{
$author_perm = Group::get_user_type($author_id, (int) $gid);
return $author_perm == NOT_A_MEMBER ? false : true;
}
示例10: default_exception
//TODO : Remove this when new UI is completely implemented.
include_once "web/includes/page.php";
require_once 'api/Category/Category.php';
require_once 'web/includes/classes/file_uploader.php';
require_once 'api/Message/Message.php';
require_once 'web/includes/functions/auto_email_notify.php';
require_once 'web/includes/functions/mailing.php';
default_exception();
$parameter = js_includes("all");
$header = 'header.tpl';
//default network header while creating groups. While group editing header_group.tpl will be used.
$edit = FALSE;
$title = __("Create Group");
if (!empty($_REQUEST['gid'])) {
$title = __("Edit Group");
$user_type = Group::get_user_type($_SESSION['user']['id'], $_REQUEST['gid']);
$header = 'header_group.tpl';
$edit = TRUE;
$groups = new Group();
$groups->load($_REQUEST['gid']);
$group_type = $groups->group_type;
}
function setup_module($column, $module, $obj)
{
global $login_uid, $paging, $page_uid, $super_groups_available, $user_type, $group_type;
switch ($module) {
case 'AddGroupModule':
if (!empty($_REQUEST['gid'])) {
$obj->id = $_REQUEST['gid'];
}
break;
示例11: setup_module
}
$users = $final_array;
//p($users);
if (Group::member_exists((int) $group->collection_id, (int) $login_uid)) {
$is_member = TRUE;
$header->is_member = TRUE;
}
$is_admin_member = FALSE;
// set the default value to
if (Group::is_admin((int) $_REQUEST['gid'], (int) $login_uid)) {
$is_admin_member = TRUE;
$header->is_admin_member = TRUE;
}
$group_details['is_member'] = $is_member;
$show_content = TRUE;
$member_type = Group::get_user_type($login_uid, (int) $gid);
function setup_module($column, $module, $obj)
{
global $group_details, $users, $content_type, $request_info, $title, $body, $is_member, $paging, $msg, $access, $group, $upload_array, $post_type_message, $post_type, $group_top_mesg, $join_group_string, $member_type, $login_uid;
$obj->group_details = $group_details;
$obj->join_this_group_string = $join_group_string;
if ($group->reg_type == REG_INVITE && $member_type == NOT_A_MEMBER) {
$group_top_mesg = 9005;
return "skip";
}
switch ($module) {
case 'MembersFacewallModule':
$obj->links = $users;
$obj->gid = $_REQUEST['gid'];
break;
case 'EventCalendarSidebarModule':
示例12: js_includes
$use_theme = 'Beta';
//TODO : Remove this when new UI is completely implemented.
//including necessary files
include "includes/page.php";
include_once "{$path_prefix}/ext/Group/Group.php";
require_once "{$path_prefix}/api/MessageBoard/MessageBoard.php";
/*including Js files */
$parameter .= js_includes('common.js');
// for query count
global $query_count_on_page, $login_uid;
$query_count_on_page = 0;
$mid = $_REQUEST['mid'];
$request_info = load_info();
$parent_id = $request_info['parent_id'];
$parent_type = $request_info['parent_type'];
$member_type = Group::get_user_type($login_uid, $parent_id);
$gid = (int) $_GET['gid'];
$group_data = ContentCollection::load_collection((int) $gid, $login_uid);
$cat_obj = new MessageBoard();
$edit_data = $cat_obj->get_by_id($mid);
$params['action'] = 'edit_forum';
$params['group_owner'] = $group_data->author_id;
$params['forum_owner'] = $edit_data['user_id'];
if (user_can($params)) {
$is_edit = TRUE;
} else {
$is_edit = FALSE;
$msg = 'You are not authorized to edit forum';
}
function setup_module($column, $module, $obj)
{
示例13: array
// When we doesn't found type
$type = 'Images';
} else {
$type = $_GET['type'];
}
$module_name = $type.'MediaGalleryModule';
$setting_data = array('middle' => array($module_name));
/* This function is a Callback function which initialize the value for the BLOCK MODULES */
if (!empty($_GET['gid'])) {
$gid = (int)$_GET['gid'];
$group_data = ContentCollection::load_collection($gid, $_SESSION['user']['id']);
$group_name = $group_data->title;
if ($_SESSION['user']['id']) {
$is_member = Group::get_user_type($_SESSION['user']['id'], (int)$gid);
}
}
function setup_module($column, $module, $obj) {
/* in this module we have to set user_id , group_id, as well as netwrok_id */
global $type, $group_data, $is_member, $msg, $show_view;
$obj->type = $type;
$obj->show_view = $show_view;
switch ($module) {
case 'ImagesMediaGalleryModule':
case 'AudiosMediaGalleryModule':
case 'VideosMediaGalleryModule':
if ($group_data->reg_type == REG_INVITE && $is_member == NOT_A_MEMBER) {
$msg = MessagesHandler::get_message(9005);
return "skip";
}
示例14: initializeModule
function initializeModule($request_method, $request_data)
{
if (empty($this->shared_data['group_info'])) {
return 'skip';
}
$this->gid = $this->shared_data['group_info']->collection_id;
if (empty(PA::$config->useTypedGroups)) {
return 'skip';
}
$this->shared_data['member_type'] = $member_type = Group::get_user_type(PA::$login_uid, (int) $this->gid);
$this->is_member = $member_type == MEMBER ? TRUE : FALSE;
if ($member_type == OWNER) {
$this->is_member = TRUE;
$this->is_admin = TRUE;
}
$acl = new Access();
// check for moderation of group permissions
$gp_access = $acl->acl_check('action', 'edit', 'users', $member_type, 'group', 'all');
if (PA::$login_uid == SUPER_USER_ID || $member_type == 'moderator') {
$gp_access = 1;
}
$this->is_admin = $this->shared_data['moderation_permissions'] = $gp_access;
$this->group_details = $this->shared_data['group_info'];
if (!$this->is_member) {
if ((!empty($this->group_details) ? $this->group_details->reg_type : NULL) && $this->group_details->reg_type == REG_MODERATED) {
$this->join_this_group_string = __('Request to follow this organization as');
} else {
$this->join_this_group_string = __('Follow This Org As');
}
} else {
// get the relationType for this user
list($relType, $relLabel) = TypedGroupEntityRelation::get_relation_to_group(PA::$login_uid, (int) $this->gid);
if (empty($relType)) {
$relType = 'member';
$relLabel = __('Member');
}
$this->relationType = $relType;
$this->relationTypeString = sprintf(__("You are a %s"), $relLabel);
}
$this->availTypes = TypedGroupEntity::get_avail_types();
$this->selectTypes = array();
foreach ($this->availTypes as $k => $l) {
$this->selectTypes[] = array('label' => $l, 'value' => $k);
}
// Do we already have a bound Entity?
// we need to load the generic parent class, as we do noot yet know the 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;
$classname = ucfirst($type) . "TypedGroupEntity";
@(include_once "api/Entity/{$classname}.php");
if (class_exists($classname)) {
$instance = new $classname();
} else {
// just get default
$instance = new TypedGroupEntity();
}
$this->profilefields = $instance->get_profile_fields();
$this->availRelations = $instance->get_avail_relations();
$this->selectRelations = array();
foreach ($this->availRelations as $k => $l) {
$this->selectRelations[] = array('label' => $l, 'value' => $k);
}
// does the admin want to edit it?
if ($this->shared_data['moderation_permissions'] && !empty($request_data['edit_enityprofile'])) {
//$this->title = sprintf(__("Edit %s profile"), $typedEntity->attributes['name']['value']);
$this->inner_template = PA::$blockmodule_path . '/' . get_class($this) . "/edit_typedgroup_profile.tpl.php";
// load into form
$this->dynFields = new DynamicFormFields($this->entity->attributes);
} else {
// display only
//$this->title = sprintf(__("%s profile"), $typedEntity->attributes['name']['value']);
$this->inner_template = PA::$blockmodule_path . '/' . get_class($this) . "/typedgroup_profile.tpl.php";
}
$this->title = '';
} else {
return 'skip';
/*
// moderators only
if(!$this->shared_data['moderation_permissions']) {
return 'skip';
}
*/
}
switch ($this->column) {
case 'middle':
break;
case 'left':
case 'right':
default:
break;
}
}
示例15: catch
$inv->inv_message = !empty($invitation_message) ? $invitation_message : NULL;
try {
$inv->send();
} catch (PAException $e) {
$save_msg = "{$e->message}";
$save_error = TRUE;
}
if ($save_error == TRUE) {
$msg[] = "Sorry: you are unable to invite a friend. <br /> Reason: " . $sav_msg;
} else {
// invitation has been sent, now send email
$user = new User();
$user->load((int) $login_uid);
$invitee_image = uihelper_resize_mk_user_img($user->picture, 80, 80, 'alt="' . $user->first_name . '" align="left" style="padding: 0px 12px 12px 0px;"');
$group_icon_image = uihelper_resize_mk_img('files/' . $group->picture, 219, 35, 'files/' . DEFAULT_NETWORK_ICON, 'alt="' . $group->title . '"');
$user_type = Group::get_user_type($login_uid, $gid);
if ($user_type == OWNER) {
$mail_type = 'invite_group';
} else {
if ($user_type == MEMBER) {
$mail_type = 'invite_group_by_member';
}
}
$group_url = $base_url . '/group.php?gid=' . $inv->inv_collection_id;
$invitee_url = url_for('user_blog', array('login' => $user->login_name));
$array_of_data = array('first_name' => $user->first_name, 'last_name' => $user->last_name, 'user_name' => $user->login_name, 'user_id' => $user->user_id, 'message' => $inv->inv_message, 'group_name' => $inv->inv_group_name, 'accept_url' => $inv->accept_url, 'register_url' => $inv->register_url, 'invited_user_name' => $inv->inv_user_first_name, 'invitee_image' => $invitee_image, 'group_id' => $inv->inv_collection_id, 'group_description' => $group->description, 'group_icon_image' => $group_icon_image, 'group_url' => $group_url, 'network_name' => $network_info->name, 'invitee_url' => $invitee_url, 'config_site_name' => $config_site_name);
$check = pa_mail($inv->inv_email, $mail_type, $array_of_data, $user->email);
$succ_msg .= $valid_user_first_emails[$counter] . ', ';
if ($counter == $valid_cnt - 1) {
$succ_msg = substr($succ_msg, 0, -2);
//$msg_1[] = "Invitation has been sent successfully to -" . $succ_msg;