<?php
namespace common\modules\event\widgets\timetable;
use common\modules\event\models\timetable\TimeTableMonthDay;
use common\modules\event\models\timetable\TimeTableMonthWeek;
use common\modules\event\widgets\day\TimeTableMonthDayView;
use yii\bootstrap\Widget;

/**
 * Class TimeTableMonthDayView
 * @package common\modules\event\widgets
 *
 * @property TimeTableMonthDay $day
 */
class TimeTableMonthView extends Widget
{
    public $timeTable;
    public $actionsColumn;


    public function run() {
        return $this->render('_timetable', [
            'timeTable' => $this->timeTable,
            'actionsColumn' => ( isset($this->actionsColumn) ? $this->actionsColumn : null)
        ]);
    }


    public static function renderDay($weekDay ){

        /**
         * @param TimeTableMonthWeek $week
         * @return string
         */
        return static function ($week) use ($weekDay) {
            return TimeTableMonthDayView::widget([
                'day' => $week->getWeekDay($weekDay),
            ]);
        };

    }

}
