public function search($params)
 {
     $query = Specialist::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id]);
     $query->andFilterWhere(['like', 'intro', $this->intro])->andFilterWhere(['like', 'first_name', $this->first_name])->andFilterWhere(['like', 'last_name', $this->last_name])->andFilterWhere(['like', 'middle_name', $this->middle_name])->andFilterWhere(['like', 'photo_image', $this->photo_image])->andFilterWhere(['like', 'phone', $this->phone])->andFilterWhere(['like', 'email', $this->email]);
     return $dataProvider;
 }
 /**
  * Страница категории
  */
 public function actionCat($id)
 {
     $query = Product::find()->joinWith('type')->where([ProductType::TableName() . '.cat_id' => $id]);
     $countQuery = clone $query;
     $pages = new Pagination(['totalCount' => $countQuery->count(), 'pageSize' => 20]);
     $productList = $query->offset($pages->offset)->limit($pages->limit)->with(['type'])->with(['organization'])->asArray()->all();
     Product::format($productList);
     $randProduct = Product::getRandom(1);
     $randOrg = Organization::getRandom(1);
     $randSpec = Specialist::getRandom(1, [], ['specTypes']);
     return $this->render('cat', ['item' => ProductCat::find()->where(['id' => $id])->asArray()->one(), 'productList' => $productList, 'productPages' => $pages, 'randProduct' => $randProduct, 'randOrg' => $randOrg, 'randSpec' => $randSpec]);
 }
 /**
  * Finds the Specialist model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Specialist the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Specialist::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Пример #4
0
 /**
  * Получаем специалиста (доктора)
  */
 public function getSpecialist()
 {
     return $this->hasOne(Specialist::className(), ['id' => 'specialist_id']);
 }
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getSpecs()
 {
     return $this->hasMany(Specialist::className(), ['id' => 'spec_id'])->viaTable('tbl_specialist_has_type', ['spec_type_id' => 'id']);
 }
Пример #6
0
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;
    background-color: #fff;
 /**
  * Страница специалиста
  */
 public function actionSpecialist($id)
 {
     return $this->render('specialist', ['item' => Specialist::find()->where(['id' => $id])->asArray()->one()]);
 }