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


PHP ElggGroup::getURL方法代码示例

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


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

示例1: group_tools_add_user

/**
 * Add a user to a group
 *
 * @param ElggGroup $group the group to add the user to
 * @param ElggUser  $user  the user to be added
 * @param string    $text  (optional) extra text for the notification
 *
 * @return boolean 	true if successfull
 */
function group_tools_add_user(ElggGroup $group, ElggUser $user, $text = "")
{
    $result = false;
    $loggedin_user = elgg_get_logged_in_user_entity();
    if (!empty($user) && $user instanceof ElggUser && !empty($group) && $group instanceof ElggGroup && !empty($loggedin_user)) {
        // make sure all goes well
        $ia = elgg_set_ignore_access(true);
        if ($group->join($user)) {
            // Remove any invite or join request flags
            remove_entity_relationship($group->getGUID(), "invited", $user->getGUID());
            remove_entity_relationship($user->getGUID(), "membership_request", $group->getGUID());
            // notify user
            $subject = elgg_echo("group_tools:groups:invite:add:subject", array($group->name));
            $msg = elgg_echo("group_tools:groups:invite:add:body", array($user->name, $loggedin_user->name, $group->name, $text, $group->getURL()));
            $params = array("group" => $group, "inviter" => $loggedin_user, "invitee" => $user);
            $msg = elgg_trigger_plugin_hook("invite_notification", "group_tools", $params, $msg);
            if (notify_user($user->getGUID(), $group->getOwnerGUID(), $subject, $msg, null, "email")) {
                $result = true;
            }
        }
        // restore access
        elgg_set_ignore_access($ia);
    }
    return $result;
}
开发者ID:amcfarlane1251,项目名称:ongarde,代码行数:34,代码来源:functions.php

示例2: group_tools_add_user

function group_tools_add_user(ElggGroup $group, ElggUser $user, $text = "")
{
    $result = false;
    if (!empty($user) && $user instanceof ElggUser && !empty($group) && $group instanceof ElggGroup && ($loggedin_user = elgg_get_logged_in_user_entity())) {
        if ($group->join($user)) {
            // Remove any invite or join request flags
            remove_entity_relationship($group->getGUID(), "invited", $user->getGUID());
            remove_entity_relationship($user->getGUID(), "membership_request", $group->getGUID());
            // notify user
            $subject = elgg_echo("group_tools:groups:invite:add:subject", array($group->name));
            $msg = elgg_echo("group_tools:groups:invite:add:body", array($user->name, $loggedin_user->name, $group->name, $text, $group->getURL()));
            if (notify_user($user->getGUID(), $group->getOwnerGUID(), $subject, $msg)) {
                $result = true;
            }
        }
    }
    return $result;
}
开发者ID:remy40,项目名称:gvrs,代码行数:18,代码来源:functions.php

示例3: sendWelcomeMessage

 /**
  * Send a welcome message to the new user of the group
  *
  * @param \ElggUser  $recipient the new user
  * @param \ElggGroup $group     the group
  *
  * @return void
  */
 protected static function sendWelcomeMessage(\ElggUser $recipient, \ElggGroup $group)
 {
     if (!$recipient instanceof \ElggUser || !$group instanceof \ElggGroup) {
         return;
     }
     // get welcome messgae
     $welcome_message = $group->getPrivateSetting('group_tools:welcome_message');
     $check_message = trim(strip_tags($welcome_message));
     if (empty($check_message)) {
         return;
     }
     // replace the place holders
     $welcome_message = str_ireplace('[name]', $recipient->name, $welcome_message);
     $welcome_message = str_ireplace('[group_name]', $group->name, $welcome_message);
     $welcome_message = str_ireplace('[group_url]', $group->getURL(), $welcome_message);
     // subject
     $subject = elgg_echo('group_tools:welcome_message:subject', [$group->name]);
     // notify the user
     notify_user($recipient->getGUID(), $group->getGUID(), $subject, $welcome_message);
 }
开发者ID:coldtrick,项目名称:group_tools,代码行数:28,代码来源:Membership.php

示例4: subgroups_page_handler

