-
Notifications
You must be signed in to change notification settings - Fork 988
/
listquestions.php
187 lines (165 loc) · 8.96 KB
/
listquestions.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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
<?php
/**
* This file render the list of groups
*/
?>
<?php $pageSize=Yii::app()->user->getState('pageSize',Yii::app()->params['defaultPageSize']);?>
<div class='side-body <?php echo getSideBodyClass(true); ?>'>
<?php if(App()->request->getParam('group_name')!=''):?>
<h3><?php eT('Questions in group: '); ?> <em><?php echo App()->request->getParam('group_name'); ?></em></h3>
<?php else:?>
<h3><?php eT('Questions in this survey'); ?></h3>
<?php endif;?>
<div class="row">
<div class="col-lg-12 content-right">
<!-- Search Box -->
<div class="row">
<div class="col-lg-12">
<div class="form text-right">
<!-- Begin Form -->
<?php $form=$this->beginWidget('CActiveForm', array(
'action' => Yii::app()->createUrl('admin/survey/sa/listquestions/surveyid/'.$surveyid),
'method' => 'get',
'htmlOptions'=>array(
'class'=>'form-inline',
),
)); ?>
<!-- search input -->
<div class="form-group">
<?php echo $form->label($model, 'search', array('label'=>gT('Search:'),'class'=>'control-label' )); ?>
<?php echo $form->textField($model, 'title', array('class'=>'form-control')); ?>
</div>
<!-- select group -->
<div class="form-group">
<?php echo $form->label($model, 'group', array('label'=>gT('Group:'),'class'=>'control-label')); ?>
<select name="gid" class="form-control">
<option value=""><?php eT('(Any group)');?></option>
<?php foreach($model->AllGroups as $group): ?>
<option value="<?php echo $group->gid;?>" <?php if( $group->gid == $model->gid){echo 'selected';} ?>>
<?php echo flattenText($group->group_name);?>
</option>
<?php endforeach?>
</select>
</div>
<?php echo CHtml::submitButton(gT('Search','unescaped'), array('class'=>'btn btn-success')); ?>
<a href="<?php echo Yii::app()->createUrl('admin/survey/sa/listquestions/surveyid/'.$surveyid);?>" class="btn btn-warning"><?php eT('Reset');?></a>
<?php $this->endWidget(); ?>
</div><!-- form -->
</div>
</div>
<!-- Grid -->
<div class="row">
<div class="col-lg-12">
<?php
$columns = array(
array(
'id'=>'id',
'class'=>'CCheckBoxColumn',
'selectableRows' => '100',
),
array(
'header' => gT('Question ID'),
'name' => 'question_id',
'value'=>'$data->qid',
),
array(
'header' => gT('Question order'),
'name' => 'question_order',
'value'=>'$data->question_order',
),
array(
'header' => gT('Code'),
'name' => 'title',
'value'=>'$data->title',
'htmlOptions' => array('class' => 'col-md-1'),
),
array(
'header' => gT('Question'),
'name' => 'question',
'value'=>'viewHelper::flatEllipsizeText($data->question,true,0)',
'htmlOptions' => array('class' => 'col-md-5'),
),
array(
'header' => gT('Question type'),
'name' => 'type',
'type'=>'raw',
'value'=>'$data->typedesc',
'htmlOptions' => array('class' => 'col-md-1'),
),
array(
'header' => gT('Group'),
'name' => 'group',
'value'=>'$data->groups->group_name',
),
array(
'header' => gT('Mandatory'),
'type' => 'raw',
'name' => 'mandatory',
'value'=> '$data->mandatoryIcon',
'htmlOptions' => array('class' => 'text-center'),
),
array(
'header' => gT('Other'),
'type' => 'raw',
'name' => 'other',
'value'=> '$data->otherIcon',
'htmlOptions' => array('class' => 'text-center'),
),
array(
'header'=>'',
'name'=>'actions',
'type'=>'raw',
'value'=>'$data->buttons',
'htmlOptions' => array('class' => 'col-md-2 col-xs-1 text-right nowrap'),
),
);
?>
<?php
$massiveAction = App()->getController()->renderPartial('/admin/survey/Question/massive_actions/_selector', array('model'=>$model, 'oSurvey'=>$oSurvey), true, false);
$this->widget('bootstrap.widgets.TbGridView', array(
'dataProvider' => $model->search(),
// Number of row per page selection
'id' => 'question-grid',
'type'=>'striped',
'emptyText'=>gT('No questions found.'),
'template' => "{items}\n<div id='ListPager'><div class=\"col-sm-4\" id=\"massive-action-container\">$massiveAction</div><div class=\"col-sm-4 pager-container ls-ba \">{pager}</div><div class=\"col-sm-4 summary-container\">{summary}</div></div>",
'summaryText'=>gT('Displaying {start}-{end} of {count} result(s).') .' '.sprintf(gT('%s rows per page'),
CHtml::dropDownList(
'pageSize',
$pageSize,
Yii::app()->params['pageSizeOptions'],
array('class'=>'changePageSize form-control', 'style'=>'display: inline; width: auto'))),
'columns' => $columns,
'ajaxUpdate' => true,
));
?>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade" id="question-preview" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel"><?php eT("Question preview");?></h4>
</div>
<div class="modal-body">
<iframe id="frame-question-preview" src="" style="zoom:0.60" width="99.6%" height="600" frameborder="0"></iframe>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal"><?php eT("Close");?></button>
</div>
</div>
</div>
</div>
<!-- To update rows per page via ajax -->
<?php App()->getClientScript()->registerScript("ListQuestions-pagination", "
var bindPageSizeChange = function(){
$('#pageSize').on('change', function(){
$.fn.yiiGridView.update('question-grid',{ data:{ pageSize: $(this).val() }});
});
};
", LSYii_ClientScript::POS_BEGIN); ?>
<?php App()->getClientScript()->registerScript("ListQuestions-run-pagination", "bindPageSizeChange(); ", LSYii_ClientScript::POS_POSTSCRIPT); ?>