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; $slug = !empty($_GET["slug"]) ? $_GET["slug"] : ""; if (!empty($_GET["slug"])) { $model = $class::fetchBySlug(trim($slug)); if ($model->id > 0) { $_GET["id"] = $model->id; $id = $model->id; } } // Проверяем по ID if ($id == 0) { $ar = explode("-", $slug); if ((int) $ar[0] > 0) { $model = $class::fetch((int) $ar[0]); $id = $model->id; } } if ($id > 0) { if ($model->id > 0) { $item = $model; } else { $item = $class::fetch($id); } if ($item->id > 0) { $images = ImageHelper::getImages($item); $other = $class::fetchAll(DBQueryParamsClass::CreateParams()->setConditions("category_id=:category_id AND id!=:id")->setParams(array(":category_id" => $item->category_id->id, ":id" => $item->id))->setOrderBy("id DESC")->setLimit(12)); $tourCategory = $item->tour_category; if (!empty($tourCategory) && sizeof($tourCategory) > 0) { $dopSQL = " AND ( "; $m = 0; foreach ($tourCategory as $tCategory) { if ($m > 0) { $dopSQL .= " OR "; } $dopSQL .= "category_id=" . $tCategory->id; $m++; } $dopSQL .= ") "; $tours = CatalogTours::fetchAll(DBQueryParamsClass::CreateParams()->setConditions("country_id=:country_id " . $dopSQL)->setParams(array(":country_id" => $item->country_id->id))->setOrderBy("rating DESC")->setLimit(9)); } elseif ($item->country_id->id > 0) { $tours = CatalogTours::fetchAll(DBQueryParamsClass::CreateParams()->setConditions("country_id=:country_id")->setParams(array(":country_id" => $item->country_id->id))->setOrderBy("rating DESC")->setLimit(10)); } else { $tours = array(); } Yii::app()->page->title = $item->name; $this->render('description', array("item" => $item, "other" => $other, "images" => $images, "tours" => $tours, "hotelCount" => $class::count(DBQueryParamsClass::CreateParams()->setConditions("category_id=:category_id")->setParams(array(":category_id" => $item->category_id->id))))); } else { throw new CHttpException("Ошибка", Yii::t("page", "Ошибка перехода на страницу")); } } else { throw new CHttpException("Ошибка", Yii::t("page", "Ошибка перехода на страницу")); } }
public function actionDescription() { $slug = Yii::app()->request->getParam("slug", ""); if (!empty($slug)) { $item = CatalogAttractions::fetchBySlug($slug); if ($item->id > 0) { Yii::app()->page->setTitle($item->name); $list = CatalogAttractions::fetchAll(DBQueryParamsClass::CreateParams()->setConditions("city_id=:cid AND id!=:id")->setParams(array(":cid" => $item->city_id->id, ":id" => $item->id))->setLimit(4)); $images = ImageHelper::getImages($item); $this->render("description", array("item" => $item, "other" => $list, "images" => $images)); } } }
<?php if (!$tour->slug) { $tour->slug = SiteHelper::getSlug($tour); } $listImages = ImageHelper::getImages($tour, 1); ?> <div class="IBItem IBTours"> <?php if ($tour->price > 0) { ?> <p><?php echo Yii::t("page", "цена"); ?> :<b><?php echo $tour->price; ?> </b>у.е.</p><?php } ?> <?php if ($tour->col > 0) { ?> <div class="floatRight rightInfo"><?php echo Yii::t("page", "просмотров"); ?> : <b><?php echo $tour->col; ?> </b></div><?php
<?php $this->widget('addressLineWidget', array('links' => array(Yii::t("page", "объявления о работе") => SiteHelper::createUrl("/work"), $item->category_id->name => SiteHelper::createUrl("/work") . "/" . $item->category_id->slug . ".html", $item->name))); $images = ImageHelper::getImages($item); ?> <div id="InnerText"> <br/> <?php SiteHelper::renderDinamicPartial("pageDescriptionTop"); ?> <h1><?php echo $item->name; ?> </h1> <div id="ITText"> <div class="LParams"> <br/> <?php echo Yii::t("page", "дата"); ?> : <?php echo SiteHelper::getDateOnFormat($item->date, "d.m.Y"); ?> <br/> <a href="<?php echo SiteHelper::createUrl("/work") . "/" . $item->category_id->slug; ?> .html"><?php echo $item->category_id->name; ?>
<tr <?php echo $banner->hot == 1 ? 'class="isHot"' : ""; ?> > <td><?php echo $banner->id; ?> </td> <td> <?php if (!$banner->image) { $countImages = 5; } else { $countImages = 4; } $listImages = ImageHelper::getImages($banner, $countImages); if (sizeof($listImages) > 0 || $banner->image) { ?> <div class="listItemsImages"> <?php if ($banner->image) { ?> <div class="LII_1"><img src="<?php echo ImageHelper::getImage($banner->image, 3); ?> " alt="" /></div><?php } ?> <?php if ($banner->image) { $i = 2;
function getRelatedImagesWidget($title) { global $wgUser; $exceptions = wfMsg('ih_exceptions'); $imageExceptions = split("\n", $exceptions); $articles = ImageHelper::getLinkedArticles($title); $images = array(); foreach ($articles as $t) { $results = ImageHelper::getImages($t->getArticleID()); if (count($results) <= 1) { continue; } $titleDb = $title->getDBkey(); foreach ($results as $row) { if ($row['il_to'] != $titleDb && !in_array($row['il_to'], $imageExceptions)) { $images[] = $row['il_to']; } } } $count = 0; $maxLoc = count($images); $maxImages = $maxLoc; $finalImages = array(); while ($count < 6 && $count < $maxImages) { $loc = rand(0, $maxLoc); if ($images[$loc] != null) { $image = Title::newFromText("Image:" . $images[$loc]); if ($image && $image->getArticleID() > 0) { $file = wfFindFile($image); if ($file && isset($file)) { $finalImages[] = array('title' => $image, 'file' => $file); $images[$loc] = null; $count++; } else { $maxImages--; } } else { $maxImages--; } $images[$loc] = null; } } if (count($finalImages) > 0) { $html = '<div><h3>' . wfMsg('ih_relatedimages_widget') . '</h3><table style="margin-top:10px" class="image_siderelated">'; $count = 0; foreach ($finalImages as $imageObject) { $image = $imageObject['title']; $file = $imageObject['file']; if ($count % 2 == 0) { $html .= "<tr>"; } $heightPreference = ImageHelper::heightPreference(127, 140, $file); $thumb = $file->getThumbnail(127, 140, true, true, $heightPreference); $imageUrl = $image->getFullURL(); $thumbUrl = $thumb->url; $imageTitle = $imageName; $html .= "<td valign='top'>\n\t\t\t\t\t\t\t<a href='" . $imageUrl . "' title='" . $imageTitle . "' class='image'>\n\t\t\t\t\t\t\t<img border='0' class='mwimage101' src='" . wfGetPad($thumbUrl) . "' alt='" . $imageTitle . "'>\n\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t</td>"; if ($count % 2 == 2) { $html .= "</tr>"; } $count++; } if ($count % 3 != 2) { $html .= "</tr>"; } $html .= "</table></div>"; return $html; } }
<tr <?php echo $item->is_hot == 1 ? 'class="isHot"' : ""; ?> > <td><?php echo $item->id; ?> </td> <td> <?php if (!$item->image) { $countImages = 5; } else { $countImages = 4; } $listImages = ImageHelper::getImages($item, $countImages); if (sizeof($listImages) > 0 || $item->image) { ?> <div class="listItemsImages"> <?php if ($item->image) { ?> <div class="LII_1"><img src="<?php echo ImageHelper::getImage($item->image, 3); ?> " alt="" /></div><?php } ?> <?php if ($item->image) { $i = 2;
public function run() { $images = ImageHelper::getImages($this->item, 1); $this->render("info", array('link' => $this->link, 'images' => $images, 'item' => $this->item)); }
static function getAnimateImageBlock($item, $link, $title = "", $count = 3) { if (!$item->image) { $countImages = $count + 1; } else { $countImages = $count; } $count = 0; if (defined("YII_SUBDOMAIN") && YII_SUBDOMAIN == "wap-") { $countImages = 1; } $titleValue = !empty($title) ? $title : $item->name; $listImages = ImageHelper::getImages($item, $countImages); echo '<div class="listItemsImages">'; if (sizeof($listImages) > 0 || $item->image) { ?> <?php if ($item->image) { ?> <div class="LII_1"><a href="<?php echo $link; ?> " title="<?php echo $titleValue; ?> "><img src="<?php echo ImageHelper::getImage($item->image, 2); ?> " alt="<?php echo $titleValue; ?> " /></a></div><?php } ?> <?php if ($item->image) { $i = 2; } else { $i = 1; } foreach ($listImages as $LItem) { if ($i == 1) { $imageSize = 2; } else { $imageSize = 3; } ?> <div class="LII_<?php echo $i; ?> "> <?php if ($i == 1) { ?> <a href="<?php echo $link; ?> " title="<?php echo $titleValue; ?> "><?php } ?> <img src="<?php echo ImageHelper::getImage($LItem->image, $imageSize); ?> " alt="<?php echo $titleValue; ?> " /> <?php if ($i == 1) { ?> </a><?php } ?> </div> <?php $i++; } ?> <?php } echo '</div>'; }
<?php if ($this->beginCache($link . "_error-page" . Yii::app()->getLanguage(), array('duration' => 3600 * 12))) { ?> <div class="ListTours"> <h2>Смотрите также</h2> <?php $i = 0; foreach ($list as $line) { $i++; if ($i == 11) { break; } if ($line->image) { $image = $line->image; } else { $images = ImageHelper::getImages($line, 1); if (sizeof($images) > 0) { $image = $images[0]->image; } } if (empty($image)) { $i--; continue; } ?> <div class="LTItem"> <div class="LTImag LTI2"><a href="<?php echo SiteHelper::createUrl("/" . $link . "/description") . "/" . $line["slug"]; ?> .html" title="<?php echo $line["name"];
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; } }