/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = NombreConocimiento::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]); $query->andFilterWhere(['like', 'nombre', $this->nombre]); return $dataProvider; }
/** * @return \yii\db\ActiveQuery */ public function getNombreConocimiento() { return $this->hasOne(NombreConocimiento::className(), ['id' => 'NombreConocimientoid']); }
<h3 class="panel-title pull-left">Conocimiento</h3> <div class="pull-right"> <button type="button" class="add-item btn btn-success btn-xs"><i class="glyphicon glyphicon-plus"></i></button> <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 (!$modelConocimientos->isNewRecord) { echo Html::activeHiddenInput($modelConocimientos, "[{$i}]id_conocimiento"); } ?> <?php echo $form->field($modelConocimientos, "[{$i}]nombre")->dropDownList(ArrayHelper::map(NombreConocimiento::find()->all(), 'id', 'nombre'), ['prompt' => 'Seleccionar Conocimiento']); ?> <div class="row"> <div class="col-sm-6"> <?php echo $form->field($modelConocimientos, "[{$i}]nivel")->dropDownList(['Principiante' => 'Principiante', 'Básico' => 'Básico', 'Intermedio' => 'Intermedio', 'Avanzado' => 'Avanzado'], ['prompt' => 'Select Option']); ?> </div> <div class="col-sm-6"> <?php echo $form->field($modelConocimientos, "[{$i}]descripcion")->textInput(['maxlength' => true]); ?> </div> </div><!-- .row --> </div> </div>
/** * Finds the NombreConocimiento model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return NombreConocimiento the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = NombreConocimiento::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }