public function actionDescription() { Yii::app()->page->setInfo(array("description" => $this->description, "keyWord" => $this->keyWord)); $id = 0; $class = $this->classModel; if (!empty($_GET["slug"])) { $model = $class::fetchBySlug(trim($_GET["slug"])); if ($model->id > 0) { $_GET["id"] = $model->id; $id = $model->id; } else { $arrId = explode("-", $_GET["slug"]); if (sizeof($arrId) > 0) { $id = (int) $arrId[0]; } } } $error = Yii::t("page", "Произошла ошибка перехода на страницу, проверьте правильно написания адреса страницы"); if ($id > 0) { $item = CatalogTours::fetch($id); if ($item->id > 0) { LogHelper::saveCatLogTours($item->id); CCModelHelper::colCounter($item); // Картинки тура $images = ImageHelper::getImages($item); Yii::app()->page->title = $item->name . ", тур " . $item->category_id->name . ", " . $item->country_id->name; $this->render('description', array("item" => $item, "images" => $images, "otherTours" => CatalogTours::fetchAll(DBQueryParamsClass::CreateParams()->setConditions("image>'' AND country_id=:country_id AND id!=:id AND firm_id!=:firm_id")->setParams(array(":country_id" => $item->country_id->id, ":id" => $item->id, ":firm_id" => $item->firm_id->id))->setOrderBy("col DESC")->setLimit(6)), "firmsTours" => CatalogTours::fetchAll(DBQueryParamsClass::CreateParams()->setConditions("image>'' AND firm_id=:firm_id AND id!=:id")->setParams(array(":firm_id" => $item->firm_id->id, ":id" => $item->id))->setOrderBy("col DESC")->setLimit(6)), "tourCount" => CatalogTours::count(DBQueryParamsClass::CreateParams()->setConditions("country_id=:country")->setParams(array(":country" => $item->country_id->id))), "firmCount" => CatalogFirms::count(DBQueryParamsClass::CreateParams()->setConditions("country_id=:country")->setParams(array(":country" => $item->country_id->id))))); } else { throw new CHttpException("", $error); } } else { throw new CHttpException("", $error); } }
public function actionDescription() { Yii::app()->page->setInfo(array("description" => $this->description, "keyWord" => $this->keyWord)); $id = 0; $class = $this->classModel; if (!empty($_GET["slug"])) { $model = $class::fetchBySlug(trim($_GET["slug"])); if ($model->id > 0) { $_GET["id"] = $model->id; $id = $model->id; } } $error = Yii::t("page", "Произошла ошибка перехода на страницу, проверьте правильно написания адреса страницы"); if ($id > 0) { $item = CatalogFirmsService::fetch($id); if ($item->id > 0) { CCModelHelper::colCounter($item); // Картинки тура $images = ImageHelper::getImages($item); Yii::app()->page->title = $item->name . " - " . Yii::t("page", "услуги от компании"); $this->render('description', array("item" => $item, "images" => $images, "firmsService" => CatalogFirmsService::fetchAll(DBQueryParamsClass::CreateParams()->setConditions("firm_id=:firm_id AND id!=:id")->setParams(array(":firm_id" => $item->firm_id, ":id" => $item->id))->setCache(0)), "firmsItems" => CatalogFirmsItems::fetchAll(DBQueryParamsClass::CreateParams()->setConditions("firm_id=:firm_id")->setParams(array(":firm_id" => $item->firm_id))->setCache(0)))); } else { throw new CHttpException("", $error); } } else { throw new CHttpException("", $error); } }
public function actionDescription() { Yii::app()->page->setInfo(array("description" => $this->description, "keyWord" => $this->keyWord)); $id = 0; $class = $this->classModel; if (!empty($_GET["slug"])) { $model = $class::fetchBySlug(trim($_GET["slug"])); if ($model->id > 0) { $_GET["id"] = $model->id; $id = $model->id; } } if (empty($id)) { $id = (int) Yii::app()->request->getParam("id", 0); } $error = Yii::app()->request->getParam("error", ""); $tab = Yii::app()->request->getParam("tab", ""); $tabArray = array("description", "pcomments", "tours"); if (!in_array($tab, $tabArray)) { $tab = ""; } // Ошибка при не правельно ID $error = Yii::t("page", "Произошла ошибка перехода на страницу, проверьте правильно написания адреса страницы"); if (empty($id) && !empty($_GET["slug"])) { $ar = explode("-", $_GET["slug"]); $id = $ar[0]; } if ($id > 0) { $item = CatalogFirmsInfo::fetch($id); if (empty($tab)) { $activeTab = "description"; } else { $activeTab = $tab; } if ($item->id > 0) { LogHelper::save("firms", $item->id, "show"); CCModelHelper::colCounter($item); $commentModel = new CatalogFirmsCommentsAdd(); if (!empty($_POST["send_comment"])) { $activeTab = "pcomments"; $commentModel->setAttributesFromArray($_POST["CatalogFirmsCommentsAdd"]); $commentModel->firm_id = $id; if (Yii::app()->user && Yii::app()->user->getId() > 0) { $commentModel->user_id = Yii::app()->user->getId(); } $commentModel->date = time(); if ($commentModel->save()) { $item->onFirmNewComment(new CEvent($commentModel), array("subject" => $commentModel->name, "firm_name" => $item->name, "date" => date("d.m.Y H:i"), "user_name" => $commentModel->fio, "description" => $commentModel->message, "link" => SiteHelper::createUrl("/user/firms/description", array("id" => $item->id, "tab" => "pcomments")))); $commentModel = new CatalogFirmsCommentsAdd(); $commentModel->formMessage = Yii::t("tours", "Сообщение отправлено, после модерации оно будет Опубликовано."); } } Yii::app()->page->title = $item->name . " - " . Yii::t("page", "туристическое агенство") . " " . $item->country_id->name_2 . " " . $item->city_id->name; // Поля про поиско по турам $tourClass = new CatalogToursFirms(); $arrSearchFieldsTours = $tourClass->getSearchAttributes(); $this->render('description', array("item" => $item, "activeTab" => $activeTab, "commentModel" => $commentModel, "otherFirms" => CatalogFirms::fetchAll(DBQueryParamsClass::CreateParams()->setConditions("image>'' AND id!=:id")->setParams(array(":id" => $item->id))->setOrderBy("col DESC")->setLimit(8)), "listGallery" => CatGallery::fetchAll(DBQueryParamsClass::CreateParams()->setConditions("catalog=:catalog AND item_id=:items_id")->setParams(array(":catalog" => "catalog_firms", ":items_id" => $item->id))->setLimit(15)), "arrSearchFieldsTours" => $arrSearchFieldsTours)); } else { throw new CHttpException("", "К сожалению описание данного тура не найденно в базе"); } } else { throw new CHttpException("", "К сожалению описание данного тура не найденно в базе"); } }