/**
 * Dispatches subgroups pages.
 * URLs take the form of
 *  
 *  Group view subgroups:      subgroups/owner/<group_guid>
 *  Group manage subgroups:    subgroups/manage/<group_guid>
 *
 * @param array $page
 * @return NULL
 */
function subgroups_page_handler($page)
{
    $pages_path = elgg_get_plugins_path() . "subgroups/pages";
    switch ($page[0]) {
        case 'add':
        case 'edit':
            elgg_set_page_owner_guid($page[1]);
            include $pages_path . "/subgroups/edit.php";
            break;
        case 'owner':
            elgg_set_page_owner_guid($page[1]);
            include $pages_path . "/subgroups/owner.php";
            break;
        case 'new':
            $group = new ElggGroup((int) $page[1]);
            if (!$group->guid) {
                register_error(elgg_echo('error:default'));
                return false;
            }
            elgg_load_library('elgg:groups');
            $title = elgg_echo('subgroups:new:of', array($group->name));
            elgg_push_breadcrumb(elgg_echo('groups'), "groups/all");
            elgg_push_breadcrumb($group->name, $group->getURL());
            elgg_push_breadcrumb(elgg_echo('subgroups:new'));
            set_input('container_guid', $group->guid);
            $body = elgg_view_layout('content', array('content' => elgg_view('groups/edit'), 'title' => $title, 'filter' => ''));
            echo elgg_view_page($title, $body);
            break;
        default:
            return false;
    }
    return true;
}
开发者ID:lorea,项目名称:Hydra-dev,代码行数:43,代码来源:start.php

示例5: group_tools_transfer_group_ownership

/**
 * Helper function to transfer the ownership of a group to a new user
 *
 * @param ElggGroup $group     the group to transfer
 * @param ElggUser  $new_owner the new owner
 *
 * @return bool
 */
function group_tools_transfer_group_ownership(ElggGroup $group, ElggUser $new_owner)
{
    if (!$group instanceof ElggGroup || !$group->canEdit()) {
        return false;
    }
    if (!$new_owner instanceof ElggUser) {
        return false;
    }
    $loggedin_user = elgg_get_logged_in_user_entity();
    // register plugin hook to make sure transfer can complete
    elgg_register_plugin_hook_handler('permissions_check', 'group', '\\ColdTrick\\GroupTools\\Access::allowGroupOwnerTransfer');
    $old_owner = $group->getOwnerEntity();
    // transfer ownership
    $group->owner_guid = $new_owner->getGUID();
    $group->container_guid = $new_owner->getGUID();
    if (!$group->save()) {
        return false;
    }
    // make sure user is added to the group
    $group->join($new_owner);
    // remove existing group administrator role for new owner
    remove_entity_relationship($new_owner->getGUID(), 'group_admin', $group->getGUID());
    // check for group icon
    if (!empty($group->icontime)) {
        $prefix = "groups/{$group->getGUID()}";
        $sizes = elgg_get_icon_sizes($group->getType());
        $ofh = new ElggFile();
        $ofh->owner_guid = $old_owner->getGUID();
        $nfh = new ElggFile();
        $nfh->owner_guid = $group->getOwnerGUID();
        foreach ($sizes as $size => $info) {
            // set correct file to handle
            $ofh->setFilename("{$prefix}{$size}.jpg");
            if (!$ofh->exists()) {
                // file doesn't exist
                continue;
            }
            $nfh->setFilename("{$prefix}{$size}.jpg");
            // open files
            $ofh->open('read');
            $nfh->open('write');
            // copy file
            $nfh->write($ofh->grabFile());
            // close file
            $ofh->close();
            $nfh->close();
            // cleanup old file
            $ofh->delete();
        }
        $group->icontime = time();
    }
    // move metadata of the group to the new owner
    $options = ['guid' => $group->getGUID(), 'limit' => false];
    $metadata = elgg_get_metadata($options);
    if (!empty($metadata)) {
        foreach ($metadata as $md) {
            if ($md->owner_guid == $old_owner->getGUID()) {
                $md->owner_guid = $new_owner->getGUID();
                $md->save();
            }
        }
    }
    // notify new owner
    if ($new_owner->getGUID() !== $loggedin_user->getGUID()) {
        $subject = elgg_echo('group_tools:notify:transfer:subject', [$group->name]);
        $message = elgg_echo('group_tools:notify:transfer:message', [$new_owner->name, $loggedin_user->name, $group->name, $group->getURL()]);
        notify_user($new_owner->getGUID(), $group->getGUID(), $subject, $message);
    }
    // unregister plugin hook to make sure transfer can complete
    elgg_unregister_plugin_hook_handler('permissions_check', 'group', '\\ColdTrick\\GroupTools\\Access::allowGroupOwnerTransfer');
    return true;
}
开发者ID:coldtrick,项目名称:group_tools,代码行数:80,代码来源:functions.php

