You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Created by Error202
|
|
|
|
* Date: 22.08.2018
|
|
|
|
*/
|
|
|
|
|
|
|
|
use yii\helpers\Html;
|
|
|
|
use yii\helpers\Url;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var $this \yii\web\View
|
|
|
|
* @var $banner \common\modules\banners\entities\Banner;
|
|
|
|
*/
|
|
|
|
|
|
|
|
$banner_id = 'banner_' . $banner->id;
|
|
|
|
$view_url = Url::to(['/banner/view']);
|
|
|
|
$click_url = Url::to(['/banner/click']);
|
|
|
|
$js = <<<JS
|
|
|
|
$("#{$banner_id}").on('click', function(){
|
|
|
|
$.ajax({
|
|
|
|
method: "POST",
|
|
|
|
url: "{$click_url}",
|
|
|
|
data: { id: "{$banner->id}" }
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
$.ajax({
|
|
|
|
method: "POST",
|
|
|
|
url: "{$view_url}",
|
|
|
|
data: { id: "{$banner->id}" }
|
|
|
|
});
|
|
|
|
JS;
|
|
|
|
$this->registerJs($js, $this::POS_READY);
|
|
|
|
?>
|
|
|
|
|
|
|
|
<?= Html::a(Html::img('@static/origin/banners/' . $banner->image), $banner->url, [
|
|
|
|
'target' => $banner->target,
|
|
|
|
'id' => $banner_id,
|
|
|
|
]) ?>
|