Blame view

backend/views/site/requests.php 1.79 KB
b0f143c3   Yarik   first commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
  <?php
  use yii\grid\GridView;
  use yii\grid\SerialColumn;
  use yii\helpers\VarDumper;
  use yii\grid\ActionColumn;
  use yii\helpers\Html;
  use yii\widgets\Pjax;
  $this->title = Yii::t('app', 'Requests');
  ?>
  <div class="site-requests">
  	<?php 
  	echo GridView::widget([
  		'dataProvider' => $dataProvider,
  		'columns' => [
  			[
  				'class' => 'yii\grid\SerialColumn'
  			],
  			[
  				'attribute' => 'created_at',
  			],
  			[
  				'header' => Yii::t('app', 'values'),
  				'content' => function($model, $key, $index, $column) {
  					$value = '';
  					$langs = $model->options;
  					$lang = $model->getOptionDefaultLang(true);
  					$value .= "<b>{$model->name}</b>:{$lang['value']}";
  					foreach($langs as $onemodel) {
  						$lang = $onemodel->getOptionDefaultLang(true);
  						$value .= "<br><b>{$onemodel->name}</b>:{$lang['value']}";
  					}
  					return $value;
  				}
  			],
  			[
  				'class' => 'yii\grid\ActionColumn',
  				'template' => '{requests} {delete-req}',
  				'buttons' => [
  					'requests' => function($url, $model, $key) { 
  						return Html::a(
  								'', 
  								$model->options['is_new']->getOptionDefaultLang()->value?$url:'#', 
  								[
  									'class' => $model->options['is_new']->getOptionDefaultLang()->value?'glyphicon glyphicon-eye-open':'glyphicon glyphicon-eye-close', 
  									'title' => Yii::t('app', 'Make already read')
  								]
  							); 
  					},
  					'delete-req' => function($url, $model, $key) {
  						return Html::a(
  							'',
  							$url,
  							[
  								'class' => 'glyphicon glyphicon-trash',
  								'title' => Yii::t('app', 'Delete'),
  								'data' => [
  									'label' => Yii::t('app', 'Delete'), 
  									'confirm' => Yii::t('app', 'Are you sure you want delete this element?'),
  									'method' => 'post',
  									'pjax' => 0
  								]
  							]		
  						);
  					}
  				]
  			]
  		],
  	]);
  	?>
  </div>