Exemplo n.º 1
0
/**
 * Returns a menu element link wit subitems.
 * If the link refers to the current page, only the name will be returned.
 * @param $link (string) URL
 * @param $data (array) link data
 * @param $level (int) item level
 */
function F_menu_link($link, $data, $level = 0)
{
    global $l, $db;
    require_once '../config/tce_config.php';
    if (!$data['enabled'] or $_SESSION['session_user_level'] < $data['level']) {
        // this item is disabled
        return;
    }
    $str = '<li>';
    if ($link != basename($_SERVER['SCRIPT_NAME'])) {
        $str .= '<a href="' . $data['link'] . '" title="' . $data['title'] . '"';
        if (!empty($data['key'])) {
            $str .= ' accesskey="' . $data['key'] . '"';
        }
        if (F_menu_isChildActive($data)) {
            $str .= ' class="active"';
        }
        $str .= '>' . $data['name'] . '</a>';
    } else {
        // active link
        $str .= '<span class="active">' . $data['name'] . '</span>';
    }
    if (isset($data['sub']) and !empty($data['sub'])) {
        // print sub-items
        $sublevel = $level + 1;
        $str .= K_NEWLINE . '<!--[if lte IE 6]><iframe class="menu"></iframe><![endif]-->' . K_NEWLINE;
        $str .= '<ul>' . K_NEWLINE;
        foreach ($data['sub'] as $sublink => $subdata) {
            $str .= F_menu_link($sublink, $subdata, $sublevel);
        }
        $str .= '</ul>' . K_NEWLINE;
    }
    $str .= '</li>' . K_NEWLINE;
    return $str;
}
Exemplo n.º 2
0
//============================================================+
/**
 * @file
 * Output XHTML unordered list menu.
 * @package com.tecnick.tcexam.admin
 * @author Nicola Asuni
 * @since 2010-09-16
 */
/**
 */
require_once '../../shared/code/tce_functions_menu.php';
$menu = array('index.php' => array('link' => 'index.php', 'title' => $l['h_index'], 'name' => $l['w_index'], 'level' => K_AUTH_PUBLIC_INDEX, 'key' => 'i', 'enabled' => true), 'tce_test_allresults.php' => array('link' => 'tce_test_allresults.php', 'title' => $l['t_all_results_user'], 'name' => $l['w_results'], 'level' => K_AUTH_PUBLIC_TEST_RESULTS, 'key' => 'r', 'enabled' => $_SESSION['session_user_level'] > K_AUTH_PUBLIC_TEST_RESULTS), 'tce_page_user.php' => array('link' => 'tce_page_user.php', 'title' => $l['w_user'], 'name' => $l['w_user'], 'level' => K_AUTH_PAGE_USER, 'key' => 'u', 'enabled' => $_SESSION['session_user_level'] > 0), 'admin' => array('link' => '../../admin/code/index.php', 'title' => $l['h_admin_link'], 'name' => $l['w_admin'], 'level' => K_ADMIN_LINK, 'key' => 'a', 'enabled' => $_SESSION['session_user_level'] >= K_ADMIN_LINK), 'tce_logout.php' => array('link' => 'tce_logout.php', 'title' => $l['h_logout_link'], 'name' => $l['w_logout'], 'level' => 1, 'key' => 'q', 'enabled' => $_SESSION['session_user_level'] > 0), 'tce_login.php' => array('link' => 'tce_login.php', 'title' => $l['h_login_link'], 'name' => $l['w_login'], 'level' => 0, 'key' => 'l', 'enabled' => $_SESSION['session_user_level'] < 1));
$menu['tce_page_user.php']['sub'] = array('tce_user_change_email.php' => array('link' => 'tce_user_change_email.php', 'title' => $l['t_user_change_email'], 'name' => $l['w_change_email'], 'level' => K_AUTH_USER_CHANGE_EMAIL, 'key' => '', 'enabled' => true), 'tce_user_change_password.php' => array('link' => 'tce_user_change_password.php', 'title' => $l['t_user_change_password'], 'name' => $l['w_change_password'], 'level' => K_AUTH_USER_CHANGE_PASSWORD, 'key' => '', 'enabled' => true));
echo '<a name="menusection" id="menusection"></a>' . K_NEWLINE;
// link to skip navigation
echo '<div class="hidden">';
echo '<a href="#topofdoc" accesskey="2" title="[2] ' . $l['w_skip_navigation'] . '">' . $l['w_skip_navigation'] . '</a>';
echo '</div>' . K_NEWLINE;
$menudata = '';
foreach ($menu as $link => $data) {
    $menudata .= F_menu_link($link, $data, 0);
}
if (!empty($menudata)) {
    echo '<ul class="menu">' . K_NEWLINE;
    echo $menudata;
    echo '</ul>' . K_NEWLINE;
    // end of menu
}
//============================================================+
// END OF FILE
//============================================================+
Exemplo n.º 3
0
//    Additionally, you can't remove, move or hide the original TCExam logo,
//    copyrights statements and links to Tecnick.com and TCExam websites.
//
//    See LICENSE.TXT file for more information.
//============================================================+
/**
 * @file
 * Output XHTML unordered list menu for user.
 * @package com.tecnick.tcexam.public
 * @author Nicola Asuni
 * @since 2010-09-20
 */
/**
 */
require_once '../config/tce_config.php';
$pagelevel = K_AUTH_PAGE_USER;
require_once '../../shared/code/tce_authorization.php';
$thispage_title = $l['w_user'];
require_once '../code/tce_page_header.php';
echo '<div class="container">' . K_NEWLINE;
// print submenu
echo '<ul>' . K_NEWLINE;
foreach ($menu['tce_page_user.php']['sub'] as $link => $data) {
    echo F_menu_link($link, $data, 1);
}
echo '</ul>' . K_NEWLINE;
echo '</div>' . K_NEWLINE;
require_once '../code/tce_page_footer.php';
//============================================================+
// END OF FILE
//============================================================+