public function actionPrograms($page = 0) { $getName = $_GET['name']; if (!$getName) { $model = BTypesOfMassage::find()->orderBy('sort ASC')->all(); $BMainpageMassage = BMainpageMassage::find()->where(['site' => 1])->one(); return $this->render('programs', ['model' => $model, 'description' => $BMainpageMassage->text]); } else { $model = BTypesOfMassage::find()->where(['translate' => $getName])->one(); $allmodel = BTypesOfMassage::find()->count(); if ($model->sort == $allmodel) { $nextprogram = 1; $prevprogram = $model->sort - 1; } else { if ($model->sort == 1) { $nextprogram = $model->sort + 1; $prevprogram = $allmodel; } else { $nextprogram = $model->sort + 1; $prevprogram = $model->sort - 1; } } $nextprogramtranslate = BTypesOfMassage::find()->where(['sort' => $nextprogram])->one(); $prevprogramtranslate = BTypesOfMassage::find()->where(['sort' => $prevprogram])->one(); $reviews = BReviews::find()->where('section = "programs" 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('programs_detail', ['model' => $model, 'nextprogramtranslate' => $nextprogramtranslate, 'prevprogramtranslate' => $prevprogramtranslate, 'reviews' => $reviews, 'captcha' => $captcha, 'save' => $save]); } }
public function actionDescription() { if (Yii::$app->user->isGuest) { $this->redirect(Yii::$app->user->loginUrl); } $model = BMainpageMassage::find()->where(['site' => 1])->one(); if (!$model) { $model = new BMainpageMassage(); } if ($model->load(Yii::$app->request->post())) { if ($model->validate()) { $model->site = 1; $model->save(); return $this->render('description', ['model' => $model, 'success' => true]); } } return $this->render('description', ['model' => $model]); }
<?php use yii\widgets\LinkPager; use app\modules\admin\models\BImages; use app\modules\admin\models\BMainpageMassage; $this->title = 'Программы эротического массажа - Мужской спа-салон «Барон»'; $program = BMainpageMassage::find()->one(); $this->registerMetaTag(['name' => 'keywords', 'content' => $program->keywords]); $this->registerMetaTag(['name' => 'description', 'content' => $program->description]); ?> <div id="content" class="clearfix"> <div id="programs_page"> <h1>Программы</h1> <div id="programs_image"> <?php foreach ($model as $programs) { $model_images = json_decode($programs->images); $BImages = BImages::findOne($model_images[0]); if ($BImages->path && file_exists(Yii::getAlias('@webroot/' . $BImages->path))) { $image = Yii::$app->image->load(Yii::getAlias('@webroot/' . $BImages->path)); $image->resize(280, 200); $image->save(Yii::getAlias('@webroot/assets/' . $BImages->name . '.' . $BImages->extension)); ?> <a href="/programs/<?php echo $programs->translate; ?> "> <img src="<?php echo '/assets/' . $BImages->name . '.' . $BImages->extension; ?>
<?php use yii\widgets\LinkPager; use app\modules\admin\models\BImages; use app\modules\admin\models\BMainpageMassage; $this->title = 'Мастера эротического массажа - Мужской спа-салон «Барон»'; $master = BMainpageMassage::find()->one(); $this->registerMetaTag(['name' => 'keywords', 'content' => $master->keywords]); $this->registerMetaTag(['name' => 'description', 'content' => $master->description]); ?> <div id="content" class="clearfix"> <div id="masters_page"> <h1>Мастера</h1> <div id="masters_image"> <?php foreach ($model as $masters) { $model_images = json_decode($masters->images); $BImages = BImages::findOne($model_images[0]); if ($BImages->path && file_exists(Yii::getAlias('@webroot/' . $BImages->path))) { $image = Yii::$app->image->load(Yii::getAlias('@webroot/' . $BImages->path)); $image->resize(280, 200); $image->save(Yii::getAlias('@webroot/assets/' . $BImages->name . '.' . $BImages->extension)); ?> <a href="/masters/<?php echo $masters->translate; ?> "> <img src="<?php echo '/assets/' . $BImages->name . '.' . $BImages->extension; ?>