/
peyli
/
Practice
Обзор
Документация
Войти
/
peyli
/
Practice
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
views/event/view.php
114 строк
5 KB
Катя
Полный код
27 июн 2026, 14:28
27 июн 2026, 14:28
6181a72
Код
Авторство
О чём код?
<?php use yii\helpers\Html; use yii\widgets\DetailView; /** @var yii\web\View $this */ /** @var app\models\Event $model */ $this->title = $model->title; \yii\web\YiiAsset::register($this); ?> <style> </style> <div class="event-view"> <h1><?= Html::encode($this->title) ?></h1> <div class="one-event"> <div class="cover-event"> <?php if (Html::encode($event->cover) == null): ?> <p class="text-muted fs-5">Нет изображения</p> <?php else: ?> <?= Html::encode($event->cover) ?> <?php endif; ?> </div> <div class="cover-text-data w-100 fs-5"> <table class="table table-borderless table-sm w-100 my-0"> <tbody> <tr> <th>Организатор</th> <td class="text-end"><?= $event->user_username ?></td> </tr> <tr> <th>Тип мероприятия</th> <td class="text-end"><?= $event->event_type ?></td> </tr> <tr> <th>Цена билета</th> <td class="text-end"> <?php if (Html::encode($event->price) == 0): ?> Бесплатно <?php else: ?> <?= Html::encode($event->price) ?> руб. <?php endif; ?> </td> </tr> <tr> <th>Место</th> <td class="text-end"><?= $event->place ?></td> </tr> <tr> <th>Время</th> <td class="text-end"><?= Yii::$app->formatter->asDate($event->start, 'dd.MM.yyyy H:i') ?> <?php if (Html::encode($event->end) == null): ?> <?php else: ?> — <?= Yii::$app->formatter->asDate($event->end, 'dd.MM.yyyy H:i') ?> <?php endif; ?> </td> </tr> </tbody> </table> </div> </div> <p class="fs-5 my-2"><?= $event->description ?></p> <div class="buttons"> <?= Html::a(Yii::t('app', 'Назад'), ['index'], ['class' => 'btn btn btn-primary fs-5']) ?> <?php if (Yii::$app->user->isGuest): ?> <?= Html::a(Yii::t('app', 'Участвовать'), ['../site/login'], ['class' => 'btn btn-primary fs-5']) ?> <?php else: $count = 0; $participants = \app\models\Participant::find()->all(); foreach ($participants as $participant): if ($participant->event_id == $event->id):?> <?php if ($participant->user_username == Yii::$app->user->identity->username): ?> <?php if ($participant->role == 'Организатор'): ?> <?= Html::a(Yii::t('app', 'Изменить'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary fs-5']) ?> <?php $count++; else:; ?> <?= Html::a(Yii::t('app', 'Отменить участие'), ['cancel', 'id' => $event->id], [ 'class' => 'btn btn-danger fs-5', 'data' => [ 'confirm' => Yii::t('app', 'Вы уверены, что хотите отменить участие?'), 'method' => 'post', ], ]) ?> <? $count++; ?> <?php endif; ?> <?php endif; ?> <?php endif; ?> <?php endforeach; ?> <?php if ($count == 0): ?> <?= Html::a(Yii::t('app', 'Участвовать'), ['join', 'id' => $event->id], ['class' => 'btn btn-primary fs-5']) ?> <?php endif; ?> <?php endif; ?> </div> <!-- <h2>Список участников:</h2>--> <!-- --><?php //foreach ($participants as $p):?> <!-- <ul>--> <!-- <li>--> <!-- --><?php //= $p->id ?><!-- (--><?php //= $p->role ?><!--) </li>--> <!-- </ul>--> <!-- --><?php //endforeach;?>