1 | <?php |
||
2 | |||
3 | use Ffcms\Core\Helper\Date; |
||
4 | use Ffcms\Core\Helper\Type\Str; |
||
5 | use Ffcms\Templex\Url\Url; |
||
6 | |||
7 | /** @var \Ffcms\Templex\Template\Template $this */ |
||
8 | /** @var Apps\Model\Front\Profile\FormUserSearch $model */ |
||
9 | /** @var \Apps\ActiveRecord\Profile[]|\Illuminate\Support\Collection|null $records */ |
||
10 | /** @var array|null $pagination */ |
||
11 | /** @var bool $ratingOn */ |
||
12 | |||
13 | $title = __('User list') . ': ' . __('Search'); |
||
14 | $this->layout('_layouts/default', [ |
||
15 | 'title' => $title, |
||
16 | 'breadcrumbs' => [ |
||
17 | Url::to('main/index') => __('Home'), |
||
18 | $title |
||
19 | ] |
||
20 | ]); |
||
21 | ?> |
||
22 | <?php $this->start('body') ?> |
||
23 | |||
24 | <h1><?= $title ?></h1> |
||
25 | |||
26 | <?php $this->insert('profile/menus/index', ['rating' => $ratingOn]) ?> |
||
27 | |||
28 | <?php $form = $this->form($model) ?> |
||
29 | |||
30 | <?= $form->start() ?> |
||
31 | |||
32 | <?= $form->fieldset()->text('query', null, __('Enter user nickname or part of user nickname, more then 3 characters')) ?> |
||
33 | <?= $form->button()->submit(__('Search'), ['class' => 'btn btn-primary']) ?> |
||
34 | |||
35 | <?= $form->stop() ?> |
||
36 | |||
37 | <?php |
||
38 | if (!$records || $records->count() < 1) { |
||
39 | if ($model->send()) { |
||
40 | echo '<div class="row"><div class="col-md-12"><div class="alert alert-danger">' . __('Users are not founded!') . '</div></div></div>'; |
||
41 | } |
||
42 | $this->stop(); |
||
43 | return; |
||
44 | } |
||
45 | ?> |
||
46 | <?php foreach ($records as $profile) :?> |
||
47 | <div class="row" style="padding-top: 10px;"> |
||
48 | <div class="col-md-2"> |
||
49 | <div class="text-center"><img src="<?= $profile->getAvatarUrl('small') ?>" class="img-fluid img-thumbnail"/></div> |
||
50 | </div> |
||
51 | <div class="col-md-8"> |
||
52 | <h3> |
||
53 | <?= Url::a(['profile/show', [$profile->user_id]], Str::likeEmpty($profile->nick) ? __('No name') : $profile->nick) ?> |
||
54 | </h3> |
||
55 | <p><?= __('Registered') ?>: <?= Date::convertToDatetime($profile->created_at, Date::FORMAT_TO_DAY) ?></p> |
||
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
56 | </div> |
||
57 | <div class="col-md-2"> |
||
58 | <h3 class="float-right"> |
||
59 | <?php |
||
60 | $markLabel = 'badge-light'; |
||
61 | if ($profile->rating > 0) { |
||
62 | $markLabel = 'badge-success'; |
||
63 | } elseif ($profile->rating < 0) { |
||
64 | $markLabel = 'badge-danger'; |
||
65 | } |
||
66 | ?> |
||
67 | <span class="badge <?= $markLabel ?>"> |
||
68 | <?= $profile->rating > 0 ? '+' : null ?><?= $profile->rating ?> |
||
69 | </span> |
||
70 | </h3> |
||
71 | </div> |
||
72 | </div> |
||
73 | <hr/> |
||
74 | <?php endforeach; ?> |
||
75 | |||
76 | <?php if ($pagination) { |
||
77 | echo $this->bootstrap()->pagination($pagination['url'], ['class' => 'pagination justify-content-center']) |
||
78 | ->size($pagination['total'], $pagination['page'], $pagination['step']) |
||
79 | ->display(); |
||
80 | } ?> |
||
81 | |||
82 | <?php $this->stop() ?> |