public function search($params)
 {
     $query = Organization::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id]);
     $query->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'keywords', $this->keywords])->andFilterWhere(['like', 'body', $this->body])->andFilterWhere(['like', 'address', $this->address])->andFilterWhere(['like', 'phone', $this->phone])->andFilterWhere(['like', 'phone2', $this->phone2])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'city', $this->city])->andFilterWhere(['like', 'region', $this->region]);
     return $dataProvider;
 }
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Organization::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', 'org_name', $this->org_name])->andFilterWhere(['like', 'position', $this->position]);
     return $dataProvider;
 }
 public function actionFeedback()
 {
     $model = new FeedbackForm();
     // Отправка запроса + валидация
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
         if ($model->sendEmail(Yii::$app->params['adminEmail'])) {
             Yii::$app->session->setFlash('success', 'Спасибо за ваше обращение, оно будет рассмотрено в ближайшее время.');
         } else {
             Yii::$app->session->setFlash('error', 'Произошла ошибка при отправке email.');
         }
         return $this->refresh();
     } else {
         $orgList = Organization::find()->select('*')->asArray()->all();
         $productList = Product::find()->select('*')->asArray()->all();
         return $this->render('feedback', ['model' => $model, 'orgList' => $orgList, 'productList' => $productList]);
     }
 }
Esempio n. 4
0
<?php

use yii\helpers\ArrayHelper;
use common\models\Specialist;
use common\models\SpecialistType;
use common\models\Product;
use common\models\ProductType;
use common\models\ProductCat;
use common\models\Diagnos;
use common\models\Organization;
use kartik\widgets\ActiveForm;
use kartik\builder\Form;
//Заболевания диагноз parent_id > 0
$catList = ArrayHelper::index(ProductCat::find()->where(['>', 'parent_id', 0])->asArray()->all(), 'id');
//Список организаций
$orgList = ArrayHelper::index(Organization::find()->asArray()->all(), 'id');
$specList = ArrayHelper::index(Specialist::find()->asArray()->all(), 'id');
$specTypeList = ArrayHelper::index(SpecialistType::find()->asArray()->all(), 'id');
$diagnosList = ArrayHelper::index(Diagnos::find()->asArray()->all(), 'id');
$css = <<<CSS

select.search_select {
  border: 0 none;
  width: 100%; border-bottom: 1px solid #A52024;
  border-left: 1px solid #A52024;
  padding: 3px 10px;
}

.select2-container--krajee .select2-selection {
    -webkit-box-shadow: none;
    box-shadow: none;