コード例 #1
0
 /**
  * @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;
 }
コード例 #2
0
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 
}
?>
コード例 #3
0
</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