当前位置: 首页>>代码示例>>PHP>>正文


PHP ElggGroup::canEdit方法代码示例

本文整理汇总了PHP中ElggGroup::canEdit方法的典型用法代码示例。如果您正苦于以下问题:PHP ElggGroup::canEdit方法的具体用法?PHP ElggGroup::canEdit怎么用?PHP ElggGroup::canEdit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ElggGroup的用法示例。


在下文中一共展示了ElggGroup::canEdit方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: groups_register_profile_buttons

/**
 * Registers the buttons for title area of the group profile page
 *
 * @param ElggGroup $group
 */
function groups_register_profile_buttons($group)
{
    $actions = array();
    // group owners
    if ($group->canEdit()) {
        // edit and invite
        $url = elgg_get_site_url() . "groups/edit/{$group->getGUID()}";
        $actions[$url] = 'groups:edit';
        $url = elgg_get_site_url() . "groups/invite/{$group->getGUID()}";
        $actions[$url] = 'groups:invite';
    }
    // group members
    if ($group->isMember(elgg_get_logged_in_user_entity())) {
        if ($group->getOwnerGUID() != elgg_get_logged_in_user_guid()) {
            // leave
            $url = elgg_get_site_url() . "action/groups/leave?group_guid={$group->getGUID()}";
            $url = elgg_add_action_tokens_to_url($url);
            $actions[$url] = 'groups:leave';
        }
    } elseif (elgg_is_logged_in()) {
        // join - admins can always join.
        $url = elgg_get_site_url() . "action/groups/join?group_guid={$group->getGUID()}";
        $url = elgg_add_action_tokens_to_url($url);
        if ($group->isPublicMembership() || $group->canEdit()) {
            $actions[$url] = 'groups:join';
        } else {
            // request membership
            $actions[$url] = 'groups:joinrequest';
        }
    }
    if ($actions) {
        foreach ($actions as $url => $text) {
            elgg_register_menu_item('title', array('name' => $text, 'href' => $url, 'text' => elgg_echo($text), 'link_class' => 'elgg-button elgg-button-action'));
        }
    }
}
开发者ID:thehereward,项目名称:Elgg,代码行数:41,代码来源:groups.php

