public function actionView($url) { // страница контента бутиков $criteria = new CDbCriteria(); $criteria->condition = "is_active=1 AND url=:url AND lang_id=:lang"; $criteria->params = array(":url" => $url, ":lang" => $this->lang); $model = Boutique::model()->find($criteria); if (empty($model)) { $this->redirect("/notfound"); } $this->pageTitle = $model->name; $this->pageDescription = $model->meta_description; $this->pageKeywords = $model->meta_keywords; $this->render("view", array("model" => $model)); }
public function actionDelete() { $success = false; $id = $_REQUEST['id']; if (is_numeric($id)) { $model = BoutiqueCities::model()->findByPk($id); if (is_object($model)) { if ($model->delete()) { $success = true; //remove all news in category $news = Boutique::model()->findAllByAttributes(array("city_id" => $model->id)); if (is_array($news) && count($news)) { foreach ($news as $element) { $element->delete(); } } } } } echo json_encode(array('status' => $success ? 'success' : 'fail')); }
public function actionToggleActivity() { if (isset($_REQUEST['pk'])) { $model = Boutique::model()->findByPk($_REQUEST['pk']); if (is_object($model)) { $model->is_active = $model->is_active ? 0 : 1; if ($model->save()) { return true; } } } return false; }
</ul> </div> <div class="foto_location" id="map" style="height:400px;border-radius:20px; width:960px;"> </div> <div class="container_location"> <?php $criteria = new CDbCriteria(); $criteria->condition = "city_id=:city AND lang_id=:lang_id AND is_active=1"; $criteria->params = array(":city" => $modelId->id, ":lang_id" => $this->lang); $modelItems = Boutique::model()->findAll($criteria); if (!empty($modelItems)) { foreach ($modelItems as $butik) { ?> <div class="cellule"> <a href="/boutiques/<?php echo $city; ?> /<?php echo $butik->url; ?> " class="bondfoto"><img src="<?php echo $butik->anons_pic; ?> " alt="Картинка"></a>