/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Asignatura::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(['idAsignatura' => $this->idAsignatura]); $query->andFilterWhere(['like', 'nombrea', $this->nombrea]); return $dataProvider; }
/** * @return \yii\db\ActiveQuery */ public function getIdAsignatura0() { return $this->hasOne(Asignatura::className(), ['idAsignatura' => 'idAsignatura']); }
/** * Finds the Asignatura model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Asignatura the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Asignatura::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
<button type="button" class="remove-item btn btn-danger btn-xs"><i class="glyphicon glyphicon-minus"></i></button> </div> <div class="clearfix"></div> </div> <div class="panel-body"> <?php // necessary for update action. if (!$modelsDetallepre->isNewRecord) { echo Html::activeHiddenInput($modelsDetallepre, "[{$i}]id"); } ?> <div class="row"> <div class="col-sm-6"> <?php echo $form->field($modelsDetallepre, "[{$i}]idAsignatura")->dropDownList(ArrayHelper::map(Asignatura::find()->all(), 'idAsignatura', 'nombrea'), ['prompt' => 'Selecciona asignatura']); ?> </div> </div> </div> </div> <?php } ?> </div> <?php DynamicFormWidget::end(); ?> </div>
/* @var $model backend\models\Grupo */ /* @var $form yii\widgets\ActiveForm */ ?> <div class="grupo-form"> <?php $form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'idDocente')->widget(Select2::classname(), ['data' => ArrayHelper::map(Docentes::find()->all(), 'idDocente', 'nombres'), 'language' => 'en', 'options' => ['placeholder' => ''], 'pluginOptions' => ['allowClear' => true]]); ?> <?php echo $form->field($model, 'idAsignatura')->widget(Select2::classname(), ['data' => ArrayHelper::map(Asignatura::find()->all(), 'idAsignatura', 'nombrea'), 'language' => 'en', 'options' => ['placeholder' => ''], 'pluginOptions' => ['allowClear' => true]]); ?> <?php echo $form->field($model, 'idPlan')->widget(Select2::classname(), ['data' => ArrayHelper::map(Plan::find()->all(), 'idPlan', 'nombrep'), 'language' => 'en', 'options' => ['placeholder' => ''], 'pluginOptions' => ['allowClear' => true]]); ?> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? 'Guardar' : 'Actualizar', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div> <?php ActiveForm::end();