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


PHP ElggMenuItem::setPriority方法代码示例

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


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

示例1: user_hover_hook

/**
 * 
 * @param type $hook
 * @param type $type
 * @param type $returnvalue
 * @param type $params
 * @return ElggMenuItem
 */
function user_hover_hook($hook, $type, $returnvalue, $params)
{
    $user = $params['entity'];
    $url = elgg_get_site_url() . "activity_tabs/user/{$user->username}";
    $item = new \ElggMenuItem('activity_tabs_user_activity', elgg_echo('activity_tabs'), $url);
    if ($type == 'menu:user_hover') {
        $item->setSection('action');
        $item->setLinkClass('activity-tabs-user-hover');
        $item->setPriority(200);
    }
    $returnvalue[] = $item;
    return $returnvalue;
}
开发者ID:smellems,项目名称:mt_activity_tabs,代码行数:21,代码来源:hooks.php

示例2: elgg_user_hover_menu

/**
 * Setup the default user hover menu
 * @access private
 */
function elgg_user_hover_menu($hook, $type, $return, $params)
{
    $user = $params['entity'];
    /* @var ElggUser $user */
    if (elgg_is_logged_in()) {
        // remove add friend from profile page
        // 		if (elgg_get_logged_in_user_guid() != $user->guid) {
        // 			if ($user->isFriend()) {
        // 				$url = "action/friends/remove?friend={$user->guid}";
        // 				$text = elgg_echo('friend:remove');
        // 				$name = 'remove_friend';
        // 			} else {
        // 				$url = "action/friends/add?friend={$user->guid}";
        // 				$text = elgg_echo('friend:add');
        // 				$name = 'add_friend';
        // 			}
        // 			$url = elgg_add_action_tokens_to_url($url);
        // 			$item = new ElggMenuItem($name, $text, $url);
        // 			$item->setSection('action');
        // 			$return[] = $item;
        // 		}
        if (elgg_get_logged_in_user_guid() == $user->guid) {
            $url = "profile/{$user->username}/edit";
            $item = new ElggMenuItem('profile:edit', elgg_echo('profile:edit'), $url);
            $item->setSection('action');
            $return[] = $item;
            $url = "avatar/edit/{$user->username}";
            $item = new ElggMenuItem('avatar:edit', elgg_echo('avatar:edit'), $url);
            $item->setSection('action');
            $return[] = $item;
            if (elgg_get_viewtype() == 'mobile') {
                $url = "profile/{$user->username}/view";
                $itemText = 'profile:view';
            } else {
                $url = "profile/{$user->username}";
                $itemText = 'profile:home_page';
            }
            $item = new ElggMenuItem('profile:home_page', elgg_echo($itemText), $url);
            $item->setSection('action');
            $return[] = $item;
            if (elgg_get_viewtype() == 'mobile') {
                $url = "action/logout";
                $item = new ElggMenuItem('profile:logout', elgg_echo('logout'), $url);
                $item->setSection('action');
                $item->setPriority(1);
                $return[] = $item;
            }
        }
    }
    // prevent admins from banning or deleting themselves
    if (elgg_get_logged_in_user_guid() == $user->guid) {
        return $return;
    }
    if (elgg_is_admin_logged_in()) {
        $actions = array();
        if (!$user->isBanned()) {
            $actions[] = 'ban';
        } else {
            $actions[] = 'unban';
        }
        $actions[] = 'delete';
        $actions[] = 'resetpassword';
        if (!$user->isAdmin()) {
            $actions[] = 'makeadmin';
        } else {
            $actions[] = 'removeadmin';
        }
        foreach ($actions as $action) {
            $url = "action/admin/user/{$action}?guid={$user->guid}";
            $url = elgg_add_action_tokens_to_url($url);
            $item = new ElggMenuItem($action, elgg_echo($action), $url);
            $item->setSection('admin');
            $item->setLinkClass('elgg-requires-confirmation');
            $return[] = $item;
        }
        $url = "profile/{$user->username}/edit";
        $item = new ElggMenuItem('profile:edit', elgg_echo('profile:edit'), $url);
        $item->setSection('admin');
        $return[] = $item;
        $url = "settings/user/{$user->username}";
        $item = new ElggMenuItem('settings:edit', elgg_echo('settings:edit'), $url);
        $item->setSection('admin');
        $return[] = $item;
    }
    return $return;
}
开发者ID:pingwangcs,项目名称:51zhaohu,代码行数:90,代码来源:users.php


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