示例#1
0
 public function actionMastersforwomen()
 {
     $getName = $_GET['name'];
     if (!$getName) {
         $query = BMastersforwomen::find();
         $countQuery = clone $query;
         $model = BMastersforwomen::find()->orderBy('sort ASC')->all();
         $BMainpageMasters = BMainpageMastersforwomen::find()->where(['site' => 1])->one();
         return $this->render('mastersforwomen', ['model' => $model, 'keywords' => $BMainpageMasters->keywords, 'description' => $BMainpageMasters->text]);
     } else {
         $model = BMastersforwomen::find()->where(['translate' => $getName])->one();
         $allmodel = BMastersforwomen::find()->count();
         if ($model->sort == $allmodel) {
             $nextmaster = 1;
             $prevmaster = $model->sort - 1;
         } else {
             if ($model->sort == 1) {
                 $nextmaster = $model->sort + 1;
                 $prevmaster = $allmodel;
             } else {
                 $nextmaster = $model->sort + 1;
                 $prevmaster = $model->sort - 1;
             }
         }
         $nextmastertranslate = BMastersforwomen::find()->where(['sort' => $nextmaster])->one();
         $prevmastertranslate = BMastersforwomen::find()->where(['sort' => $prevmaster])->one();
         $reviews = BReviews::find()->where('section = "masters" AND translate = "' . $getName . '" AND moderate = 1')->orderBy('id DESC')->all();
         if (!$model) {
             return $this->render('error', ['name' => 'Not Found (#404)', 'message' => 'Страница не найдена']);
         }
         if (Yii::$app->getSession()->getFlash('captcha')) {
             $captcha = false;
         } else {
             $captcha = true;
         }
         if (Yii::$app->getSession()->getFlash('save')) {
             $save = true;
         } else {
             $save = false;
         }
         return $this->render('mastersforwomen_detail', ['model' => $model, 'nextmastertranslate' => $nextmastertranslate, 'prevmastertranslate' => $prevmastertranslate, 'reviews' => $reviews, 'captcha' => $captcha, 'save' => $save]);
     }
 }
             } else {
                 return '�� ������� ������� ����������� �� ����';
             }
         } else {
             return '�� ������� ������������ �����������';
         }
     } else {
         return '�� ������ ������ ��� ��������';
     }
 }
 public function actionSort()
 {
     if (!$_POST) {
         return $this->redirect('/admin/mastersforwomen');
     }
     if ($_POST['id_master']) {
         foreach ($_POST['id_master'] as $key => $id_master) {
             $ids[] = "(" . $id_master . "," . ($key + 1) . ")";