Initial import
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
use app\models\Ts;
|
||||
use app\models\UserExplorerObjects;
|
||||
use app\services\Auth;
|
||||
use app\models\Subscriptions;
|
||||
use app\services\Cart;
|
||||
|
||||
$user = Auth::getUser();
|
||||
$lang = Yii::$app->language;
|
||||
|
||||
$userExplorerObjects = UserExplorerObjects::find()->where(['user_id' => $user->id]);
|
||||
$count = $userExplorerObjects->count();
|
||||
|
||||
$userExplorerObjects = $userExplorerObjects->orderBy(['date_visit' => SORT_DESC])->all();
|
||||
|
||||
$data = [];
|
||||
$totalPoints = 0;
|
||||
function countMessage($count)
|
||||
{
|
||||
$en = $count == 1 ? 'visited place' : 'visited places';
|
||||
$bg = $count == 1 ? 'посетен обект' : 'посетени обекта';
|
||||
return ['en' => $en, 'bg' => $bg];
|
||||
|
||||
}
|
||||
|
||||
foreach ($userExplorerObjects as $ueo) {
|
||||
if ($ueo->explorerObject && $ueo->explorerObject->tourObject) {
|
||||
$tourObject = $ueo->explorerObject->tourObject;
|
||||
$totalPoints += $ueo->explorerObject->points;
|
||||
$data[] = (object)['name' => $lang == 'en' ? $tourObject->name_en : $tourObject->name,
|
||||
'points' => $ueo->explorerObject->points,
|
||||
'img' => $ueo->explorerObject->getSrcOfSingleImage('explorer_object_image', '1:1'),
|
||||
'date' => $ueo->date_visit ? date('d.m.Y', strtotime($ueo->date_visit)) : ''
|
||||
];
|
||||
}
|
||||
}
|
||||
$count = sizeof($data)
|
||||
?>
|
||||
|
||||
<div class="title"><?= $count . ' ' . countMessage($count)[$lang] ?> | <?= $lang == 'en' ? 'total points' : 'общ бр. точки' ?>: <?= $totalPoints ?></div>
|
||||
<div class="list-rows top10">
|
||||
<?php foreach ($data as $v): ?>
|
||||
<div class="list-row">
|
||||
<img src="<?= $v->img ?>">
|
||||
<div class="list-row-info padding10">
|
||||
<div class="padding5"><?= $v->name ?></div>
|
||||
<div class="padding5"><b><?= $lang == 'en' ? 'points' : 'точки' ?>: </b><span
|
||||
class="points"><?= $v->points ?></span></div>
|
||||
<div class="padding5"><?= $v->date ?></div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
Reference in New Issue
Block a user