public function actionIndex() { $page = (int) Yii::app()->request->getParam("p", 1); $this->layout = '//layouts/main-landing'; if (!empty($_GET["country"])) { $model = CatalogCountry::fetchBySlug(trim($_GET["country"])); } if ($model && $model->id > 0) { $item = $model; Yii::app()->page->setInfo(array("description" => $item->name . "," . $this->description, "keyWord" => $item->name . "," . $this->keyWord)); if (!empty($item) && $item->id > 0) { Yii::app()->page->title = $item->name; $this->render('index', array("item" => $item, "page" => $page, "tours" => CatalogTours::fetchAll(DBQueryParamsClass::CreateParams()->setConditions("image>'' AND country_id=:id")->setParams(array(":id" => $item->id))->setOrderBy("rating DESC")->setLimit(12)), "gallerySlide" => CatGallery::fetchAll(DBQueryParamsClass::CreateParams()->setConditions("catalog='catalog_country' AND type='slide-gallery' AND item_id=:id")->setParams(array(":id" => $item->id))->setOrderBy("pos")->setLimit(-1)), "gallery" => CatGallery::fetchAll(DBQueryParamsClass::CreateParams()->setConditions("catalog='catalog_country' AND type='' AND item_id=:id")->setParams(array(":id" => $item->id))->setOrderBy("pos")->setLimit(9)), "info" => CatalogInfo::fetchAll(DBQueryParamsClass::CreateParams()->setConditions("category_id=(SELECT id FROM catalog_info_category WHERE slug=:slug LIMIT 1)")->setParams(array(":slug" => $item->slug))), "monuments" => CatalogMonuments::fetchAll(DBQueryParamsClass::CreateParams()->setConditions("country_id=:id")->setParams(array(":id" => $item->id))))); } else { throw new CHttpException("Ошибка", Yii::t("page", "Ошибка перехода на страницу")); } } else { throw new CHttpException("Ошибка", Yii::t("page", "Ошибка перехода на страницу")); } }
public function actionIndex() { $tab = Yii::app()->request->getParam("tab", ""); $page = (int) Yii::app()->request->getParam("p", 1); $action = Yii::app()->request->getParam("action", "t"); $country = Yii::app()->request->getParam("country", ""); $category = Yii::app()->request->getParam("category", ""); $ccategory = Yii::app()->request->getParam("ccategory", ""); $icategory = Yii::app()->request->getParam("icategory", ""); $slug = Yii::app()->request->getParam("slug", ""); $activeTab = ""; $t_page = 1; $i_page = 1; $c_page = 1; if ($action == "t") { $t_page = $page; $activeTab = "s_tours"; } if ($action == "i" || $tab == "info") { $i_page = $page; $activeTab = "s_info"; } if ($action == "c" || $tab == "curorts") { $c_page = $page; $activeTab = "s_curorts"; } /* foreach( $_GET as $key=>$item ) { echo "#"; if( empty( $_GET[$key] ) || $_GET[$key]=="null" )continue; echo $key."*"; $item = CatalogSections::fetchBySlug( $key ); if( $item->id >0 )break; }*/ if (!empty($slug)) { $item = CatalogSections::fetchBySlug($slug); } else { $item = CatalogSections::fetchBySlug("otdyh-v-gorah"); } if ($item && $item->id > 0) { Yii::app()->page->setInfo(array("description" => $item->name . "," . $this->description, "keyWord" => $item->name . "," . $this->keyWord)); if (!empty($item) && $item->id > 0) { $infoCategory = " 1=1 "; $infoSQL = " 1=1 "; if (!empty($icategory)) { $infoCategory .= " AND category_id = ( SELECT id FROM catalog_info_category WHERE slug='" . $icategory . "' )"; } $i = 0; if (sizeof($item->info) > 0) { $infoCategory .= " AND ( "; $infoSQL .= " AND ( "; foreach ($item->info as $itemC) { if ($i > 0) { $infoCategory .= " OR "; $infoSQL .= " OR "; } $infoCategory .= " category_id='" . $itemC->id . "' "; $infoSQL .= " category_id='" . $itemC->id . "' "; $i++; } $infoCategory .= " ) "; $infoSQL .= " ) "; } $curortsCategory = " 1=1 "; $kurortsSQL = " 1=1 "; if (!empty($ccategory)) { $curortsCategory .= " AND category_id = ( SELECT id FROM catalog_kurorts_category WHERE slug='" . $ccategory . "' )"; } if (sizeof($item->curorts) > 0) { $curortsCategory .= " AND ( "; $kurortsSQL .= " AND ( "; $i = 0; foreach ($item->curorts as $itemC) { if ($i > 0) { $curortsCategory .= " OR "; $kurortsSQL .= " OR "; } $curortsCategory .= " category_id='" . $itemC->id . "' "; $kurortsSQL .= " category_id='" . $itemC->id . "' "; $i++; } $curortsCategory .= " ) "; $kurortsSQL .= " ) "; $cororts = CatalogKurorts::fetchAll(DBQueryParamsClass::CreateParams()->setConditions($curortsCategory)->setOrderBy("col DESC")->setPage($c_page)->setLimit(15)); $curortsCount = CatalogKurorts::count(DBQueryParamsClass::CreateParams()->setConditions($curortsCategory)); } else { $cororts = array(); $curortsCount = 0; } $toursCategory = " 1=1 "; $toursSQL = " 1=1 "; if ($item->country_id->id > 0) { $toursCategory .= " AND country_id = '" . $item->country_id->id . "'"; $toursSQL .= " AND country_id = '" . $item->country_id->id . "'"; } if (!empty($country)) { $toursCategory .= " AND country_id = ( SELECT id FROM catalog_country WHERE slug='" . $country . "' LIMIT 1 )"; } if (!empty($category)) { $toursCategory .= " AND category_id = ( SELECT id FROM catalog_tours_category WHERE slug='" . $category . "' LIMIT 1 )"; } if (sizeof($item->tours) > 0) { $toursCategory .= " AND ( "; $toursSQL .= " AND ( "; } $i = 0; foreach ($item->tours as $itemC) { if ($i > 0) { $toursCategory .= " OR "; $toursSQL .= " OR "; } $toursCategory .= " category_id='" . $itemC->id . "' "; $toursSQL .= " category_id='" . $itemC->id . "' "; $i++; } if (sizeof($item->tours) > 0) { $toursCategory .= " ) "; $toursSQL .= " ) "; } // Одно исключение для детских лагерей if ($item->id == 7) { $detCount = CatalogKurorts::count(DBQueryParamsClass::CreateParams()->setConditions($curortsCategory)); } else { $detCount = 0; } Yii::app()->page->title = $item->name; $this->render('index', array("icategory" => $icategory, "ccategory" => $ccategory, "category" => $category, "country" => $country, "activeTab" => $activeTab, "item" => $item, "infoSQL" => $infoSQL, "info" => CatalogInfo::fetchAll(DBQueryParamsClass::CreateParams()->setConditions($infoCategory)->setOrderBy("col DESC")->setPage($i_page)->setLimit(15)), "infoCount" => CatalogInfo::count(DBQueryParamsClass::CreateParams()->setConditions($infoCategory)), "toursSQL" => $toursSQL, "tours" => CatalogTours::fetchAll(DBQueryParamsClass::CreateParams()->setConditions($toursCategory)->setOrderBy("col DESC")->setPage($t_page)->setLimit(15)), "tourCount" => CatalogTours::count(DBQueryParamsClass::CreateParams()->setConditions($toursCategory)), "kurortsSQL" => $kurortsSQL, "curorts" => $cororts, "curortsCount" => $curortsCount, "detCount" => $detCount, "t_page" => $t_page, "i_page" => $i_page, "c_page" => $c_page, "offset" => 15)); } else { throw new CHttpException("Ошибка", Yii::t("page", "Ошибка перехода на страницу")); } } else { throw new CHttpException("Ошибка", Yii::t("page", "Ошибка перехода на страницу")); } }
echo $item_->name; ?> <?php echo Yii::t("page", "информация для туристов"); ?> "><?php echo $item_->name; ?> ( <?php echo $count; ?> )</a> <ul> <?php foreach (CatalogInfoCategory::fetchAll(DBQueryParamsClass::CreateParams()->setOrderBy("name")->setConditions("owner=:owner")->setParams(array(":owner" => $item_->id))->setLimit(-1)) as $item) { $count = CatalogInfo::count(DBQueryParamsClass::CreateParams()->setConditions("category_id=:category")->setParams(array(":category" => $item->id))->setLimit(-1)); ?> <?php if ($count > 0) { ?> <li><a href="<?php echo SiteHelper::createUrl("/touristInfo", array("category" => $item->slug)); ?> .html" title="<?php echo $item->name; ?> "><?php echo $item->name; ?> ( <?php
<th>Страна</th> <th>Категория<br/>тура</th> <th>Действие</th> </tr> <?php foreach ($list as $item) { $worldCount = 0; $uzCount = 0; $itemCount = 0; // Определеяем количество статей if ($item->info_category_id->id > 0) { $itemCount = CatalogInfo::count(DBQueryParamsClass::CreateParams()->setConditions("category_id =:cid")->setParams([":cid" => $item->info_category_id->id])); } elseif ($item->country_id->id > 0) { $itemCount = CatalogInfo::count(DBQueryParamsClass::CreateParams()->setConditions("country_id = :cid")->setParams([":cid" => $item->country_id->id])); } elseif ($item->category_id->id > 0) { $itemCountArr = CatalogInfo::sql("SELECT count(id) as count_ FROM catalog_info WHERE id in ( SELECT leftId FROM cat_relations WHERE leftClass='CatalogInfo' AND rightId='" . $item->category_id->id . "' AND rightClass='CatalogToursCategory' )"); if (sizeof($itemCountArr) > 0) { $itemCount = $itemCountArr[0]["count_"]; } } if ($item->country_id->id > 0) { $countryWhere = "country_id = "; } $sql = "SELECT count(id) as count_ FROM catalog_tours WHERE active=1"; if ($item->category_id->id > 0) { $sql .= " AND category_id='" . $item->category_id->id . "'"; } $worldCountArr = CatalogTours::sql($sql . " AND country_id='1' "); if (sizeof($worldCountArr) > 0) { $worldCount = $worldCountArr[0]["count_"]; }
<div id="fc_other"> <div id="fc_other_01"> <div id="fc_other_02"> <h3><?php echo Yii::t("page", "Все туристические страны"); ?> :</h3> <?php if ($this->beginCache("firstPage_country_" . Yii::app()->getLanguage(), array('duration' => 3600))) { ?> <ul> <?php foreach (CatalogCountry::fetchAll(DBQueryParamsClass::CreateParams()->setLimit(-1)->setCache(0)) as $item) { $tour = CatalogTours::count(DBQueryParamsClass::CreateParams()->setConditions("country_id=:country_id")->setParams(array("country_id" => $item->id))); $hotels = CatalogHotels::count(DBQueryParamsClass::CreateParams()->setConditions("country_id=:country_id")->setParams(array("country_id" => $item->id))); $info = CatalogInfo::count(DBQueryParamsClass::CreateParams()->setConditions("country_id=:country_id")->setParams(array("country_id" => $item->id))); ?> <li> <a href="<?php echo SiteHelper::createUrl("/tours/country") . "/" . $item->slug; ?> .html" title="<?php echo Yii::t("page", "Туры"); ?> <?php echo $item->name_2; ?> " onmouseover="displayOrNone('fcp_lt_<?php echo $item->id; ?> ')" onmouseout="displayOrNone('fcp_lt_<?php
public function actionShow($idIn = 0, $locatIn = "", $return = FALSE) { $id = (int) Yii::app()->request->getParam("id", 0); if ($id == 0 && $idIn > 0) { $id = $idIn; } $locat = Yii::app()->request->getParam("location", ""); if (empty($locat) && !empty($locatIn)) { $locat = $locatIn; } /* График: По странам ( сортировка по цене ) 31 По категориям ( сортировка по цене ) 30 По странам ( сортировка по просмотрам) По категориям ( сортировка по просмотрам ) Определям кандидата по очереди сначала города потом категории Выбираем по сортировке первую страну Проверяем по очередньсти Формируем письмо Заголовок ( зависит от того по стране или категории + от сортировки ) указываем группу подписциков указываем группу рассылоку И полетели */ $cout = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Cache-Control" content="public"/> <meta http-equiv="Cache-Control" content="max-age=86400, must-revalidate"/> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> </head> <body>'; $logTable = SubscribeTable::fetch($id); if ($logTable->id > 0) { if ($locat == "uzb" && $logTable->country_id->id == 1) { return ""; } $countryId = 0; $categoryId = 0; if ($logTable->country_id->id > 0) { $countryId = $logTable->country_id->id; $countryModel = CatalogCountry::fetch($countryId); } if ($logTable->category_id->id > 0) { $categoryId = $logTable->category_id->id; $categoryModel = CatalogToursCategory::fetch($categoryId); } if ($countryId > 0 || $categoryId > 0) { $info = []; if ($countryId > 0) { $toursMinPrice = CatalogTours::fetchAll(DBQueryParamsClass::CreateParams()->setConditions("country_id=:cid AND price>0 AND active=1")->setParams([":cid" => $countryModel->id])->setOrderBy("price")->setLimit(1)->setCache(0)); $tours = CatalogTours::fetchAll(DBQueryParamsClass::CreateParams()->setConditions("country_id=:cid AND id !=:id AND active=1")->setParams([":cid" => $countryModel->id, ":id" => $toursMinPrice[0]->id])->setLimit(7)->setOrderBy("rating DESC, price")); $tours[] = $toursMinPrice[0]; $info = CatalogInfo::fetchAll(DBQueryParamsClass::CreateParams()->setConditions("country_id=:cid")->setParams([":cid" => $countryModel->id])->setLimit(4)->setOrderBy("id DESC")); $subject = $countryModel->title . ", от " . $tours[sizeof($tours) - 1]->price . ($tours[sizeof($tours) - 1]->currency_id->id ? $tours[sizeof($tours) - 1]->currency_id->title : "\$"); } else { $params = [":cid" => $categoryModel->id]; $condition = "category_id=:cid"; if ($locat == "uzb") { echo $locat . "==uzb<br/>"; $params = array_merge($params, [":country" => 1]); $condition .= " AND country_id!=:country"; } else { $params = array_merge($params, [":country" => 1]); $condition .= " AND country_id=:country"; } echo $condition . "*"; $toursMinPrice = CatalogTours::fetchAll(DBQueryParamsClass::CreateParams()->setConditions($condition)->setParams($params)->setOrderBy("price")->setLimit(1)->setCache(0)); $tours = CatalogTours::fetchAll(DBQueryParamsClass::CreateParams()->setConditions($condition . " AND id !=:id")->setParams(array_merge($params, [":id" => $toursMinPrice[0]->id]))->setLimit(7)->setOrderBy("rating DESC, price")); $tours[] = $toursMinPrice[0]; //$info = CatalogInfo::fetchAll(DBQueryParamsClass::CreateParams()->setConditions("country_id=:cid")->setParams([":cid" => $categoryModel->id])->setLimit(4)->setOrderBy("id DESC")); if ($tours[sizeof($tours) - 1]->price > 0) { $subject = "Тур - " . $categoryModel->name . ", от " . $tours[sizeof($tours) - 1]->price . ($tours[sizeof($tours) - 1]->currency_id->id ? $tours[sizeof($tours) - 1]->currency_id->title : "\$"); } else { $subject = "Тур - " . $categoryModel->name; } } $message = "Предлагаем Вашему вниманию интересную подборку с нашего портала <a href=\"http://www.world-travel.uz\">World-Travel.uz</a>.<br/><br/><h1>" . $subject . "</h1><br/><table>"; $n = 0; $reserveNum = 0; $reserveList = []; foreach ($tours as $tour) { if ($tour->id == 0) { continue; } $image = ImageHelper::getImages($tour, 1); // Если картинки для тура нету, то берем её из резерва catalog_image_reserve if (sizeof($image) == 0) { if (sizeof($reserveList) == 0) { $reserveList = CatalogImageReserve::findByAttributes(["country_id" => $tour->country_id->id]); } if (sizeof($reserveList) > 0) { $new = new CatGallery(); if (!empty($reserveList[$reserveNum])) { $new->image = $reserveList[$reserveNum]->image; } else { if ($tour->country_id->banner) { $new->image = $tour->country_id->banner; } else { $new->image = $tour->country_id->image; } } $image[] = $new; $reserveNum++; } } if ($n == 0 || $n == 2 || $n == 4 || $n == 6) { $message .= "<tr>"; } $message .= "<td style=\"width:50%;text-align:center;vertical-align: top;background-color: #EEE9DD;padding: 10px;border: 1px solid #fff;\">\n <table width=\"100%\">\n <tr>\n <td style=\"background:#E4DDCD;font-size:13px;text-align: right;padding-right: 5px;vertical-align: middle;\"><b>" . $tour->name . "</b></td>"; if ($tour->price > 0) { $message .= "<td style=\"background:#E4DDCD;vertical-align: top;line-height: 14px;text-align: center;\"><span style=\"font-size:10px;\">от</span><br/><b style=\"color:#ff4f00;font-size:24px;\"> " . $tour->price . ($tour->currency_id->id ? $tour->currency_id->title : "\$") . "</b><br/></td>"; } $message .= "</tr>\n </table>"; if (sizeof($image) > 0) { $message .= "<div style=\"max-height: 134px;overflow: hidden;\"><img src=\"" . (SiteHelper::createUrl("/") . ImageHelper::getImage($image[0]->image, 2)) . "\" style=\"max-width:200px\"/></div>"; } //if( $tour->included )$message .= "<td>Включенно: ".$tour->included."</td></tr>"; if ($tour->duration) { $message .= $tour->duration . "<br/>"; } if ($tour->category_id->id > 0) { $message .= "Тур - " . $tour->category_id->name2 . "<br/>"; } $message .= "<div><a style=\"margin-top: 11px;background:#ff4f00;color:#fff;font-weight: bold;display: inline-block;padding: 5px 10px;border-radius: 4px;\" href=\"" . SiteHelper::createUrl("/tours/description") . "/" . $tour->slug . ".html\">Заказать</a></div></td>"; // if ($n == 1 || $n == 3 || $n == 5 || $n == 7) { $message .= "</tr>"; } $n++; } $message .= '</table></div><br/>'; if (sizeof($info) > 0) { $message .= '<div style="background: #e4ddcd;padding: 0px 10px 10px 10px;overflow: hidden;"><table>'; foreach ($info as $item) { $message .= "<tr><td colspan=\"2\"><h3 style=\"margin:10px 0px 5px 0px;\">" . $item->name . "</h3></td></tr>\n <tr>\n <td colspan=\"2\" style=\"border-bottom:1px solid #F4F1EA;padding-bottom:10px;\">\n <table width=\"100%\">\n <tr>\n <td><img src=\"" . SiteHelper::createUrl("/") . ImageHelper::getImage($item->image, 2) . "\" style=\"padding-right: 10px;\" alt=\"" . $item->name . "\" /></td>\n <td style=\"text-align: justify;vertical-align:top\">" . SiteHelper::getSubTextOnWorld($item->description, 350) . "<br/><div align=\"right\"><a href=\"" . SiteHelper::createUrl("/touristInfo/description") . $item->slug . ".html\">читайте подробнее >>></a></div></td>\n </tr>\n </table>\n </td>\n </tr>"; // } $message .= "</table></div>"; } $cout .= $message . "</body></html>"; //if( SubscribesUzHelper::sendEmails( array( 7, 35, 41 ), $subject, $message, 3 ) )echo "Ура отправил"; // else echo "Что-то пошло не так"; } } if ($return) { return $cout; } else { echo $cout; } }