示例6: parseGroup

 /**
  * @SWG\Definition(
  *  definition="Group",
  *  required={"guid","name", "membership"},
  *  @SWG\Property(property="guid", type="integer"),
  *  @SWG\Property(property="name", type="string"),
  *  @SWG\Property(property="description", type="string"),
  *  @SWG\Property(property="membership", type="string", description="Can be open or closed."),
  *  @SWG\Property(property="icon_url", type="string"),
  *  @SWG\Property(property="url", type="string"),
  *  @SWG\Property(property="activities_unread_count", type="integer"),
  *  @SWG\Property(property="time_created", type="string")
  * )
  */
 private function parseGroup(\ElggGroup $group)
 {
     $user = elgg_get_logged_in_user_entity();
     return array('guid' => $group->guid, 'name' => html_entity_decode($group->name, ENT_QUOTES), 'description' => html_entity_decode($group->description, ENT_QUOTES), 'membership' => $group->membership === 2 ? "open" : "closed", 'icon_url' => $group->getIconURL(), 'url' => $group->getURL(), 'activities_unread_count' => $this->handler->getContainerUnreadCount($user, $group), 'time_created' => date('c', $group->time_created));
 }
开发者ID:Pleio,项目名称:pleio_rest,代码行数:19,代码来源:Groups.php

