<?php 
$html='';
        $html.='<div
                class=" input-append input-prepend date dateTimePicker navbar-search"
                id="datetimepicker" 
            >';        
// 	  $html.='<span class="add-on"><i class="icon-arrow-left" onclick="prevYear()"></i></span>';
	  $html.= CHtml::textField('StatisticDay',date('Y'), array(
            'size'=>60,
            'maxlength'=>256,
            'readonly'=>'readonly',
            'disabled' => 'disabled',
            'class'=>'span1'
        ));

        $html.='<span class="add-on"><i class="icon-th"></i></span>';
        $html.='</div>';
//         $html.='<span class="add-on"><i class="icon-arrow-right" onclick="nextYear()"></i></span>';
      echo $html;
      $dataUrl =  url('analyticsDailyReport/default/createReport',
	array(
	  'id'=>isset($_GET['id']) ? $_GET['id'] : $model ? $model->id :'',
	  'targetType'=>isset($_GET['targetType']) ? $_GET['targetType'] : $model ? $this->getStatisticTypeByClassName(get_class($model)) :'',
	)
      );
      
      
      echo "<div id='dropdown' style='display:inline'></div>" // placeholder for Week Selector
?>
<script>
getWeekDropdown();
$('#dropdown').on("change", "#weekDropdown", function() {
    selectWeek(this.value);
    updateDiagram();
});

$('#StatisticDay').on('change',function(){
  getWeekDropdown();
});

function getWeekDropdown() {
  $.post(
    '<?php echo url('analytics/analytic/ajaxGetWeekDropdown')?>',
    {
      year:$('#StatisticDay').val(),
      week:'<?php echo $week ?>',
      '<?php echo Yii::app()->request->csrfTokenName; ?>':'<?php echo Yii::app()->request->csrfToken;?>'
    },
    function(data) {
      $('#dropdown').html(data)
      $('#weekDropdown').trigger('change');
    },
    'html'
  );
}

var weeklyOptions = {
  format: 'yyyy',
  date: $('#StatisticDay').val(),
  endDate:new Date(),
  autoclose:true,
  startView:4,
  minView:4,
  todayBtn:true,
  forceParse:false,
  pickerPosition:'bottom-left',
  showMeridian:false,
}
$('.dateTimePicker').datetimepicker(weeklyOptions)
$('.today').on('click',function(){
$('#weekDropdown').val('<?php echo date('W')?>');

})
</script>