示例2: htmlspecialchars

    }
    if ($valuetype == 'tags') {
        $input[$shortname] = string_to_tag_array($input[$shortname]);
    }
}
$input['name'] = htmlspecialchars(get_input('name', '', false), ENT_QUOTES, 'UTF-8');
$user = elgg_get_logged_in_user_entity();
$group_guid = (int) get_input('group_guid');
$is_new_group = $group_guid == 0;
if ($is_new_group && elgg_get_plugin_setting('limited_groups', 'groups') == 'yes' && !$user->isAdmin()) {
    register_error(elgg_echo("groups:cantcreate"));
    forward(REFERER);
}
$group = new ElggGroup($group_guid);
// load if present, if not create a new group
if ($group_guid && !$group->canEdit()) {
    register_error(elgg_echo("groups:cantedit"));
    forward(REFERER);
}
// Assume we can edit or this is a new group
if (sizeof($input) > 0) {
    foreach ($input as $shortname => $value) {
        // update access collection name if group name changes
        if (!$is_new_group && $shortname == 'name' && $value != $group->name) {
            $group_name = html_entity_decode($value, ENT_QUOTES, 'UTF-8');
            $ac_name = sanitize_string(elgg_echo('groups:group') . ": " . $group_name);
            $acl = get_access_collection($group->group_acl);
            if ($acl) {
                // @todo Elgg api does not support updating access collection name
                $db_prefix = elgg_get_config('dbprefix');
                $query = "UPDATE {$db_prefix}access_collections SET name = '{$ac_name}' \n\t\t\t\t\tWHERE id = {$group->group_acl}";
开发者ID:duanhv,项目名称:mdg-social,代码行数:31,代码来源:edit.php

示例3: ElggGroup

    if ($valuetype == 'tags') {
        $input[$shortname] = string_to_tag_array($input[$shortname]);
    }
}
$user_guid = get_input('user_guid');
$user = NULL;
if (!$user_guid) {
    $user = $_SESSION['user'];
} else {
    $user = get_entity($user_guid);
}
$dgroup_guid = get_input('dgroup_guid');
$dgroup = new ElggGroup($dgroup_guid);
// load if present, if not create a new dgroup
$dgroup->subtype = 'dgroup';
if ($dgroup_guid && !$dgroup->canEdit() && !isadminloggedin()) {
    register_error(elgg_echo("dgroups:cantedit"));
    forward($_SERVER['HTTP_REFERER']);
    exit;
}
// Assume we can edit or this is a new dgroup
if (sizeof($input) > 0) {
    foreach ($input as $shortname => $value) {
        $dgroup->{$shortname} = $value;
    }
}
// Validate create
if (!$dgroup->name) {
    register_error(elgg_echo("dgroups:notitle"));
    forward($_SERVER['HTTP_REFERER']);
    exit;
开发者ID:eokyere,项目名称:elgg,代码行数:31,代码来源:edit.php

示例4: groups_register_profile_buttons

/**
 * Registers the buttons for title area of the group profile page
 *
 * @param ElggGroup $group
 */
function groups_register_profile_buttons($group)
{
    $user = elgg_get_logged_in_user_entity();
    $actions = array();
    // group owners
    if ($group->canEdit()) {
        // local groups except town groups cannot be edited (except by admins)
        if ($group->grouptype != 'local' || $group->grouptype == 'local' && $group->localtype == 'town' || $user->isAdmin()) {
            $url = elgg_get_site_url() . "groups/edit/{$group->getGUID()}";
            $actions[$url] = 'groups:edit';
        }
        // local groups except town groups cannot use invitation system
        if ($group->grouptype != 'local' || $group->grouptype == 'local' && $group->localtype == 'town') {
            $url = elgg_get_site_url() . "groups/invite/{$group->getGUID()}";
            $actions[$url] = 'groups:invite';
        }
    }
    // add a button to allow adding town groups (only for group members)
    if ($group->grouptype == 'local' && $group->localtype == 'departemental' && $group->isMember(elgg_get_logged_in_user_entity())) {
        $url = elgg_get_site_url() . "groups/local/add/{$group->getGUID()}";
        $actions[$url] = 'localgroups:addtown';
    }
    // group members (not for local groups except town group)
    if ($group->grouptype == 'local' && $group->localtype == 'town' || $group->grouptype != 'local') {
        if ($group->isMember(elgg_get_logged_in_user_entity())) {
            if ($group->getOwnerGUID() != elgg_get_logged_in_user_guid()) {
                // leave
                $url = elgg_get_site_url() . "action/groups/leave?group_guid={$group->getGUID()}";
                $url = elgg_add_action_tokens_to_url($url);
                $actions[$url] = 'groups:leave';
            }
        } elseif (elgg_is_logged_in()) {
            // join - admins can always join.
            $url = elgg_get_site_url() . "action/groups/join?group_guid={$group->getGUID()}";
            $url = elgg_add_action_tokens_to_url($url);
            if ($group->isPublicMembership() || $group->canEdit()) {
                $actions[$url] = 'groups:join';
            } else {
                // request membership
                $actions[$url] = 'groups:joinrequest';
            }
        }
    }
    if ($actions) {
        foreach ($actions as $url => $text) {
            elgg_register_menu_item('title', array('name' => $text, 'href' => $url, 'text' => elgg_echo($text), 'link_class' => 'elgg-button elgg-button-action'));
        }
    }
}
开发者ID:remy40,项目名称:gvrs,代码行数:54,代码来源:groups.php

示例5: event_manager_can_create_group_events

/**
 * Checks if a certain user can create group events
 *
 * @param $group Group to check rights for
 * @param $user  User to check rights for
 *
 * @return bool
 */
function event_manager_can_create_group_events(\ElggGroup $group, $user = null)
{
    if (empty($user)) {
        $user = elgg_get_logged_in_user_entity();
    }
    if (!$group instanceof \ElggGroup || !$user instanceof \ElggUser) {
        return false;
    }
    $who_create_group_events = elgg_get_plugin_setting('who_create_group_events', 'event_manager');
    // group_admin, members
    switch ($who_create_group_events) {
        case 'group_admin':
            return $group->canEdit($user->guid);
        case 'members':
            if ($group->isMember($user)) {
                return true;
            } else {
                return $group->canEdit($user->guid);
            }
    }
    return false;
}
开发者ID:coldtrick,项目名称:event_manager,代码行数:30,代码来源:functions.php

示例6: group_tools_group_mail_members_enabled

/**
 * Check if group mail is enabled for members
 *
 * @param ElggGroup $group The group to check (can be empty to check plugin setting)
 *
 * @return bool
 */
function group_tools_group_mail_members_enabled(ElggGroup $group = null)
{
    static $mail_members_enabled;
    if (!isset($mail_members_enabled)) {
        $mail_members_enabled = false;
        $setting = elgg_get_plugin_setting('mail_members', 'group_tools');
        if ($setting === 'yes') {
            $mail_members_enabled = true;
        }
    }
    // quick return if mail members is not allowed
    if (!group_tools_group_mail_enabled()) {
        return false;
    }
    if (!$mail_members_enabled) {
        return false;
    }
    if (empty($group) || !$group instanceof ElggGroup) {
        return true;
    }
    if ($group->canEdit()) {
        // group owners and admin can mail
        return true;
    }
    if ($group->isMember() && $group->mail_members_enable === 'yes') {
        return true;
    }
    return false;
}
开发者ID:coldtrick,项目名称:group_tools,代码行数:36,代码来源:functions.php


注:本文中的ElggGroup::canEdit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。