tray/src/messenger/webim/libs/statistics.php
2013-03-13 07:52:48 +00:00

42 lines
1.5 KiB
PHP

<?php
/*
* 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.
*/
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)
{
global $page, $webimroot;
$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') : ""
);
if (Settings::get('enabletracking')) {
$page['tabs'][getlocal("report.bypage.title")] = ($active != 2 ? "$webimroot/operator/statistics.php".get_statistics_query('bypage') : "");
}
}
?>