-
Notifications
You must be signed in to change notification settings - Fork 988
/
questionbar_view.php
287 lines (249 loc) · 15.2 KB
/
questionbar_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
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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
<?php
$aReplacementData=array();
?>
<div class='menubar surveybar' id="questionbarid">
<div class='row container-fluid'>
<?php if(isset($questionbar['buttons']['view'])):?>
<div class="col-md-12">
<?php if(Permission::model()->hasSurveyPermission($surveyid,'surveycontent','read')): ?>
<?php if (count($languagelist) > 1): ?>
<!-- test/execute survey -->
<div class="btn-group">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="icon-do" ></span>
<?php if($oSurvey->active=='N'):?>
<?php eT('Preview survey');?>
<?php else: ?>
<?php eT('Execute survey');?>
<?php endif;?>
<span class="caret"></span>
</button>
<ul class="dropdown-menu" style="min-width : 252px;">
<?php foreach ($languagelist as $tmp_lang): ?>
<li>
<a target='_blank' href='<?php echo $this->createUrl("survey/index",array('sid'=>$surveyid,'newtest'=>"Y",'lang'=>$tmp_lang));?>'>
<?php echo getLanguageNameFromCode($tmp_lang,false); ?>
</a>
</li>
<?php endforeach; ?>
</ul>
</div>
<!-- preview group -->
<!-- Preview multilangue -->
<div class="btn-group">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="icon-do"></span>
<?php eT("Preview question group"); ?> <span class="caret"></span>
</button>
<ul class="dropdown-menu" style="min-width : 252px;">
<?php foreach ($languagelist as $tmp_lang): ?>
<li>
<a target="_blank" href="<?php echo $this->createUrl("survey/index/action/previewgroup/sid/{$surveyid}/gid/{$gid}/lang/" . $tmp_lang); ?>" >
<?php echo getLanguageNameFromCode($tmp_lang,false); ?>
</a>
</li>
<?php endforeach; ?>
</ul>
</div>
<!-- preview question -->
<!-- Single button -->
<div class="btn-group">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="icon-do"></span>
<?php eT("Preview question"); ?> <span class="caret"></span>
</button>
<ul class="dropdown-menu" style="min-width : 252px;">
<?php foreach ($languagelist as $tmp_lang): ?>
<li>
<a target="_blank" href='<?php echo $this->createUrl("survey/index/action/previewquestion/sid/" . $surveyid . "/gid/" . $gid . "/qid/" . $qid . "/lang/" . $tmp_lang); ?>' >
<?php echo getLanguageNameFromCode($tmp_lang,false); ?>
</a>
</li>
<?php endforeach; ?>
</ul>
</div>
<?php else:?>
<!-- test/execute survey -->
<a class="btn btn-default btntooltip" href="<?php echo $this->createUrl("survey/index",array('sid'=>$surveyid,'newtest'=>"Y",'lang'=>$oSurvey->language)); ?>" role="button" accesskey='d' target='_blank'>
<span class="icon-do" ></span>
<?php if($oSurvey->active=='N'):?>
<?php eT('Preview survey');?>
<?php else: ?>
<?php eT('Execute survey');?>
<?php endif;?>
</a>
<!-- preview question group -->
<a class="btn btn-default" href="<?php echo $this->createUrl("survey/index/action/previewgroup/sid/$surveyid/gid/$gid/"); ?>" role="button" target="_blank">
<span class="icon-do"></span>
<?php eT("Preview question group");?>
</a>
<!-- preview question -->
<a class="btn btn-default" href='<?php echo $this->createUrl("survey/index/action/previewquestion/sid/" . $surveyid . "/gid/" . $gid . "/qid/" . $qid); ?>' role="button" target="_blank">
<span class="icon-do"></span>
<?php eT("Preview question");?>
</a>
<?php endif; ?>
<?php else: ?>
<a class="btn disabled" href="#" role="button">
<span class="icon-do"></span>
<?php eT("Preview question");?>
</a>
<?php endif; ?>
<!-- Edit button -->
<?php if(Permission::model()->hasSurveyPermission($surveyid,'surveycontent','update')): ?>
<a class="btn btn-default " href='<?php echo $this->createUrl("admin/questions/sa/editquestion/surveyid/".$surveyid."/gid/".$gid."/qid/".$qid); ?>' role="button">
<span class="icon-edit"></span>
<?php eT("Edit");?>
</a>
<?php endif; ?>
<!-- Check logic -->
<?php if(Permission::model()->hasSurveyPermission($surveyid,'surveycontent','read')): ?>
<a class="btn btn-default " href="<?php echo $this->createUrl("admin/expressions/sa/survey_logic_file/sid/{$surveyid}/gid/{$gid}/qid/{$qid}/"); ?>" role="button">
<span class="icon-expressionmanagercheck"></span>
<?php eT("Check logic"); ?>
</a>
<?php endif; ?>
<!-- Delete -->
<?php if( $activated != "Y" && Permission::model()->hasSurveyPermission($surveyid,'surveycontent','delete' )):?>
<a class="btn btn-default"
data-toggle="modal"
data-href="<?php echo $this->createUrl("admin/questions/sa/delete/surveyid/$surveyid/gid/$gid/qid/$qid"); ?>"
data-target="#confirmation-modal"
data-message="<?php eT("Deleting this question will also delete any answer options and subquestions it includes. Are you sure you want to continue?","js"); ?>"
>
<span class="fa fa-trash text-danger"></span>
<?php eT("Delete"); ?>
</a>
<?php else: ?>
<a class="btn btn-default readonly btntooltip" href="#" role="button" data-toggle="tooltip" data-placement="bottom" title="<?php eT("You can't delete a question if the survey is active."); ?>">
<span class="fa fa-trash text-danger"></span>
<?php eT("Delete"); ?>
</a>
<?php endif; ?>
<!-- export -->
<?php if(Permission::model()->hasSurveyPermission($surveyid,'surveycontent','export')):?>
<a class="btn btn-default " href="<?php echo $this->createUrl("admin/export/sa/question/surveyid/$surveyid/gid/$gid/qid/$qid");?>" role="button">
<span class="icon-export"></span>
<?php eT("Export "); ?>
</a>
<?php endif; ?>
<!-- copy -->
<?php if(Permission::model()->hasSurveyPermission($surveyid,'surveycontent','create')):?>
<?php if(($activated != "Y")):?>
<a class="btn btn-default" href="<?php echo $this->createUrl("admin/questions/sa/copyquestion/surveyid/$surveyid/gid/$gid/qid/$qid");?>" role="button">
<span class="icon-copy"></span>
<?php eT("Copy"); ?>
</a>
<?php else:?>
<a class="btn readonly btntooltip" href="#" role="button" data-toggle="tooltip" data-placement="bottom" title="<?php eT("You can't copy a question if the survey is active."); ?>" >
<span class="icon-copy"></span>
<?php eT("Copy"); ?>
</a>
<?php endif;?>
<?php endif;?>
<!-- conditions -->
<?php if(Permission::model()->hasSurveyPermission($surveyid,'surveycontent','update')):?>
<a class="btn btn-default " href="<?php echo $this->createUrl("admin/conditions/sa/index/subaction/editconditionsform/surveyid/$surveyid/gid/$gid/qid/$qid"); ?>" role="button">
<span class="icon-conditions"></span>
<?php eT("Set conditions "); ?>
</a>
<?php endif;?>
<!-- subquestions -->
<?php if(Permission::model()->hasSurveyPermission($surveyid,'surveycontent','update')):?>
<?php if($qtypes[$qrrow['type']]['subquestions'] >0):?>
<a class="btn btn-default " href="<?php echo $this->createUrl('admin/questions/sa/subquestions/surveyid/'.$surveyid.'/gid/'.$gid.'/qid/'.$qid); ?>" role="button">
<span class="icon-defaultanswers"></span>
<?php eT("Edit subquestions "); ?>
</a>
<?php endif;?>
<?php endif;?>
<!-- Answer Options -->
<?php if( Permission::model()->hasSurveyPermission($surveyid,'surveycontent','update') && $qtypes[$qrrow['type']]['answerscales'] > 0 ):?>
<a class="btn btn-default " href="<?php echo $this->createUrl('admin/questions/sa/answeroptions/surveyid/'.$surveyid.'/gid/'.$gid.'/qid/'.$qid); ?>" role="button">
<span class="icon-defaultanswers"></span>
<?php eT("Edit answer options "); ?>
</a>
<?php endif;?>
<!-- Default Values -->
<?php if(Permission::model()->hasSurveyPermission($surveyid,'surveycontent','read') && $qtypes[$qrrow['type']]['hasdefaultvalues'] >0):?>
<a class="btn btn-default " href="<?php echo $this->createUrl('admin/questions/sa/editdefaultvalues/surveyid/'.$surveyid.'/gid/'.$gid.'/qid/'.$qid); ?>" role="button">
<span class="icon-defaultanswers"></span>
<?php eT("Edit default answers"); ?>
</a>
<?php endif;?>
</div>
<?php endif;?>
<?php if(isset($questionbar['buttons']['conditions'])):?>
<div class="col-sm-12 form form-inline">
<a class="btn btn-default <?php if(isset($questionbar['buttons']['condition']['conditions'])){echo 'active';}?>" href="<?php echo $this->createUrl("/admin/conditions/sa/index/subaction/conditions/surveyid/$surveyid/gid/$gid/qid/$qid"); ?>" role="button">
<span class="fa fa-info-sign"></span>
<?php eT("Show conditions for this question");?>
</a>
<a class="btn btn-default <?php if(isset($questionbar['buttons']['condition']['edit']) && $questionbar['buttons']['condition']['edit']){ echo 'active'; }?>" href="<?php echo $this->createUrl("admin/conditions/sa/index/subaction/editconditionsform/surveyid/$surveyid/gid/$gid/qid/$qid"); ?>" role="button">
<span class="icon-conditions_add"></span>
<?php eT("Add and edit conditions");?>
</a>
<a class="btn btn-default <?php if(isset($questionbar['buttons']['condition']['copyconditionsform'])){echo 'active';}?>" href="<?php echo $this->createUrl("admin/conditions/sa/index/subaction/copyconditionsform/surveyid/$surveyid/gid/$gid/qid/$qid"); ?>" role="button">
<span class="icon-copy"></span>
<?php eT("Copy conditions");?>
</a>
<?php if(!isset($organizebar)): // TODO: Factor out organizer bar in own view? ?>
<?php if(isset($questionbar['savebutton']['form'])):?>
<a class="btn btn-success" href="#" role="button">
<span class="fa fa-floppy-o"></span>
<?php eT("Save");?>
</a>
<?php endif;?>
<?php /*
<a class="btn btn-default" href="<?php echo $this->createUrl("admin/survey/sa/listquestiongroups/surveyid/282267{$surveyid}"); ?>" role="button">
<span class="fa fa-saved"></span>
<?php eT("Save and close");?>
</a>
*/ ?>
<?php /*
<!-- Close -->
<?php if(isset($questionbar['closebutton']['url'])):?>
<a class="btn btn-danger pull-right margin-left" href="<?php echo $questionbar['closebutton']['url']; ?>" role="button">
<span class="fa fa-close"></span>
<?php eT("Close");?>
</a>
<?php endif;?>
*/ ?>
<!-- Condition designer navigator -->
<?php if(isset($questionbar['buttons']['conditions'])):?>
<?php echo $questionNavOptions; ?> <!-- HTML is in views/admin/conditions/includes/navigator.php -->
<?php endif;?>
<?php if(isset($questionbar['returnbutton']['url'])):?>
<a class="btn btn-default" href="<?php echo $questionbar['returnbutton']['url']; ?>" role="button">
<span class="fa fa-step-backward"></span>
<?php echo $questionbar['returnbutton']['text'];?>
</a>
<?php endif;?>
<?php endif;?>
</div>
<?php endif; ?>
<?php // TODO: Factor out in own view? ?>
<?php if(isset($organizebar)): ?>
<!-- Organize bar -->
<div class='col-md-7'>
</div>
<div class='col-md-5 text-right'>
<!-- Save buttons -->
<a class="btn btn-success" href="#" role="button" id="save-button">
<span class="fa fa-floppy-o"></span>
<?php eT("Save");?>
</a>
<?php/*
<a class="btn btn-default" href="<?php echo $organizebar['saveandclosebuttonright']['url']; ?>" role="button" id="save-and-close-button">
<span class="fa fa-saved"></span>
<?php eT("Save and close");?>
</a>
<a class="btn btn-danger" href="<?php echo $organizebar['closebuttonright']['url']; ?>" role="button">
<span class="fa fa-close"></span>
<?php eT("Close");?>
</a>
*/?>
</div>
<?php endif;?>
</div>
</div>