if (utf8_strlen($title) > 30) { $title = utf8_substr($title, 0, 30) . '...'; } // Обрезаем, если больше 20 $description = ''; if ($item->canShowInView('description')) { $description = $item->getStrByLang('description'); } ?> <div class="new-building-object-list"> <div class="image"> <?php $res = Images::getMainThumb(300, 157, $item->images); $img = CHtml::image($res['thumbUrl'], $item->getStrByLang('title'), array('title' => $item->getStrByLang('title'), 'class' => 'apartment_type_img')); echo CHtml::link($img, $item->getUrl(), array('title' => $item->getStrByLang('title'), 'alt' => $item->getStrByLang('title'))); ?> <div class="title"> <a href="<?php echo $item->getUrl(); ?> " ><?php echo $title; ?> </a> </div> </div> <div class="address" style="min-height:66px"> <?php
?> /images/photo_count.png"><b><?php echo $countImagesArr[$item->id]; ?> </b></div> <?php } ?> <div class="apartment_type"><?php echo Apartment::getNameByType($item->type); ?> </div> <?php $res = Images::getMainThumb(150, 100, $item->images); $img = CHtml::image($res['thumbUrl'], $item->getStrByLang('title'), array('title' => $item->getStrByLang('title'), 'class' => 'apartment_type_img')); echo CHtml::link($img, $item->getUrl(), array('title' => $item->getStrByLang('title'))); ?> </div> </div> <div class="offer-text"> <div class="apartment-title"> <?php $title = CHtml::encode($item->getStrByLang('title')); if ($item->rating && !isset($booking)) { //$title = truncateText($item->getStrByLang('title'), 5); if (utf8_strlen($title) > 21) { $title = utf8_substr($title, 0, 21) . '...'; }
public static function preparePosting(Apartment $model) { if ($model) { $message = ''; $defaultLang = Lang::getDefaultLang(); $tmp = 'title_' . $defaultLang; if (isset($model->{$tmp})) { $message .= $model->{$tmp}; } // vkontakte if (SocialpostingModel::getSocialParamValue('useVkontakte')) { $vkApId = SocialpostingModel::getSocialParamValue('vkontakteApplicationId'); $vkToken = SocialpostingModel::getSocialParamValue('vkontakteToken'); $vkUsId = SocialpostingModel::getSocialParamValue('vkontakteUserId'); //if ($vkApId && $vkToken && !is_numeric($model->autoVKPostId)) { if ($vkApId && $vkToken && utf8_strlen($model->autoVKPostId) < 1) { if ($message) { $imageUrl = null; $res = Images::getMainThumb(300, 200, $model->images); if ($res['link']) { $imageUrl = $res['link']; } $post = self::addPostToVK($message, $vkApId, $vkToken, $vkUsId, $model->getUrl(), $imageUrl); //logs(var_export($post, false)); //logs(var_export($post, true)); $postId = '0'; if ($post && isset($post->response)) { $postId = isset($post->response->post_id) && $post->response->post_id ? $post->response->post_id : 0; } $model->autoVKPostId = $postId; $model->update(array('autoVKPostId')); /*$sql = 'UPDATE {{apartment}} SET autoVKPostId = "'.strip_tags(addslashes($postId)).'" WHERE id = '.$model->id; Yii::app()->db->createCommand($sql)->execute();*/ } } } // twitter if (SocialpostingModel::getSocialParamValue('useTwitter')) { $twApiKey = SocialpostingModel::getSocialParamValue('twitterApiKey'); $twApiSecret = SocialpostingModel::getSocialParamValue('twitterApiSecret'); $twTokenKey = SocialpostingModel::getSocialParamValue('twitterTokenKey'); $twTokenSecret = SocialpostingModel::getSocialParamValue('twitterTokenSecret'); //if ($twApiKey && $twApiSecret && $twTokenKey && $twTokenSecret && !is_numeric($model->autoTwitterPostId)) { if ($twApiKey && $twApiSecret && $twTokenKey && $twTokenSecret && utf8_strlen($model->autoTwitterPostId) < 1) { if ($message) { $post = self::addPostToTw($message, $twApiKey, $twApiSecret, $twTokenKey, $twTokenSecret, $model->getUrl()); //logs(var_export($post, false)); //logs(var_export($post, true)); $postId = '0'; if ($post && isset($post->id_str)) { $postId = $post->id_str ? $post->id_str : 0; } $model->autoTwitterPostId = strip_tags(addslashes($postId)); $model->update(array('autoTwitterPostId')); /*$sql = 'UPDATE {{apartment}} SET autoTwitterPostId = "'.strip_tags(addslashes($postId)).'" WHERE id = '.$model->id; Yii::app()->db->createCommand($sql)->execute();*/ } } } } return true; }
echo Yii::app()->baseUrl; ?> /images/photo_count.png"><b><?php if (isset($countImagesArr[$lastEstateObject->id])) { echo $countImagesArr[$lastEstateObject->id]; } ?> </b></div> <div class="apartment_type"><?php echo Apartment::getNameByType($lastEstateObject->type); ?> </div> <?php $res = Images::getMainThumb(150, 100, $lastEstateObject->images); $img = CHtml::image($res['thumbUrl'], $item->getStrByLang('title'), array('title' => $lastEstateObject->getStrByLang('title'), 'class' => 'apartment_type_img')); echo CHtml::link($img, $lastEstateObject->getUrl(), array('title' => $lastEstateObject->getStrByLang('title'))); ?> </div> </div> <div class="offer-text"> <div class="apartment-title"> <?php $title = CHtml::encode($lastEstateObject->getStrByLang('title')); if ($lastEstateObject->rating && !isset($booking)) { //$title = truncateText($item->getStrByLang('title'), 5); if (utf8_strlen($title) > 21) { $title = utf8_substr($title, 0, 21) . '...'; } } else {
<div class="gmap-marker"> <div align="center" class="gmap-marker-adlink"> <?php echo CHtml::link('<strong>' . tt('ID', 'apartments') . ': ' . $model->id . '</strong>, ' . Apartment::getNameByType($model->type) . ', ' . CHtml::encode($model->getStrByLang('title')), $model->getUrl()); ?> </div> <?php $res = Images::getMainThumb(150, 100, $model->images); ?> <div align="center" class="gmap-marker-img"> <?php echo CHtml::image($res['thumbUrl'], $model->getStrByLang('title'), array('title' => $model->getStrByLang('title'))); ?> </div> <?php ?> <div align="center" class="gmap-marker-adress"> <?php echo CHtml::encode($model->getStrByLang('address')); ?> </div> </div>
echo ' ' . Booking::getDate($model->is_free_to); } echo '</div>'; } ?> </div> <?php } ?> <div> <table cellpadding="0" cellspacing="0" border="0" width="100%"> <tr> <td width="320px" valign="top"> <?php $res = Images::getMainThumb(300, 200, $model->images); echo CHtml::image($res['thumbUrl'], $model->getStrByLang('title'), array('title' => $model->getStrByLang('title'))); ?> </td> <td valign="top"> <?php echo '<div>'; echo '<strong>' . tt('Type', 'apartments') . '</strong>: ' . Apartment::getNameByType($model->type); echo '</div>'; ?> <?php if (param('useShowUserInfo')) { if (issetModule('tariffPlans') && issetModule('paidservices')) { if (!Yii::app()->user->isGuest && TariffPlans::checkAllowShowPhone()) { echo '<div>'; echo '<strong>' . tt('Owner phone', 'apartments') . '</strong>: <img src="' . Yii::app()->controller->createUrl('/apartments/main/generatephone', array('id' => $model->id, 'width' => 180)) . '" style="vertical-align: text-top;"/>';
<?php if (is_array($ads) && count($ads) > 0) { $i = 0; foreach ($ads as $item) { if ($i == 4) { return; } echo '<div class="similarhr-ads-adv">'; echo '<a href="#card-object" role="button" data-toggle="modal" class="image">'; $res = Images::getMainThumb(297, 198, $item->images); echo CHtml::image($res['thumbUrl'], '', array('title' => $item->{'title_' . Yii::app()->language}, 'width' => 297, 'height' => 198)); echo '<span>' . Apartment::getNameByType($item->type) . ' ' . $item->bt_getPriceMod() . '</span></a>'; echo '<div class="similarhr-ads-desc"> <a href="#card-object" role="button" data-toggle="modal">' . truncateText(CHtml::encode($item->getStrByLang('title')), 6) . '</a> <ul> <li>м. Савёловская</li> <li>ул. Раздельная, д.12</li> </ul> </div> '; echo '</div>'; $i++; } } ?>
public function actionView($id = 0, $url = '', $printable = 0) { //$this->showSearchForm = false; $this->htmlPageId = 'viewlisting'; $apartment = NULL; $seo = NULL; if (($id || $url) && issetModule('seo')) { $url = $url ? $url : $id; $seo = SeoFriendlyUrl::getForView($url, $this->modelName); if ($seo) { $this->setSeo($seo); $id = $seo->model_id; } } if ($id) { $apartment = Apartment::model()->with(array('windowTo', 'objType', 'city'))->findByPk($id); // избавляемся от дублей $apartmentUrl = $apartment->getUrl(false); if (!$printable && issetModule('seo') && $apartment->seo && Yii::app()->request->url != $apartmentUrl) { $this->redirect($apartmentUrl, true, 301); } } if (!$apartment) { throw404(); } if (!in_array($apartment->type, Apartment::availableApTypesIds()) || !in_array($apartment->price_type, array_keys(Apartment::getPriceArray(Apartment::PRICE_SALE, true)))) { throw404(); } if ($apartment->owner_id != 1 && $apartment->owner_active == Apartment::STATUS_INACTIVE) { if (!(isset(Yii::app()->user->id) && Yii::app()->user->id == $apartment->owner_id) && !Yii::app()->user->checkAccess('backend_access')) { Yii::app()->user->setFlash('notice', tt('apartments_main_index_propertyNotAvailable', 'apartments')); throw404(); } } if (($apartment->active == Apartment::STATUS_INACTIVE || $apartment->active == Apartment::STATUS_MODERATION) && !Yii::app()->user->checkAccess('backend_access') && !(isset(Yii::app()->user->id) && Yii::app()->user->id == $apartment->owner_id)) { Yii::app()->user->setFlash('notice', tt('apartments_main_index_propertyNotAvailable', 'apartments')); //$this->redirect(Yii::app()->homeUrl); throw404(); } if ($apartment->active == Apartment::STATUS_MODERATION && $apartment->owner_active == Apartment::STATUS_ACTIVE && $apartment->owner_id == Yii::app()->user->id) { Yii::app()->user->setFlash('error', tc('Awaiting moderation')); } if ($apartment->deleted) { Yii::app()->user->setFlash('error', tt('Listing is deleted', 'apartments')); } $dateFree = CDateTimeParser::parse($apartment->is_free_to, 'yyyy-MM-dd'); if ($dateFree && $dateFree < time() - 60 * 60 * 24) { $apartment->is_special_offer = 0; $apartment->update(array('is_special_offer')); } if (!Yii::app()->request->isAjaxRequest) { $ipAddress = Yii::app()->request->userHostAddress; $userAgent = Yii::app()->request->userAgent; Apartment::setApartmentVisitCount($apartment, $ipAddress, $userAgent); } $lastNews = News::getLastNews(); $lastArticles = Article::getLastArticles(); ####################################################################### # для соц. кнопок if ($apartment->getStrByLang("title")) { Yii::app()->clientScript->registerMetaTag($apartment->getStrByLang("title"), null, null, array('property' => 'og:title')); } if ($apartment->getStrByLang("description")) { Yii::app()->clientScript->registerMetaTag($apartment->getStrByLang("description"), null, null, array('property' => 'og:description')); } Yii::app()->clientScript->registerMetaTag($apartment->getUrl(), null, null, array('property' => 'og:url')); if (Yii::app()->theme->name == 'atlas') { $res = Images::getMainThumb(640, 400, $apartment->images); } else { $res = Images::getMainThumb(300, 200, $apartment->images); } if (isset($res['thumbUrl']) && $res['thumbUrl']) { Yii::app()->clientScript->registerMetaTag($res['thumbUrl'], null, null, array('property' => 'og:image')); Yii::app()->clientScript->registerLinkTag('image_src', null, $res['thumbUrl']); } ####################################################################### if ($printable) { $this->layout = '//layouts/print'; $this->render('view_print', array('model' => $apartment)); } else { $this->render('view', array('model' => $apartment, 'statistics' => Apartment::getApartmentVisitCount($apartment), 'lastNews' => $lastNews, 'lastArticles' => $lastArticles)); } }
<?php if (param('useShowUserInfo')) { echo '<div class="apartment-user-info' . ($data->is_special_offer ? ' top50' : '') . '">'; $this->widget('zii.widgets.jui.CJuiTabs', array('tabs' => array(tc('Listing provided by') => $this->renderPartial('//../modules/apartments/views/_user_info', array('data' => $data), true)), 'htmlOptions' => array('class' => 'info-tabs'))); echo '</div>'; } ?> <div class="viewapartment-main-photo"> <div class="apartment_type"><?php echo Apartment::getNameByType($data->type); ?> </div> <?php $img = null; $res = Images::getMainThumb(300, 200, $data->images); $img = CHtml::image($res['thumbUrl'], $res['comment']); if ($res['link']) { echo CHtml::link($img, $res['link'], array('rel' => 'prettyPhoto[img-gallery]', 'title' => $res['comment'])); } else { echo $img; } if (isFree()) { $var01 = 5; $var1 = User::model()->randomStringNonNumeric(3); $var2 = User::model()->randomStringNonNumeric(4); $var3 = User::model()->randomStringNonNumeric(5); $var4 = User::model()->randomStringNonNumeric(6); $var5 = User::model()->randomStringNonNumeric(7); $var6 = User::model()->randomStringNonNumeric(8); $var7 = User::model()->randomStringNonNumeric(3);
public static function returnMainThumbForGrid($data = null) { if ($data) { $res = Images::getMainThumb(60, 45, $data->images); return CHtml::image($res['thumbUrl'], $data->getStrByLang('title'), array('title' => $data->getStrByLang('title'), 'class' => 'apartment_type_img_small')); } }
if (utf8_strlen($title) > 30) { $title = utf8_substr($title, 0, 30) . '...'; } // Обрезаем, если больше 20 $description = ''; if ($item->canShowInView('description')) { $description = $item->getStrByLang('description'); } ?> <div class="add-luxury-offer"> <div class="image"> <?php $res = Images::getMainThumb(526, 348, $item->images); $img = CHtml::image($res['thumbUrl'], $item->getStrByLang('title'), array('title' => $item->getStrByLang('title'), 'class' => 'apartment_type_img')); echo CHtml::link($img, $item->getUrl(), array('title' => $item->getStrByLang('title'), 'alt' => $item->getStrByLang('title'))); ?> <div class="add-luxury-offer-title"> <div><a href="<?php echo $item->getUrl(); ?> "><?php echo $title; ?> <?php echo $item->square; ?> м<sup>2</sup></a></div> <div><?php