<?php

if (!isset($_REQUEST["week"])) {
    $_REQUEST["week"] = (int) date("W");
}
if (!isset($_REQUEST["range"])) {
    $_REQUEST["range"] = Statistic::StatisticTimeRangeTypeDay;
}

$this->widget('ext.PlNavbar', array(
    'brand' => __('ANALYTICS_ADVANCED_QUEUE_REPORT_MODULE_LABEL'),
    'enableHelpBtn' => false,
    'summary' => '',
    'items' => array(
        array(
            'class' => 'bootstrap.widgets.TbMenu',
            'items' => array(
                '---',
                array(
                    'label' => isset($_REQUEST['range']) ? Statistic::readable($_REQUEST['range']) : Statistic::readable(Statistic::StatisticTimeRangeTypeDay),
                    'items' => $rangeDropdown,
                    'linkOptions' => array(
                        'data-translation-target' => 'ANALYTICS_TARGET_DROPDOWN_LABEL', //FIXME
                    ),
                ),
            ),
        ),
        !isset($_REQUEST['range']) || $_REQUEST['range'] == Statistic::StatisticTimeRangeTypeDay ? $this->getParentView('dayPicker', array()) : '',
        isset($_REQUEST['range']) && $_REQUEST['range'] == Statistic::StatisticTimeRangeTypeWeek ? $this->getParentView('weekPicker', array("week" => $_REQUEST["week"])) : '',
        isset($_REQUEST['range']) && $_REQUEST['range'] == Statistic::StatisticTimeRangeTypeMonth ? $this->getParentView('monthPicker', array()) : '',
        isset($_REQUEST['range']) && $_REQUEST['range'] == Statistic::StatisticTimeRangeTypeYear ? $this->getParentView('yearPicker', array()) : '',
    ),
        )
);
