<?php
// Charray's CMS (CCMS) Version 0.9.1.1
//
// Copyright (c) 2007, Kinson Chan
// charray[at]gmail.com / kchan[at]cs.hku.hk
// All rights reserved.
//
// Please refer to LICENSE.txt coming with this package for
// terms and conditions for redistribution and reuse.
if (!defined("CCMS_IN")) {
die();
}
function ccms_module_navigation($file) {
global $ccms_controller_url;
global $ccms_path;
$result = array();
$menu = ccms_expanded_menu('/', $ccms_path);
$result['title'] = "<a href=\"$ccms_controller_url/\">" . htmlentities($menu['/']['title'], ENT_COMPAT, 'UTF-8') . '</a>';
$result['content'] = ccms_module_navigation_menu($menu['/']['nested']);
return $result;
}
function ccms_module_navigation_menu($menu) {
global $ccms_controller_url;
$result = '';
if (!$menu) {
return $result;
}
$result .= "<ul style=\"list-style-type: none; margin: 3px 0px 3px 5px;\n" .
"padding: 0px 0px 0px 0px;\">\n";
foreach ($menu as $path => $info) {
$path = str_replace('%2F', '/', urlencode($path));
$info['title'] = htmlentities($info['title'], ENT_COMPAT, 'UTF-8');
$result .= '<li style="margin: 2px 0px 0px 2px;">';
$result .= "<a href=\"$ccms_controller_url$path\">";
$result .= $info['title'];
$result .= "</a>\n";
if (isset($info['nested']) && !empty($info['nested'])) {
$result .= ccms_module_navigation_menu($info['nested']);
}
$result .= "</li>\n";
}
$result .= "</ul>\n";
return $result;
}
?>