-
Notifications
You must be signed in to change notification settings - Fork 988
/
activateSurvey_view.php
267 lines (239 loc) · 12.8 KB
/
activateSurvey_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
<?php
/** @var Survey $oSurvey */
?>
<?php if ((isset($failedcheck) && $failedcheck) || (isset($failedgroupcheck) && $failedgroupcheck)): ?>
<div class='side-body <?php echo getSideBodyClass(false); ?>'>
<div class="row welcome survey-action">
<div class="col-sm-12 content-right">
<div class="jumbotron message-box message-box-error">
<h2><?php eT("Activate Survey"); echo " ($surveyid)"; ?></h2>
<p class="lead text-warning"><strong><?php eT("Error"); ?> !</strong></p>
<p class="lead text-warning"><strong><?php eT("Survey does not pass consistency check"); ?></strong></p>
<p>
<?php eT("The following problems have been found:"); ?><br />
<ul class="list-unstyled">
<?php
if (isset($failedcheck) && $failedcheck)
{
foreach ($failedcheck as $fc)
{ ?>
<li> Question qid-<?php echo $fc[0]; ?> ("<a href='<?php echo Yii::app()->getController()->createUrl('admin/questions/sa/view/surveyid/'.$surveyid.'/gid/'.$fc[3].'/qid/'.$fc[0]); ?>'><?php echo $fc[1]; ?></a>")<?php echo $fc[2]; ?></li>
<?php }
}
if (isset($failedgroupcheck) && $failedgroupcheck)
{
foreach ($failedgroupcheck as $fg)
{ ?>
<li> Group gid-<?php echo $fg[0]; ?> ("<a href='<?php echo Yii::app()->getController()->createUrl('admin/questiongroups/sa/view/surveyid/'.$surveyid.'/gid/'.$fg[0]); ?>'><?php echo flattenText($fg[1]); ?></a>")<?php echo $fg[2]; ?></li>
<?php }
} ?>
</ul>
<?php eT("The survey cannot be activated until these problems have been resolved."); ?>
</p>
<p>
<button class="btn btn-default" id="ajaxAllConsistency"><?=gT("Resolve all issues")?></button>
<a class="btn btn-default" href="<?php echo $this->createUrl("admin/survey/sa/view/surveyid/$surveyid"); ?>" role="button">
<?php eT("Return to survey"); ?>
</a>
</p>
</div>
<?php
App()->getClientScript()->registerScript('FixSolvableErrors', "
$('#ajaxAllConsistency').on('click', function(e){
e.preventDefault();
var items = $('.selector__fixConsistencyProblem').map(function(i,item){
return function(){
return $.ajax({
url: $(item).attr('href'),
beforeSend: function(){
$(item).prop('disabled',true).append('<i class=\"fa fa-spinner fa-pulse\"></i>');
},
complete: function(jqXHR, status){
if(status == 'success')
$(item).remove();
else
console.log(jqXHR);
}
});
};
});
var runIteration = function (arrayOfLinks, iterator){
iterator = iterator || 0;
if(iterator < arrayOfLinks.length){
arrayOfLinks[iterator]().then(function(){
iterator++;
runIteration(arrayOfLinks, iterator);
});
}
};
runIteration(items);
});
", LSYii_ClientScript::POS_POSTSCRIPT);
?>
</div>
<?php else:?>
<div class='side-body <?php echo getSideBodyClass(false); ?>'>
<div class='container message-box col-sm-12'>
<h2 class='col-sm-7 col-sm-offset-2'><?php eT("Warning: Please read this carefully before proceeding!"); ?></h2>
<p class="lead col-sm-7 col-sm-offset-2">
<?php eT("You should only activate a survey when you are absolutely certain that your survey setup is finished and will not need changing."); ?>
</p>
<p class="col-sm-7 col-sm-offset-2">
<?php eT("Once a survey is activated you can no longer:"); ?>
</p>
<div class='col-sm-6 col-sm-offset-4'>
<ul class=''>
<li><?php eT("Add or delete groups"); ?></li>
<li><?php eT("Add or delete questions"); ?></li>
<li><?php eT("Add or delete subquestions or change their codes"); ?></li>
</ul>
</div>
<div class="col-sm-7 col-sm-offset-2"><p><strong>
<?php eT("Additionally the following settings cannot be changed when the survey is active.");?>
</strong><br><?php eT("Please check these settings now:");?></p></div>
<?php echo CHtml::form(array("admin/survey/sa/activate/surveyid/{$surveyid}/"), 'post', array('class'=>'form-horizontal')); ?>
<div class='row'>
<div class="col-sm-4 col-sm-offset-2">
<div class='form-group'>
<label for='anonymized' class='control-label col-sm-7'>
<?php eT("Anonymized responses?"); ?>
<script type="text/javascript">
<!--
function alertPrivacy()
{
if (document.getElementById('anonymized').value == 'Y')
{
alert('<?php eT("Warning"); ?>: <?php eT("If you turn on the -Anonymized responses- option and create a tokens table, LimeSurvey will mark your completed tokens only with a 'Y' instead of date/time to ensure the anonymity of your participants.","js"); ?>');
}
}
//-->
</script>
</label>
<?php /*$this->widget('yiiwheels.widgets.switch.WhSwitch', array(
'name' => 'anonymizedazd',
'htmlOptions' => array(
'id' => 'anonymizedazd',
)
)); */ ?>
<div class='col-sm-5'>
<select id='anonymized' class='form-control' name='anonymized' onchange='alertPrivacy();'>
<option value='Y'
<?php if ($aSurveysettings['anonymized'] == "Y") { ?>
selected='selected'
<?php } ?>
><?php eT("Yes"); ?></option>
<option value='N'
<?php if ($aSurveysettings['anonymized'] != "Y") { ?>
selected='selected'
<?php } ?>
><?php eT("No"); ?></option>
</select>
</div>
</div>
</div>
<div class="col-sm-4">
<div class='form-group'>
<label for='datestamp' class='control-label col-sm-7'>
<?php eT("Date stamp?"); ?>
</label>
<div class='col-sm-5'>
<select id='datestamp' class='form-control' name='datestamp' onchange='alertDateStampAnonymization();'>
<option value='Y' <?php if ($aSurveysettings['datestamp'] == "Y"){echo 'selected="selected"';}?>>
<?php eT("Yes"); ?>
</option>
<option value='N' <?php if ($aSurveysettings['datestamp'] != "Y"){echo "selected='selected'";}?>>
<?php eT("No"); ?>
</option>
</select>
</div>
</div>
</div>
</div>
<div class='row'>
<div class="col-sm-4 col-sm-offset-2">
<div class='form-group'>
<label for='ipaddr' class='control-label col-sm-7'>
<?php eT("Save IP address?"); ?>
</label>
<div class='col-sm-5'>
<select name='ipaddr' id='ipaddr' class='form-control'>
<option value='Y' <?php if ($aSurveysettings['ipaddr'] == "Y") {echo "selected='selected'";} ?>>
<?php eT("Yes"); ?>
</option>
<option value='N' <?php if ($aSurveysettings['ipaddr'] != "Y") { echo "selected='selected'";} ?>>
<?php eT("No"); ?>
</option>
</select>
</div>
</div>
</div>
<div class="col-sm-4 ">
<div class='form-group'>
<label for='ipaddr' class='control-label col-sm-7'>
<?php eT("Anonymize IP address?"); ?>
</label>
<div class='col-sm-5'>
<select name='ipanonymize' id='ipanonymize' class='form-control'>
<option value='Y' <?php if ($aSurveysettings['ipanonymize'] == "Y") {echo "selected='selected'";} ?>>
<?php eT("Yes"); ?>
</option>
<option value='N' <?php if ($aSurveysettings['ipanonymize'] != "Y") { echo "selected='selected'";} ?>>
<?php eT("No"); ?>
</option>
</select>
</div>
</div>
</div>
</div>
<div class="col-sm-4 col-sm-offset-2">
<div class='form-group'>
<label class='control-label col-sm-7' for='savetimings'><?php eT("Save timings?"); ?></label>
<div class='col-sm-5'>
<select class='form-control' id='savetimings' name='savetimings'>
<option value='Y' <?php if (!isset($aSurveysettings['savetimings']) || !$aSurveysettings['savetimings'] || $aSurveysettings['savetimings'] == "Y") { ?> selected='selected' <?php } ?>>
<?php eT("Yes"); ?>
</option>
<option value='N' <?php if (isset($aSurveysettings['savetimings']) && $aSurveysettings['savetimings'] == "N") { ?> selected='selected' <?php } ?>>
<?php eT("No"); ?>
</option>
</select>
</div>
</div>
</div>
<div class="col-sm-4">
<div class='form-group'>
<label class='control-label col-sm-7' for='refurl'><?php eT("Save referrer URL?"); ?></label>
<div class='col-sm-5'>
<select class='form-control' name='refurl' id='refurl'>
<option value='Y' <?php if ($aSurveysettings['refurl'] == "Y"){echo "selected='selected'";} ?>>
<?php eT("Yes"); ?>
</option>
<option value='N' <?php if ($aSurveysettings['refurl'] != "Y") {echo "selected='selected'";} ?>>
<?php eT("No"); ?>
</option>
</select>
</div>
</div>
</div>
<p class='col-sm-7 col-sm-offset-2'>
<?php eT("Please note that once responses have collected with this survey and you want to add or remove groups/questions or change one of the settings above, you will need to deactivate this survey, which will move all data that has already been entered into a separate archived table."); ?><br /><br />
</p>
<?php if($oSurvey->getIsDateExpired()):?>
<div class="row">
<div class='col-sm-7 col-sm-offset-2'>
<div class="alert alert-warning"><?php eT('Note: This survey has a past expiration date configured and is currently not available to participants. Please remember to update/remove the expiration date in the survey settings after activation.')?><div>
</div>
</div>
<?php endif;?>
<div class='col-sm-6 col-sm-offset-4'>
<input type='hidden' name='ok' value='Y' />
<input id="activateSurvey__basicSettings--proceed" type='submit' class="btn btn-success btn-lg " value="<?php eT("Save & activate survey"); ?>" />
<a class="btn btn-default btn-lg" href="<?php echo $this->createUrl("admin/survey/sa/view/surveyid/$surveyid"); ?>" role="button">
<?php eT("Cancel"); ?>
</a>
</div>
<div class='col-sm-12'> </div>
</form>
</div>
</div>
<?php endif;?>