示例7: foreach

        $metadata = elgg_get_metadata(array('guid' => $group_guid, 'limit' => false));
        if ($metadata) {
            foreach ($metadata as $md) {
                if ($md->owner_guid == $old_owner_guid) {
                    $md->owner_guid = $new_owner_guid;
                    $md->save();
                }
            }
        }
        // @todo Remove this when #4683 fixed
        $owner_has_changed = true;
        $old_icontime = $group->icontime;
        //
        $new_owner = get_entity($new_owner_guid);
        $subject = elgg_echo('zhgroups:transfer:onwer:subject', array($group->name));
        $body = '<div style="color:#333;font-size:16px;">' . elgg_echo('zhgroups:transfer:onwer:body', array($new_owner->name, $user->getURL(), $user->name, $group->getURL(), $group->name, $group->getURL(), $group->name)) . '</div>';
        zhgroups_send_email_to_user($group, $new_owner, $subject, $body, true, true);
    }
}
$must_move_icons = $owner_has_changed && $old_icontime;
$group->save();
add_entity_relationship($group->owner_guid, 'notifyemail', $group->guid);
if (!check_entity_relationship($group->owner_guid, 'notifyemail', $group->guid)) {
    register_error(elgg_echo('zhgroups:notifications:sub:error') . elgg_echo('zhaohu:sorry'));
}
// Invisible group support
// @todo this requires save to be called to create the acl for the group. This
// is an odd requirement and should be removed. Either the acl creation happens
// in the action or the visibility moves to a plugin hook
if (elgg_get_plugin_setting('hidden_groups', 'groups') == 'yes') {
    $visibility = (int) get_input('vis', '', false);
开发者ID:pingwangcs,项目名称:51zhaohu,代码行数:31,代码来源:edit.php

示例8: hj_framework_edit_object_action


//.........这里部分代码省略.........
                $file->close();
                move_uploaded_file($attachments['tmp_name'][$i], $file->getFilenameOnFilestore());
                $saved = $file->save();
                if ($saved) {
                    $mime_type = ElggFile::detectMimeType($attachments['tmp_name'][$i], $attachments['type'][$i]);
                    $info = pathinfo($name);
                    $office_formats = array('docx', 'xlsx', 'pptx');
                    if ($mime_type == "application/zip" && in_array($info['extension'], $office_formats)) {
                        switch ($info['extension']) {
                            case 'docx':
                                $mime_type = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
                                break;
                            case 'xlsx':
                                $mime_type = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
                                break;
                            case 'pptx':
                                $mime_type = "application/vnd.openxmlformats-officedocument.presentationml.presentation";
                                break;
                        }
                    }
                    // check for bad ppt detection
                    if ($mime_type == "application/vnd.ms-office" && $info['extension'] == "ppt") {
                        $mime_type = "application/vnd.ms-powerpoint";
                    }
                    //add_metastring("projectId");
                    //$file->projectId = $project_guid;
                    $file->setMimeType($mime_type);
                    $file->originalfilename = $name;
                    if (elgg_is_active_plugin('file')) {
                        $file->simpletype = file_get_simple_type($mime_type);
                    }
                    $saved = $file->save();
                    if ($saved) {
                        $file->addRelationship($guid, 'attachment');
                    }
                }
            }
        }
        $accesslevel = get_input('accesslevel', false);
        $params = array('entity' => $entity);
        $form = hj_framework_prepare_form($form_name, $params);
        $fields = $form['form']['fields'];
        $ignore_fields = array('guid', 'type', 'subtype', 'owner_guid', 'container_guid', 'access_id', 'title', 'description');
        foreach ($fields as $name => $options) {
            if (in_array($name, $ignore_fields)) {
                continue;
            }
            if (!$options) {
                continue;
            }
            $type = elgg_extract('input_type', $options, 'text');
            $accesslevel_id = isset($accesslevel[$name]) ? $accesslevel[$name] : $entity->access_id;
            $params = array('name' => $name, 'form_name' => $form_name, 'field' => $options, 'access_id' => $accesslevel_id, 'entity' => $entity, 'event' => $event);
            if (!elgg_trigger_plugin_hook('process:input', "form:input:name:{$name}", $params, false) && !elgg_trigger_plugin_hook('process:input', "form:input:type:{$type}", $params, false)) {
                $value = get_input($name);
                set_input($name, null);
                //				if (!$value) {
                //					elgg_delete_metadata(array(
                //						'guid' => $entity->guid,
                //						'metadata_name' => $name
                //					));
                //
                //					continue;
                //				}
                //
                //				if (is_array($value) && count($value) > 1) {
                //					elgg_delete_metadata(array(
                //						'guid' => $entity->guid,
                //						'metadata_name' => $name
                //					));
                //					foreach ($value as $val) {
                //						if (!empty($val)) {
                //							create_metadata($entity->guid, $name, $val, '', $entity->owner_guid, $accesslevel_id, true);
                //						}
                //					}
                //				} else {
                //					if (is_array($value)) {
                //						$value = implode(',', $value);
                //					}
                //					create_metadata($entity->guid, $name, $value, '', $entity->owner_guid, $accesslevel_id);
                //				}
                $entity->{$name} = $value;
            }
        }
        $entity->save();
        elgg_trigger_plugin_hook('process:form', "form:{$form_name}", array('form_name' => $form_name, 'entity' => $entity), null);
    }
    $forward_url = elgg_trigger_plugin_hook('action:forward', 'form', array('entity' => $entity, 'form_name' => $form_name), $entity->getURL());
    foreach ($_POST['user-callout-id'] as $callout_user) {
        $callout_user_guids[] = $callout_user;
    }
    if ($callout_user_guids) {
        $calloutUsers = new UserCallout(get_entity(elgg_get_logged_in_user_guid()), $callout_user_guids, "a forum post", $forward_url);
        $calloutUsers->sendUserNotifications();
    }
    system_message(elgg_echo('hj:framework:submit:success'));
    elgg_clear_sticky_form($form_name);
    hj_framework_clear_form_validation_status($form_name);
    return array('entity' => $entity, 'forward' => $forward_url);
}
开发者ID:amcfarlane1251,项目名称:ongarde,代码行数:101,代码来源:actions.php


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