-
Notifications
You must be signed in to change notification settings - Fork 988
/
listquestiongroups.php
117 lines (105 loc) · 4.4 KB
/
listquestiongroups.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
<?php
/**
* This file render the list of groups
* It use the QuestionGroup model search method to build the data provider.
*
* @var $model obj the QuestionGroup model
* @var $surveyid int
*/
?>
<?php $pageSize=Yii::app()->user->getState('pageSize',Yii::app()->params['defaultPageSize']);?>
<div class="side-body">
<h3><?php eT('Question Groups 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">
<?php $form=$this->beginWidget('CActiveForm', array(
'action' => Yii::app()->createUrl('admin/survey/sa/listquestiongroups/surveyid/'.$surveyid),
'method' => 'get',
'htmlOptions'=>array(
'class'=>'form-horizontal',
),
)); ?>
<div class="form-group">
<?php echo $form->label($model, 'name', array('class'=>'col-sm-2 control-label text-right col-sm-offset-6')); ?>
<div class="col-sm-2 text-right">
<?php echo $form->textField($model, 'group_name', array('class'=>'form-control')); ?>
</div>
<div class="col-sm-2">
<?php echo CHtml::submitButton('Search', array('class'=>'btn btn-success')); ?>
<input type="button" class="btn btn-warning" value="reset" />
</div>
</div>
<?php $this->endWidget(); ?>
</div><!-- form -->
</div>
</div>
<!-- The table grid -->
<div class="row">
<div class="col-lg-12">
<?php
$this->widget('bootstrap.widgets.TbGridView', array(
'id'=>'question-group-grid',
'dataProvider' => $model->search(),
// Number of row per page selection
'summaryText'=>gT('Displaying {start}-{end} of {count} result(s).') .
CHtml::dropDownList(
'pageSize',
$pageSize,
Yii::app()->params['pageSizeOptions'],
array('class'=>'changePageSize form-control', 'style'=>'display: inline; width: auto')) .
gT(' rows per page'),
// Columns to dispplay
'columns' => array(
// Group Id
array(
'name'=>'Group id',
'value'=>'$data->gid',
'htmlOptions' => array('class' => 'col-md-1'),
),
// Group Order
array(
'name'=>'Group Order',
'value'=>'$data->group_order',
'htmlOptions' => array('class' => 'col-md-1'),
),
// Group Name
array(
'name'=>'Group Name',
'value'=>'$data->group_name',
'htmlOptions' => array('class' => 'col-md-2'),
),
// Description
array(
'name'=>'Description',
'type'=>'raw',
'value'=>'$data->description',
'htmlOptions' => array('class' => 'col-md-2'),
),
// Action buttons (defined in model)
array(
'name'=>'',
'type'=>'raw',
'value'=>'$data->buttons',
'htmlOptions' => array('class' => 'col-md-2 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-group-grid',{ data:{ pageSize: $(this).val() }});
});
});
</script>