OSDN Git Service

Исправлено оформление пункта Выход
[invent/invent.git] / views / reports / index.php
1 <?php
2
3 use yii\helpers\Html;
4 use yii\grid\GridView;
5 use yii\widgets\Pjax;
6 use yii\helpers\Url;
7 use yii\widgets\DetailView;
8 use yii\helpers\ArrayHelper;
9 use app\models\Status;
10 use app\models\User;
11
12 /* @var $this yii\web\View */
13 /* @var $searchModel app\models\ItemsSearch */
14 /* @var $dataProvider yii\data\ActiveDataProvider */
15
16 $this->title = Yii::t('app', 'Reports');
17 $this->params[ 'breadcrumbs' ][] = $this->title;
18
19 $lastLocation = 0;
20
21 $models = $dataProvider->getModels();
22
23 function cell($text, $color, $wrap='')
24 {
25     return '<td ' . $wrap . ' style="padding: 2px 2px 2px 2px;"><font color="' . $color . '">' . $text . '</font></td>';
26 }
27
28 foreach ($models as $model)
29 {
30     $color='#000000';
31     if ($model->status->name == 'Списано' || $model->status->name == 'К списанию')
32     {
33         $color='#FF0000';
34     }
35     if ($model->status->name == 'Работает')
36     {
37         $color='#009F00';
38     }
39     if ($model->status->name == 'Сломано')
40     {
41         $color='#0000FF';
42     }
43     if ($model->locations->id != $lastLocation)
44     {
45         if ($lastLocation == 0)
46         {
47     ?>
48         <table border="1" style="padding: 2px 2px 2px 2px;" width="100%"><tbody>
49     <?php
50         }
51         $lastLocation = $model->locations->id;
52     ?>
53         <tr>
54             <td colspan="8" style="padding: 2px 2px 2px 2px;"><H2><?= $model->locations->regions->name ?></H2>
55             <H3><?= $model->locations->name ?></H3></td>
56         </tr>
57         <tr bgcolor="#EFEFEF">
58             <th style= "text-align:center">Инвентарный номер</th>
59             <th style= "text-align:center">Серийный номер</th>
60             <th style= "text-align:center">Оборудование</th>
61             <th style= "text-align:center">Тип</th>
62             <th style= "text-align:center">Состояние</th>
63             <th style= "text-align:center">Сетевое имя</th>
64             <th style= "text-align:center">ОС</th>
65             <th style= "text-align:center">МАС адрес</th>
66         </tr>
67     <?php
68     }
69     ?>
70     <tr>
71         <?= cell($model->items->invent, $color) ?>
72         <?= cell($model->items->serial, $color) ?>
73         <?= cell($model->items->models->name, $color) ?>
74         <?= cell($model->items->models->types->name, $color) ?>
75         <?= cell($model->status->name, $color, 'nowrap') ?>
76         <?= cell($model->items->name, $color, 'nowrap') ?>
77         <?= cell($model->items->os, $color) ?>
78         <?= cell($model->items->mac, $color) ?>
79     </tr>
80     <?php
81 }
82 if ($lastLocation !== 0)
83 {
84 ?>
85         </tbody></table>
86
87 <?php
88 }
89 ?>
90 <div>
91
92 </div>