/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = TblClassroom::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['id' => $this->id, 'serviceable' => $this->serviceable, 'last_date_serviced' => $this->last_date_serviced]); $query->andFilterWhere(['like', 'classroom_name', $this->classroom_name]); return $dataProvider; }
?> <?php echo $form->field($model, 'assigned_to')->textInput(); ?> <?php echo $form->field($model, 'inventory')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'comments')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'classroom')->dropDownList(ArrayHelper::map(TblClassroom::find()->all(), 'id', 'classroom_name'), ['prompt' => 'Select Classroom']); ?> <?php echo $form->field($model, 'classroom_other')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'course_code')->dropDownList(ArrayHelper::map(TblCourses::find()->all(), 'id', 'course_name', 'course_code'), ['prompt' => 'Select Course']); ?> <?php echo $form->field($model, 'setup_time')->widget(TimePicker::classname(), []); ?> <?php echo $form->field($model, 'pickup_time')->widget(TimePicker::classname(), []);
/** * Finds the TblClassroom model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return TblClassroom the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = TblClassroom::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * * @return \yii\db\ActiveQuery */ public function getClassroom() { return $this->hasOne(TblClassroom::classname(), ['id' => 'classroom']); }