瀏覽代碼

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

refactoring
Guillaume Bourgeois 5 年之前
父節點
當前提交
e5b8026ae7
共有 1 個檔案被更改,包括 71 行新增0 行删除
  1. +71
    -0
      backend/views/layouts/header.php

+ 71
- 0
backend/views/layouts/header.php 查看文件

@@ -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>

Loading…
取消
儲存