Esempio n. 1
0
/* @var $form yii\bootstrap\ActiveForm */
use backend\modules\reservation\models\UsageForm;
use backend\modules\reservation\models\Subject;
use backend\modules\reservation\Module;
use kartik\datecontrol\DateControl;
use yii\bootstrap\ActiveField;
use yii\helpers\ArrayHelper;
use yii\helpers\Html;
use yii\bootstrap\ActiveForm;
use yii\helpers\Url;
use yii\web\View;
/** @noinspection PhpUndefinedFieldInspection */
$actionId = $this->context->action->id;
$dayTimes = $model->getDayTimes();
$subjectsList = ArrayHelper::merge(['0' => '== ' . Module::t('res', 'new') . ' =='], Subject::getSubjects());
$subject = $model->subject_id > 0 ? Subject::findOne($model->subject_id) : null;
$timeFromTimes = array_slice($dayTimes, 0, -1, true);
$timeToTimes = array_slice($dayTimes, 1, null, true);
?>

<div class="row">

	<div class="col-sm-12">

		<?php 
$form = ActiveForm::begin(['fieldClass' => ActiveField::className()]);
?>

		<div class="row">
			<div class="col-xs-12 col-md-6">
Esempio n. 2
0
 /**
  * Finds the model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Subject the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Subject::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }