-
Notifications
You must be signed in to change notification settings - Fork 988
/
survey.php
2382 lines (2078 loc) · 124 KB
/
survey.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
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
* LimeSurvey (tm)
* Copyright (C) 2011 The LimeSurvey Project Team / Carsten Schmitz
* All rights reserved.
* License: GNU/GPL License v2 or later, see LICENSE.php
* LimeSurvey is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*
* $Id$
*/
class survey extends SurveyCommonController {
function __construct()
{
parent::__construct();
}
/**
* Shows survey details
*/
function view($surveyid,$gid=null,$qid=null)
{
if (!is_null($qid))
{
$css_admin_includes[] = $this->config->item('styleurl')."admin/default/superfish.css";
$this->config->set_item("css_admin_includes", $css_admin_includes);
self::_getAdminHeader();
self::_showadminmenu($surveyid);
self::_surveybar($surveyid,$gid);
self::_surveysummary($surveyid,"viewquestion");
self::_questiongroupbar($surveyid,$gid,$qid,"viewquestion");
self::_questionbar($surveyid,$gid,$qid,"viewquestion");
self::_loadEndScripts();
self::_getAdminFooter("http://docs.limesurvey.org", $this->limesurvey_lang->gT("LimeSurvey online manual"));
}
else
{
if (!is_null($gid))
{
$css_admin_includes[] = $this->config->item('styleurl')."admin/default/superfish.css";
$this->config->set_item("css_admin_includes", $css_admin_includes);
self::_getAdminHeader();
self::_showadminmenu($surveyid);
self::_surveybar($surveyid,$gid);
self::_surveysummary($surveyid,"viewgroup");
self::_questiongroupbar($surveyid,$gid,$qid,"viewgroup");
self::_loadEndScripts();
self::_getAdminFooter("http://docs.limesurvey.org", $this->limesurvey_lang->gT("LimeSurvey online manual"));
}
else
{
if(bHasSurveyPermission($surveyid,'survey','read'))
{
$css_admin_includes[] = $this->config->item('styleurl')."admin/default/superfish.css";
$this->config->set_item("css_admin_includes", $css_admin_includes);
self::_getAdminHeader();
self::_showadminmenu($surveyid);
self::_surveybar($surveyid);
self::_surveysummary($surveyid);
self::_loadEndScripts();
self::_getAdminFooter("http://docs.limesurvey.org", $this->limesurvey_lang->gT("LimeSurvey online manual"));
}
}
}
}
function deactivate($surveyid)
{
$css_admin_includes[] = $this->config->item('styleurl')."admin/default/superfish.css";
$this->config->set_item("css_admin_includes", $css_admin_includes);
self::_getAdminHeader();
self::_showadminmenu($surveyid);
self::_surveybar($surveyid);
//$postsid=returnglobal('sid');
if ($this->input->post('sid'))
{
$postsid = $this->input->post('sid');
}
else
{
$postsid = $surveyid;
}
$clang = $this->limesurvey_lang;
$date = date('YmdHis'); //'Hi' adds 24hours+minutes to name to allow multiple deactiviations in a day
$_POST = $this->input->post();
if (!isset($_POST['ok']) || !$_POST['ok'])
{
/**$deactivateoutput .= "<br />\n<div class='messagebox ui-corner-all'>\n";
$deactivateoutput .= "<div class='header ui-widget-header'>".$clang->gT("Deactivate Survey")." ($surveyid)</div>\n";
$deactivateoutput .= "\t<div class='warningheader'>\n";
$deactivateoutput .= $clang->gT("Warning")."<br />".$clang->gT("READ THIS CAREFULLY BEFORE PROCEEDING");
$deactivateoutput .= "</div>\n";
$deactivateoutput .= "\t".$clang->gT("In an active survey, a table is created to store all the data-entry records.")."\n";
$deactivateoutput .= "\t<p>".$clang->gT("When you deactivate a survey all the data entered in the original table will be moved elsewhere, and when you activate the survey again, the table will be empty. You will not be able to access this data using LimeSurvey any more.")."</p>\n";
$deactivateoutput .= "\t<p>".$clang->gT("Deactivated survey data can only be accessed by system administrators using a Database data access tool like phpmyadmin. If your survey uses tokens, this table will also be renamed and will only be accessible by system administrators.")."</p>\n";
$deactivateoutput .= "\t<p>".$clang->gT("Your responses table will be renamed to:")." {$dbprefix}old_{$_GET['sid']}_{$date}</p>\n";
$deactivateoutput .= "\t<p>".$clang->gT("Also you should export your responses before deactivating.")."</p>\n";
$deactivateoutput .= "\t<input type='submit' value='".$clang->gT("Deactivate Survey")."' onclick=\"".get2post("$scriptname?action=deactivate&ok=Y&sid={$_GET['sid']}")."\" />\n";
$deactivateoutput .= "</div><br />\n"; */
$data['clang'] = $clang;
$data['surveyid'] = $surveyid;
$data['date'] = $date;
$data['dbprefix'] = $this->db->dbprefix;
$data['step1'] = true;
$this->load->view('admin/Survey/deactivateSurvey_view',$data);
}
else
{
$this->load->helper('database');
//See if there is a tokens table for this survey
if (tableExists("tokens_{$postsid}"))
{
$toldtable="tokens_{$postsid}";
$tnewtable="old_tokens_{$postsid}_{$date}";
//$tdeactivatequery = db_rename_table(db_table_name_nq($toldtable) ,db_table_name_nq($tnewtable));
$tdeactivateresult = db_rename_table($toldtable ,$tnewtable) or die ("Couldn't deactivate tokens table because:<br /><br /><br />Survey was not deactivated either.<br /><br /><a href='".site_url('admin/survey/view/'.$postsid)."'>".$clang->gT("Main Admin Screen")."</a>");
if ($this->db->dbdriver=='postgres')
{
// If you deactivate a postgres table you have to rename the according sequence too and alter the id field to point to the changed sequence
//$deactivatequery = db_rename_table(db_table_name_nq($toldtable).'_tid_seq',db_table_name_nq($tnewtable).'_tid_seq');
$deactivateresult = db_rename_table($toldtable.'_tid_seq',$tnewtable.'_tid_seq') or die ("Could not rename the old sequence for this token table.<br /><br /><a href='".site_url('admin/survey/view/'.$postsid)."'>".$clang->gT("Main Admin Screen")."</a>");
$setsequence="ALTER TABLE ".$this->db->dbprefix.$tnewtable." ALTER COLUMN tid SET DEFAULT nextval('".$this->db->dbprefix.$tnewtable."_tid_seq'::regclass);";
$deactivateresult = db_execute_assosc($setsequence) or die ("Could not alter the field 'tid' to point to the new sequence name for this token table. <br /><br />Survey was not deactivated either.<br /><br /><a href='".site_url('admin/survey/view/'.$postsid)."'>".$clang->gT("Main Admin Screen")."</a>");
$setidx="ALTER INDEX ".$this->db->dbprefix.$toldtable."_idx RENAME TO ".$this->db->dbprefix.$tnewtable."_idx;";
$deactivateresult = db_execute_assosc($setidx) or die ("Could not alter the index for this token table. <br /><br />Survey was not deactivated either.<br /><br /><a href='".site_url('admin/survey/view/'.$postsid)."'>".$clang->gT("Main Admin Screen")."</a>");
}
}
// IF there are any records in the saved_control table related to this survey, they have to be deleted
$query = "DELETE FROM ".$this->db->dbprefix."saved_control WHERE sid={$postsid}";
//$result = $connect->Execute($query);
$result = db_execute_assoc($query);
$oldtable=$this->db->dbprefix."survey_{$postsid}";
$newtable=$this->db->dbprefix."old_survey_{$postsid}_{$date}";
//Update the auto_increment value from the table before renaming
$new_autonumber_start=0;
$query = "SELECT id FROM $oldtable ORDER BY id desc";
$result = db_select_limit_assoc($query, 1,0, false, false);
if ($result)
{
foreach ($result->result_array() as $row)
{
if (strlen($row['id']) > 12) //Handle very large autonumbers (like those using IP prefixes)
{
$part1=substr($row['id'], 0, 12);
$part2len=strlen($row['id'])-12;
$part2=sprintf("%0{$part2len}d", substr($row['id'], 12, strlen($row['id'])-12)+1);
$new_autonumber_start="{$part1}{$part2}";
}
else
{
$new_autonumber_start=$row['id']+1;
}
}
}
/**
$query = "UPDATE ".$this->db->dbprefix."surveys SET autonumber_start=$new_autonumber_start WHERE sid=$postsid";
//echo "hello".$new_autonumber_start."---".$postsid;
$result = db_execute_assosc($query); //Note this won't die if it fails - that's deliberate.
*/
$condn = array('sid' => $surveyid);
$insertdata = array('autonumber_start' => $new_autonumber_start);
$this->load->model('surveys_model');
$this->surveys_model->updateSurvey($insertdata,$condn);
//$deactivatequery = db_rename_table($oldtable,$newtable);
$deactivateresult = db_rename_table($oldtable,$newtable) or die ("Couldn't make backup of the survey table. Please try again. <br /><br />Survey was not deactivated either.<br /><br /><a href='".site_url('admin/survey/view/'.$postsid)."'>".$clang->gT("Main Admin Screen")."</a>");
if ($this->db->dbdriver=='postgres')
{
// If you deactivate a postgres table you have to rename the according sequence too and alter the id field to point to the changed sequence
//$deactivatequery = db_rename_table($oldtable.'_id_seq',$newtable.'_id_seq');
$deactivateresult = db_rename_table($oldtable.'_id_seq',$newtable.'_id_seq') or die ("Couldn't make backup of the survey table. Please try again. <br /><br />Survey was not deactivated either.<br /><br /><a href='".site_url('admin/survey/view/'.$postsid)."'>".$clang->gT("Main Admin Screen")."</a>");
$setsequence="ALTER TABLE $newtable ALTER COLUMN id SET DEFAULT nextval('{$newtable}_id_seq'::regclass);";
$deactivateresult = db_execute_assosc($setsequence) or die ("Couldn't make backup of the survey table. Please try again. <br /><br />Survey was not deactivated either.<br /><br /><a href='".site_url('admin/survey/view/'.$postsid)."'>".$clang->gT("Main Admin Screen")."</a>");
}
// $dict = NewDataDictionary($connect);
// $dropindexquery=$dict->DropIndexSQL(db_table_name_nq($oldtable).'_idx');
// $connect->Execute($dropindexquery[0]);
$insertdata = array('active' => 'N');
//$this->load->model('surveys_model');
/**
$deactivatequery = "UPDATE ".$this->db->dbprefix."surveys SET active='N' WHERE sid=$surveyid"; */
$deactivateresult = $this->surveys_model->updateSurvey($insertdata,$condn) or die ("Couldn't deactivate because updating of surveys table failed!<br /><br /><a href='".site_url('admin/survey/view/'.$postsid)."'>Admin</a>");
/**
$deactivateoutput .= "<br />\n<div class='messagebox ui-corner-all'>\n";
$deactivateoutput .= "<div class='header ui-widget-header'>".$clang->gT("Deactivate Survey")." ($surveyid)</div>\n";
$deactivateoutput .= "\t<div class='successheader'>".$clang->gT("Survey Has Been Deactivated")."\n";
$deactivateoutput .= "</div>\n";
$deactivateoutput .= "\t<p>\n";
$deactivateoutput .= "\t".$clang->gT("The responses table has been renamed to: ")." $newtable.\n";
$deactivateoutput .= "\t".$clang->gT("The responses to this survey are no longer available using LimeSurvey.")."\n";
$deactivateoutput .= "\t<p>".$clang->gT("You should note the name of this table in case you need to access this information later.")."</p>\n";
if (isset($toldtable) && $toldtable)
{
$deactivateoutput .= "\t".$clang->gT("The tokens table associated with this survey has been renamed to: ")." $tnewtable.\n";
}
$deactivateoutput .= "\t<p>".$clang->gT("Note: If you deactivated this survey in error, it is possible to restore this data easily if you do not make any changes to the survey structure. See the LimeSurvey documentation for further details")."</p>";
$deactivateoutput .= "</div><br/> \n";
*/
$pquery = "SELECT savetimings FROM ".$this->db->dbprefix."surveys WHERE sid={$postsid}";
$presult=db_execute_assoc($pquery);
$prow=$presult->row_array(); //fetch savetimings value
if ($prow['savetimings'] == "Y")
{
$oldtable=$this->db->dbprefix."survey_{$postsid}_timings";
$newtable=$this->db->dbprefix."old_survey_{$postsid}_timings_{$date}";
//$deactivatequery = db_rename_table($oldtable,$newtable);
$deactivateresult2 = db_rename_table($oldtable,$newtable) or die ("Couldn't make backup of the survey timings table. Please try again.<br /><br />Survey was deactivated.<br /><br /><a href='".site_url('admin/survey/view/'.$postsid)."'>".$clang->gT("Main Admin Screen")."</a>");
$deactivateresult=($deactivateresult && $deactivateresult2);
}
$data['clang'] = $clang;
$data['surveyid'] = $surveyid;
$data['tnewtable'] = $tnewtable;
$data['toldtable'] = $toldtable;
$this->load->view('admin/Survey/deactivateSurvey_view',$data);
}
self::_loadEndScripts();
self::_getAdminFooter("http://docs.limesurvey.org", $this->limesurvey_lang->gT("LimeSurvey online manual"));
}
function activate($surveyid)
{
$css_admin_includes[] = $this->config->item('styleurl')."admin/default/superfish.css";
$this->config->set_item("css_admin_includes", $css_admin_includes);
self::_getAdminHeader();
self::_showadminmenu($surveyid);
self::_surveybar($surveyid);
//$postsid=returnglobal('sid');
if ($this->input->post('sid'))
{
$postsid = $this->input->post('sid');
}
else
{
$postsid = $surveyid;
}
$qtypes=getqtypelist('','array');
$this->load->helper("admin/activate");
$_POST = $this->input->post();
if (!isset($_POST['ok']) || !$_POST['ok'])
{
if (isset($_GET['fixnumbering']) && $_GET['fixnumbering'])
{
fixNumbering($_GET['fixnumbering']);
}
// Check consistency for groups and questions
$failedgroupcheck = checkGroup($postsid);
$failedcheck = checkQuestions($postsid, $surveyid, $qtypes);
$data['clang'] = $this->limesurvey_lang;
$data['surveyid'] = $surveyid;
$data['$failedcheck'] = $failedcheck;
$data['failedgroupcheck'] = $failedgroupcheck;
$this->load->view("admin/Survey/activateSurvey_view",$data);
//IF ANY OF THE CHECKS FAILED, PRESENT THIS SCREEN
/**if ((isset($failedcheck) && $failedcheck) || (isset($failedgroupcheck) && $failedgroupcheck))
{
$activateoutput .= "<br />\n<div class='messagebox ui-corner-all'>\n";
$activateoutput .= "<div class='header ui-widget-header'>".$clang->gT("Activate Survey")." ($surveyid)</div>\n";
$activateoutput .= "<div class='warningheader'>\n".$clang->gT("Error")."<br />\n";
$activateoutput .= $clang->gT("Survey does not pass consistency check")."</div>\n";
$activateoutput .= "<p>\n";
$activateoutput .= "<strong>".$clang->gT("The following problems have been found:")."</strong><br />\n";
$activateoutput .= "<ul>\n";
if (isset($failedcheck) && $failedcheck)
{
foreach ($failedcheck as $fc)
{
$activateoutput .= "<li> Question qid-{$fc[0]} (\"<a href='$scriptname?sid=$surveyid&gid=$fc[3]&qid=$fc[0]'>{$fc[1]}</a>\"){$fc[2]}</li>\n";
}
}
if (isset($failedgroupcheck) && $failedgroupcheck)
{
foreach ($failedgroupcheck as $fg)
{
$activateoutput .= "\t\t\t\t<li> Group gid-{$fg[0]} (\"<a href='$scriptname?sid=$surveyid&gid=$fg[0]'>{$fg[1]}</a>\"){$fg[2]}</li>\n";
}
}
$activateoutput .= "</ul>\n";
$activateoutput .= $clang->gT("The survey cannot be activated until these problems have been resolved.")."\n";
$activateoutput .= "</div><br /> \n";
return;
}
$activateoutput .= "<br />\n<div class='messagebox ui-corner-all'>\n";
$activateoutput .= "<div class='header ui-widget-header'>".$clang->gT("Activate Survey")." ($surveyid)</div>\n";
$activateoutput .= "<div class='warningheader'>\n";
$activateoutput .= $clang->gT("Warning")."<br />\n";
$activateoutput .= $clang->gT("READ THIS CAREFULLY BEFORE PROCEEDING")."\n";
$activateoutput .= "\t</div>\n";
$activateoutput .= $clang->gT("You should only activate a survey when you are absolutely certain that your survey setup is finished and will not need changing.")."<br /><br />\n";
$activateoutput .= $clang->gT("Once a survey is activated you can no longer:")."<ul><li>".$clang->gT("Add or delete groups")."</li><li>".$clang->gT("Add or delete questions")."</li><li>".$clang->gT("Add or delete subquestions or change their codes")."</li></ul>\n";
$activateoutput .= $clang->gT("However you can still:")."<ul><li>".$clang->gT("Edit your questions code/title/text and advanced options")."</li><li>".$clang->gT("Edit your group names or descriptions")."</li><li>".$clang->gT("Add, remove or edit answer options")."</li><li>".$clang->gT("Change survey name or description")."</li></ul>\n";
$activateoutput .= $clang->gT("Once data has been entered into this survey, if you want to add or remove groups or questions, you will need to deactivate this survey, which will move all data that has already been entered into a separate archived table.")."<br /><br />\n";
$activateoutput .= "\t<input type='submit' value=\"".$clang->gT("Activate Survey")."\" onclick=\"".get2post("$scriptname?action=activate&ok=Y&sid={$_GET['sid']}")."\" />\n";
$activateoutput .= "</div><br /> \n";
*/
}
else
{
$activateoutput = activateSurvey($postsid,$surveyid);
$displaydata['display'] = $activateoutput;
//$data['display'] = $editsurvey;
$this->load->view('survey_view',$displaydata);
}
self::_loadEndScripts();
self::_getAdminFooter("http://docs.limesurvey.org", $this->limesurvey_lang->gT("LimeSurvey online manual"));
}
function listsurveys()
{
$clang = $this->limesurvey_lang;
$this->load->helper('database');
$this->load->helper('surveytranslator');
//self::_js_admin_includes(base_url().'scripts/admin/surveysettings.js');
self::_js_admin_includes(base_url().'scripts/jquery/jquery.tablesorter.min.js');
self::_js_admin_includes(base_url().'scripts/admin/listsurvey.js');
self::_getAdminHeader();
self::_showadminmenu(false);;
$query = " SELECT a.*, c.*, u.users_name FROM ".$this->db->dbprefix."surveys as a "
." INNER JOIN ".$this->db->dbprefix."surveys_languagesettings as c ON ( surveyls_survey_id = a.sid AND surveyls_language = a.language ) AND surveyls_survey_id=a.sid AND surveyls_language=a.language "
." INNER JOIN ".$this->db->dbprefix."users as u ON (u.uid=a.owner_id) ";
if ($this->session->userdata('USER_RIGHT_SUPERADMIN') != 1)
{
$query .= "WHERE a.sid in (select sid from ".$this->db->dbprefix."survey_permissions WHERE uid=".$this->session->userdata('loginID')." AND permission='survey' AND read_p=1) ";
}
$query .= " ORDER BY surveyls_title";
$this->load->helper('database');
$result = db_execute_assoc($query); // or safe_die($connect->ErrorMsg()); //Checked
if($result->num_rows() > 0) {
/**$listsurveys= "<br /><table class='listsurveys'><thead>
<tr>
<th colspan='7'> </th>
<th colspan='3'>".$clang->gT("Responses")."</th>
<th colspan='2'> </th>
</tr>
<tr>
<th>".$clang->gT("Status")."</th>
<th>".$clang->gT("SID")."</th>
<th>".$clang->gT("Survey")."</th>
<th>".$clang->gT("Date created")."</th>
<th>".$clang->gT("Owner") ."</th>
<th>".$clang->gT("Access")."</th>
<th>".$clang->gT("Anonymized responses")."</th>
<th>".$clang->gT("Full")."</th>
<th>".$clang->gT("Partial")."</th>
<th>".$clang->gT("Total")."</th>
<th>".$clang->gT("Tokens available")."</th>
<th>".$clang->gT("Response rate")."</th>
</tr></thead>
<tfoot><tr class='header ui-widget-header'>
<td colspan=\"12\"> </td>".
"</tr></tfoot>
<tbody>"; */
$gbc = "evenrow";
$dateformatdetails=getDateFormatData($this->session->userdata('dateformat'));
$listsurveys = "";
$first_time = true;
foreach ($result->result_array() as $rows)
{
if($rows['anonymized']=="Y")
{
$privacy=$clang->gT("Yes") ;
}
else
{
$privacy =$clang->gT("No") ;
}
if (tableExists('tokens_'.$rows['sid']))
{
$visibility = $clang->gT("Closed");
}
else
{
$visibility = $clang->gT("Open");
}
if($rows['active']=="Y")
{
if ($rows['expires']!='' && $rows['expires'] < date_shift(date("Y-m-d H:i:s"), "Y-m-d", $this->config->item('timeadjust')))
{
$status=$clang->gT("Expired") ;
}
elseif ($rows['startdate']!='' && $rows['startdate'] > date_shift(date("Y-m-d H:i:s"), "Y-m-d", $this->config->item('timeadjust')))
{
$status=$clang->gT("Not yet active") ;
}
else {
$status=$clang->gT("Active") ;
}
// Complete Survey Responses - added by DLR
$gnquery = "SELECT COUNT(id) AS countofid FROM ".$this->db->dbprefix."survey_".$rows['sid']." WHERE submitdate IS NULL";
$gnresult = db_execute_assoc($gnquery); //Checked)
foreach ($gnresult->result_array() as $gnrow)
{
$partial_responses=$gnrow['countofid'];
}
$gnquery = "SELECT COUNT(id) AS countofid FROM ".$this->db->dbprefix."survey_".$rows['sid'];
$gnresult = db_execute_assoc($gnquery); //Checked
foreach ($gnresult->result_array() as $gnrow)
{
$responses=$gnrow['countofid'];
}
}
else $status = $clang->gT("Inactive") ;
if ($first_time) // can't use same instance of Date_Time_Converter library every time!
{
$this->load->library('Date_Time_Converter',array($rows['datecreated'], "Y-m-d H:i:s"));
$datetimeobj = $this->date_time_converter ; // new Date_Time_Converter($rows['datecreated'] , "Y-m-d H:i:s");
$first_time = false;
}
else
{
// no need to load the library again, just make a new instance!
$datetimeobj = new Date_Time_Converter(array($rows['datecreated'], "Y-m-d H:i:s"));
}
$datecreated=$datetimeobj->convert($dateformatdetails['phpdate']);
if (in_array($rows['owner_id'],getuserlist('onlyuidarray')))
{
$ownername=$rows['users_name'] ;
}
else
{
$ownername="---";
}
$questionsCount = 0;
$questionsCountQuery = "SELECT * FROM ".$this->db->dbprefix."questions WHERE sid={$rows['sid']} AND language='".$rows['language']."'"; //Getting a count of questions for this survey
$questionsCountResult = db_execute_assoc($questionsCountQuery); //($connect->Execute($questionsCountQuery); //Checked)
$questionsCount = $questionsCountResult->num_rows();
$listsurveys.="<tr>";
if ($rows['active']=="Y")
{
if ($rows['expires']!='' && $rows['expires'] < date_shift(date("Y-m-d H:i:s"), "Y-m-d", $this->config->item('timeadjust')))
{
$listsurveys .= "<td><img src='".$this->config->item('imageurl')."/expired.png' "
. "alt='".$clang->gT("This survey is active but expired.")."' /></td>";
}
else
{
if (bHasSurveyPermission($rows['sid'],'surveyactivation','update'))
{
$listsurveys .= "<td><a href=\"#\" onclick=\"window.open('".$this->config->item('scriptname')."?action=deactivate&sid={$rows['sid']}', '_top')\""
. " title=\"".$clang->gTview("This survey is active - click here to deactivate this survey.")."\" >"
. "<img src='".$this->config->item('imageurl')."/active.png' alt='".$clang->gT("This survey is active - click here to deactivate this survey.")."' /></a></td>\n";
} else
{
$listsurveys .= "<td><img src='".$this->config->item('imageurl')."/active.png' "
. "alt='".$clang->gT("This survey is currently active.")."' /></td>\n";
}
}
} else {
if ( $questionsCount > 0 && bHasSurveyPermission($rows['sid'],'surveyactivation','update') )
{
$listsurveys .= "<td><a href=\"#\" onclick=\"window.open('".$this->config->item('scriptname')."?action=activate&sid={$rows['sid']}', '_top')\""
. " title=\"".$clang->gTview("This survey is currently not active - click here to activate this survey.")."\" >"
. "<img src='".$this->config->item('imageurl')."/inactive.png' title='' alt='".$clang->gT("This survey is currently not active - click here to activate this survey.")."' /></a></td>\n" ;
} else
{
$listsurveys .= "<td><img src='".$this->config->item('imageurl')."/inactive.png'"
. " title='".$clang->gT("This survey is currently not active.")."' alt='".$clang->gT("This survey is currently not active.")."' />"
. "</td>\n";
}
}
$link = site_url("admin/survey/view/".$rows['sid']);
$listsurveys.="<td align='center'><a href='".$link."'>{$rows['sid']}</a></td>";
$listsurveys.="<td align='left'><a href='".$link."'>{$rows['surveyls_title']}</a></td>".
"<td>".$datecreated."</td>".
"<td>".$ownername." (<a href='#' class='ownername_edit' id='ownername_edit_{$rows['sid']}'>Edit</a>)</td>".
"<td>".$visibility."</td>" .
"<td>".$privacy."</td>";
if ($rows['active']=="Y")
{
$complete = $responses - $partial_responses;
$listsurveys .= "<td>".$complete."</td>";
$listsurveys .= "<td>".$partial_responses."</td>";
$listsurveys .= "<td>".$responses."</td>";
}else{
$listsurveys .= "<td> </td>";
$listsurveys .= "<td> </td>";
$listsurveys .= "<td> </td>";
}
if ($rows['active']=="Y" && tableExists("tokens_".$rows['sid']))
{
//get the number of tokens for each survey
$tokencountquery = "SELECT COUNT(tid) AS countoftid FROM ".$this->db->dbprefix."tokens_".$rows['sid'];
$tokencountresult = db_execute_assoc($tokencountquery); //Checked)
foreach ($tokencountresult->result_array() as $tokenrow)
{
$tokencount = $tokenrow['countoftid'];
}
//get the number of COMLETED tokens for each survey
$tokencompletedquery = "SELECT COUNT(tid) AS countoftid FROM ".$this->db->dbprefix."tokens_".$rows['sid']." WHERE completed!='N'";
$tokencompletedresult = db_execute_assoc($tokencompletedquery); //Checked
foreach ($tokencompletedresult->result_array() as $tokencompletedrow)
{
$tokencompleted = $tokencompletedrow['countoftid'];
}
//calculate percentage
//prevent division by zero problems
if($tokencompleted != 0 && $tokencount != 0)
{
$tokenpercentage = round(($tokencompleted / $tokencount) * 100, 1);
}
else
{
$tokenpercentage = 0;
}
$listsurveys .= "<td>".$tokencount."</td>";
$listsurveys .= "<td>".$tokenpercentage."%</td>";
}
else
{
$listsurveys .= "<td> </td>";
$listsurveys .= "<td> </td>";
}
$listsurveys .= "</tr>" ;
}
$listsurveys.="</tbody>";
$listsurveys.="</table><br />" ;
$data['clang'] = $clang;
$this->load->view('admin/Survey/listSurveys_view',$data);
}
else
{
$listsurveys ="<p><strong> ".$clang->gT("No Surveys available - please create one.")." </strong><br /><br />" ;
//$this->load->view('survey_view',$displaydata);
}
$displaydata['display'] = $listsurveys;
//$data['display'] = $editsurvey;
$this->load->view('survey_view',$displaydata);
self::_loadEndScripts();
self::_getAdminFooter("http://docs.limesurvey.org", $this->limesurvey_lang->gT("LimeSurvey online manual"));
}
function delete()
{
$css_admin_includes[] = $this->config->item('styleurl')."admin/default/superfish.css";
$this->config->set_item("css_admin_includes", $css_admin_includes);
self::_getAdminHeader();
$data['surveyid'] = $surveyid = $this->input->post('sid');
self::_showadminmenu($surveyid);
self::_surveybar($this->input->post('sid'));
if(bHasSurveyPermission($surveyid,'survey','delete'))
{
$data['deleteok'] = $deleteok = $this->input->post('deleteok');
$data['clang'] = $this->limesurvey_lang;
$data['link'] = site_url("admin/survey/delete");
if (!(!isset($deleteok) || !$deleteok))
{
$this->load->dbforge();
if (tableExists("survey_$surveyid")) //delete the survey_$surveyid table
{
//$dsquery = $dict->DropTableSQL("{$dbprefix}survey_$surveyid");
//$dict->ExecuteSQLArray($sqlarray); $dict->ExecuteSQLArray($dsquery)
$dsresult = $this->dbforge->drop_table('survey_'.$surveyid) or safe_die ("Couldn't drop table survey_".$surveyid." in survey.php");
}
if (tableExists("survey_{$surveyid}_timings")) //delete the survey_$surveyid_timings table
{
//$dsquery = $dict->DropTableSQL("{$dbprefix}survey_{$surveyid}_timings");
//$dict->ExecuteSQLArray($sqlarraytimings);
$dsresult = $this->dbforge->drop_table('survey_'.$surveyid.'_timings') or safe_die ("Couldn't drop table survey_".$surveyid."_timings in survey.php");
}
if (tableExists("tokens_$surveyid")) //delete the tokens_$surveyid table
{
//$dsquery = $dict->DropTableSQL("{$dbprefix}tokens_$surveyid");
$dsresult = $this->dbforge->drop_table('tokens_'.$surveyid) or safe_die ("Couldn't drop table token_".$surveyid." in survey.php");
}
$dsquery = "SELECT qid FROM ".$this->db->dbprefix."questions WHERE sid=$surveyid";
$dsresult = db_execute_assoc($dsquery) or safe_die ("Couldn't find matching survey to delete<br />$dsquery<br />");
while ($dsrow = $dsresult->result_array())
{
//$asdel = "DELETE FROM {$dbprefix}answers WHERE qid={$dsrow['qid']}";
//$asres = $connect->Execute($asdel);
$this->db->delete('answers', array('qid' => $dsrow['qid']));
$this->db->delete('conditions', array('qid' => $dsrow['qid']));
$this->db->delete('question_attributes', array('qid' => $dsrow['qid']));
/**
$cddel = "DELETE FROM {$dbprefix}conditions WHERE qid={$dsrow['qid']}";
$cdres = $connect->Execute($cddel) or safe_die ("Delete conditions failed<br />$cddel<br />".$connect->ErrorMsg());
$qadel = "DELETE FROM {$dbprefix}question_attributes WHERE qid={$dsrow['qid']}";
$qares = $connect->Execute($qadel); */
}
//$qdel = "DELETE FROM {$dbprefix}questions WHERE sid=$surveyid";
//$qres = $connect->Execute($qdel);
$this->db->delete('questions', array('sid' => $surveyid));
//$scdel = "DELETE FROM {$dbprefix}assessments WHERE sid=$surveyid";
//$scres = $connect->Execute($scdel);
$this->db->delete('assessments', array('sid' => $surveyid));
//$gdel = "DELETE FROM {$dbprefix}groups WHERE sid=$surveyid";
//$gres = $connect->Execute($gdel);
$this->db->delete('groups', array('sid' => $surveyid));
//$slsdel = "DELETE FROM {$dbprefix}surveys_languagesettings WHERE surveyls_survey_id=$surveyid";
//$slsres = $connect->Execute($slsdel);
$this->db->delete('surveys_languagesettings', array('surveyls_survey_id' => $surveyid));
//$srdel = "DELETE FROM {$dbprefix}survey_permissions WHERE sid=$surveyid";
//$srres = $connect->Execute($srdel);
$this->db->delete('survey_permissions', array('sid' => $surveyid));
//$srdel = "DELETE FROM {$dbprefix}saved_control WHERE sid=$surveyid";
//$srres = $connect->Execute($srdel);
$this->db->delete('saved_control', array('sid' => $surveyid));
//$sdel = "DELETE FROM {$dbprefix}surveys WHERE sid=$surveyid";
//$sres = $connect->Execute($sdel);
$this->db->delete('surveys', array('sid' => $surveyid));
$sdel = "DELETE ".$this->db->dbprefix."quota_languagesettings FROM ".$this->db->dbprefix."quota_languagesettings, ".$this->db->dbprefix."quota WHERE ".$this->db->dbprefix."quota_languagesettings.quotals_quota_id=".$this->db->dbprefix."quota.id and sid=$surveyid";
$sres = db_execute_assoc($sdel);
//$sres = $connect->Execute($sdel);
//$this->db->delete('assessments', array('sid' => $surveyid));
//$sdel = "DELETE FROM {$dbprefix}quota WHERE sid=$surveyid";
//$sres = $connect->Execute($sdel);
$this->db->delete('quota', array('sid' => $surveyid));
//$sdel = "DELETE FROM {$dbprefix}quota_members WHERE sid=$surveyid;";
//$sres = $connect->Execute($sdel);
$this->db->delete('quota_members', array('sid' => $surveyid));
}
$this->load->view('admin/Survey/deleteSurvey_view',$data);
}
else {
//include('access_denied.php');
$finaldata['display'] = access_denied("editsurvey",$surveyid);
$this->load->view('survey_view',$finaldata);
}
self::_loadEndScripts();
self::_getAdminFooter("http://docs.limesurvey.org", $this->limesurvey_lang->gT("LimeSurvey online manual"));
}
function editlocalsettings($surveyid)
{
$clang = $this->limesurvey_lang;
$css_admin_includes[] = $this->config->item('styleurl')."admin/default/superfish.css";
$this->config->set_item("css_admin_includes", $css_admin_includes);
self::_js_admin_includes(base_url().'scripts/admin/surveysettings.js');
self::_getAdminHeader();
self::_showadminmenu($surveyid);;
self::_surveybar($surveyid);
if(bHasSurveyPermission($surveyid,'surveylocale','read'))
{
$grplangs = GetAdditionalLanguagesFromSurveyID($surveyid);
$baselang = GetBaseLanguageFromSurveyID($surveyid);
array_unshift($grplangs,$baselang);
$editsurvey = PrepareEditorScript();
$editsurvey .="<div class='header ui-widget-header'>".$clang->gT("Edit survey text elements")."</div>\n";
$editsurvey .= "<form id='addnewsurvey' class='form30' name='addnewsurvey' action='".site_url("admin/database/index/updatesurveylocalesettings")."' method='post'>\n"
. '<div id="tabs">';
$i = 0;
foreach ($grplangs as $grouplang)
{
// this one is created to get the right default texts fo each language
$this->load->library('Limesurvey_lang',array($grouplang));
$this->load->helper('database');
$this->load->helper('surveytranslator');
$bplang = $this->limesurvey_lang;//new limesurvey_lang($grouplang);
$esquery = "SELECT * FROM ".$this->db->dbprefix."surveys_languagesettings WHERE surveyls_survey_id=$surveyid and surveyls_language='$grouplang'";
$esresult = db_execute_assoc($esquery); //Checked
$esrow = $esresult->row_array();
$tab_title[$i] = getLanguageNameFromCode($esrow['surveyls_language'],false);
if ($esrow['surveyls_language']==GetBaseLanguageFromSurveyID($surveyid))
$tab_title[$i] .= '('.$clang->gT("Base Language").')';
$esrow = array_map('htmlspecialchars', $esrow);
$data['clang'] = $clang;
$data['esrow'] = $esrow;
$data['surveyid'] = $surveyid;
$data['action'] = "editsurveylocalesettings";
$tab_content[$i] = $this->load->view('admin/Survey/editLocalSettings_view',$data,true);
/**
$tab_content[$i] = "<ul>\n"
. "<li><label for=''>".$clang->gT("Survey title").":</label>\n"
. "<input type='text' size='80' name='short_title_".$esrow['surveyls_language']."' value=\"{$esrow['surveyls_title']}\" /></li>\n"
. "<li><label for=''>".$clang->gT("Description:")."</label>\n"
. "<textarea cols='80' rows='15' name='description_".$esrow['surveyls_language']."'>{$esrow['surveyls_description']}</textarea>\n"
. getEditor("survey-desc","description_".$esrow['surveyls_language'], "[".$clang->gT("Description:", "js")."](".$esrow['surveyls_language'].")",$surveyid,'','',$action)
. "</li>\n"
. "<li><label for=''>".$clang->gT("Welcome message:")."</label>\n"
. "<textarea cols='80' rows='15' name='welcome_".$esrow['surveyls_language']."'>{$esrow['surveyls_welcometext']}</textarea>\n"
. getEditor("survey-welc","welcome_".$esrow['surveyls_language'], "[".$clang->gT("Welcome:", "js")."](".$esrow['surveyls_language'].")",$surveyid,'','',$action)
. "</li>\n"
. "<li><label for=''>".$clang->gT("End message:")."</label>\n"
. "<textarea cols='80' rows='15' name='endtext_".$esrow['surveyls_language']."'>{$esrow['surveyls_endtext']}</textarea>\n"
. getEditor("survey-endtext","endtext_".$esrow['surveyls_language'], "[".$clang->gT("End message:", "js")."](".$esrow['surveyls_language'].")",$surveyid,'','',$action)
. "</li>\n"
. "<li><label for=''>".$clang->gT("End URL:")."</label>\n"
. "<input type='text' size='80' name='url_".$esrow['surveyls_language']."' value=\"{$esrow['surveyls_url']}\" />\n"
. "</li>"
. "<li><label for=''>".$clang->gT("URL description:")."</label>\n"
. "<input type='text' size='80' name='urldescrip_".$esrow['surveyls_language']."' value=\"{$esrow['surveyls_urldescription']}\" />\n"
. "</li>"
. "<li><label for=''>".$clang->gT("Date format:")."</label>\n"
. "<select size='1' name='dateformat_".$esrow['surveyls_language']."'>\n";
foreach (getDateFormatData() as $index=>$dateformatdata)
{
$tab_content[$i].= "<option value='{$index}'";
if ($esrow['surveyls_dateformat']==$index) {
$tab_content[$i].=" selected='selected'";
}
$tab_content[$i].= ">".$dateformatdata['dateformat'].'</option>';
}
$tab_content[$i].= "</select></li>"
. "<li><label for=''>".$clang->gT("Decimal Point Format:")."</label>\n";
$tab_content[$i].="<select size='1' name='numberformat_".$esrow['surveyls_language']."'>\n";
foreach (getRadixPointData() as $index=>$radixptdata)
{
$tab_content[$i].= "<option value='{$index}'";
if ($esrow['surveyls_numberformat']==$index) {
$tab_content[$i].=" selected='selected'";
}
$tab_content[$i].= ">".$radixptdata['desc'].'</option>';
}
$tab_content[$i].= "</select></li></ul>"; */
$i++;
}
$editsurvey .= "<ul>";
foreach($tab_title as $i=>$eachtitle){
$editsurvey .= "<li style='clear:none'><a href='#edittxtele$i'>$eachtitle</a></li>";
}
$editsurvey .= "</ul>";
foreach ($tab_content as $i=>$eachcontent){
$editsurvey .= "<div id='edittxtele$i'>$eachcontent</div>";
}
$editsurvey .= "</div>";
if(bHasSurveyPermission($surveyid,'surveylocale','update'))
{
$editsurvey .= "<p><input type='submit' class='standardbtn' value='".$clang->gT("Save")."' />\n"
. "<input type='hidden' name='action' value='updatesurveylocalesettings' />\n"
. "<input type='hidden' name='sid' value=\"{$surveyid}\" />\n"
. "<input type='hidden' name='language' value=\"{$esrow['surveyls_language']}\" />\n"
. "</p>\n"
. "</form>\n";
}
//echo $editsurvey;
$finaldata['display'] = $editsurvey;
$this->load->view('survey_view',$finaldata);
//self::_getAdminFooter("http://docs.limesurvey.org", $this->limesurvey_lang->gT("LimeSurvey online manual"));
}
else
{
//include("access_denied.php");
$finaldata['display'] = access_denied("editsurvey",$surveyid);
$this->load->view('survey_view',$finaldata);
}
self::_loadEndScripts();
self::_getAdminFooter("http://docs.limesurvey.org", $this->limesurvey_lang->gT("LimeSurvey online manual"));
}
function copy()
{
$importsurvey = "";
$action = $this->input->post('action');
$surveyid = $this->input->post('sid');
if ($action == "importsurvey" || $action == "copysurvey")
{
if ( $this->input->post('copysurveytranslinksfields') == "on" || $this->input->post('translinksfields') == "on")
{
$sTransLinks = true;
}
$clang = $this->limesurvey_lang;
// Start the HTML
if ($action == 'importsurvey')
{
$importsurvey .= "<div class='header ui-widget-header'>".$clang->gT("Import survey")."</div>\n";
$importingfrom = "http";
}
elseif($action == 'copysurvey')
{
$importsurvey .= "<div class='header ui-widget-header'>".$clang->gT("Copy survey")."</div>\n";
$copyfunction= true;
}
// Start traitment and messagebox
$importsurvey .= "<div class='messagebox ui-corner-all'>\n";
$importerror=false; // Put a var for continue
if ($action == 'importsurvey')
{
$the_full_file_path = $this->config->item('tempdir') . "/" . $_FILES['the_file']['name'];
if (!@move_uploaded_file($_FILES['the_file']['tmp_name'], $the_full_file_path))
{
$importsurvey .= "<div class='errorheader'>".$clang->gT("Error")."</div>\n";
$importsurvey .= sprintf ($clang->gT("An error occurred uploading your file. This may be caused by incorrect permissions in your %s folder."),$this->config->item('tempdir'))."<br /><br />\n";
$importsurvey .= "<input type='submit' value='".$clang->gT("Main Admin Screen")."' onclick=\"window.open('$scriptname', '_top')\"><br /><br />\n";
$importerror=true;
}
else
{
$importsurvey .= "<div class='successheader'>".$clang->gT("Success")."</div> <br />\n";
$importsurvey .= $clang->gT("File upload succeeded.")."<br /><br />\n";
$importsurvey .= $clang->gT("Reading file..")."<br />\n";
$sFullFilepath=$the_full_file_path;
$aPathInfo = pathinfo($sFullFilepath);
if (isset($aPathInfo['extension']))
{
$sExtension = $aPathInfo['extension'];
}
else
{
$sExtension = "";
}
}
if (!$importerror && (strtolower($sExtension)!='csv' && strtolower($sExtension)!='lss'))
{
$importsurvey .= "<div class='errorheader'>".$clang->gT("Error")."</div>\n";
$importsurvey .= $clang->gT("Import failed. You specified an invalid file type.")."\n";
$importerror=true;
}
}
elseif ($action == 'copysurvey')
{
$surveyid = sanitize_int($this->input->post('copysurveylist'));
$exclude = array();
if (get_magic_quotes_gpc()) {$sNewSurveyName = stripslashes($this->input->post('copysurveyname'));}
else{
$sNewSurveyName=$this->input->post('copysurveyname');
}
/**
require_once("../classes/inputfilter/class.inputfilter_clean.php");
$myFilter = new InputFilter('','',1,1,1);
if ($filterxsshtml)
{
$sNewSurveyName = $myFilter->process($sNewSurveyName);
} else {
$sNewSurveyName = html_entity_decode($sNewSurveyName, ENT_QUOTES, "UTF-8");
}
*/
if ($this->input->post('copysurveyexcludequotas') == "on")
{
$exclude['quotas'] = true;
}
if ($this->input->post('copysurveyexcludeanswers') == "on")
{
$exclude['answers'] = true;
}
if ($this->input->post('copysurveyresetconditions') == "on")
{
$exclude['conditions'] = true;
}
//include("export_structure_xml.php");
if (!$surveyid)
{
self::_getAdminHeader();
echo ""
."<br />\n"
."<table width='350' align='center' style='border: 1px solid #555555' cellpadding='1' cellspacing='0'>\n"
."\t<tr bgcolor='#555555'><td colspan='2' height='4'><font size='1' face='verdana' color='white'><strong>"
.$clang->gT("Export Survey")."</strong></td></tr>\n"
."\t<tr><td align='center'>\n"
."<br /><strong><font color='red'>"
.$clang->gT("Error")."</font></strong><br />\n"
.$clang->gT("No SID has been provided. Cannot dump survey")."<br />\n"
."<br /><input type='submit' value='"
.$clang->gT("Main Admin Screen")."' onclick=\"window.open('$scriptname', '_top')\">\n"
."\t</td></tr>\n"