Exemple #1
0
/**
 * Navigation menu for a user's or a group's pages
 *
 * @uses $vars['page'] Page object if manually setting selected item
 */
$page_guid = (int) get_input("guid");
$page = false;
if (!empty($page_guid)) {
    $page = get_entity($page_guid);
}
$selected_page = elgg_extract("page", $vars, $page);
// do we have a selected page
if (pages_tools_is_valid_page($selected_page)) {
    // make the navigation tree
    if (pages_tools_register_navigation_tree($selected_page)) {
        $title = elgg_echo("pages:navigation");
        $title .= "<span " . elgg_format_attributes(array("class" => "float-alt", "title" => elgg_echo("pages_tools:navigation:tooltip"))) . ">";
        $title .= elgg_view_icon("info");
        $title .= "</span>";
        // get the navigation menu
        $menu = "<div id='pages-tools-navigation' class='hidden'>";
        $menu .= elgg_view_menu("pages_nav", array("class" => "pages-nav", "sort_by" => "priority"));
        $menu .= "</div>";
        $menu .= elgg_view("graphics/ajax_loader", array("hidden" => false));
        // load the correct JS/css
        elgg_load_js("jquery.tree");
        elgg_load_css("jquery.tree");
        // draw everything
        echo elgg_view_module("aside", $title, $menu);
    }
Exemple #2
0
<?php

$entity = elgg_extract('entity', $vars);
if (!pages_tools_is_valid_page($entity)) {
    return;
}
$root_page = pages_tools_get_root_page($entity);
$tree_data = pages_tools_get_tree_html_from_cache($root_page);
if ($tree_data !== false) {
    echo $tree_data;
    return;
}
if (!pages_tools_register_navigation_tree($entity)) {
    return;
}
// get the navigation menu
$tree_data = elgg_view_menu('pages_nav', array('class' => 'pages-nav', 'sort_by' => 'priority'));
pages_tools_save_tree_html_to_cache($root_page, $tree_data);
echo $tree_data;