ADD - учёт внешних переходов + несколько товаров с юлмарта для теста

This commit is contained in:
Krivchikov Dmitry 2015-11-08 22:38:03 +03:00
parent aed37ab481
commit 8eb430121a
6 changed files with 85 additions and 13 deletions

View File

@ -0,0 +1,28 @@
<?php
class GoController extends Controller
{
static function actionAway()
{
if (!isset($_GET['url'])) {
App::error404();
}
$url = $_GET['url'];
$url = filter_var($url, FILTER_VALIDATE_URL);
if($url) {
$go = new GoAway(array(
'date' => date('c'),
'url' => $url,
'ref' => isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '',
));
$go->save();
App::redirect($url, 302);
} else {
App::log('goAwayErrors', $url);
App::error404();
}
}
}

View File

@ -101,6 +101,7 @@ class PointController extends Controller
'photoLinks' => $photoLinksRes, 'photoLinks' => $photoLinksRes,
'articles' => $articles, 'articles' => $articles,
'extraParams' => $point->getExtraParams(), 'extraParams' => $point->getExtraParams(),
'goods' => Goods::model()->getRandom(6),
)); ));
} else { } else {
App::error404(); App::error404();

17
ground/models/GoAway.php Normal file
View File

@ -0,0 +1,17 @@
<?php
class GoAway extends Model
{
function __construct($fromArray = array())
{
$this->_tableName_ = 'goAway';
parent::__construct($fromArray);
}
static function model()
{
return new self();
}
}

24
ground/models/Goods.php Normal file
View File

@ -0,0 +1,24 @@
<?php
class Goods extends Model
{
function __construct($fromArray = array())
{
$this->_tableName_ = 'goods';
parent::__construct($fromArray);
}
static function model()
{
return new self();
}
function getRandom($count = 6)
{
return $this->getAll(array(
'order' => 'RAND()',
'limit' => (int) $count,
));
}
}

View File

@ -90,19 +90,7 @@ $index = 0;
Использованы фотоматериалы с сайтов: <?= $photoLinks ?> Использованы фотоматериалы с сайтов: <?= $photoLinks ?>
<?php endif; ?> <?php endif; ?>
</div> </div>
<div class="col-md-12" style="text-align: center; margin: 10px auto;"> <p style="margin-top: 5px; text-align: right;">
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Point - DOWN -->
<ins class="adsbygoogle"
style="display:block"
data-ad-client="ca-pub-0069680015252793"
data-ad-slot="4972494746"
data-ad-format="auto"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div>
<p style="margin-top: 25px; text-align: right;">
<?php if (App::$user && App::$user->id): ?> <?php if (App::$user && App::$user->id): ?>
[ <button type="button" class="btn btn-link" style="color: #333;" onclick="addRemoveFavorite(<?= $point->id ?>)"><span id="myFavoritesButton" class="glyphicon glyphicon-star<?= $point->inFavorites ? '' : '-empty' ?>"></span> Хочу посетить</button> ] [ <button type="button" class="btn btn-link" style="color: #333;" onclick="addRemoveFavorite(<?= $point->id ?>)"><span id="myFavoritesButton" class="glyphicon glyphicon-star<?= $point->inFavorites ? '' : '-empty' ?>"></span> Хочу посетить</button> ]
[ <button type="button" class="btn btn-link" style="color: #333;" onclick="addRemoveLike(<?= $point->id ?>)"><span id="myLikesButton" class="glyphicon glyphicon-<?= $point->iLike ? 'ok' : 'thumbs-up' ?>"></span> Нравится</button> ] [ <button type="button" class="btn btn-link" style="color: #333;" onclick="addRemoveLike(<?= $point->id ?>)"><span id="myLikesButton" class="glyphicon glyphicon-<?= $point->iLike ? 'ok' : 'thumbs-up' ?>"></span> Нравится</button> ]
@ -150,6 +138,16 @@ $index = 0;
</div> </div>
<hr/> <hr/>
<?php if (!empty($goods)): ?>
<div class="row test-ulm-row">
<div class="col-md-12">
<h3 style="margin-top: 0;">В путешествии обязательно пригодится:</h3>
<?php foreach ($goods as $good): ?><a href="/go/away/?url=<?= $good->url ?>" target="_blank" class="test-ulm"><img src="<?= $good->img ?>" title="<?= $good->name ?>" class=""/><br/><?= $good->name ?><br/><nobr><b><?= $good->price ?> руб.</nobr></b></a><?php endforeach; ?>
</div>
</div>
<hr/>
<?php endif; ?>
<?php if (!$articles): ?> <?php if (!$articles): ?>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">

View File

@ -5,6 +5,10 @@ div.pointsWall .point span.header {font-size: 22px; color: white; font-weight: b
.mainTextBlock {font-size: 16px; text-align: justify;} .mainTextBlock {font-size: 16px; text-align: justify;}
.test-ulm-row {background-color: #fff;margin-top: -19px;margin-bottom: -19px;padding-top: 10px;padding-bottom: 10px;}
.test-ulm-row .test-ulm {text-align: center;width: 16.5%;float: right;display: inline-block;}
.test-ulm-row .test-ulm nobr {font-size: 1.2em;}
/* -------------------------------------------*/ /* -------------------------------------------*/
/* ------------- ADAPTIVE --------------------*/ /* ------------- ADAPTIVE --------------------*/
/* -------------------------------------------*/ /* -------------------------------------------*/