public function fields() { $fields = parent::fields(); unset($fields['mem']); return array_merge($fields, ['data', 'date' => function () { return Time::dateNormalize($this->created); }, 'model' => function () { return $this->getData()->getModel(); }]); // TODO: Change the autogenerated stub }
public function fields() { return ['id', 'user_id', 'message', 'user', 'created' => function () { return Time::dateNormalize($this->created, true); }]; }
<a href="<?php echo Url::to(['user/index', 'id' => $event->user_id]); ?> "> <?php echo \common\helpers\Html::avatar($event->user, User::AVATAR_60, ['class' => 'media-object img-circle']); ?> </a> </div> <div class="media-body"> <h5 class="media-heading"><?php echo $event->user->username; ?> </h5> Опубликовал событие <?php echo \common\helpers\Time::dateNormalize($event->created_at); ?> </div> </div> </div> </div> </div> <?php echo $this->render('/event/view-subscribers.php', ['event' => $event]); ?> <?php echo $this->render('/event/view-comments.php', ['event' => $event]); ?> </div>
title="<?php echo $userFrom->username; ?> "> <?php echo $userFrom->getAvatar(User::AVATAR_60, ['class' => 'media-object']); ?> </a> </div> <div class="media-body"> <h4 class="media-heading"><?php echo $userFrom->username; ?> | <small><?php echo Time::dateNormalize($model->created); ?> </small> </h4> <?php if ($status == SubscribeUser::STATUS_SUBSCRIBE) { ?> подписался <?php } else { ?> отменил подписку <?php } ?> на обновления пользователя
"> <?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 } ?> <a href="<?php echo Url::to(['/event/view', 'id' => $event->id]); ?>
<div class="md md-brightness-1 user-point-on" title="Онлайн"></div> <?php } else { ?> <div class="md md-brightness-1 user-point-off" title="Оффлайн"></div> <?php } ?> </div> <h2><?php echo $userView->username; ?> </h2> <p> <span title="Дата регистрации"><i class="md md-assignment-ind"></i> <?php echo \common\helpers\Time::dateNormalize($userView->created_at); ?> </span> </p> <hr class="separator"/> <div> <div class="row"> <div class="col-xs-6 text-center text-muted"> <div class="user-view-counter"><?php echo $c = $userView->getSubscribers()->count(); ?> </div> <div class="user-view-counter-title small"><?php echo String::declension($c, ['подписчик', 'подписчка', 'подписчиков'], '{text}'); ?>
public function fields() { return ['id', 'name', 'f' => function () { return ['begin' => Time::dateNormalize($this->begin), 'end' => Time::dateNormalize($this->end)]; }, 'img' => function () { return ['main' => $this->getImage(self::IMAGE_MAIN, ['onlyLink' => true]), 'md' => $this->getImage(self::IMAGE_THUMB_MD, ['onlyLink' => true]), 'sm' => $this->getImage(self::IMAGE_THUMB_SM, ['onlyLink' => true])]; }, 'link' => function () { return ['subscribe' => Url::to(['/event/subscribe', 'id' => $this->id]), 'view' => Url::to(['/event/view', 'id' => $this->id])]; }, 'subscribe' => function () { return (bool) $this->subscribe; }, 'description', 'geo_longitude', 'begin', 'end', 'type' => function () { return $this->type; }, 'site', 'geo_latitude', 'geo_title', 'geo_description', 'user', 'tags' => function () { // return Yii::$app->db->cache(function () { return $this->getTags()->indexBy(null)->select(['name'])->asArray()->column(); // }, 3600); }, 'finished' => function () { return $this->isCompleted(); }]; }
/** * Устанавливаем существующую модель * @param Event $event */ public function setEventModel(Event $event) { $this->_eventModel = $event; $this->geoDescription = $event->geo_description; $this->geoCoordinates = $event->geo_longitude . ',' . $event->geo_latitude; $this->type = $event->event_type_id; $this->name = $event->name; $this->description = $event->description; $this->begin = Time::toDateTime($event->begin)->format('d.m.Y H:i'); if ($event->end) { $this->end = Time::toDateTime($event->end)->format('d.m.Y H:i'); } $this->img = $event->getImage(Event::IMAGE_MAIN, ['onlyLink' => 1]); $this->site = $event->site; $tags = ArrayHelper::getColumn($event->tags, 'name'); $this->tag = implode(', ', $tags); $this->setPrice($event->getPriceList()->asArray()->all()); }