/**
  * Generates a page with statistics info.
  *
  * @param Request $request
  * @return string Rendered page content
  */
 public function indexAction(Request $request)
 {
     $operator = $this->getOperator();
     $statistics_type = $request->attributes->get('type');
     $page = array();
     $page['operator'] = get_operator_name($operator);
     $page['availableDays'] = range(1, 31);
     $page['availableMonth'] = get_month_selection(time() - 400 * 24 * 60 * 60, time() + 50 * 24 * 60 * 60);
     $page['showresults'] = false;
     $page['type'] = $statistics_type;
     $page['showbydate'] = $statistics_type == self::TYPE_BY_DATE;
     $page['showbyagent'] = $statistics_type == self::TYPE_BY_OPERATOR;
     $page['showbypage'] = $statistics_type == self::TYPE_BY_PAGE;
     $cron_uri = $this->generateUrl('cron', array('cron_key' => Settings::get('cron_key')), UrlGeneratorInterface::ABSOLUTE_URL);
     $page['pageDescription'] = getlocal('From this page you can generate a variety of usage reports. Last time statistics was calculated {0}. You can calculate it <a href="{1}" target="_blank">manually</a>.', array(date_to_text(Settings::get('_last_cron_run')), $cron_uri));
     $page['show_invitations_info'] = (bool) Settings::get('enabletracking');
     $page['errors'] = array();
     // Get and validate time interval
     $time_interval = $this->extractTimeInterval($request);
     $start = $time_interval['start'];
     $end = $time_interval['end'];
     if ($start > $end) {
         $page['errors'][] = getlocal('You have selected From date after Till date');
     }
     $page = array_merge($page, set_form_date($start, 'start'), set_form_date($end - 24 * 60 * 60, 'end'));
     // Get statistics info
     if ($statistics_type == self::TYPE_BY_DATE) {
         $statistics = get_by_date_statistics($start, $end);
         $page['reportByDate'] = $statistics['records'];
         $page['reportByDateTotal'] = $statistics['total'];
     } elseif ($statistics_type == self::TYPE_BY_OPERATOR) {
         $page['reportByAgent'] = get_by_operator_statistics($start, $end);
     } elseif ($statistics_type == self::TYPE_BY_PAGE) {
         $page['reportByPage'] = get_by_page_statistics($start, $end);
     }
     $page['showresults'] = count($page['errors']) == 0;
     $page['title'] = getlocal("Statistics");
     $page['menuid'] = "statistics";
     $page = array_merge($page, prepare_menu($operator));
     $page['tabs'] = $this->buildTabs($request);
     return $this->render('statistics', $page);
 }
示例#2
0
        $tmlPage['formendday'] = date('d', $currTime);
        $tmlPage['formendmonth'] = date('m.y', $currTime);
    }
}
//
// This function should be defined before it's used otherwise on
// some PHP verions it can fail with Fatal error: Call to undefined function
//
function get_operators_list()
{
    $operators = Operator::getInstance()->GetAllAccessedOperators();
    $result = array();
    $result[''] = Resources::Get('search.any.operator');
    if (!empty($operators)) {
        foreach ($operators as $op) {
            $result[$op['operatorid']] = $op['fullname'];
        }
    }
    return $result;
}
$tmlPage['availableDays'] = range(1, 31);
$currTime = getCurrentTime();
$tmlPage['availableMonth'] = get_month_selection($currTime - 400 * 24 * 60 * 60, $currTime);
$tmlPage['operatorList'] = get_operators_list();
$TML->assign('departments', Operator::getInstance()->enumAvailableDepartmentsForOperator($operator['operatorid'], Resources::getCurrentLocale()));
$TML->assign('locales', getAvailableLocalesForChat());
$tmlPage['show_empty'] = $show_empty;
$TML->assign('page_settings', $tmlPage);
$TML->assign('advanced', true);
$TML->display('thread_search.tpl');
require_once dirname(__FILE__) . '/inc/admin_epilog.php';
示例#3
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.
 */
require_once '../libs/common.php';
require_once '../libs/chat.php';
require_once '../libs/operator.php';
$operator = check_login();
setlocale(LC_TIME, getstring("time.locale"));
$page = array();
$page['operator'] = topage(get_operator_name($operator));
$page['availableDays'] = range(1, 31);
$page['availableMonth'] = get_month_selection(time() - 400 * 24 * 60 * 60, time() + 50 * 24 * 60 * 60);
$page['showresults'] = false;
$errors = array();
if (isset($_GET['startday'])) {
    $startday = verifyparam("startday", "/^\\d+\$/");
    $startmonth = verifyparam("startmonth", "/^\\d{2}.\\d{2}\$/");
    $endday = verifyparam("endday", "/^\\d+\$/");
    $endmonth = verifyparam("endmonth", "/^\\d{2}.\\d{2}\$/");
    $start = get_form_date($startday, $startmonth);
    $end = get_form_date($endday, $endmonth) + 24 * 60 * 60;
} else {
    $curr = getdate(time());
    if ($curr['mday'] < 7) {
        // previous month
        if ($curr['mon'] == 1) {
            $month = 12;