/**
  * Creates a new Timetable model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Timetable();
     $model->setScenario('timetable-create');
     $groupsArray = Group::getGroupArray();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         Yii::$app->session->setFlash('success', Module::t('timetable-admin', 'Created record "{group} | {weekDay} | {start} - {end}".', ['group' => $groupsArray[$model->group_id], 'weekDay' => $model->getWeekArray()[$model->week_day], 'start' => Yii::$app->formatter->asTime(strtotime($model->start), 'H:i'), 'end' => Yii::$app->formatter->asTime(strtotime($model->end), 'H:i')]));
         return $this->redirect(['index']);
     } else {
         return $this->render('create', ['model' => $model, 'groupsArray' => $groupsArray]);
     }
 }