-
Notifications
You must be signed in to change notification settings - Fork 988
/
listquestions.php
151 lines (132 loc) · 7.1 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
<?php
/**
* This file render the list of groups
*/
?>
<?php $pageSize=Yii::app()->user->getState('pageSize',Yii::app()->params['defaultPageSize']);?>
<div class="side-body">
<h3><?php eT('Questions in this survey'); ?></h3>
<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="group_name" class="form-control">
<option value=""><?php eT('(Any group)');?></option>
<?php foreach($model->AllGroups as $group): ?>
<option value="<?php echo $group->group_name;?>" <?php if( $group->group_name == $model->group_name){echo 'selected';} ?>>
<?php echo $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
$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.'),
'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' => array(
array(
'header' => gt('Question ID'),
'name' => 'question_id',
'value'=>'$data->qid',
'htmlOptions' => array('class' => 'col-md-1 hidden-xs'),
),
array(
'header' => gt('Question order'),
'name' => 'question_order',
'value'=>'$data->question_order',
'htmlOptions' => array('class' => 'col-md-2 hidden-xs'),
),
array(
'header' => gt('Code'),
'name' => 'title',
'value'=>'$data->title',
'htmlOptions' => array('class' => 'col-xs-1'),
),
array(
'header' => gt('Question'),
'name' => 'question',
'value'=>'strip_tags($data->question)',
'htmlOptions' => array('class' => 'col-xs-1 '),
),
array(
'header' => gt('Group'),
'name' => 'group',
'value'=>'$data->groups->group_name',
'htmlOptions' => array('class' => 'col-md-2 '),
),
array(
'header'=>'',
'name'=>'actions',
'type'=>'raw',
'value'=>'$data->buttons',
'htmlOptions' => array('class' => 'col-md-2 col-xs-1 text-right'),
),
),
'ajaxUpdate' => true,
));
?>
</div>
</div>
</div>
</div>
</div>
<!-- To update rows per page via ajax -->
<script type="text/javascript">
jQuery(function($) {
jQuery(document).on("change", '#pageSize', function(){
$.fn.yiiGridView.update('question-grid',{ data:{ pageSize: $(this).val() }});
});
});
</script>
<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">Close</button>
</div>
</div>
</div>
</div>