Ejemplo n.º 1
0
 public function getParentText()
 {
     $category = FCategory::findOne($this->id);
     if (isset($category->parent)) {
         return $category->parent->name;
     } else {
         return 'Выбрать';
     }
 }
Ejemplo n.º 2
0
 public function actionModalPodCategory()
 {
     $post = Yii::$app->request->post();
     $id = $post["id_category"];
     $query = FCategory::find()->where(['parent_id' => $id]);
     $FCategory = $query->all();
     if ($query->count() == 0) {
         return "no";
     } else {
         return $this->renderPartial('modalPodCategory', ['category' => $FCategory]);
     }
 }
Ejemplo n.º 3
0
 public function setQuery($query)
 {
     $geo = new Geo();
     $geo->reset();
     $geo->installGeo($this->id_okrug, $this->id_region, $this->id_city);
     if ($geo->arrayCity) {
         $where["id_city"] = $geo->arrayCity;
     }
     if ($this->id_cat) {
         $cat = FCategory::findOne($this->id_cat);
         $arrayUsers = $cat->arrayUsers;
         $where["id"] = $arrayUsers;
     }
     if (isset($where)) {
         $query = $query->where($where);
     }
     if ($this->search != "") {
         $query = $query->andWhere(["or like", $this->search_field, $this->search]);
     }
     return $query;
 }
Ejemplo n.º 4
0
 public function actionTarif()
 {
     $FCategory = FCategory::find()->where(["bool_item" => 1])->all();
     $RPages = RPages::findOne(["page_name" => 'tarif']);
     return $this->render('tarif', ["categories" => $FCategory, 'page' => $RPages]);
 }
Ejemplo n.º 5
0
 public function getCategory()
 {
     return $this->hasOne(FCategory::className(), ['id' => 'value']);
 }
Ejemplo n.º 6
0
 public function getArrayUsers()
 {
     if ($this->bool_item == 1) {
         $items = RItems::find()->where(['id_parent' => $this->id])->all();
         foreach ($items as $item) {
             $id_user[] = $item->id_user;
         }
     } else {
         $cats = FCategory::find()->where(['parent_id' => $this->id])->all();
         $id_user = array();
         foreach ($cats as $cat) {
             if ($cat->arrayUsers) {
                 $id_user = ArrayHelper::merge($id_user, $cat->arrayUsers);
             }
         }
     }
     if (isset($id_user) and count($id_user) > 0) {
         return $id_user;
     } else {
         return false;
     }
 }
Ejemplo n.º 7
0
 public function getParentCategory()
 {
     return $this->hasOne(FCategory::className(), ['id' => 'id_category']);
 }
Ejemplo n.º 8
0
 public function getRelatedCategoryDetail()
 {
     return $this->hasOne(FCategory::className(), ['id' => 'id_related_category']);
 }
Ejemplo n.º 9
0
 public function actionEditFilter()
 {
     $post = Yii::$app->request->post();
     $get = Yii::$app->request->get();
     $id_category = $get["id"];
     $id_field = $post["id_field"];
     $cat = FCategory::findOne($id_category);
     $cat->installFilter($id_field);
 }
Ejemplo n.º 10
0
 public function actionEditRecord($id)
 {
     $RItems = RItems::findOne($id);
     $model = new RItemsForm();
     $model->loadForm($RItems);
     $user = Yii::$app->user->identity;
     $cat = FCategory::findOne($model->id_category);
     if (Yii::$app->request->isPost) {
         $post = Yii::$app->request->post();
         $model->load($post);
         $model->image = UploadedFile::getInstances($model, 'image');
         if ($model->validate()) {
             $model->save();
             $this->redirect(['user/index']);
         }
     }
     return $this->render('editRecord', ['user' => $user, 'model' => $model, 'cat' => $cat]);
 }