-
Notifications
You must be signed in to change notification settings - Fork 988
/
viewquotas_view.php
142 lines (134 loc) · 7.55 KB
/
viewquotas_view.php
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
<?php
/* @var $this AdminController */
/* @var Survey $oSurvey */
/* @var CActiveDataProvider $oDataProvider Containing Quota objects*/
/* @var array $aEditUrls */
/* @var array $aDeleteUrls */
/* @var array $aQuotaItems */
/* @var integer $totalquotas */
/* @var integer $totalcompleted */
/* @var integer $iGridPageSize */
/* @var Quota $oQuota The last Quota as base for Massive edits */
/* @var QuotaLanguageSetting[] $aQuotaLanguageSettings The last Quota LanguageSettings */
// DO NOT REMOVE This is for automated testing to validate we see that page
echo viewHelper::getViewTestTag('surveyQuotas');
?>
<div class='side-body <?php echo getSideBodyClass(false); ?>'>
<div class="row">
<div class="col-lg-12 content-right">
<h3>
<?php eT("Survey quotas");?>
</h3>
<?php if( isset($sShowError) ):?>
<div class="alert alert-warning alert-dismissible" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
<strong><?php eT("Quota could not be added!", 'js'); ?></strong><br/> <?php eT("It is missing a quota message for the following languages:", 'js'); ?><br/><?php echo $sShowError; ?>
</div>
<?php endif; ?>
<?php if($oDataProvider->itemCount > 0):?>
<!-- Grid -->
<div class="row">
<div class="col-sm-12 content-right">
<?php $this->widget('bootstrap.widgets.TbGridView', array(
'dataProvider' => $oDataProvider,
'id' => 'quota-grid',
'htmlOptions' => ['class' => 'table-responsive grid-view-ls'],
'itemsCssClass' => 'table-quotas table-striped table-condensed',
'ajaxUpdate' => 'quota-grid',
'emptyText' => gT('No quotas'),
'summaryText' => gT('Displaying {start}-{end} of {count} result(s).') . ' ' . sprintf(gT('%s rows per page'),
CHtml::dropDownList(
'pageSize',
$iGridPageSize,
Yii::app()->params['pageSizeOptions'],
array(
'class' => 'changePageSize form-control',
'style' => 'display: inline; width: auto',
'onchange' => "$.fn.yiiGridView.update('quota-grid',{ data:{ pageSize: $(this).val() }})"
)
)
),
'columns' => array(
array(
'id' => 'id',
'class' => 'CCheckBoxColumn',
'selectableRows' => '100',
'htmlOptions' => array('style' => 'vertical-align:top'),
),
array(
'name' => gT('Quota members'),
'type' => 'raw',
'htmlOptions' => array('style' => 'vertical-align:top'),
'value' => function ($oQuota) use ($oSurvey, $aQuotaItems) {
/** @var Quota $oQuota */
$out = '<p>' . $this->renderPartial('/admin/quotas/viewquotas_quota_members',
array(
'oSurvey' => $oSurvey,
'oQuota' => $oQuota,
'aQuotaItems' => $aQuotaItems,
), true) . '<p>';
return $out;
},
),
array(
'name' => 'completeCount',
'header' => gT('Completed'),
'type' => 'raw',
'htmlOptions' => array('style' => 'vertical-align:top'),
'footer' => $totalcompleted,
),
array(
'name' => 'qlimit',
'header' => gT('Limit'),
'htmlOptions' => array('style' => 'vertical-align:top'),
'footer' => $totalquotas,
),
array(
'header' => gT("Action"),
'value' => function ($oQuota) use ($oSurvey, $aEditUrls, $aDeleteUrls, $aQuotaItems) {
/** @var Quota $oQuota */
return $this->renderPartial('/admin/quotas/viewquotas_quota_actions',
array(
'oSurvey' => $oSurvey,
'oQuota' => $oQuota,
'editUrl' => $aEditUrls[$oQuota->getPrimaryKey()],
'deleteUrl' => $aDeleteUrls[$oQuota->getPrimaryKey()],
'aQuotaItems' => $aQuotaItems,
), true);
},
'type' => 'raw',
'headerHtmlOptions' => array(
'style' => 'text-align:right;',
),
'htmlOptions' => array(
'style' => 'text-align: right; vertical-align:top',
),
),
),
));
?>
</div>
<?php endif; ?>
<?php if (Permission::model()->hasSurveyPermission($oSurvey->getPrimaryKey(), 'quotas','create')):?>
<?php if($oDataProvider->itemCount > 0):?>
<div class="pull-left">
<?php $this->renderPartial('/admin/quotas/viewquotas_massive_selector',
array(
'oSurvey'=>$oSurvey,
'oQuota'=>$oQuota,
'aQuotaLanguageSettings'=>$aQuotaLanguageSettings,
));?>
</div>
<?php endif; ?>
<div class="pull-right">
<?php echo CHtml::beginForm(array("admin/quotas/sa/newquota/surveyid/{$oSurvey->getPrimaryKey()}"), 'post'); ?>
<?php echo CHtml::hiddenField('sid',$oSurvey->getPrimaryKey());?>
<?php echo CHtml::hiddenField('action','quotas');?>
<?php echo CHtml::hiddenField('subaction','new_quota');?>
<?php echo CHtml::endForm();?>
</div>
<?php endif; ?>
</div>
</div>
</div>
</div>