|
1234567891011121314151617181920212223242526272829303132 |
- <?php
-
- use domain\Order\Order\OrderModule;
- use domain\User\User\User;
- use domain\User\User\UserModule;
- use common\helpers\Price;
-
- $userModule = UserModule::getInstance();
- $orderModule = OrderModule::getInstance();
-
- $credit = $userModule->getRepository()->getCredit($user);
- $countOrders = $orderModule->getRepository()->countOrdersByUser($user);
-
- ?>
-
- <ul class="nav nav-tabs">
- <?= menu_navigation_item('view', 'Récapitulatif', $action, $user) ?>
- <?= menu_navigation_item('update', 'Profil', $action, $user) ?>
- <?= menu_navigation_item('credit', 'Cagnotte <span class="label label-default badge">'.Price::format($credit).'</span>', $action, $user) ?>
- <?= menu_navigation_item('orders', 'Commandes <span class="label label-default badge">'.$countOrders.'</span>', $action, $user) ?>
- </ul>
-
-
- <?php
-
- function menu_navigation_item(string $action, string $label, string $currentAction, User $user) {
- $classActive = ($action == $currentAction) ? ' class="active"' : '';
- $url = Yii::$app->urlManager->createUrl(['user/'.$action, 'id' => $user->id]);
- return '<li'.$classActive.'><a href="'.$url.'">'.$label.'</a></li>';
- }
-
- ?>
|