/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = LessonTime::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['lesson_time_id' => $this->lesson_time_id]); $query->andFilterWhere(['like', 'lesson_time_name', $this->lesson_time_name])->andFilterWhere(['like', 'begin_time', $this->begin_time])->andFilterWhere(['like', 'end_time', $this->end_time]); return $dataProvider; }
/** * @return \yii\db\ActiveQuery */ public function getLesson0() { return $this->hasOne(LessonTime::className(), ['lesson_time_id' => 'lesson']); }
<?php $form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'id_classroom')->widget(Select2::classname(), ['data' => $classroomsArray, 'language' => 'uk', 'pluginOptions' => ['allowClear' => true], 'options' => ['placeholder' => ' ']])->label('Аудиторія'); ?> <?php echo $form->field($model, 'day')->widget(DatePicker::className(), ['inline' => false, 'language' => 'ua', 'clientOptions' => ['autoclose' => true, 'format' => 'yyyy-mm-dd']]); ?> <?php echo $form->field($model, 'lesson')->widget(Select2::classname(), ['data' => ArrayHelper::map(LessonTime::find()->all(), 'lesson_time_id', 'lesson_time_name'), 'language' => 'uk', 'pluginOptions' => ['allowClear' => true], 'options' => ['placeholder' => ' ']])->label('Пара'); ?> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? 'Забронювати' : 'Зберегти', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div> <?php ActiveForm::end(); ?> </div>
/** * Finds the LessonTime model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return LessonTime the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = LessonTime::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
use app\module\handbook\models\ClassRooms; use yii\bootstrap\Modal; use yii\helpers\Url; /* @var $this yii\web\View */ /* @var $model app\module\timetable\models\Lessons */ $semester_for_editor = $_GET['semester_for_editor']; $course_get = $_GET['course_get']; $faculty = $_GET['faculty_id']; $speciality = $_GET['speciality_id']; $group_id = $_GET['group_id']; $inflow_year = date('Y') - $course_get; $spec_name = Speciality::findOne(["speciality_id" => $speciality]); $faculty_name = Faculty::findOne(["faculty_id" => $faculty]); $week = ["", "Понеділок", "Вівторок", "Середа", "Четвер", "П'ятниця", "Субота"]; $groups_list = Groups::findAll(["id_speciality" => $speciality, "inflow_year" => $inflow_year, "group_id" => $group_id]); $less_time = LessonTime::find()->all(); $gl = Groups::findAll(["parent_group" => $group_id]); if (count($gl) > 0) { //Определяем есть ли у группы подгруппы $group_has_subgroup = true; $groups_list = $gl; $parent = $gl[0]['parent_group']; } else { $group_has_subgroup = false; $parent = 0; } $this->title = 'Редагувати розклад:'; $this->params['breadcrumbs'][] = ['label' => 'Редактор розкладу', 'url' => ['index']]; $this->params['breadcrumbs'][] = $semester_for_editor . ' семестр'; $this->params['breadcrumbs'][] = $course_get . ' курс'; $this->params['breadcrumbs'][] = $faculty_name['faculty_name'];