本文整理汇总了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;
}
示例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;
}