2008-11-26 22:50:40 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* AgileBill - Open Billing Software
|
|
|
|
*
|
|
|
|
* This body of work is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the Open AgileBill License
|
|
|
|
* License as published at http://www.agileco.com/agilebill/license1-4.txt
|
2009-08-03 04:10:16 +00:00
|
|
|
*
|
|
|
|
* Originally authored by Tony Landis, AgileBill LLC
|
|
|
|
*
|
|
|
|
* Recent modifications by Deon George
|
|
|
|
*
|
|
|
|
* @author Deon George <deonATleenooksDOTnet>
|
|
|
|
* @copyright 2009 Deon George
|
|
|
|
* @link http://osb.leenooks.net
|
2008-11-26 22:50:40 +00:00
|
|
|
*
|
|
|
|
* @link http://www.agileco.com/
|
|
|
|
* @copyright 2004-2008 Agileco, LLC.
|
|
|
|
* @license http://www.agileco.com/agilebill/license1-4.txt
|
2009-08-03 04:10:16 +00:00
|
|
|
* @author Tony Landis <tony@agileco.com>
|
|
|
|
* @package AgileBill
|
|
|
|
* @subpackage Menu
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The main AgileBill Admin Menu Method
|
|
|
|
*
|
2008-11-26 22:50:40 +00:00
|
|
|
* @package AgileBill
|
2009-08-03 04:10:16 +00:00
|
|
|
* @subpackage Menu
|
2008-11-26 22:50:40 +00:00
|
|
|
*/
|
2009-08-03 04:10:16 +00:00
|
|
|
|
|
|
|
function auth_generate_admin_menu($menu_obj) {
|
|
|
|
global $C_translate,$smarty,$C_list;
|
|
|
|
|
2008-11-26 22:50:40 +00:00
|
|
|
$menu_obj->auth_update();
|
|
|
|
|
2009-08-03 04:10:16 +00:00
|
|
|
$i = 1;
|
|
|
|
$js = '';
|
|
|
|
$arr = $menu_obj->module;
|
2008-11-26 22:50:40 +00:00
|
|
|
$arr2 = $menu_obj->module;
|
|
|
|
|
2009-08-03 04:10:16 +00:00
|
|
|
# Loop through the modules
|
|
|
|
while (list($module,$val) = each($arr)) {
|
|
|
|
if (! empty($val[2])) {
|
|
|
|
if ($val[1] == $val[0] || empty($val[0]) || empty($val[1])) {
|
|
|
|
$module_name = $C_translate->translate('menu',$module,'','menutitle');
|
2008-11-26 22:50:40 +00:00
|
|
|
$parent = $val[0];
|
|
|
|
$module_id = $val[0];
|
2009-08-03 04:10:16 +00:00
|
|
|
$module_arr[$i]['name'] = $module_name;
|
|
|
|
$module_arr[$i]['module'] = $module;
|
|
|
|
|
|
|
|
# Loop through the methods
|
|
|
|
while (list($method,$meth_arr) = each($arr[$module])) {
|
|
|
|
if (gettype($meth_arr) == 'array' && ! empty($meth_arr[1])) {
|
|
|
|
$method_name = $C_translate->translate($method,$module,'','methodtitle');
|
2008-11-26 22:50:40 +00:00
|
|
|
|
|
|
|
if(empty($meth_arr[2]))
|
|
|
|
$page = $module.':'.$method;
|
|
|
|
else
|
2009-08-03 04:10:16 +00:00
|
|
|
$page = htmlspecialchars(str_replace('%%',$module,$meth_arr[2]));
|
2008-11-26 22:50:40 +00:00
|
|
|
|
2009-08-03 04:10:16 +00:00
|
|
|
$module_arr[$i]['methods'][] = array('name'=>$method_name,'page'=>$page);
|
2008-11-26 22:50:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-08-03 04:10:16 +00:00
|
|
|
# Loop through the sub-modules:
|
2008-11-26 22:50:40 +00:00
|
|
|
reset($arr2);
|
2009-08-03 04:10:16 +00:00
|
|
|
$ii = 0;
|
|
|
|
while (list($module,$val) = each ($arr2)) {
|
|
|
|
if (! empty($val[2])) {
|
|
|
|
if ($val[1] == $parent && $module_id != $val[0]) {
|
|
|
|
$module_name = $C_translate->translate('menu',$module,'','menutitle');
|
|
|
|
$module_arr[$i]["sub_name"][$ii] = $module_name;
|
|
|
|
|
|
|
|
# Loop through the methods
|
|
|
|
while (list($method,$meth_arr) = each($arr2[$module])) {
|
|
|
|
if (gettype($meth_arr) == 'array' && ! empty($meth_arr[1])) {
|
|
|
|
$method_name = $C_translate->translate($method,$module,'','methodtitle');
|
|
|
|
|
|
|
|
if(empty($meth_arr[2]))
|
|
|
|
$page = $module.':'.$method;
|
|
|
|
else
|
|
|
|
$page = htmlspecialchars(str_replace('%%',$module,$meth_arr[2]));
|
|
|
|
|
|
|
|
$module_arr[$i]['sub_methods'][$ii][] = array('name'=>$method_name,'page'=>$page);
|
2008-11-26 22:50:40 +00:00
|
|
|
}
|
|
|
|
}
|
2009-08-03 04:10:16 +00:00
|
|
|
|
|
|
|
$ii++;
|
2008-11-26 22:50:40 +00:00
|
|
|
}
|
|
|
|
}
|
2009-08-03 04:10:16 +00:00
|
|
|
}
|
2008-11-26 22:50:40 +00:00
|
|
|
|
2009-08-03 04:10:16 +00:00
|
|
|
$i++;
|
|
|
|
}
|
|
|
|
}
|
2008-11-26 22:50:40 +00:00
|
|
|
}
|
|
|
|
|
2009-08-03 04:10:16 +00:00
|
|
|
# Generate the main modules:
|
2008-11-26 22:50:40 +00:00
|
|
|
$js = '';
|
2009-01-05 02:21:21 +00:00
|
|
|
$js .= ".|Overview|javascript:openUrl('?_page=core:admin');\n";
|
|
|
|
$js .= ".|Exit Administration|javascript:exitAdmin();\n";
|
2008-11-26 22:50:40 +00:00
|
|
|
|
2009-08-03 04:10:16 +00:00
|
|
|
for ($i=1; $i<=count($module_arr); $i++) {
|
2008-11-26 22:50:40 +00:00
|
|
|
$name = $module_arr[$i]['name'];
|
|
|
|
$js .= ".|{$name}\n";
|
|
|
|
|
2009-08-03 04:10:16 +00:00
|
|
|
# Generate the main methods:
|
|
|
|
for ($ii=0; $ii<count($module_arr[$i]['methods']); $ii++) {
|
2008-11-26 22:50:40 +00:00
|
|
|
$name = $module_arr[$i]['methods'][$ii]['name'];
|
2009-08-03 04:10:16 +00:00
|
|
|
$page = $module_arr[$i]['methods'][$ii]['page'];
|
2009-01-05 02:21:21 +00:00
|
|
|
|
|
|
|
$js .= "..|{$name}|javascript:openUrl('?_page={$page}')\n";
|
2008-11-26 22:50:40 +00:00
|
|
|
}
|
|
|
|
|
2009-08-03 04:10:16 +00:00
|
|
|
# Generate the sub modules:
|
|
|
|
for ($ii=0; $ii<count(@$module_arr[$i]['sub_name']); $ii++) {
|
2008-11-26 22:50:40 +00:00
|
|
|
$name = $module_arr[$i]['sub_name'][$ii];
|
2009-01-05 02:21:21 +00:00
|
|
|
$js .= "..|{$name}|#\n";
|
2009-08-03 04:10:16 +00:00
|
|
|
|
|
|
|
# Generate the sub methods:
|
|
|
|
for ($iii=0; $iii<count($module_arr[$i]['sub_methods'][$ii]); $iii++) {
|
2008-11-26 22:50:40 +00:00
|
|
|
$name = $module_arr[$i]['sub_methods'][$ii][$iii]['name'];
|
|
|
|
$page = $module_arr[$i]['sub_methods'][$ii][$iii]['page'];
|
2009-01-05 02:21:21 +00:00
|
|
|
$js .= "...|{$name}|javascript:openUrl('?_page={$page}')\n";
|
2008-11-26 22:50:40 +00:00
|
|
|
}
|
|
|
|
}
|
2009-08-03 04:10:16 +00:00
|
|
|
}
|
2008-11-26 22:50:40 +00:00
|
|
|
|
2009-08-03 04:10:16 +00:00
|
|
|
# Set the dates for the quicksearch
|
|
|
|
$smarty->assign('today_start',$C_list->date(mktime(0,0,0,date('m'),date('d'),date('Y'))));
|
|
|
|
$smarty->assign('week_start',$C_list->date(mktime(0,0,0,date('m'),date('d')-7,date('Y'))));
|
|
|
|
$smarty->assign('month_start',$C_list->date(mktime(0,0,0,date('m'),1,date('Y'))));
|
2008-11-26 22:50:40 +00:00
|
|
|
|
|
|
|
# Generate the menu
|
2009-08-03 04:10:16 +00:00
|
|
|
require_once(PATH_INCLUDES.'phplayers/PHPLIB.php');
|
|
|
|
require_once(PATH_INCLUDES.'phplayers/layersmenu-common.inc.php');
|
|
|
|
require_once(PATH_INCLUDES.'phplayers/treemenu.inc.php');
|
2008-11-26 22:50:40 +00:00
|
|
|
|
2009-08-03 04:10:16 +00:00
|
|
|
# Unstoppable agileco logo ;)
|
|
|
|
echo '<img src="themes/default/images/logo-small.png" alt="Logo" style="border: 0; position: absolute; top: 8px; left: 45px;"/>';
|
2008-11-26 22:50:40 +00:00
|
|
|
|
|
|
|
$mnu = new TreeMenu();
|
|
|
|
$mnu->setMenuStructureString($js);
|
2009-08-03 04:10:16 +00:00
|
|
|
$mnu->setIconsize(16,16);
|
2008-11-26 22:50:40 +00:00
|
|
|
$mnu->parseStructureForMenu('treemenu1');
|
2009-08-03 04:10:16 +00:00
|
|
|
$mnu->setTreemenuTheme('kde_');
|
|
|
|
return $mnu->newTreeMenu('treemenu1');
|
2008-11-26 22:50:40 +00:00
|
|
|
}
|
2009-01-05 02:21:21 +00:00
|
|
|
?>
|