-
Notifications
You must be signed in to change notification settings - Fork 986
/
questionbar_view.php
285 lines (246 loc) · 15.3 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
<?php if (isset($tmp_survlangs)) { ?>
<div class="langpopup" id="previewquestionpopup"><?php $clang->eT("Please select a language:"); ?><ul>
<?php foreach ($tmp_survlangs as $tmp_lang)
{ ?>
<li><a target='_blank' onclick="$('#previewquestion').qtip('hide');" href='<?php echo $this->createUrl("survey/index/action/previewquestion/sid/" . $surveyid . "/gid/" . $gid . "/qid/" . $qid . "/lang/" . $tmp_lang); ?>' accesskey='d'><?php echo getLanguageNameFromCode($tmp_lang,false); ?></a></li>
<?php } ?>
</ul></div>
<?php } ?>
<div class='menubar-title ui-widget-header'>
<strong><?php $clang->eT("Question"); ?></strong> <span class='basic'><?php echo $qrrow['question']; ?> (<?php echo $clang->gT("ID").":".$qid; ?>)</span>
</div>
<div class='menubar-main'>
<div class='menubar-left'>
<img src='<?php echo Yii::app()->getConfig('imageurl'); ?>/blank.gif' alt='' width='55' height='20' />
<img src='<?php echo Yii::app()->getConfig('imageurl'); ?>/seperator.gif' alt='' />
<?php if(hasSurveyPermission($surveyid,'surveycontent','read'))
{
if (count(Survey::model()->findByPk($surveyid)->additionalLanguages) == 0)
{ ?>
<a accesskey='q' href="<?php echo $this->createUrl("survey/index/action/previewquestion/sid/" . $surveyid . "/gid/" . $gid . "/qid/" . $qid); ?>" target="_blank"
title="<?php $clang->eTview("Preview This Question"); ?>">
<img src='<?php echo Yii::app()->getConfig('imageurl'); ?>/preview.png' alt='<?php $clang->eT("Preview This Question"); ?>' /></a>
<img src='<?php echo Yii::app()->getConfig('imageurl'); ?>/seperator.gif' alt='' />
<?php } else { ?>
<a accesskey='q' id='previewquestion'
title="<?php $clang->eTview("Preview This Question"); ?>">
<img src='<?php echo Yii::app()->getConfig('imageurl'); ?>/preview.png' title='' alt='<?php $clang->eT("Preview This Question"); ?>' /></a>
<img src='<?php echo Yii::app()->getConfig('imageurl'); ?>/seperator.gif' alt='' />
<?php }
} ?>
<?php if(hasSurveyPermission($surveyid,'surveycontent','update'))
{ ?>
<a href='<?php echo $this->createUrl("admin/question/editquestion/surveyid/".$surveyid."/gid/".$gid."/qid/".$qid); ?>'
title="<?php $clang->eTview("Edit current question"); ?>">
<img src='<?php echo Yii::app()->getConfig('imageurl'); ?>/edit.png' alt='<?php $clang->eT("Edit Current Question"); ?>' /></a>
<?php } ?>
<?php if(hasSurveyPermission($surveyid,'surveyactivation','read'))
{ ?>
<img src='<?php echo Yii::app()->getConfig('imageurl'); ?>/seperator.gif' alt='' />
<a href="<?php echo $this->createUrl("admin/expressions/survey_logic_file/sid/{$surveyid}/gid/{$gid}/qid/{$qid}/"); ?>','_blank')"
title="<?php $clang->eTview("Survey Logic File for current question"); ?>">
<img src='<?php echo Yii::app()->getConfig('imageurl'); ?>/quality_assurance.png' alt='<?php $clang->eT("Survey Logic File for current question"); ?>' /></a>
<?php } ?>
<?php if ((($qct == 0 && $activated != "Y") || $activated != "Y") && hasSurveyPermission($surveyid,'surveycontent','delete'))
{
if (is_null($condarray))
{ ?>
<a href='#'
onclick="if (confirm('<?php $clang->eT("Deleting this question will also delete any answer options and subquestions it includes. Are you sure you want to continue?","js"); ?>')) { <?php echo convertGETtoPOST($this->createUrl("admin/question/delete/surveyid/$surveyid/gid/$gid/qid/$qid")); ?>}">
<img src='<?php echo Yii::app()->getConfig('imageurl'); ?>/delete.png' alt='<?php $clang->eT("Delete current question"); ?>'
border='0' hspace='0' /></a>
<?php }
else
// TMSW Conditions->Relevance: not needed - should be allowed to delete questions even if others depend upon it - use separate view to see exceptions
{ ?>
<a href='<?php echo $this->createUrl('admin/survey/view/surveyid/'.$surveyid.'/gid/'.$gid.'/qid/'.$qid); ?>'
onclick="alert('<?php $clang->eT("It's impossible to delete this question because there is at least one question having a condition on it.","js"); ?>')"
title="<?php $clang->eTview("Disabled - Delete current question"); ?>">
<img src='<?php echo Yii::app()->getConfig('imageurl'); ?>/delete_disabled.png' alt='<?php $clang->eT("Disabled - Delete current question"); ?>' /></a>
<?php }
}
else {
?>
<img src='<?php echo Yii::app()->getConfig('imageurl'); ?>/blank.gif' alt='' width='40' />
<?php }
if(hasSurveyPermission($surveyid,'surveycontent','export'))
{ ?>
<a href='<?php echo $this->createUrl("admin/export/question/surveyid/$surveyid/gid/$gid/qid/$qid");?>'
title="<?php $clang->eTview("Export this question"); ?>" >
<img src='<?php echo Yii::app()->getConfig('imageurl'); ?>/dumpquestion.png' alt='<?php $clang->eT("Export this question"); ?>' /></a>
<?php } ?>
<img src='<?php echo Yii::app()->getConfig('imageurl'); ?>/seperator.gif' alt='' />
<?php if(hasSurveyPermission($surveyid,'surveycontent','create'))
{
if ($activated != "Y")
{ ?>
<a href='<?php echo $this->createUrl("admin/question/copyquestion/surveyid/$surveyid/gid/$gid/qid/$qid");?>'
title="<?php $clang->eTview("Copy Current Question"); ?>" >
<img src='<?php echo Yii::app()->getConfig('imageurl'); ?>/copy.png' alt='<?php $clang->eT("Copy Current Question"); ?>' /></a>
<img src='<?php echo Yii::app()->getConfig('imageurl'); ?>/seperator.gif' alt='' />
<?php }
else
{ ?>
<a href='#' title="<?php $clang->eTview("Copy Current Question"); ?>"
onclick="alert('<?php $clang->eT("You can't copy a question if the survey is active.","js"); ?>')">
<img src='<?php echo Yii::app()->getConfig('imageurl'); ?>/copy_disabled.png' alt='<?php $clang->eT("Copy Current Question"); ?>' /></a>
<img src='<?php echo Yii::app()->getConfig('imageurl'); ?>/seperator.gif' alt='' />
<?php }
}
else
{ ?>
<img src='<?php echo Yii::app()->getConfig('imageurl'); ?>/blank.gif' alt='' width='40' />
<?php }
if(hasSurveyPermission($surveyid,'surveycontent','update'))
{ ?>
<a href="<?php echo $this->createUrl("admin/conditions/index/subaction/editconditionsform/surveyid/$surveyid/gid/$gid/qid/$qid"); ?>"
title="<?php $clang->eTview("Set/view conditions for this question"); ?>">
<img src='<?php echo Yii::app()->getConfig('imageurl'); ?>/conditions.png' alt='<?php $clang->eT("Set conditions for this question"); ?>' /></a>
<img src='<?php echo Yii::app()->getConfig('imageurl'); ?>/seperator.gif' alt='' />
<?php }
else
{ ?>
<img src='<?php echo Yii::app()->getConfig('imageurl'); ?>/blank.gif' alt='' width='40' />
<?php }
if(hasSurveyPermission($surveyid,'surveycontent','read'))
{
if ($qtypes[$qrrow['type']]['subquestions'] >0)
{ ?>
<a href='<?php echo $this->createUrl('admin/question/subquestions/surveyid/'.$surveyid.'/gid/'.$gid.'/qid/'.$qid); ?>'
title='<?php $clang->eTview("Edit subquestions for this question"); ?>'>
<img src='<?php echo Yii::app()->getConfig('imageurl'); ?>/<?php if ($qtypes[$qrrow['type']]['subquestions']==1){?>subquestions.png<?php } else {?>subquestions2d.png<?php } ?>' alt='<?php $clang->eT("Edit subquestions for this question"); ?>' /></a>
<?php }
}
else
{ ?>
<img src='<?php echo Yii::app()->getConfig('imageurl'); ?>/blank.gif' alt='' width='40' />
<?php }
if(hasSurveyPermission($surveyid,'surveycontent','read') && $qtypes[$qrrow['type']]['answerscales'] > 0)
{ ?>
<a href='<?php echo $this->createUrl('admin/question/answeroptions/surveyid/'.$surveyid.'/gid/'.$gid.'/qid/'.$qid); ?>'
title="<?php $clang->eTview("Edit answer options for this question"); ?>">
<img src='<?php echo Yii::app()->getConfig('imageurl'); ?>/answers.png' alt='<?php $clang->eT("Edit answer options for this question"); ?>' /></a>
<?php }
else
{ ?>
<img src='<?php echo Yii::app()->getConfig('imageurl'); ?>/blank.gif' alt='' width='40' />
<?php }
if(hasSurveyPermission($surveyid,'surveycontent','read') && $qtypes[$qrrow['type']]['hasdefaultvalues'] >0)
{ ?>
<a href='<?php echo $this->createUrl('admin/question/editdefaultvalues/surveyid/'.$surveyid.'/gid/'.$gid.'/qid/'.$qid); ?>'
title="<?php $clang->eTview("Edit default answers for this question"); ?>">
<img src='<?php echo Yii::app()->getConfig('imageurl'); ?>/defaultanswers.png' alt='<?php $clang->eT("Edit default answers for this question"); ?>' /></a>
<?php } ?>
</div>
<div class='menubar-right'>
<input type='image' src='<?php echo Yii::app()->getConfig('imageurl'); ?>/minus.gif'
title='<?php $clang->eT("Hide details of this question"); ?>' alt='<?php $clang->eT("Hide details of this question"); ?>' onclick='document.getElementById("questiondetails").style.display="none";' />
<input type='image' src='<?php echo Yii::app()->getConfig('imageurl'); ?>/plus.gif' title='<?php $clang->eT("Show details of this question"); ?>' alt='<?php $clang->eT("Show Details of this Question"); ?>' onclick='document.getElementById("questiondetails").style.display="";' />
<input type='image' src='<?php echo Yii::app()->getConfig('imageurl'); ?>/close.gif' title='<?php $clang->eT("Close this question"); ?>' alt='<?php $clang->eT("Close this question"); ?>'
onclick="window.open('<?php echo $this->createUrl("admin/survey/view/surveyid/$surveyid/gid/$gid"); ?>','_top');" />
</div>
</div>
</div>
<p style='margin:0;font-size:1px;line-height:1px;height:1px;'> </p>
<table id='questiondetails' <?php echo $qshowstyle; ?>><tr><td><strong>
<?php $clang->eT("Code:"); ?></strong></td>
<td><?php echo $qrrow['title']; ?>
<?php if ($qrrow['type'] != "X")
{
if ($qrrow['mandatory'] == "Y") { ?>
: (<i><?php $clang->eT("Mandatory Question"); ?></i>)
<?php }
else { ?>
: (<i><?php $clang->eT("Optional Question"); ?></i>)
<?php }
} ?>
</td></tr>
<tr><td><strong>
<?php $clang->eT("Question:"); ?></strong></td><td>
<?php
templatereplace($qrrow['question']);
echo LimeExpressionManager::GetLastPrettyPrintExpression();
?></td></tr>
<tr><td><strong>
<?php $clang->eT("Help:"); ?></strong></td><td>
<?php
if (trim($qrrow['help'])!=''){
templatereplace($qrrow['help']);
echo LimeExpressionManager::GetLastPrettyPrintExpression();
} ?>
</td></tr>
<?php if ($qrrow['preg'])
{ ?>
<tr ><td><strong>
<?php $clang->eT("Validation:"); ?></strong></td><td><?php echo $qrrow['preg']; ?>
</td></tr>
<?php } ?>
<tr><td><strong>
<?php $clang->eT("Type:"); ?></strong></td><td><?php echo $qtypes[$qrrow['type']]['description']; ?>
</td></tr>
<?php if ($qct == 0 && $qtypes[$qrrow['type']]['answerscales'] >0)
{ ?>
<tr ><td></td><td>
<span class='statusentryhighlight'>
<?php $clang->eT("Warning"); ?>: <a href='<?php echo $this->createUrl("admin/question/answeroptions/surveyid/$surveyid/gid/$gid/qid/$qid"); ?>'><?php $clang->eT("You need to add answer options to this question"); ?>
<img src='<?php echo Yii::app()->getConfig('imageurl'); ?>/answers_20.png' title='<?php $clang->eT("Edit answer options for this question"); ?>' /></a></span></td></tr>
<?php }
if($sqct == 0 && $qtypes[$qrrow['type']]['subquestions'] >0)
{ ?>
<tr ><td></td><td>
<span class='statusentryhighlight'>
<?php $clang->eT("Warning"); ?>: <a href='<?php echo $this->createUrl("admin/question/subquestions/surveyid/$surveyid/gid/$gid/qid/$qid"); ?>'><?php $clang->eT("You need to add subquestions to this question"); ?>
<img src='<?php echo Yii::app()->getConfig('imageurl'); ?>/<?php if ($qtypes[$qrrow['type']]['subquestions']==1){?>subquestions_20<?php } else {?>subquestions2d_20<?php } ?>.png' title='<?php $clang->eT("Edit subquestions for this question"); ?>' /></a></span></td></tr>
<?php }
if ($qrrow['type'] == "M" or $qrrow['type'] == "P")
{ ?>
<tr>
<td><strong>
<?php $clang->eT("Option 'Other':"); ?></strong></td>
<td>
<?php if ($qrrow['other'] == "Y") { ?>
<?php $clang->eT("Yes"); ?>
<?php } else
{ ?>
<?php $clang->eT("No"); ?>
<?php } ?>
</td></tr>
<?php }
if (isset($qrrow['mandatory']) and ($qrrow['type'] != "X") and ($qrrow['type'] != "|"))
{ ?>
<tr>
<td><strong>
<?php $clang->eT("Mandatory:"); ?></strong></td>
<td>
<?php if ($qrrow['mandatory'] == "Y") { ?>
<?php $clang->eT("Yes"); ?>
<?php } else
{ ?>
<?php $clang->eT("No"); ?>
<?php } ?>
</td>
</tr>
<?php } ?>
<?php if (trim($qrrow['relevance']) != '') { ?>
<tr>
<td><?php $clang->eT("Relevance equation:"); ?></td>
<td>
<?php
LimeExpressionManager::ProcessString("{" . $qrrow['relevance'] . "}", $qid); // tests Relevance equation so can pretty-print it
echo LimeExpressionManager::GetLastPrettyPrintExpression();
?>
</td>
</tr>
<?php } ?>
<?php
$sCurrentCategory='';
foreach ($advancedsettings as $aAdvancedSetting)
{ ?>
<tr>
<td><?php echo $aAdvancedSetting['caption'];?>:</td>
<td><?php
if ($aAdvancedSetting['i18n']==false) echo $aAdvancedSetting['value']; else echo $aAdvancedSetting[$baselang]['value']?>
</td>
</tr>
<?php } ?>
</table>