예제 #1
0
 public static function prepareMenu($h, $t, $v, $p)
 {
     $default = new MenuList(elgg_extract('default', $v, []));
     $alt = new MenuList(elgg_extract('alt', $v, []));
     // dump alt items into default
     $default->appendList($alt);
     $avatar = $default->get('profile');
     $account = $default->get('account');
     if ($avatar && $account) {
         $user = elgg_get_logged_in_user_entity();
         // copy account children under avatar
         $children = new MenuList($account->getChildren());
         // copy admin out
         $admin = $children->remove('administration');
         $url = $avatar->getHref();
         $profile = new \ElggMenuItem('view-profile', elgg_echo('profile'), $url);
         $children->move($profile, 0);
         $avatar->setHref(null);
         elgg_push_context('mrclay_aalborg_topbar');
         $avatar->setText(elgg_view_entity_icon($user, 'tiny'));
         elgg_pop_context();
         $default->remove($account);
         $default->push($avatar);
         if ($admin) {
             $admin->setTooltip(elgg_echo('admin'));
             $admin->setText(elgg_view_icon('settings-alt'));
             $default->move($admin, 0);
         }
     }
     return ['default' => $default->getItems()];
 }
예제 #2
0
파일: hooks.php 프로젝트: Elgg/probation
function hook_prepare_entity_menu($hook, $type, $menus, $params)
{
    $entity = elgg_extract('entity', $params);
    if (!$entity->{QUARANTINED}) {
        return;
    }
    $list = new MenuList($menus['default']);
    $list->move(\ElggMenuItem::factory(['name' => 'probation_approve_content', 'href' => elgg_add_action_tokens_to_url("action/probation/approve_content?guid={$entity->guid}"), 'text' => 'Approve (probation)', 'title' => 'Restore this content to its desired access level']), 0);
    $list->remove('access');
    $menus['default'] = $list->getItems();
    return $menus;
}
예제 #3
0
 public static function prepareMenu($h, $t, $v, $p)
 {
     if (!elgg_in_context('mrclay_aalborg_topbar')) {
         return;
     }
     $action_section = new MenuList(elgg_extract('action', $v, []));
     $action_section->remove('avatar:edit');
     $user = $p['entity'];
     /* @var \ElggUser $user */
     if (elgg_is_active_plugin('notifications')) {
         $item = \ElggMenuItem::factory(array('name' => '2_a_user_notify', 'text' => elgg_echo('notifications:subscriptions:changesettings'), 'href' => "notifications/personal/{$user->username}", 'section' => "notifications"));
         $action_section->push($item);
         if (elgg_is_active_plugin('groups')) {
             $item = \ElggMenuItem::factory(array('name' => '2_group_notify', 'text' => elgg_echo('notifications:subscriptions:changesettings:groups'), 'href' => "notifications/group/{$user->username}", 'section' => "notifications"));
             $action_section->push($item);
         }
     }
     $item = \ElggMenuItem::factory(array('name' => 'logout', 'text' => elgg_view_icon('sign-out') . elgg_echo('logout'), 'href' => elgg_add_action_tokens_to_url("action/logout")));
     $action_section->push($item);
     $v['action'] = $action_section->getItems();
     return $v;
 }
예제 #4
0
 public static function registerExtrasMenu($h, $t, $v, $p)
 {
     $all = new MenuList($v);
     $all->remove('file_list');
     return $all->getItems();
 }