2012-03-14 00:09:37 +04:00
|
|
|
<?php
|
|
|
|
/*
|
2013-03-13 01:03:50 +04:00
|
|
|
* Copyright 2005-2013 the original author or authors.
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
2012-03-14 00:09:37 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
function get_statistics_query($type)
|
|
|
|
{
|
|
|
|
$query = $_SERVER['QUERY_STRING'];
|
|
|
|
if (! empty($query)) {
|
|
|
|
$query = '?'.$query;
|
|
|
|
$query = preg_replace("/\?type=\w+\&/", "?", $query);
|
|
|
|
$query = preg_replace("/(\?|\&)type=\w+/", "", $query);
|
|
|
|
}
|
|
|
|
$query .= strstr($query, "?") ? "&type=$type" : "?type=$type";
|
|
|
|
return $query;
|
|
|
|
}
|
|
|
|
|
|
|
|
function setup_statistics_tabs($active)
|
|
|
|
{
|
2012-07-16 18:26:53 +04:00
|
|
|
global $page, $webimroot;
|
2012-03-14 00:09:37 +04:00
|
|
|
$page['tabs'] = array(
|
|
|
|
getlocal("report.bydate.title") => $active != 0 ? "$webimroot/operator/statistics.php".get_statistics_query('bydate') : "",
|
|
|
|
getlocal("report.byoperator.title") => $active != 1 ? "$webimroot/operator/statistics.php".get_statistics_query('byagent') : ""
|
|
|
|
);
|
2012-07-16 18:26:53 +04:00
|
|
|
if (Settings::get('enabletracking')) {
|
2012-03-14 00:09:37 +04:00
|
|
|
$page['tabs'][getlocal("report.bypage.title")] = ($active != 2 ? "$webimroot/operator/statistics.php".get_statistics_query('bypage') : "");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-13 01:03:50 +04:00
|
|
|
?>
|