/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = RecursoHumano::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(['idrecurso_humano' => $this->idrecurso_humano]); $query->andFilterWhere(['like', 'nombre', $this->nombre])->andFilterWhere(['like', 'puesto', $this->puesto])->andFilterWhere(['like', 'area', $this->area])->andFilterWhere(['like', 'edad', $this->edad])->andFilterWhere(['like', 'antiguedad', $this->antiguedad])->andFilterWhere(['like', 'fotografia', $this->fotografia]); return $dataProvider; }
/** * Finds the RecursoHumano model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return RecursoHumano the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = RecursoHumano::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * @return \yii\db\ActiveQuery */ public function getRecursoHumanoIdrecursoHumano() { return $this->hasOne(RecursoHumano::className(), ['idrecurso_humano' => 'recurso_humano_idrecurso_humano']); }
use yii\widgets\ActiveForm; use yii\helpers\ArrayHelper; /* @var $this yii\web\View */ /* @var $model app\models\Detalle */ /* @var $form yii\widgets\ActiveForm */ ?> <div class="detalle-form"> <?php $form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'recurso_humano_idrecurso_humano')->dropDownList(ArrayHelper::map(\app\models\RecursoHumano::find()->asArray()->all(), 'idrecurso_humano', 'nombre'), ['prompt' => 'Selecciona']); ?> <?php echo $form->field($model, 'tareas_idtareas')->dropDownList(ArrayHelper::map(\app\models\Tareas::find()->asArray()->all(), 'idtareas', 'nombre'), ['prompt' => 'Selecciona']); ?> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div> <?php
/** * @return \yii\db\ActiveQuery */ public function getRecursoHumanoIdrecursoHumanos() { return $this->hasMany(RecursoHumano::className(), ['idrecurso_humano' => 'recurso_humano_idrecurso_humano'])->viaTable('tareas_has_recurso_humano', ['tareas_idtareas' => 'idtareas']); }