Esempio n. 1
0
/**
 * check child pages for their own sub-pages
 *
 * @param array $rs list of child-pages
 *
 * @return string HTML sitemap
 */
function Sitemap_getLinks($rs)
{
    global $PAGEDATA;
    $c = '';
    foreach ($rs as $r) {
        $d = strpos($r['classes'], 'hasChildren') !== false ? '<ul>' . Sitemap_getLinks(Menu_getChildren($r['id'], $PAGEDATA->id)) . '</ul>' : '';
        $c .= '<li><a href="' . $r['link'] . '" class="' . $r['classes'] . '">' . htmlspecialchars($r['name']) . '</a>' . $d . '</li>';
    }
    return $c;
}
Esempio n. 2
0
function Menu_show($b)
{
    global $PAGEDATA;
    if (!$PAGEDATA->id) {
        return '';
    }
    $md5 = md5('ww_menudisplay|' . print_r($b, true));
    $cache = cache_load('menus', $md5);
    if ($cache) {
        return $cache;
    }
    if (is_array($b)) {
        $align = isset($b['direction']) && $b['direction'] == 'vertical' ? 'Left' : 'Top';
        $vals = $b;
    } else {
        $arr = explode('|', $b);
        $b = $arr[0];
        $vals = array();
        if (count($arr) > 1) {
            $d = split(',', $arr[1]);
        } else {
            $d = array();
        }
        foreach ($d as $e) {
            $f = split('=', $e);
            if (count($f) > 1) {
                $vals[$f[0]] = $f[1];
            } else {
                $vals[$f[0]] = 1;
            }
        }
        $c = '';
        $align = $b == 'vertical' ? 'Left' : 'Top';
    }
    $parent = 0;
    $classes = '';
    if (isset($vals['mode'])) {
        if ($vals['mode'] == 'accordian' || $vals['mode'] == 'accordion') {
            $classes .= ' click_required accordion';
        } else {
            if ($vals['mode'] == 'two-tier') {
                $classes .= ' two-tier';
            }
        }
    } else {
        $vals['mode'] = 'default';
    }
    if (isset($vals['preopen_menu'])) {
        $classes .= ' preopen_menu';
    }
    if (isset($vals['close']) && $vals['close'] == 'no') {
        $classes .= ' noclose';
    }
    if (isset($vals['parent'])) {
        $r = Page::getInstanceByName($vals['parent']);
        if ($r) {
            $parent = $r->id;
        }
    }
    if (isset($vals['spans'])) {
        $vals['spans'] = (int) $vals['spans'];
    } else {
        $vals['spans'] = 1;
    }
    $search_options = 0;
    $ajaxmenu = $vals['nodropdowns'] ? '' : ' ajaxmenu ';
    $c = '<div id="ajaxmenu' . $parent . '" class="menuBar' . $align . $ajaxmenu . $classes . ' parent' . $parent . '">';
    $rs = Menu_getChildren($parent, $PAGEDATA->id, 0, $parent, $search_options);
    $links = 0;
    if ($vals['spans']) {
        $spanl = '<span class="l"></span>';
        $spanr = '<span class="r"></span>';
    } else {
        $spanl = '';
        $spanr = '';
    }
    if (count($rs)) {
        foreach ($rs as $r) {
            $page = Page::getInstance($r['id']);
            if (!$links) {
                $r['classes'] .= ' first';
            }
            $c .= '<a id="ajaxmenu_link' . $r['id'] . '" class="' . $r['classes'] . '" href="' . $page->getRelativeURL() . '">' . $spanl . htmlspecialchars($page->name) . $spanr . '</a>';
            $links++;
        }
    }
    if (!@$GLOBALS['DBVARS']['disable-hidden-sitemap']) {
        $c .= '<a class="menuItemTop nojs" href="' . $PAGEDATA->getRelativeURL() . '?webmespecial=sitemap">' . __('Site Map') . '</a>';
    }
    $c .= '</div>';
    if ($vals['mode'] == 'two-tier') {
        $pid = $PAGEDATA->getTopParentId();
        if ($pid != 2 && $pid != 3 && $pid != 17 && $pid != 32 && $pid != 33 && $pid != 34) {
            $pid = 2;
        }
        $rs = Menu_getChildren($pid, $PAGEDATA->id, 0, $parent, $search_options);
        $c .= '<div id="ajaxmenu' . $pid . '" class="menu tier-two">';
        if (count($rs)) {
            foreach ($rs as $r) {
                $page = Page::getInstance($r['id']);
                $c .= '<a id="ajaxmenu_link' . $r['id'] . '" class="' . $r['classes'] . '" href="' . $page->getRelativeURL() . '">' . $spanl . htmlspecialchars($page->name) . $spanr . '</a>';
            }
        } else {
            $c .= '<a><span class="l"></span>&nbsp;<span class="r"></span></a>';
        }
        $c .= '</div>';
    }
    cache_save('menus', $md5, $c);
    return $c;
}
Esempio n. 3
0
/**
 * retrieve a list of pages
 *
 * @param int  $parentid       the page which the returned pages are contained in
 * @param int  $currentpage    the id of the page the viewer's currently reading
 * @param int  $topParent      the top page for this menu
 * @param text $search_options filters to search under
 *
 * @return text
 */
function AjaxMenu_getChildren($parentid, $currentpage = 0, $topParent = 0, $search_options = 0)
{
    return array($parentid, Menu_getChildren($parentid, $currentpage, 0, $topParent, $search_options));
}
Esempio n. 4
0
function Menu_getSubMenuBootstrap($parent, $top_id)
{
    if (!$parent['numchildren']) {
        return '';
    }
    $rs = Menu_getChildren($parent['id'], $PAGEDATA->id, 0, $top_id);
    $html = '<ul class="dropdown-menu">';
    foreach ($rs as $r) {
        $html .= '<li><a href="' . htmlspecialchars($r['link']) . '"' . ' classes="' . $r['classes'] . '">' . htmlspecialchars($r['name']) . '</a>' . Menu_getSubMenuBootstrap($r, $top_id) . '</li>';
    }
    $html .= '</ul>';
    return $html;
}
<?php

require '../../ww.incs/basics.php';
if (!is_admin()) {
    exit;
}
require '../../ww.incs/menus.php';
$p = (int) $_REQUEST['p'];
echo json_encode(array('pid' => $p, 'subpages' => Menu_getChildren($p, 0, 1)));
Esempio n. 6
0
/**
 * retrieve list of pages for a menu
 *
 * @return array array of menu items
 */
function Core_getMenu()
{
    require_once 'menus.php';
    return array(@$_REQUEST['pid'], Menu_getChildren(@$_REQUEST['pid'], @$_REQUEST['id'], 0, @$_REQUEST['top_id']));
}