<?php
namespace common\modules\event\widgets\event;
use common\helpers\AppDateTimeHelper;
use common\models\Event;
use DateTime;
use yii\bootstrap\Widget;


/**
 * Class TimeTableMonthDayView
 * @package common\modules\event\widgets
 *
 * @property Event $event
 */
class EventView extends Widget
{
    public $event;
    public $start;
    public $end;

    public function init(){
        parent::init();
        if ( isset($this->event )){
            $this->start = AppDateTimeHelper::convertUnixTimeToDateTime($this->event->start);
            $this->end = AppDateTimeHelper::convertUnixTimeToDateTime($this->event->end);
        }
    }


    public function run(){
        return $this->render('_event',
            [
                'event' => $this->event,
                'start' => $this->start,
                'end' => $this->end
            ]
        );
    }



}
