public function init() { if (!$this->title) { $this->title = \Yii::$app->view->title; } parent::init(); // TODO: Change the autogenerated stub $this->description = String::truncate($this->description, 1000); }
public function run() { $class = $this->model->getData()->className(); $class = String::onlyClassName($class); $data = []; $method = 'prepare' . $class; if (method_exists($this, $method)) { $data = $this->{$method}(); } $class = String::camelToDash($class); $params = array_merge($data, ['model' => $this->model, 'userView' => $this->userView]); return $this->render('wall/' . $class, $params); }
<div class="event-body"> <a href="<?php echo Url::to(['/user/index', 'id' => $event->user->id]); ?> "> <?php echo \common\helpers\Html::avatar($event->user, 50, ['alt' => $event->user->username, 'class' => 'media-object img-circle owner-img']); ?> </a> <div class="event-title"><?php echo $event->name; ?> </div> <div class="event-description"><?php echo \common\helpers\String::truncate($event->description, $context->descriptionLength); ?> </div> <div class="event-date"><?php echo \common\helpers\Time::dateNormalize($event->begin); ?> </div> <div class="event-control"> <?php if ($user) { ?> <i class="md <% if(subscribe){%> md-add-circle<% }else{ %>md-add-circle-outline <%} %> event-control-subscribe " data-remote="<%=link.subscribe%>" title="<% if(subscribe){%> Отменить подписку<% }else{ %>Подписаться<%} %>"></i> <?php }
</div> <div class="col-xs-3 text-center text-muted"> <div class="user-view-counter-xs"><?php echo $c = $userView->getEventSubscribe()->count(); ?> </div> <div class="user-view-counter-title-xs small"><?php echo String::declension($c, ['событие', 'события', 'событий'], '{text}'); ?> </div> </div> <div class="col-xs-3 text-center text-muted"> <div class="user-view-counter-xs"><?php echo $c = $userView->getEventSubscribe()->count(); ?> </div> <div class="user-view-counter-title-xs small"><?php echo String::declension($c, ['событие', 'события', 'событий'], '{text}'); ?> </div> </div> </div> </div> </div> </div> </div> <div class="panel panel-default visible-xs"> <div class="panel-body"> </div> </div>
?> на событие | <small><?php echo Time::dateNormalize($model->created); ?> </small></h5> <div class="media"> <div class="media-left"> <a href="<?php echo Url::to(['event/view', 'id' => $event->id]); ?> "> <?php echo $event->getImage(\common\models\Event::IMAGE_THUMB_SM, ['class' => 'media-object', 'width' => 50]); ?> </a> </div> <div class="media-body"> <strong class="media-heading"><?php echo $event->name; ?> </strong> <p> <?php echo \common\helpers\String::truncate($event->description); ?> </p> </div> </div> </div> </div>
* Time: 18:28 * @var $this \yii\base\View * @var $context \common\widgets\Share */ $context = $this->context; use ijackua\sharelinks\ShareLinks; use yii\helpers\Html; Yii::$app->view->registerMetaTag(['name' => "keywords", 'content' => $context->title]); Yii::$app->view->registerMetaTag(['property' => "og:type", 'content' => 'article']); Yii::$app->view->registerMetaTag(['property' => "og:url", 'content' => \yii\helpers\Url::canonical()]); Yii::$app->view->registerMetaTag(['property' => "og:image", 'itemprop' => "image primaryImageOfPage", 'content' => $context->image]); //twitter Yii::$app->view->registerMetaTag(['name' => "twitter:card", 'content' => 'summary']); Yii::$app->view->registerMetaTag(['name' => "twitter:domain", 'content' => Yii::$app->getHomeUrl()]); Yii::$app->view->registerMetaTag(['name' => "twitter:title", 'property' => 'og:title', 'itemprop' => 'title name', 'content' => \common\helpers\String::truncate($context->title, 140)]); Yii::$app->view->registerMetaTag(['name' => "twitter:description", 'property' => "og:description", 'itemprop' => "description", 'content' => \common\helpers\String::truncate($context->description, 140)]); Yii::$app->view->registerMetaTag(['name' => "twitter:image", 'content' => $context->image]); ?> <div class="socialShareBlock"> <?php echo Html::a('', $context->shareUrl(ShareLinks::SOCIAL_FACEBOOK), ['title' => 'Поделиться в Facebook', 'class' => "socicon socicon-facebook"]); ?> <?php echo Html::a('', $context->shareUrl(ShareLinks::SOCIAL_TWITTER), ['title' => 'Поделиться в Twitter', 'class' => "socicon socicon-twitter"]); ?> <?php echo Html::a('<i class="icon-gplus-squared"></i>', $context->shareUrl(ShareLinks::SOCIAL_GPLUS), ['title' => 'Поделиться в Google Plus', 'class' => "socicon socicon-google"]); ?> <?php echo Html::a('<i class="icon-vkontakte"></i>', $context->shareUrl(ShareLinks::SOCIAL_VKONTAKTE), ['title' => 'Поделиться в VK', 'class' => "socicon socicon-vkontakte"]); ?>