本文整理汇总了PHP中Group::load_group_by_id方法的典型用法代码示例。如果您正苦于以下问题:PHP Group::load_group_by_id方法的具体用法?PHP Group::load_group_by_id怎么用?PHP Group::load_group_by_id使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Group
的用法示例。
在下文中一共展示了Group::load_group_by_id方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generate_inner_html
function generate_inner_html()
{
if ($this->id) {
$this->load_data();
}
if ($this->ccid > 0) {
// load that group so we can check it's access and reg type
$this->group = Group::load_group_by_id((int) $this->ccid);
}
$inner_template = PA::$blockmodule_path . '/' . get_class($this) . '/cnmodule.php';
$inner_html_blog = new Template($inner_template);
$inner_html_blog->set_object('network_info', PA::$network_info);
$inner_html_blog->set('current_theme_path', PA::$theme_url);
// $inner_html_blog->set('links', $this->links);
$inner_html_blog->set('cid', $this->id);
$inner_html_blog->set('ccid', $this->ccid);
$inner_html_blog->set('parent_collection_id', $this->parent_collection_id);
// some or most of the following can be empty so we use the @
$inner_html_blog->set('blog_title', str_replace('"', '"', $this->blog_title));
$inner_html_blog->set('blog_type', $this->blog_type);
$redirect = urldecode(isset($_GET) && isset($_GET['redirect']) ? $_GET['redirect'] : '');
$redirect = urldecode(isset($_POST) && isset($_POST['redirect']) ? $_POST['redirect'] : $redirect);
$pattern = '/(https?:\\/\\/)?(((www\\.)?([a-zA-Z0-9_\\.\\-]*)\\b\\.[a-z]{2,4}(\\.[a-z]{2})?)|(localhost))(:[0-9]*)?((\\/[a-zA-Z0-9_\\-\\.]*)+)?(\\.[a-z]*)?(\\?\\S+)?/';
$redirect = preg_match($pattern, $redirect) ? $redirect : '';
$inner_html_blog->set('redirect', urlencode($redirect));
$inner_html_blog->set('body', $this->body);
$inner_html_blog->set('trackback', $this->trackback);
$inner_html_blog->set('tag_entry', $this->tag_entry);
$inner_html_blog->set('error_msg', $this->error_msg);
$center_content = $inner_html_blog->fetch();
$inner_template = PA::$blockmodule_path . '/' . get_class($this) . '/cnmodule_simple.php';
$inner_html_gen = new Template($inner_template);
$inner_html_gen->set_object('network_info', PA::$network_info);
$inner_html_gen->set('current_theme_path', PA::$theme_url);
/* $inner_html_gen->set('title', $this->title); */
// $inner_html_gen->set('links', $this->links);
$inner_html_gen->set('sb_mc_type', $this->sb_mc_type);
$inner_html_gen->set('sb_types', $this->sb_types);
$inner_html_gen->set('center_content', $center_content);
$inner_html_gen->set('display', $this->display);
$inner_html_gen->set('targets', $this->targets);
$inner_html_gen->set('show_external_blogs', $this->show_external_blogs);
$inner_html_gen->set('user_groups', $this->get_user_groups());
$inner_html_gen->set('group_access', $this->group->access_type);
$inner_html_gen->set('group_reg', $this->group->rdg_type);
$inner_html_gen->set('album_type', $this->album_type);
$inner_html_gen->set('outputthis_error_mesg', $this->outputthis_error_mesg);
$inner_html_gen->set('error_msg', $this->error_msg);
if ($this->album_type != -1) {
$inner_html_gen->set('user_albums', $this->get_user_albums());
}
$inner_html_gen->set('permission_to_post', $this->permission_to_post);
$inner_html_gen->set('is_edit', $this->is_edit);
$inner_html_gen->set('ccid', $this->ccid);
$inner_html = $inner_html_gen->fetch();
return $inner_html;
}
示例2: render
function render()
{
global $paging;
$request_info = load_info();
$this->parent_id = $request_info['parent_id'];
$this->parent_type = $request_info['parent_type'];
$this->parent_name_hidden = $request_info['parent_name_hidden'];
$this->header_title = $request_info['header_title'];
$thread_obj = new MessageBoard();
$thread_obj->set_parent($this->parent_id, $this->parent_type);
$this->Paging["count"] = $thread_obj->get($count = TRUE);
$this->Paging['show'] = $paging['show'];
$this->Paging['page'] = $paging['page'];
$this->forum_details = $thread_obj->get($count = FALSE, $this->Paging["show"], $this->Paging["page"]);
$group_data = Group::load_group_by_id((int) $_GET['gid']);
$this->group_name = $group_data->title;
$this->topic_count = $this->Paging["count"];
$this->inner_HTML = $this->generate_inner_html();
$content = parent::render();
return $content;
}
示例3: get_largest_groups
/**
* get largest groups
* @access public
* @param string search string
*/
public static function get_largest_groups($number = 'all')
{
Logger::log("Enter: Group::get_largest_groups() ");
if ($number == 'all') {
$limit = '';
} else {
$limit = ' LIMIT ' . $number;
}
$sql = "SELECT DISTINCT(GU.group_id), COUNT(GU.user_id) as cnt\n FROM {groups_users} as GU LEFT JOIN {groups} as G on GU.group_id = G.group_id where G.reg_type <> ? GROUP BY GU.group_id ORDER BY cnt DESC {$limit}";
$data = array(0 => REG_INVITE);
// Reg_Type 2 is for Invite Only Groups.
$res = Dal::query($sql, $data);
$groups = array();
if ($res->numRows()) {
while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) {
$group_by_id = Group::load_group_by_id($row->group_id);
$groups[] = array('group_id' => $row->group_id, 'title' => $group_by_id->title, 'author_id' => $group_by_id->author_id, 'created' => $group_by_id->created, 'members' => $row->cnt, 'picture' => $group_by_id->picture);
}
}
Logger::log("Exit: Group::get_largest_groups() ");
return $groups;
}
示例4: validate_group_invitation_id
public static function validate_group_invitation_id($invitation_id)
{
Logger::log("Enter: Invitation::validate_invitation_id() | Args: \$invitation_id = {$invitation_id}");
$valid = Invitation::validate_invitation_id($invitation_id);
if (!$valid) {
return false;
}
//get collection_id
$Ginv = Invitation::load($invitation_id);
//find if group is deleted or not
$g = Group::load_group_by_id($Ginv->inv_collection_id);
if (!$g) {
return false;
}
//if we have come this far it means invitaion id is valid and group is active
Logger::log("Exit: Invitation::validate_invitation_id() | Args: \$invitation_id = {$invitation_id}");
return true;
}
示例5: check_content_privacy
/**
* check is content published in a private Group
* @param $content
*/
public static function check_content_privacy($content)
{
$result = false;
if ((int) $content['collection_id'] > 0) {
$group = Group::load_group_by_id((int) $content['collection_id']);
if (is_object($group)) {
if ($group->access_type == ACCESS_PRIVATE || $group->reg_type == REG_INVITE) {
// content published in a private Group!
$result = true;
}
}
}
return $result;
/* the following code was commented out because it's
obsolete and no longer works as required
-Martin
*/
/* if($content['collection_id'] == -1) {
$sql = "SELECT content_id, collection_id, title, author_id, type FROM {contents} WHERE collection_id <> -1 AND author_id = ? AND is_active = 1 AND title = ? AND type = ?";
$data = array((int)$content['author_id'], $content['title'], $content['type']);
$res = Dal::query($sql, $data);
if ($res->numRows()) {
$i = 0;
while ($row = $res->fetchRow(DB_FETCHMODE_ASSOC)) {
$group = Group::load_group_by_id((int)$row['collection_id']);
if(is_object($group)) {
if(($group->access_type == ACCESS_PRIVATE) || ($group->reg_type == REG_INVITE)) {
$result = true; // content published in a private Group!
break;
}
}
}
}
} */
}
示例6: route2groups
function route2groups()
{
global $user, $is_edit;
$extra = unserialize(PA::$network_info->extra);
$tags = preg_split('/\\s*,\\s*/', strtolower($_POST['tags']));
$tags = array_unique($tags);
$net_owner = new User();
$net_owner->load((int) PA::$network_info->owner_id);
$valid_post_types = array('BlogPost', 'Contribution', 'Suggestion');
$type = isset($_POST) && isset($_POST['blog_type']) && in_array($_POST['blog_type'], $valid_post_types) ? $_POST['blog_type'] : 'BlogPost';
//find tag entry
$terms = array();
foreach ($tags as $term) {
$tr = trim($term);
if ($tr) {
$terms[] = $tr;
}
}
if (!empty($_POST['route_to_pa_home']) && $_POST['route_to_pa_home'] == 1) {
$display_on_homepage = DISPLAY_ON_HOMEPAGE;
//its zero
} else {
$display_on_homepage = NO_DISPLAY_ON_HOMEPAGE;
//This will not show up on homepage - flag has opposite values
}
if (is_array($_POST['route_targets_group'])) {
if (in_array(-2, $_POST['route_targets_group'])) {
//-2 means Select none of group
// no need to post in any group
} elseif (in_array(-1, $_POST['route_targets_group'])) {
//-1 means select all the groups
// post in all the groups
$group_array = explode(',', $_POST['Allgroups']);
foreach ($group_array as $gid) {
// post to all the groups
$_group = Group::load_group_by_id((int) $gid);
$login_required_str = null;
if ($_group->access_type == ACCESS_PRIVATE) {
$login_required_str = '&login_required=true';
}
switch ($type) {
case 'BlogPost':
default:
$res = BlogPost::save_blogpost(0, PA::$login_uid, $_POST['blog_title'], $_POST['description'], NULL, $terms, $gid, $is_active = 1, $display_on_homepage);
break;
case 'Contribution':
$res = Contribution::save_contribution(0, PA::$login_uid, $_POST['blog_title'], $_POST['description'], NULL, $terms, $gid, $is_active = 1, $display_on_homepage);
break;
case 'Suggestion':
$res = Suggetion::save_suggestion(0, PA::$login_uid, $_POST['blog_title'], $_POST['description'], NULL, $terms, $gid, $is_active = 1, $display_on_homepage);
break;
}
$permalink_cid = $res['cid'];
// NOTE: would this notification message be sent for each group ???
$content_obj = Content::load_content((int) $permalink_cid);
PANotify::send("content_posted", PA::$network_info, $user, $content_obj);
// notify network owner (maybe group owner would be better?)
if ($display_on_homepage == DISPLAY_ON_HOMEPAGE) {
PANotify::send("content_posted_to_comm_blog", PA::$network_info, $user, $content_obj);
}
//-------
//for rivers of people
$activity = 'group_post_a_blog';
$activity_extra['info'] = $user->first_name . 'posted a new blog';
$activity_extra['blog_name'] = $_POST["blog_title"];
$activity_extra['blog_id'] = $permalink_cid;
$activity_extra['blog_url'] = PA::$url . PA_ROUTE_CONTENT . '/cid=' . $permalink_cid . $login_required_str;
$extra = serialize($activity_extra);
$object = $gid;
// update status to unverified
$group = ContentCollection::load_collection((int) $gid, PA::$login_uid);
if ($group->reg_type == REG_MODERATED) {
Network::moderate_network_content((int) $gid, $permalink_cid);
} else {
if ($extra['network_content_moderation'] == NET_YES && $is_edit == 0 && PA::$network_info->owner_id != $user->user_id) {
Network::moderate_network_content($gid, $permalink_cid);
}
}
if (!PA::is_moderated_content() && $group->reg_type != REG_MODERATED) {
//Write to activity log only when moderation is off
Activities::save($user->user_id, $activity, $object, $extra);
}
}
} else {
// post in selected groups
foreach ($_POST['route_targets_group'] as $gid) {
//only send to selected groups
$_group = Group::load_group_by_id((int) $gid);
$login_required_str = null;
if ($_group->access_type == ACCESS_PRIVATE) {
$login_required_str = '&login_required=true';
}
switch ($type) {
case 'BlogPost':
default:
$res = BlogPost::save_blogpost(0, PA::$login_uid, $_POST['blog_title'], $_POST['description'], NULL, $terms, $gid, $is_active = 1, $display_on_homepage);
break;
case 'Contribution':
$res = Contribution::save_contribution(0, PA::$login_uid, $_POST['blog_title'], $_POST['description'], NULL, $terms, $gid, $is_active = 1, $display_on_homepage);
break;
//.........这里部分代码省略.........
示例7: 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;
}
示例8: handleGET_newBoard
private function handleGET_newBoard($request_data)
{
global $error_msg;
$forum_defaults = array('allow_anonymous_post' => false, 'membership_approval' => false, 'allow_users_create_category' => true, 'allow_users_create_forum' => true, 'threads_per_page' => 20, 'posts_per_page' => 20, 'post_edit_mode' => 'tinymce_base', 'avatar_size' => '85x100', 'banned_message' => 'You are banned from this forum!', 'join_requested_message' => 'Your membership request has been sent.', 'join_approved_message' => 'Your membership request has been approved.');
switch ($this->board_type) {
case PaForumBoard::network_board:
$network = Network::get_by_id((int) $request_data['parent_id']);
$title = $network->name . " " . __("network forum board");
break;
case PaForumBoard::group_board:
$group = Group::load_group_by_id((int) $request_data['parent_id']);
$title = $group->title . " " . __("group forum board");
break;
case PaForumBoard::personal_board:
$user = new User();
$user->load((int) $request_data['parent_id']);
$title = $user->login_name . " " . __("personal forum board");
break;
}
if ($request_data['owner_id'] == PA::$login_uid) {
$params = array("owner_id" => $request_data['parent_id'], "network_id" => $this->nid, "title" => $title, "description" => __("Forum Board description goes here"), "type" => $this->board_type, "theme" => 'default', "settings" => serialize($forum_defaults), "is_active" => 1, "created_at" => date("Y-m-d H:i:s"));
try {
$board_id = PaForumBoard::insertPaForumBoard($params);
} catch (Exception $e) {
unset($request_data['action']);
unset($request_data['owner_id']);
$err = "Exception in ForumModule, function handleGET_newBoard();<br />Message: " . $e->getMessage();
$this->redirectWithMessage($err, $request_data);
}
$status = PaForumsUsers::_owner | PaForumsUsers::_allowed;
try {
$params = array("user_id" => $request_data['owner_id'], "board_id" => $board_id, "user_status" => $status, "is_active" => 1, "date_join" => date("Y-m-d H:i:s"));
PaForumsUsers::insertPaForumsUsers($params);
} catch (Exception $e) {
unset($request_data['action']);
unset($request_data['owner_id']);
$err = "Exception in ForumModule, function handleGET_newBoard();<br />Message: " . $e->getMessage();
$this->redirectWithMessage($err, $request_data);
}
unset($request_data);
$request_data['board_id'] = $board_id;
$this->redirectWithMessage(__("Forum Board sucessfully saved"), $request_data, 'info_message');
} else {
$error_msg = __("You don't have permissions to create this Forum Board!");
return 'skip';
}
}
示例9: foreach
foreach ($add_assoc_user_errors as $n => $err) {
$msg .= "<br />{$err}";
}
$is_display = false;
$is_edit = true;
}
// add eventAssociations for valid login_names
}
// add_assoc_group
$add_assoc_group_errors = array();
// declaring array so as to avoid notices for undefined variables
if (isset($_POST['add_assoc_groups'])) {
$ed = get_event_data();
$add_groups = $_POST['add_groups'];
foreach ($add_groups as $i => $add_gid) {
$add_group = Group::load_group_by_id($add_gid);
$add_gname = $add_group->title;
// check if user MAY add
$is_member = Group::get_user_type((int) PA::$login_user->user_id, (int) $add_gid);
if ($is_member == NOT_A_MEMBER) {
$add_assoc_group_errors[] = sprintf(__("You cannot add an Event to the caledar of group %s, as you are not a member."), $add_gname);
} else {
// try to add EventAssociation for this group_id
try {
$ea = new EventAssociation();
$ea->event_id = $ed['event_id'];
$ea->user_id = PA::$login_user->user_id;
$ea->assoc_target_type = 'group';
$ea->assoc_target_id = $add_gid;
$ea->assoc_target_name = $add_gname;
$ea->save();
示例10: generate_inner_html
function generate_inner_html()
{
if ($this->id) {
$this->load_data();
}
if ($this->ccid > 0) {
// load that group so we can check it's access and reg type
$this->group = Group::load_group_by_id((int) $this->ccid);
}
$inner_template = PA::$blockmodule_path . '/' . get_class($this) . '/center_inner_blog.tpl';
$inner_html_blog = new Template($inner_template);
$inner_html_blog->set_object('network_info', PA::$network_info);
$inner_html_blog->set('current_theme_path', PA::$theme_url);
// $inner_html_blog->set('links', $this->links);
$inner_html_blog->set('cid', $this->id);
$inner_html_blog->set('ccid', $this->ccid);
$inner_html_blog->set('parent_collection_id', $this->parent_collection_id);
// some or most of the following can be empty so we use the @
$inner_html_blog->set('blog_title', str_replace('"', '"', @$this->blog_title));
$inner_html_blog->set('blog_type', @$this->blog_type);
switch ($this->blog_type) {
case 'Contribution':
$inner_html_blog->set('message', '<p>Comments are easy to do, but sometimes you need to think about what you\'re writing.
So we\'re providing you with a rich text editor, which can have media (video, photos)
embedded in the text as well as web links. When you\'re done,
just hit the "Publish Post" button.</p>');
break;
case 'Suggestion':
$inner_html_blog->set('message', '<p>Thanks for taking the time to make us even better. Most people
are content with clicking the next link in Google, but not you! You have decided to do something, take action, and help make something powerful.</p>');
break;
case 'BlogPost':
$inner_html_blog->set('message', '<p>A penny for your thoughts, but I think in an depth response is worth much, much more. Thanks
for taking the time to leave a thoughtful tidbit of your knowledge in the Civic Commons. Your peers will thank you.</p>');
break;
default:
break;
}
$redirect = urldecode(isset($_GET) && isset($_GET['redirect']) ? $_GET['redirect'] : '');
$redirect = urldecode(isset($_POST) && isset($_POST['redirect']) ? $_POST['redirect'] : $redirect);
$pattern = '/(https?:\\/\\/)?(((www\\.)?([a-zA-Z0-9_\\.\\-]*)\\b\\.[a-z]{2,4}(\\.[a-z]{2})?)|(localhost))(:[0-9]*)?((\\/[a-zA-Z0-9_\\-\\.]*)+)?(\\.[a-z]*)?(\\?\\S+)?/';
$redirect = preg_match($pattern, $redirect) ? $redirect : '';
$inner_html_blog->set('redirect', urlencode($redirect));
$inner_html_blog->set('body', @$this->body);
$inner_html_blog->set('trackback', @$this->trackback);
$inner_html_blog->set('tag_entry', @$this->tag_entry);
$inner_html_blog->set('error_msg', @$this->error_msg);
$center_content = $inner_html_blog->fetch();
$inner_template = PA::$blockmodule_path . '/' . get_class($this) . '/center_inner_private_simple.tpl';
$inner_html_gen = new Template($inner_template);
$inner_html_gen->set_object('network_info', PA::$network_info);
$inner_html_gen->set('current_theme_path', PA::$theme_url);
/*$inner_html_gen->set('title', $this->title);*/
// $inner_html_gen->set('links', $this->links);
$inner_html_gen->set('sb_mc_type', @$this->sb_mc_type);
$inner_html_gen->set('sb_types', @$this->sb_types);
$inner_html_gen->set('center_content', $center_content);
$inner_html_gen->set('display', $this->display);
$inner_html_gen->set('targets', $this->targets);
$inner_html_gen->set('show_external_blogs', $this->show_external_blogs);
$inner_html_gen->set('user_groups', $this->get_user_groups());
$inner_html_gen->set('group_access', @$this->group->access_type);
$inner_html_gen->set('group_reg', @$this->group->rdg_type);
$inner_html_gen->set('album_type', $this->album_type);
$inner_html_gen->set('outputthis_error_mesg', @$this->outputthis_error_mesg);
$inner_html_gen->set('error_msg', @$this->error_msg);
if ($this->album_type != -1) {
$inner_html_gen->set('user_albums', $this->get_user_albums());
}
$inner_html_gen->set('permission_to_post', $this->permission_to_post);
$inner_html_gen->set('is_edit', $this->is_edit);
$inner_html_gen->set('ccid', $this->ccid);
$post_type_name_singular = $this->blog_type;
if ($post_type_name_singular == 'BlogPost') {
$post_type_name_singular = 'Post';
}
$inner_html_gen->set('post_type_name_singular', $post_type_name_singular);
$inner_html = $inner_html_gen->fetch();
return $inner_html;
}