Do not use global $page array in setup_statistics_tabs func

This commit is contained in:
Dmitriy Simushev 2014-01-16 09:50:32 +00:00
parent ab56e6f35b
commit 175686aded
2 changed files with 14 additions and 6 deletions

View File

@ -32,16 +32,24 @@ function get_statistics_query($type)
return $query;
}
function setup_statistics_tabs($active)
{
global $page;
$page['tabs'] = array(
/**
* Builds list of the statistics tabs. The keys of the resulting array are
* tabs titles and the values are tabs URLs.
*
* @param int $active Number of the active tab. The count starts from 0.
* @return array Tabs list
*/
function setup_statistics_tabs($active) {
$tabs = array(
getlocal("report.bydate.title") => $active != 0 ? (MIBEW_WEB_ROOT . "/operator/statistics.php".get_statistics_query('bydate')) : "",
getlocal("report.byoperator.title") => $active != 1 ? (MIBEW_WEB_ROOT . "/operator/statistics.php".get_statistics_query('byagent')) : ""
);
if (Settings::get('enabletracking')) {
$page['tabs'][getlocal("report.bypage.title")] = ($active != 2 ? (MIBEW_WEB_ROOT . "/operator/statistics.php".get_statistics_query('bypage')) : "");
$tabs[getlocal("report.bypage.title")] = ($active != 2 ? (MIBEW_WEB_ROOT . "/operator/statistics.php".get_statistics_query('bypage')) : "");
}
return $tabs;
}
/**

View File

@ -181,7 +181,7 @@ $page['title'] = getlocal("statistics.title");
$page['menuid'] = "statistics";
prepare_menu($operator);
setup_statistics_tabs($activetab);
$page['tabs'] = setup_statistics_tabs($activetab);
$page_style = new PageStyle(PageStyle::currentStyle());
$page_style->render('statistics');