Parcourir la source

[backend] Header : liens vers les distributions passées et futures.

dev
Guillaume Bourgeois il y a 5 ans
Parent
révision
e5b8026ae7
1 fichiers modifiés avec 71 ajouts et 0 suppressions
  1. +71
    -0
      backend/views/layouts/header.php

+ 71
- 0
backend/views/layouts/header.php Voir le fichier

@@ -70,6 +70,77 @@ $producer = Producer::getCurrent() ;
?>
<ul class="nav navbar-nav">
<?php
$pastDistributionsArray = Distribution::find()
->with('order')
->where(['<', 'distribution.date', date('Y-m-d')])
->andWhere([
'distribution.id_producer' => Producer::getId(),
'distribution.active' => 1
])
->orderBy('date DESC')
->limit(3)
->all();
$pastDistributionsArray = array_reverse($pastDistributionsArray) ;
$incomingDistributionsArray = Distribution::find()
->with('order')
->where(['>=', 'distribution.date', date('Y-m-d')])
->andWhere([
'distribution.id_producer' => Producer::getId(),
'distribution.active' => 1
])
->orderBy('date ASC')
->limit(20)
->all();
?>
<li class="dropdown distributions-menu notifications-menu">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-calendar"></i>
</a>
<ul class="dropdown-menu">
<?php if(count($pastDistributionsArray)): ?>
<li class="header">3 dernières distributions :</li>
<li>
<ul class="menu">
<?php foreach($pastDistributionsArray as $distribution): ?>
<li>
<a href="<?= Yii::$app->urlManagerBackend->createUrl(['distribution/index','date' => $distribution->date]) ; ?>">
<h5><?= strftime('%A %d %B', strtotime($distribution->date)) ?></h5>
</a>
</li>
<?php endforeach; ?>
</ul>
</li>
<?php endif; ?>
<?php if(count($incomingDistributionsArray)): ?>
<li class="header">Prochaines distributions :</li>
<li>
<ul class="menu">
<?php foreach($incomingDistributionsArray as $distribution): ?>
<li>
<a href="<?= Yii::$app->urlManagerBackend->createUrl(['distribution/index','date' => $distribution->date]) ; ?>">
<h5><?= strftime('%A %d %B', strtotime($distribution->date)) ?></h5>
</a>
</li>
<?php endforeach; ?>
</ul>
</li>
<?php else: ?>
<li class="header">
Aucune distribution prévue.<br />
<a class="btn btn-default" href="<?= Yii::$app->urlManagerBackend->createUrl(['distribution/index']) ; ?>">Gérer mes distributions</a>
</li>
<?php endif; ?>
</ul>
</li>
<li class="dropdown users-menu notifications-menu">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-user-plus"></i>

Chargement…
Annuler
Enregistrer