|
- <?php
-
-
-
- use yii\helpers\Html;
- use common\models\Producer;
- use common\models\User;
- use yii\widgets\ActiveForm;
- use yii\helpers\ArrayHelper;
-
-
-
- ?>
-
- <header class="main-header">
-
- <?= Html::a('<span class="logo-mini"><img src="'.Yii::$app->urlManagerBackend->getBaseUrl().'/img/logo-distrib.png" /></span><span class="logo-lg"><img src="'.Yii::$app->urlManagerBackend->getBaseUrl().'/img/logo-distrib.png" /></span>', Yii::$app->homeUrl, ['class' => 'logo']) ?>
-
- <nav class="navbar navbar-static-top" role="navigation">
-
- <a href="#" class="sidebar-toggle" data-toggle="push-menu" role="button">
- <span class="sr-only">Toggle navigation</span>
- </a>
-
- <div class="navbar-custom-menu">
- <?php
-
- $usersArray = User::findBy(['id_producer' => Producer::getId()])
- ->andWhere('CAST(FROM_UNIXTIME(user.created_at) AS date) > \''.date("Y-m-d", strtotime("-7 days")).'\'')
- ->orderBy('created_at DESC')
- ->all();
-
- ?>
-
- <ul class="nav navbar-nav">
- <li class="dropdown users-menu notifications-menu">
- <a href="#" class="dropdown-toggle" data-toggle="dropdown">
- <i class="fa fa-user-plus"></i>
- <?php if(count($usersArray)): ?><span class="label label-success"><?= count($usersArray) ?></span>
- <?php else: ?><span class="label label-warning">0</span><?php endif; ?>
- </a>
- <ul class="dropdown-menu">
- <?php if(count($usersArray)): ?>
- <li class="header">Inscriptions des 7 derniers jours</li>
- <li>
- <ul class="menu">
- <?php foreach($usersArray as $user): ?>
- <li>
- <a href="<?= Yii::$app->urlManagerBackend->createUrl(['user/update','id' => $user['user_id']]) ; ?>">
- <h5><?= Html::encode($user['name'].' '.$user['lastname']) ; ?> <small><i class="fa fa-clock-o"></i> <?= date('d/m/Y à H:i',$user['created_at']); ?></small></h5>
- </a>
- </li>
- <?php endforeach; ?>
- </ul>
- </li>
- <?php else: ?>
- <li class="header">Aucun nouvel inscrit ces 7 derniers jours.</li>
- <?php endif; ?>
- </ul>
- </li>
-
- <?php
-
- $usersNegativeCreditArray = User::findBy(['id_producer' => Producer::getId()])
- ->andWhere('user_producer.credit < 0')
- ->orderBy('lastname, name ASC')
- ->all();
-
- ?>
-
- <li class="dropdown users-negative-credit-menu notifications-menu">
- <a href="#" class="dropdown-toggle" data-toggle="dropdown">
- <i class="fa fa-euro"></i>
- <?php if(count($usersNegativeCreditArray)): ?><span class="label label-warning"><?= count($usersNegativeCreditArray) ?></span>
- <?php else: ?><span class="label label-success">0</span><?php endif; ?>
- </a>
-
- <ul class="dropdown-menu">
- <?php if(count($usersNegativeCreditArray)): ?>
- <li class="header">Utilisateurs au crédit négatif</li>
- <li>
- <ul class="menu">
- <?php foreach($usersNegativeCreditArray as $user): ?>
- <li>
- <a href="<?= Yii::$app->urlManagerBackend->createUrl(['user/credit','id' => $user['user_id']]) ; ?>">
- <h5><?= Html::encode($user['name'].' '.$user['lastname']) ; ?> <small><i class="fa fa-euro"></i> <?= Price::format($user['credit']); ?></small></h5>
- </a>
- </li>
- <?php endforeach; ?>
- </ul>
- </li>
- <?php else: ?>
- <li class="header">Aucun de vos utilisateurs n'a de crédit négatif.</li>
- <?php endif; ?>
- </ul>
-
- </li>
-
- <?php if (User::isCurrentProducer() || User::isCurrentAdmin()): ?>
- <li class="dropdown">
- <a href="#" class="dropdown-toggle" data-toggle="dropdown">
- <i class="fa fa-home"></i>
- <span><?= Html::encode(Yii::$app->user->identity->getNameProducer()); ?></span>
- <i class="fa fa-caret-down"></i>
- </a>
-
- <ul class="dropdown-menu">
- <?php if(User::isCurrentAdmin()): ?>
- <li>
- <a href="<?= Yii::$app->urlManagerProducer->createAbsoluteUrl(['site/index','slug_producer' => Producer::getCurrent()->slug]); ?>">
- <i class="fa fa-th-large"></i>
- <span class="hidden-xs">Espace du producteur</span>
- </a>
- </li>
- <li class="header"> <strong>Autres producteurs</strong></li>
- <?php $producersArray = Producer::find()->orderBy('name ASC')->all(); ?>
- <?php foreach($producersArray as $producer): ?>
- <li><a href="<?= Yii::$app->urlManagerBackend->createUrl(['site/change-producer', 'id' => $producer->id]); ?>"><?= Html::encode($producer->name) ?></a></li>
- <?php endforeach; ?>
- <?php else: ?>
- <li>
- <a href="<?= Yii::$app->urlManagerProducer->createAbsoluteUrl(['site/index','slug_producer' => Producer::getCurrent()->slug]); ?>">
- <i class="fa fa-th-large"></i>
- <span class="hidden-xs">Mon espace</span>
- </a>
- </li>
- <?php endif; ?>
- </ul>
- </li>
- <?php endif; ?>
-
- <li class="dropdown user user-menu">
- <a href="#" class="dropdown-toggle" data-toggle="dropdown">
- <i class="fa fa-user"></i>
- <span class="hidden-xs"><?= Html::encode(User::getCurrent()->name.' '.User::getCurrent()->lastname) ; ?></span>
- <i class="fa fa-caret-down"></i>
- </a>
- <ul class="dropdown-menu">
- <li><a href="<?= Yii::$app->urlManagerFrontend->createAbsoluteUrl(['user/update']); ?>"><i class="fa fa-user"></i> Profil</a></li>
- <li><a href="<?= Yii::$app->urlManagerBackend->createUrl(['site/logout']); ?>"><i class="fa fa-sign-out"></i> Déconnexion</a></li>
- </ul>
- </li>
-
- <li class="link-control-sidebar">
- <a href="#" data-toggle="control-sidebar"><i class="fa fa-gears"></i></a>
- </li>
-
- </ul>
- </div>
- </nav>
- </header>
|