本文整理匯總了PHP中Group::get_owner_id方法的典型用法代碼示例。如果您正苦於以下問題:PHP Group::get_owner_id方法的具體用法?PHP Group::get_owner_id怎麽用?PHP Group::get_owner_id使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Group
的用法示例。
在下文中一共展示了Group::get_owner_id方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: 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();
}
}
示例2: auto_email_notification_members
function auto_email_notification_members($activity_type, $params)
{
if (!PA::$network_info) {
return;
}
//setting common variables
$notification = new EmailNotification();
// mail to
// FIXME: these two seemed not to be set in occasion
$gid = @$params['gid'] ? $params['gid'] : @$_GET['gid'];
$rid = @$params['related_uid'];
if ($gid) {
$network_owner_id = Group::get_owner_id($gid);
$notification->network_owner = User::map_ids_to_logins($network_owner_id['user_id']);
$group_owner = new User();
$group_owner->load((int) $network_owner_id['user_id']);
$notification->to = $group_owner->email;
$group_owner_name = $group_owner->login_name;
//mail from
$notification->from = (int) PA::$login_uid;
$array_of_data = array('to' => $notification->to, 'from' => $notification->from, 'owner_name' => $group_owner_name, 'group_owner_id' => $network_owner_id['user_id']);
}
if ($rid) {
$notification->network_owner = User::map_ids_to_logins(array($rid));
foreach ($notification->network_owner as $key => $value) {
$rel_user = new User();
$rel_user->load((int) $key);
$related_name = $rel_user->login_name;
$notification->to = $rel_user->email;
}
$notification->from = (int) PA::$login_uid;
$array_of_data = array('to' => $notification->to, 'from' => $notification->from, 'related_name' => $related_name);
}
$array_of_data['params'] = $params;
$notification->send($activity_type, $array_of_data);
}
示例3: getGroupOwner
private function getGroupOwner()
{
$owner_id = Group::get_owner_id((int) $this->group->group_id);
$group_owner = new User();
$group_owner->load((int) $owner_id);
return $group_owner;
}
示例4: buildStatistics
private function buildStatistics($board)
{
$board_statistics = $board->getBoardStatistics();
$statistics = array();
$statistics['title'] = $board->get_title();
$statistics['description'] = $board->get_description();
$statistics['type'] = $board->get_type() . " board";
$statistics['created_at'] = $board->get_created_at();
switch ($board->get_type()) {
case PaForumBoard::network_board:
$net_id = $board->get_owner_id();
if ($net_id == 1) {
// mother network - owner_id always is '1' !
$owner_id = 1;
} else {
$owner_id = Network::get_network_owner((int) $board->get_owner_id());
}
break;
case PaForumBoard::group_board:
$owner_id = Group::get_owner_id((int) $board->get_owner_id());
break;
case PaForumBoard::personal_board:
$owner_id = $board->get_owner_id();
break;
}
$user = new User();
$user->load((int) $owner_id);
$statistics['owner'] = $user;
$statistics['nb_categories'] = $board_statistics['nb_categories'];
$nb_forums = 0;
$nb_threads = 0;
$nb_posts = 0;
$threads = array();
$last_posts = array();
foreach ($board_statistics['categories'] as $category) {
if ($category->statistics['nb_forums'] > 0) {
$nb_forums += $category->statistics['nb_forums'];
foreach ($category->statistics['forums'] as $forum) {
if (!empty($forum->statistics['threads']) and count($forum->statistics['threads']) > 0) {
foreach ($forum->statistics['threads'] as &$thr) {
$thr->forum = $forum;
}
$threads = array_merge($threads, $forum->statistics['threads']);
$nb_threads += $forum->statistics['nb_threads'];
$nb_posts += $forum->statistics['nb_posts'];
if (!empty($forum->statistics['last_post'])) {
$last_posts[] = $forum->statistics['last_post'];
}
}
}
}
}
if (count($threads) > 1) {
usort($threads, "cmpThreadCreated");
}
$statistics['threads'] = $threads;
$statistics['nb_forums'] = $nb_forums;
$statistics['nb_threads'] = $nb_threads;
$statistics['nb_posts'] = $nb_posts;
$statistics['last_posts'] = $last_posts;
$statistics['nb_users'] = PaForumsUsers::countPaForumsUsers("board_id = " . $board->get_id());
return $statistics;
}
示例5: send_approval_message_to_user
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;
}
示例6: getBoardOwner
private function getBoardOwner($request_data)
{
switch ($this->board_type) {
case PaForumBoard::network_board:
$owner_id = Network::get_network_owner((int) $this->parent_id);
break;
case PaForumBoard::group_board:
$group_owner = Group::get_owner_id((int) $this->parent_id);
$owner_id = $group_owner['user_id'];
break;
case PaForumBoard::personal_board:
$owner_id = (int) $this->parent_id;
break;
}
$this->owner_id = $owner_id;
$user = new User();
$user->load((int) $owner_id);
return $user;
}
示例7: header
// catch if delete is fail
}
$location = $_SERVER['HTTP_REFERER'];
header("Location: {$location}");
exit;
}
} else {
// When User wants to delete repllies of forum
$mid = $_GET['mid'];
$params['action'] = 'delete_rep';
// fiding the parent for the replly
$request_info = load_info();
$msg = new MessageBoard();
$rep_details = $msg->get_by_id($_REQUEST['mid']);
$cond_array = array('boardmessage_id' => $request_info['parent_id']);
$forum_detail = MessageBoard::get_forums($cond_array);
$owner = Group::get_owner_id($_REQUEST['ccid']);
$params['forum_owner'] = $forum_detail[0]->user_id;
$params['rep_owner'] = $rep_details['user_id'];
$params['group_owner'] = $owner['user_id'];
if (user_can($params)) {
try {
MessageBoard::delete($mid);
} catch (Exception $e) {
// catch if delete is fail
}
$location = $_SERVER['HTTP_REFERER'];
header("Location: {$location}");
exit;
}
}
示例8: save
/**
* Saves Group data to database
* @access public
* @param int $user_id ID of the user trying to save
*/
public function save($user_id = NULL)
{
Logger::log('Enter: Group::save() | Args: \\$user_id = ' . $user_id);
if (!empty($user_id)) {
$this->author_id = $user_id;
}
if (empty($this->title)) {
Logger::log('Exit: Group::save(). Title of the group is not specified.');
throw new PAException(GROUP_NAME_NOT_EXIST, 'Title of the group is not specified');
}
if (!isset($this->access_type)) {
Logger::log('Exit: Group::save(). Access type for the group is not specifed');
throw new PAException(GROUP_ACCESS_TYPE_NOT_EXIST, 'Access type for the group is not specifed');
}
if (!isset($this->reg_type)) {
Logger::log('Exit: Group::save(). User registration type is not specified for the group.');
throw new PAException(GROUP_REGISTRATION_TYPE_NOT_EXIST, 'User registration type is not specified for the group.');
}
if (!isset($this->is_moderated)) {
Logger::log('Exit: Group::save(). Moderation type is not specifed for the group.');
throw new PAException(GROUP_IS_MODERATED_NOT_EXIST, 'Moderation type is not specifed for the group.');
}
if (!empty($this->extra)) {
$this->extra = serialize($this->extra);
}
//if collection_id exists the update else insert
if ($this->collection_id) {
// $user_type = Group::get_user_type ($this->author_id, $this->collection_id);
// $access = $this->acl_object->acl_check( 'action', 'edit', 'users', $user_type, 'group', 'all' );
$access = PermissionsHandler::can_group_user(Group::get_owner_id((int) $this->collection_id), $this->collection_id, array('permissions' => 'manage_groups'));
if (!$access) {
throw new PAException(OPERATION_NOT_PERMITTED, 'You are not authorized to edit this group.');
}
$sql = "UPDATE {groups} SET access_type = ?, reg_type = ?, is_moderated = ?, category_id = ? , header_image = ? , header_image_action = ?, display_header_image = ?, group_type =?, extra=? WHERE group_id = ?";
try {
$res = Dal::query($sql, array($this->access_type, $this->reg_type, $this->is_moderated, $this->category_id, $this->header_image, $this->header_image_action, $this->display_header_image, $this->group_type, @$this->extra, $this->collection_id));
parent::save();
} catch (Exception $e) {
Dal::rollback();
throw $e;
}
} else {
//only registered user can create a group
// This already has been taken care via session
// we can add further modification if not use session user_id
try {
parent::save();
$sql = "INSERT INTO {groups} (group_id, access_type, reg_type, is_moderated, category_id, header_image, header_image_action, display_header_image, group_type, extra) VALUES (?, ?, ?, ?, ?,?,?,?, ?, ?)";
$data = array($this->collection_id, $this->access_type, $this->reg_type, $this->is_moderated, $this->category_id, $this->header_image, $this->header_image_action, $this->display_header_image, $this->group_type, @$this->extra);
$res = Dal::query($sql, $data);
$this->created = time();
$sql = "INSERT INTO {groups_users} (group_id, user_id, user_type, created) VALUES (?, ?, ?, ?)";
$res = Dal::query($sql, array($this->collection_id, $this->author_id, OWNER, $this->created));
foreach ($this->moderators as $mod) {
$sql = "INSERT INTO {groups_users} (group_id, user_id, user_type, created) VALUES (?, ?, ?, ?)";
$res = Dal::query($sql, array($this->collection_id, $mod, MODERATOR, $this->created));
}
Dal::commit();
// setup extra permissions for group owner
// so, we need to assign group admin role to group owner now:
$role_extra = array('user' => false, 'network' => false, 'groups' => array($this->collection_id));
$user_roles[] = array('role_id' => GROUP_ADMIN_ROLE, 'extra' => serialize($role_extra));
$group_owner = new User();
$group_owner->load($this->author_id);
$group_owner->set_user_role($user_roles);
} catch (Exception $e) {
Dal::rollback();
throw $e;
}
}
Logger::log("Exit: Group::save()");
return $this->collection_id;
}