<?php   
$source = app()->locale->aMName.'_'.app()->locale->pMName;
$search = array(
    app()->locale->aMName,
    app()->locale->pMName
);
$replace  = array('am','pm');
$result = str_replace($search,$replace ,$source);
$result = explode('_',$result);

?>
<script>
$.fn.datetimepicker.dates['en'] = {
    days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"],
    meridiem: [<?php echo (json_encode($result[0])); ?>, <?php echo(json_encode($result[1])); ?>],
    daysShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
    daysMin:<?php echo(json_encode(array_values(Yii::app()->locale->getWeekDayNames('abbreviated', true))));?>,
    months:<?php echo(json_encode(array_values(Yii::app()->locale->getMonthNames('wide', true))));?>,
    monthsShort: <?php echo(json_encode(array_values(Yii::app()->locale->getMonthNames('abbreviated', true))));?>,
    today: "<?php echo  __("CALENDAR_TODAY");?>",
    suffix: ["st", "nd", "rd", "th"],
};
</script>
<?php
if (!isset($_POST["week"])) {
    $_POST["week"] = (int)date("W");
}

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

$xAxisTranslationTag = 'ANALYTIC_QUEUE_REPORT_X_AXIS_LABEL_FOR_'.Statistic::readable(Statistic::StatisticTimeRangeTypeDay,true);
if (isset($_GET['range'])) {
 $xAxisTranslationTag = 'ANALYTIC_QUEUE_REPORT_X_AXIS_LABEL_FOR_'.Statistic::readable($_GET['range'],true);
 
}
if (app()->user->translateMode) {
  for ($i=0;$i<4;$i++) {

    $tag = 'ANALYTIC_QUEUE_REPORT_X_AXIS_LABEL_FOR_'.Statistic::readable($i,true);
    echo "<i data-translation-id='".$tag."'>".$tag."= ".__($tag)."</i><br>";
  }
}
$dataUrl = url('analyticsQueueReport/default/createReport');

echo $this->getParentView('index',array('dataUrl'=>$dataUrl,'xAxisTranslationTag'=>$xAxisTranslationTag));
?>
