當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。