/** * @return array */ public function getGrid() { $period = $this->getDisplayPeriod(); $models = $this->calendar->findItems($period->getStartDate()->getTimestamp(), $period->getEndDate()->getTimestamp()); if ($this->viewMode == CalendarInterface::VIEW_MODE_MONTH) { $grid = CalendarHelper::composeMonthGrid($period, $models); } else { $grid = CalendarHelper::composeWeekGrid($period, $models); } return $grid; }
echo $this->render($context->headerView); ?> <div class="row"> <div class="calendar-week-header-cell"></div> <?php foreach ($grid as $column => $day) { ?> <?php $time = reset($day); ?> <div class="calendar-week-header-cell"> <?php echo Yii::$app->formatter->asDate($time->date->getTimestamp(), 'E'); ?> <?php $count = CalendarHelper::getColumnItemsCount($grid, $column); ?> <?php if ($count > 0) { ?> <span class="badge"><?php echo $count; ?> </span> <?php } ?> </div> <?php } ?>
</div> <?php foreach ($grid as $week) { ?> <div class="row"> <div class="calendar-month-cell"> <div class="panel panel-default"> <div class="panel-body"> <?php $weekStr = reset($week)->date->format('W'); ?> <?php echo $weekStr; ?> <?php $count = CalendarHelper::getColumnItemsCount($grid, $weekStr); ?> <?php if ($count > 0) { ?> <span class="badge"><?php echo $count; ?> </span> <?php } ?> </div> </div> </div> <?php