public function searchintercession($params, $typr) { $query = Intervenant::find()->where(['typeinter' => $typr]); $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(['like', 'typeinter', $this->typeinter])->andFilterWhere(['like', 'titre', $this->titre])->andFilterWhere(['like', 'adresse', $this->adresse])->andFilterWhere(['like', 'mail', $this->mail])->andFilterWhere(['like', 'tel', $this->tel]); return $dataProvider; }
<?php use yii\helpers\Html; use yii\helpers\ArrayHelper; use yii\widgets\ActiveForm; use yii\grid\GridView; use yii\data\ActiveDataProvider; use yii\bootstrap\Dropdown; use app\models\Bien; use app\models\Reformer; use app\models\Intervenant; /* @var $this yii\web\View */ /* @var $model app\models\Bien */ /* @var $form yii\widgets\ActiveForm */ $dataIntervenant = ArrayHelper::map(Intervenant::find()->where(['typeinter' => 'Don'])->asArray()->all(), 'titre', 'titre'); ?> <div class="bien-formAmort"> <?php $form = ActiveForm::begin(); ?> <div class="col-lg-12"> <label class="col-lg-2 control-label"> Unite:</label> <?php echo $form->field($model, 'titre', [])->dropDownList($dataIntervenant, ['prompt' => '----------Choisir une unite----------', 'onchange' => ' $.post( "index.php?r=reformer/listunite&id=' . '"+$(this).val(), function( data ) { $( "select#intervenant-titre").html(data ); });'])->label(false); ?>