-
Notifications
You must be signed in to change notification settings - Fork 988
/
listquestions.php
156 lines (143 loc) · 7.69 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
<?php
/**
* This file render the list of groups
*/
/** @var QuestionAdministrationController $this */
/** @var Survey $oSurvey */
/** @var Question $model */
// DO NOT REMOVE This is for automated testing to validate we see that page
echo viewHelper::getViewTestTag('surveyListQuestions');
$baseLanguage = $oSurvey->language;
?>
<?php $pageSize = App()->user->getState('pageSize', App()->params['defaultPageSize']);?>
<div class='side-body <?php echo getSideBodyClass(true); ?>'>
<h3 class="ls-flex ls-flex-row">
<?php if(App()->request->getParam('group_name')!=''):?>
<div class="ls-flex-item text-left"><?php eT('Questions in group: '); ?> <em><?php echo App()->request->getParam('group_name'); ?></em></div>
<?php else:?>
<div class="ls-flex-item text-left"><?php eT('Questions in this survey'); ?></div>
<?php endif;?>
</h3>
<div class="row">
<div class="col-lg-12 content-right">
<!-- Search Box -->
<div class="row">
<div class="col-lg-12 ls-flex ls-flex-row">
<div class="ls-flex-item text-left">
<?php App()->getController()->renderPartial(
'/admin/survey/surveybar_addgroupquestion',
[
'surveybar' => $surveybar,
'oSurvey' => $oSurvey,
'surveyHasGroup' => isset($surveyHasGroup) ? $surveyHasGroup : false
]
); ?>
</div>
<div class="ls-flex-item form text-right">
<!-- Begin Form -->
<?php $form=$this->beginWidget('CActiveForm', array(
'action' => App()->createUrl(
'questionAdministration/listquestions',
['surveyid'=>$oSurvey->primaryKey]
),
'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($oSurvey->groups as $group): ?>
<option value="<?php echo $group->gid;?>" <?php if( $group->gid == $model->gid){echo 'selected';} ?>>
<?php echo flattenText($group->questiongroupl10ns[$oSurvey->language]->group_name);?>
</option>
<?php endforeach?>
</select>
</div>
<?php echo CHtml::submitButton(
gT('Search', 'unescaped'),
array('class'=>'btn btn-success')
); ?>
<a href="<?php echo App()->createUrl(
'questionAdministration/listquestions',
['surveyid'=>$oSurvey->primaryKey]
);?>" class="btn btn-warning"><?php eT('Reset');?></a>
<?php $this->endWidget(); ?>
</div><!-- form -->
</div>
</div>
<hr/>
<!-- Grid -->
<div class="row ls-space margin top-10">
<div class="col-lg-12">
<?php
$massiveAction = Yii::app()->getController()->renderPartial(
'/admin/survey/Question/massive_actions/_selector',
array('model'=>$model, 'oSurvey'=>$oSurvey),
true,
false
);
$this->widget('ext.LimeGridView.LimeGridView', array(
'dataProvider' => $model->search(),
'id' => 'question-grid',
'emptyText' => gT('No questions found.'),
'htmlOptions' => ['class' => 'table-responsive grid-view-ls'],
'template' => "{items}\n<div id='questionListPager'><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,
App()->params['pageSizeOptions'],
array(
'class' => 'changePageSize form-control',
'style' => 'display: inline; width: auto'
)
)
),
'columns' => $model->questionListColumns,
'ajaxUpdate' => 'question-grid',
'afterAjaxUpdate' => "bindPageSizeChange"
));
?>
</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(){
$(document).trigger('actions-updated');
};
", LSYii_ClientScript::POS_BEGIN); ?>
<?php App()->getClientScript()->registerScript("ListQuestions-run-pagination", "bindPageSizeChange(); ", LSYii_ClientScript::POS_POSTSCRIPT); ?>