Exemplo n.º 1
0
 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;
 }
 public function actionCreunite()
 {
     $model = new Intervenant();
     if ($model->load(Yii::$app->request->post())) {
         $model->typeinter = "Don";
         $model->save();
     }
     $model = new Intervenant();
     return $this->render('createdon', ['model' => $model]);
 }
Exemplo n.º 3
0
<?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);
?>
 /**
  * Finds the Intervenant model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Intervenant the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Intervenant::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }