示例#1
0
文件: item.php 项目: ibou77/elgg
 * @package Elgg.Core
 * @subpackage Navigation
 *
 * @uses $vars['item']       ElggMenuItem
 * @uses $vars['item_class'] Additional CSS class for the menu item
 */
$item = $vars['item'];
$link_class = 'elgg-menu-closed';
if ($item->getSelected()) {
    // @todo switch to addItemClass when that is implemented
    //$item->setItemClass('elgg-state-selected');
    $link_class = 'elgg-menu-opened';
}
$children = $item->getChildren();
if ($children) {
    $item->addLinkClass($link_class);
    $item->addLinkClass('elgg-menu-parent');
}
$item_class = $item->getItemClass();
if ($item->getSelected()) {
    $item_class = "{$item_class} elgg-state-selected";
}
if (isset($vars['item_class']) && $vars['item_class']) {
    $item_class .= ' ' . $vars['item_class'];
}
echo "<li class=\"{$item_class}\">";
echo elgg_view_menu_item($item);
if ($children) {
    echo elgg_view('navigation/menu/elements/section', array('items' => $children, 'class' => 'elgg-menu elgg-child-menu'));
}
echo '</li>';
示例#2
0
    echo elgg_echo('viewfailure', array(__FILE__));
    return TRUE;
}
$icon = elgg_view_entity_icon($user, 'large', array('use_hover' => false, 'use_link' => false, 'img_class' => 'photo u-photo'));
$icon = "<img src='" . $user->getIconURL('large') . "' class='img-responsive'/>";
// grab the actions and admin menu items from user hover
$menu = elgg_trigger_plugin_hook('register', "menu:user_hover", array('entity' => $user), array());
$builder = new ElggMenuBuilder($menu);
$menu = $builder->getMenu();
$actions = elgg_extract('action', $menu, array());
$admin = elgg_extract('admin', $menu, array());
$profile_actions = '';
if (elgg_is_logged_in() && $actions) {
    $profile_actions = '<div class="btn-group-vertical btn-block" style="margin-top:20px;margin-bottom:20px;">';
    foreach ($actions as $action) {
        $item = elgg_view_menu_item($action, array('class' => 'btn btn-success ' . $action->getItemClass()));
        $profile_actions .= "{$item}";
    }
    $profile_actions .= '</div>';
}
$profile_actions = elgg_view_menu('owner_block', array('entity' => $user));
elgg_view('page/elements/owner_block/extend', $vars);
// if admin, display admin links
$admin_links = '';
if (elgg_is_admin_logged_in() && elgg_get_logged_in_user_guid() != elgg_get_page_owner_guid()) {
    $text = elgg_echo('admin:options');
    $admin_links = '<ul class="nav nav-pills nav-stacked">';
    $admin_links .= "<li><a rel=\"toggle\" href=\"#profile-menu-admin\">{$text}&hellip;</a>";
    $admin_links .= '<ul class="profile-admin-menu" id="profile-menu-admin">';
    foreach ($admin as $menu_item) {
        $admin_links .= elgg_view('navigation/menu/elements/item', array('item' => $menu_item));
示例#3
0
    // no user so we quit view
    echo elgg_echo('viewfailure', array(__FILE__));
    return TRUE;
}
$icon = elgg_view_entity_icon($user, 'large', array('use_hover' => false, 'use_link' => false, 'img_class' => 'photo u-photo'));
// grab the actions and admin menu items from user hover
$menu = elgg_trigger_plugin_hook('register', "menu:user_hover", array('entity' => $user), array());
$builder = new ElggMenuBuilder($menu);
$menu = $builder->getMenu();
$actions = elgg_extract('action', $menu, array());
$admin = elgg_extract('admin', $menu, array());
$profile_actions = '';
if (elgg_is_logged_in() && $actions) {
    $profile_actions = '<ul class="elgg-menu profile-action-menu mvm">';
    foreach ($actions as $action) {
        $item = elgg_view_menu_item($action, array('class' => 'elgg-button elgg-button-action'));
        $profile_actions .= "<li class=\"{$action->getItemClass()}\">{$item}</li>";
    }
    $profile_actions .= '</ul>';
}
// if admin, display admin links
$admin_links = '';
if (elgg_is_admin_logged_in() && elgg_get_logged_in_user_guid() != elgg_get_page_owner_guid()) {
    $text = elgg_echo('admin:options');
    $admin_links = '<ul class="profile-admin-menu-wrapper">';
    $admin_links .= "<li><a rel=\"toggle\" href=\"#profile-menu-admin\">{$text}&hellip;</a>";
    $admin_links .= '<ul class="profile-admin-menu" id="profile-menu-admin">';
    foreach ($admin as $menu_item) {
        $admin_links .= elgg_view('navigation/menu/elements/item', array('item' => $menu_item));
    }
    $admin_links .= '</ul>';
 /**
  * Get the menu item content (usually a link)
  *
  * @param array $vars Options to pass to output/url if a link
  * @return string
  * @deprecated 1.9 Use elgg_view_menu_item()
  */
 public function getContent(array $vars = array())
 {
     elgg_deprecated_notice("ElggMenuItem::getContent() deprecated by elgg_view_menu_item()", 1.9);
     return elgg_view_menu_item($this, $vars);
 }
示例#5
0
}
$icon_view = '';
$icon = $item->getData('icon');
if ($icon) {
    $icon_view = elgg_view_icon($icon);
}
$indicator_view = '';
$indicator = $item->getData('indicator');
if (isset($indicator)) {
    $indicator_view = elgg_format_element('span', ['class' => 'elgg-menu-indicator'], (int) $indicator);
}
if ($item->getData('title')) {
    $item->addLinkClass('elgg-tooltip');
}
$item->setText($icon_view . $text . $indicator_view);
$item_view = elgg_view_menu_item($item);
if ($children) {
    $item_view .= elgg_view('navigation/menu/elements/section', ['items' => $children, 'class' => 'elgg-menu elgg-child-menu', 'subsections' => $item->getData('subsections'), 'child_menu' => true]);
}
echo elgg_format_element('li', ['class' => $item->getItemClass(), 'data-menu-item' => $item->getName()], $item_view);
$require = (array) $item->getData('require');
if (!empty($require)) {
    ?>
	<script>
		require(<?php 
    echo json_encode($require);
    ?>
);
	</script>
	<?php 
}
示例#6
0
文件: owner_block.php 项目: n8b/VMN
    echo elgg_echo('viewfailure', array(__FILE__));
    return TRUE;
}
$icon = elgg_view_entity_icon($user, 'large', array('use_hover' => false, 'use_link' => false, 'img_class' => 'photo u-photo'));
$icon = "<img src='" . $user->getIconURL('large') . "' class='img-responsive'/>";
// grab the actions and admin menu items from user hover
$menu = elgg_trigger_plugin_hook('register', "menu:user_hover", array('entity' => $user), array());
$builder = new ElggMenuBuilder($menu);
$menu = $builder->getMenu();
$actions = elgg_extract('action', $menu, array());
$admin = elgg_extract('admin', $menu, array());
$profile_actions = '';
if (elgg_is_logged_in() && $actions) {
    $profile_actions = '<div class="btn-group-vertical btn-block" style="margin-top:20px;margin-bottom:20px;">';
    foreach ($actions as $action) {
        $item = elgg_view_menu_item($action, array('class' => 'btn btn-success'));
        $profile_actions .= "{$item}";
    }
    $profile_actions .= '</div>';
}
// if admin, display admin links
$admin_links = '';
if (elgg_is_admin_logged_in() && elgg_get_logged_in_user_guid() != elgg_get_page_owner_guid()) {
    $text = elgg_echo('admin:options');
    $admin_links = '<ul class="nav nav-pills nav-stacked">';
    $admin_links .= "<li><a rel=\"toggle\" href=\"#profile-menu-admin\">{$text}&hellip;</a>";
    $admin_links .= '<ul class="profile-admin-menu" id="profile-menu-admin">';
    foreach ($admin as $menu_item) {
        $admin_links .= elgg_view('navigation/menu/elements/item', array('item' => $menu_item));
    }
    $admin_links .= '</ul>';
示例#7
0
}
$entity = $item->getData('entity');
$collapse = (bool) $item->getData('collapse');
$children = $item->getChildren();
$item_class = array($item->getItemClass());
$submenu = '';
if ($children) {
    $item_class[] = "elgg-menu-parent";
    $item_class[] = $collapse ? 'elgg-menu-closed' : 'elgg-menu-open';
    $toggle = '<span class="elgg-child-menu-toggle"><span class="collapse ">&#9698;</span><span class="expand">&#9654;</span></span>';
    if (!empty($children)) {
        $submenu = elgg_view('navigation/menu/categories/section', array('items' => $children, 'class' => 'elgg-menu elgg-child-menu', 'collapse' => true));
    }
} else {
    $item_class[] = "elgg-menu-nochildren";
    $toggle = '<span class="elgg-child-menu-indicator">&#9675;</span>';
}
if (elgg_in_context('categories-manage')) {
    if (!$submenu) {
        $submenu = elgg_format_element('ul', array('class' => 'elgg-menu elgg-child-menu'));
    }
    $toggle = '';
}
if ($item->getSelected()) {
    $item_class[] = "elgg-state-selected";
}
if (isset($vars['item_class'])) {
    $item_class[] = $vars['item_class'];
}
echo elgg_format_element('li', array('class' => $item_class, 'data-guid' => $entity->guid, 'data-href' => $entity ? $entity->getURL() : ''), $toggle . elgg_view_menu_item($item) . $submenu);