/
html.php
3677 lines (3313 loc) · 192 KB
/
html.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
/*
* LimeSurvey
* Copyright (C) 2007 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$
*/
//Security Checked: POST, GET, SESSION, DB, REQUEST, returnglobal
//Ensure script is not run directly, avoid path disclosure
include_once("login_check.php");
if (isset($_POST['uid'])) {$postuserid=sanitize_int($_POST['uid']);}
if (isset($_POST['ugid'])) {$postusergroupid=sanitize_int($_POST['ugid']);}
if ($action == "listsurveys")
{
$js_admin_includes[]='../scripts/jquery/jquery.tablesorter.min.js';
$js_admin_includes[]='scripts/listsurvey.js';
$query = " SELECT a.*, c.*, u.users_name FROM ".db_table_name('surveys')." as a "
." INNER JOIN ".db_table_name('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 ".db_table_name('users')." as u ON (u.uid=a.owner_id) ";
if ($_SESSION['USER_RIGHT_SUPERADMIN'] != 1)
{
$query .= " INNER JOIN ".db_table_name('surveys_rights')." AS b ON a.sid = b.sid ";
$query .= " WHERE b.uid =".$_SESSION['loginID'];
}
$query .= " ORDER BY surveyls_title";
$result = db_execute_assoc($query) or safe_die($connect->ErrorMsg()); //Checked
if($result->RecordCount() > 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("Anonymous answers")."</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'>
<td colspan=\"12\"> </td>".
"</tr></tfoot>
<tbody>";
$gbc = "evenrow";
$dateformatdetails=getDateFormatData($_SESSION['dateformat']);
while($rows = $result->FetchRow())
{
if($rows['private']=="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", $timeadjust))
{
$status=$clang->gT("Expired") ;
}
elseif ($rows['startdate']!='' && $rows['startdate'] > date_shift(date("Y-m-d H:i:s"), "Y-m-d", $timeadjust))
{
$status=$clang->gT("Not yet active") ;
}
else {
$status=$clang->gT("Active") ;
}
// Complete Survey Responses - added by DLR
$gnquery = "SELECT count(id) FROM ".db_table_name("survey_".$rows['sid'])." WHERE submitdate IS NULL";
$gnresult = db_execute_num($gnquery); //Checked
while ($gnrow = $gnresult->FetchRow())
{
$partial_responses=$gnrow[0];
}
$gnquery = "SELECT count(id) FROM ".db_table_name("survey_".$rows['sid']);
$gnresult = db_execute_num($gnquery); //Checked
while ($gnrow = $gnresult->FetchRow())
{
$responses=$gnrow[0];
}
}
else $status =$clang->gT("Inactive") ;
$datetimeobj = new Date_Time_Converter($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 ".db_table_name('questions')." WHERE sid={$rows['sid']} AND language='".$rows['language']."'"; //Getting a count of questions for this survey
$questionsCountResult = $connect->Execute($questionsCountQuery); //Checked
$questionsCount = $questionsCountResult->RecordCount();
if ($gbc == "oddrow") {$gbc = "evenrow";}
else {$gbc = "oddrow";}
$listsurveys.="<tr class='$gbc'>";
if ($rows['active']=="Y")
{
if ($rows['expires']!='' && $rows['expires'] < date_shift(date("Y-m-d H:i:s"), "Y-m-d", $timeadjust))
{
$listsurveys .= "<td><img src='$imagefiles/expired.png' "
. "alt='".$clang->gT("This survey is active but expired.")."' /></td>";
}
else
{
if (bHasRight($rows['sid'],'activate_survey'))
{
$listsurveys .= "<td><a href=\"#\" onclick=\"window.open('$scriptname?action=deactivate&sid={$rows['sid']}', '_top')\""
. " title=\"".$clang->gTview("This survey is active - click here to deactivate this survey.")."\" >"
. "<img src='$imagefiles/active.png' alt='".$clang->gT("This survey is active - click here to deactivate this survey.")."' /></a></td>\n";
} else
{
$listsurveys .= "<td><img src='$imagefiles/active.png' "
. "alt='".$clang->gT("This survey is currently active.")."' /></td>\n";
}
}
} else {
if ( $questionsCount > 0 && bHasRight($rows['sid'],'activate_survey') )
{
$listsurveys .= "<td><a href=\"#\" onclick=\"window.open('$scriptname?action=activate&sid={$rows['sid']}', '_top')\""
. " title=\"".$clang->gTview("This survey is currently not active - click here to activate this survey.")."\" >"
. "<img src='$imagefiles/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='$imagefiles/inactive.png'"
. " title='".$clang->gT("This survey is currently not active.")."' alt='".$clang->gT("This survey is currently not active.")."' />"
. "</td>\n";
}
}
$listsurveys.="<td align='center'><a href='".$scriptname."?sid=".$rows['sid']."'>{$rows['sid']}</a></td>";
$listsurveys.="<td align='left'><a href='".$scriptname."?sid=".$rows['sid']."'>{$rows['surveyls_title']}</a></td>".
"<td>".$datecreated."</td>".
"<td>".$ownername."</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) FROM ".db_table_name("tokens_".$rows['sid']);
$tokencountresult = db_execute_num($tokencountquery); //Checked
while ($tokenrow = $tokencountresult->FetchRow())
{
$tokencount = $tokenrow[0];
}
//get the number of COMLETED tokens for each survey
$tokencompletedquery = "SELECT count(tid) FROM ".db_table_name("tokens_".$rows['sid'])." WHERE completed!='N'";
$tokencompletedresult = db_execute_num($tokencompletedquery); //Checked
while ($tokencompletedrow = $tokencompletedresult->FetchRow())
{
$tokencompleted = $tokencompletedrow[0];
}
//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 />" ;
}
else $listsurveys="<p><strong> ".$clang->gT("No Surveys available - please create one.")." </strong><br /><br />" ;
}
if ($action == "personalsettings")
{
// prepare data for the htmleditormode preference
$edmod1='';
$edmod2='';
$edmod3='';
$edmod4='';
switch ($_SESSION['htmleditormode'])
{
case 'none':
$edmod2="selected='selected'";
break;
case 'inline':
$edmod3="selected='selected'";
break;
case 'popup':
$edmod4="selected='selected'";
break;
default:
$edmod1="selected='selected'";
break;
}
$cssummary = "<div class='formheader'>"
. "<strong>".$clang->gT("Your personal settings")."</strong>\n"
. "</div>\n"
. "<div>\n"
. "<form action='$scriptname' id='personalsettings' method='post'>"
. "<ul>\n";
// Current language
$cssummary .= "<li>\n"
. "<label for='lang'>".$clang->gT("Interface language").":</label>\n"
. "<select id='lang' name='lang'>\n";
foreach (getlanguagedata(true) as $langkey=>$languagekind)
{
$cssummary .= "<option value='$langkey'";
if ($langkey == $_SESSION['adminlang']) {$cssummary .= " selected='selected'";}
$cssummary .= ">".$languagekind['nativedescription']." - ".$languagekind['description']."</option>\n";
}
$cssummary .= "</select>\n"
. "</li>\n";
// Current htmleditormode
$cssummary .= "<li>\n"
. "<label for='htmleditormode'>".$clang->gT("HTML editor mode").":</label>\n"
. "<select id='htmleditormode' name='htmleditormode'>\n"
. "<option value='default' $edmod1>".$clang->gT("Default")."</option>\n"
. "<option value='inline' $edmod3>".$clang->gT("Inline HTML editor")."</option>\n"
. "<option value='popup' $edmod4>".$clang->gT("Popup HTML editor")."</option>\n"
. "<option value='none' $edmod2>".$clang->gT("No HTML editor")."</option>\n";
$cssummary .= "</select>\n"
. "</li>\n";
// Date format
$cssummary .= "<li>\n"
. "<label for='dateformat'>".$clang->gT("Date format").":</label>\n"
. "<select name='dateformat' id='dateformat'>\n";
foreach (getDateFormatData() as $index=>$dateformatdata)
{
$cssummary.= "<option value='{$index}'";
if ($index==$_SESSION['dateformat'])
{
$cssummary.= "selected='selected'";
}
$cssummary.= ">".$dateformatdata['dateformat'].'</option>';
}
$cssummary .= "</select>\n"
. "</li>\n"
. "</ul>\n"
. "<p><input type='hidden' name='action' value='savepersonalsettings' /><input class='submit' type='submit' value='".$clang->gT("Save settings")
."' /></p></form></div>";
}
if (isset($surveyid) && $surveyid &&
$action!='dataentry' && $action!='browse' && $action!='exportspss' &&
$action!='statistics' && $action!='importoldresponses' && $action!='exportr' &&
$action!='vvimport' && $action!='vvexport' && $action!='exportresults')
{
if(bHasRight($surveyid))
{
$js_admin_includes[]='../scripts/jquery/jquery.cookie.js';
$js_admin_includes[]='scripts/surveytoolbar.js';
$baselang = GetBaseLanguageFromSurveyID($surveyid);
$sumquery3 = "SELECT * FROM ".db_table_name('questions')." WHERE sid=$surveyid AND parent_qid=0 AND language='".$baselang."'"; //Getting a count of questions for this survey
$sumresult3 = $connect->Execute($sumquery3); //Checked
$sumcount3 = $sumresult3->RecordCount();
$sumquery6 = "SELECT count(*) FROM ".db_table_name('conditions')." as c, ".db_table_name('questions')." as q WHERE c.qid = q.qid AND q.sid=$surveyid"; //Getting a count of conditions for this survey
$sumcount6 = $connect->GetOne($sumquery6); //Checked
$sumquery2 = "SELECT * FROM ".db_table_name('groups')." WHERE sid=$surveyid AND language='".$baselang."'"; //Getting a count of groups for this survey
$sumresult2 = $connect->Execute($sumquery2); //Checked
$sumcount2 = $sumresult2->RecordCount();
$sumquery1 = "SELECT * FROM ".db_table_name('surveys')." inner join ".db_table_name('surveys_languagesettings')." on (surveyls_survey_id=sid and surveyls_language=language) WHERE sid=$surveyid"; //Getting data for this survey
$sumresult1 = db_select_limit_assoc($sumquery1, 1) ; //Checked
if ($sumresult1->RecordCount()==0){die('Invalid survey id');} // if surveyid is invalid then die to prevent errors at a later time
// Output starts here...
$surveysummary = "";
$surveyinfo = $sumresult1->FetchRow();
$surveyinfo = array_map('FlattenText', $surveyinfo);
//$surveyinfo = array_map('htmlspecialchars', $surveyinfo);
$activated = $surveyinfo['active'];
//BUTTON BAR
$surveysummary .= "" //"<tr><td colspan=2>\n"
. "<div class='menubar'>\n"
. "<div class='menubar-title'>\n"
. "<strong>".$clang->gT("Survey")."</strong> "
. "<span class='basic'>{$surveyinfo['surveyls_title']} (".$clang->gT("ID").":$surveyid)</span></div>\n"
. "<div class='menubar-main'>\n"
. "<div class='menubar-left' id='basicsurveybar'>\n";
if ($activated == "N" )
{
$surveysummary .= "<img src='$imagefiles/inactive.png' "
. "alt='".$clang->gT("This survey is not currently active")."' />\n";
if($sumcount3>0 && bHasRight($surveyid,'activate_survey'))
{
$surveysummary .= "<a href=\"#\" onclick=\"window.open('$scriptname?action=activate&sid=$surveyid', '_top')\""
. " title=\"".$clang->gTview("Activate this Survey")."\" >"
. "<img src='$imagefiles/activate.png' name='ActivateSurvey' alt='".$clang->gT("Activate this Survey")."'/></a>\n" ;
}
else
{
$surveysummary .= "<img src='$imagefiles/activate_disabled.png' alt='"
. $clang->gT("Survey cannot be activated. Either you have no permission or there are no questions.")."' />\n" ;
}
}
elseif ($activated == "Y")
{
if ($surveyinfo['expires']!='' && ($surveyinfo['expires'] < date_shift(date("Y-m-d H:i:s"), "Y-m-d H:i", $timeadjust)))
{
$surveysummary .= "<img src='$imagefiles/expired.png' "
. "alt='".$clang->gT("This survey is active but expired.")."' />\n";
}
elseif (($surveyinfo['startdate']!='') && ($surveyinfo['startdate'] > date_shift(date("Y-m-d H:i:s"), "Y-m-d H:i", $timeadjust)))
{
$surveysummary .= "<img src='$imagefiles/notyetstarted.png' "
. "alt='".$clang->gT("This survey is active but has a start date.")."' />\n";
}
else
{
$surveysummary .= "<img src='$imagefiles/active.png' title='' "
. "alt='".$clang->gT("This survey is currently active")."' />\n";
}
if(bHasRight($surveyid,'activate_survey'))
{
$surveysummary .= "<a href=\"#\" onclick=\"window.open('$scriptname?action=deactivate&sid=$surveyid', '_top')\""
. " title=\"".$clang->gTview("Deactivate this Survey")."\" >"
. "<img src='$imagefiles/deactivate.png' alt='".$clang->gT("Deactivate this Survey")."' /></a>\n" ;
}
else
{
$surveysummary .= "<img src='$imagefiles/blank.gif' alt='' width='14' />\n";
}
}
$surveysummary .= "<img src='$imagefiles/seperator.gif' alt='' />\n";
// survey rights
if ($activated == "N")
{
$icontext=$clang->gT("Test This Survey");
$icontext2=$clang->gTview("Test This Survey");
} else
{
$icontext=$clang->gT("Execute This Survey");
$icontext2=$clang->gTview("Execute This Survey");
}
$baselang = GetBaseLanguageFromSurveyID($surveyid);
if (count(GetAdditionalLanguagesFromSurveyID($surveyid)) == 0)
{
$surveysummary .= "<a href=\"#\" accesskey='d' onclick=\"window.open('"
. $publicurl."/index.php?sid=$surveyid&newtest=Y&lang=$baselang', '_blank')\" title=\"".$icontext2."\" >"
. "<img src='$imagefiles/do.png' name='DoSurvey' alt='$icontext' />"
. "</a>\n";
} else {
$surveysummary .= "<a href=\"#\" onclick=\"$('#printpopup').css('visibility','hidden'); $('#langpopup2').css('visibility','visible');\" "
. "title=\"".$icontext2."\" accesskey='d'>"
. "<img src='$imagefiles/do.png' name='DoSurvey' alt='$icontext' />"
. "</a>\n";
$tmp_survlangs = GetAdditionalLanguagesFromSurveyID($surveyid);
$tmp_survlangs[] = $baselang;
rsort($tmp_survlangs);
// Test Survey Language Selection Popup
$surveysummary .="<div class=\"langpopup2\" id=\"langpopup2\">".$clang->gT("Please select a language:")."<ul>";
foreach ($tmp_survlangs as $tmp_lang)
{
$surveysummary .= "<li><a href=\"#\" accesskey='d' onclick=\"document.getElementById('langpopup2').style.visibility='hidden'; window.open('".$publicurl."/index.php?sid=$surveyid&newtest=Y&lang=".$tmp_lang."', '_blank')\"><font color=\"#097300\"><b>".getLanguageNameFromCode($tmp_lang,false)."</b></font></a></li>";
}
$surveysummary .= "<li class='cancellink'><a href=\"#\" accesskey='d' onclick=\"document.getElementById('langpopup2').style.visibility='hidden';\"><span style='color:#DF3030'>".$clang->gT("Cancel")."</span></a></li>"
."</ul></div>";
}
$surveysummary .= "<img src='$imagefiles/seperator.gif' alt='' />\n";
if($_SESSION['USER_RIGHT_SUPERADMIN'] == 1 || $surveyinfo['owner_id'] == $_SESSION['loginID'])
{
$surveysummary .= "<a href=\"#\" onclick=\"window.open('$scriptname?action=surveysecurity&sid=$surveyid', '_top')\""
. " title='".$clang->gTview("Survey Security Settings")."'>"
. "<img src='$imagefiles/survey_security.png' name='SurveySecurity' alt='".$clang->gT("Survey Security Settings")."' />"
. "</a>\n";
}
else
{
$surveysummary .= "<img src='$imagefiles/blank.gif' alt='' width='40' />\n";
}
if(bHasRight($surveyid,'edit_survey_property'))
{
$surveysummary .= "<a href=\"#\" onclick=\"window.open('$scriptname?action=editsurveysettings&sid=$surveyid', '_top')\""
. " title=\"".$clang->gTview("Edit survey settings")."\" >"
. "<img src='$imagefiles/token_manage.png' name='EditSurveySettings' alt='".$clang->gT("Edit survey settings")."' /></a>\n";
}
else
{
$surveysummary .= "<img src='$imagefiles/blank.gif' alt='' width='80' />\n";
}
if (count(GetAdditionalLanguagesFromSurveyID($surveyid)) == 0)
{
$surveysummary .= "<a href=\"#\" onclick=\"window.open('$scriptname?action=showprintablesurvey&sid=$surveyid', '_blank')\""
. " title=\"".$clang->gTview("Printable Version of Survey")."\" >"
. "<img src='$imagefiles/print.png' name='ShowPrintableSurvey' alt='".$clang->gT("Printable Version of Survey")."' />";
} else {
$surveysummary .= "<a href=\"#\" onclick=\"document.getElementById('printpopup').style.visibility='visible'; "
. "document.getElementById('langpopup2').style.visibility='hidden';\""
. " title=\"".$clang->gTview("Printable Version of Survey")."\" >"
. "<img src='$imagefiles/print.png' name='ShowPrintableSurvey' alt='".$clang->gT("Printable Version of Survey")."' />\n";
$tmp_survlangs = GetAdditionalLanguagesFromSurveyID($surveyid);
$baselang = GetBaseLanguageFromSurveyID($surveyid);
$tmp_survlangs[] = $baselang;
rsort($tmp_survlangs);
// Test Survey Language Selection Popup
$surveysummary .="<div class=\"langpopup2\" id=\"printpopup\"><table width=\"100%\"><tr><td>".$clang->gT("Please select a language:")."</td></tr>";
foreach ($tmp_survlangs as $tmp_lang)
{
$surveysummary .= "<tr><td><a href=\"#\" accesskey='d' onclick=\"document.getElementById('printpopup').style.visibility='hidden'; window.open('$scriptname?action=showprintablesurvey&sid=$surveyid&lang=".$tmp_lang."', '_blank')\"><font color=\"#097300\"><b>".getLanguageNameFromCode($tmp_lang,false)."</b></font></a></td></tr>";
}
$surveysummary .= "<tr><td align=\"center\"><a href=\"#\" accesskey='d' onclick=\"document.getElementById('printpopup').style.visibility='hidden';\"><font color=\"#DF3030\">".$clang->gT("Cancel")."</font></a></td></tr></table></div>";
$surveysummary .= "<script type='text/javascript'>document.getElementById('printpopup').style.left='152px';</script>\n";
}
$surveysummary .= "</a><img src='$imagefiles/seperator.gif' alt='' />\n";
if(bHasRight($surveyid,'edit_survey_property'))
{
$surveysummary .= "<a href=\"#\" onclick=\"window.open('$scriptname?action=editsurveylocalesettings&sid=$surveyid', '_top')\""
. " title=\"".$clang->gTview("Edit survey properties")."\" >"
. "<img src='$imagefiles/edit.png' name='EditSurveyProperties' alt='".$clang->gT("Edit survey text elements")."' /></a>\n";
}
else
{
$surveysummary .= "<img src='$imagefiles/blank.gif' alt='' width='80' />\n";
}
if (bHasRight($surveyid,'delete_survey'))
{
// $surveysummary .= "<a href=\"#\" onclick=\"window.open('$scriptname?action=deletesurvey&sid=$surveyid', '_top')\""
$surveysummary .= "<a href=\"#\" onclick=\"".get2post("$scriptname?action=deletesurvey&sid=$surveyid")."\""
. " title=\"".$clang->gTview("Delete Current Survey")."\" >"
. "<img src='$imagefiles/delete.png' name='DeleteWholeSurvey' alt='".$clang->gT("Delete Current Survey")."' /></a>\n" ;
}
else
{
$surveysummary .= "<img src='$imagefiles/blank.gif' alt='' width='40' />\n";
}
if (bHasRight($surveyid,'export'))
{
$surveysummary .= "<a href=\"#\" onclick=\"window.open('$scriptname?action=exportstructure&sid=$surveyid', '_top')\""
. " title=\"".$clang->gTview("Export Survey Structure")."\">"
. "<img src='$imagefiles/export.png' alt='". $clang->gT("Export Survey Structure")."' name='ExportSurvey' />"
. "</a>\n" ;
}
else
{
$surveysummary .= "<img src='$imagefiles/blank.gif' alt='' width='40' />";
}
if ($activated == "Y" && bHasRight($surveyid,'browse_response'))
{
$surveysummary .= "<a href=\"#\" onclick=\"window.open('$scriptname?action=browse&sid=$surveyid', '_top')\""
. " title=\"".$clang->gTview("Browse Responses For This Survey")."\" >"
. "<img src='$imagefiles/browse.png' name='BrowseSurveyResults' alt='".$clang->gT("Browse Responses For This Survey")."' /></a>\n";
if ($surveyinfo['allowsave'] == "Y")
{
$surveysummary .= "<a href=\"#\" onclick=\"window.open('$scriptname?action=saved&sid=$surveyid', '_top')\""
. " title=\"".$clang->gTview("View Saved but not submitted Responses")."\" >"
. "<img src='$imagefiles/saved.png' name='BrowseSaved' alt='".$clang->gT("View Saved but not submitted Responses")."' /></a>\n";
}
}
if (bHasRight($surveyid,'export') || bHasRight($surveyid,'activate_survey'))
{
$surveysummary .= "<img src='$imagefiles/seperator.gif' alt='' />\n";
$surveysummary .="<a href=\"#\" onclick=\"window.open('$scriptname?action=tokens&sid=$surveyid', '_top')\""
. " title=\"".$clang->gTview("Token management")."\" >"
. "<img src='$imagefiles/tokens.png' name='TokensControl' alt='".$clang->gT("Token management")."' /></a>\n" ;
}
if($activated!="Y" && bHasRight($surveyid,'define_questions') && getGroupSum($surveyid,$surveyinfo['language'])>1)
{
$surveysummary .= "<img src='$imagefiles/seperator.gif' alt='' />\n";
$surveysummary .= "<a href=\"#\" onclick=\"window.open('$scriptname?action=ordergroups&sid=$surveyid', '_top')\""
. " title=\"".$clang->gTview("Change question group order")."\" >"
. "<img src='$imagefiles/reorder.png' alt='".$clang->gT("Change question group order")."' name='ordergroups' />"
. "</a>\n";
}
// Second toolsbar
$surveysummary .= "</div>\n"
. "<div class='menubar-left'>\n"
. "<img id='surveyhandleright' class='btnsurveybar' alt=\"".$clang->gT("Standard survey options")."\"src='$imagefiles/handle-right.png' />\n"
. "<img id='surveyhandleleft' class='btnsurveybar' alt=\"".$clang->gT("Advanced survey options")."\"src='$imagefiles/handle-left.png' />\n"
."</div>"
. "<div class='menubar-left' id='advancedsurveybar'>\n";
if ($activated == "N" )
{
$surveysummary .= "<img src='$imagefiles/inactive.png' "
. "alt='".$clang->gT("This survey is not currently active")."' />\n";
if($sumcount3>0 && bHasRight($surveyid,'activate_survey'))
{
$surveysummary .= "<a href=\"#\" onclick=\"window.open('$scriptname?action=activate&sid=$surveyid', '_top')\""
. "title=\"".$clang->gTview("Activate this Survey")."\" >"
. "<img src='$imagefiles/activate.png' name='ActivateSurvey' alt='".$clang->gT("Activate this Survey")."'/></a>\n" ;
}
else
{
$surveysummary .= "<img src='$imagefiles/activate_disabled.png' alt='"
. $clang->gT("Survey cannot be activated. Either you have no permission or there are no questions.")."' />\n" ;
}
}
elseif ($activated == "Y")
{
if ($surveyinfo['expires']!='' && ($surveyinfo['expires'] < date_shift(date("Y-m-d H:i:s"), "Y-m-d H:i", $timeadjust)))
{
$surveysummary .= "<img src='$imagefiles/expired.png' "
. "alt='".$clang->gT("This survey is active but expired.")."' />\n";
}
elseif (($surveyinfo['startdate']!='') && ($surveyinfo['startdate'] > date_shift(date("Y-m-d H:i:s"), "Y-m-d H:i", $timeadjust)))
{
$surveysummary .= "<img src='$imagefiles/notyetstarted.png' "
. "alt='".$clang->gT("This survey is active but has a start date.")."' />\n";
}
else
{
$surveysummary .= "<img src='$imagefiles/active.png' title='' "
. "alt='".$clang->gT("This survey is currently active")."' />\n";
}
if(bHasRight($surveyid,'activate_survey'))
{
$surveysummary .= "<a href=\"#\" onclick=\"window.open('$scriptname?action=deactivate&sid=$surveyid', '_top')\""
. "title=\"".$clang->gTview("Deactivate this Survey")."\" >"
. "<img src='$imagefiles/deactivate.png' alt='".$clang->gT("Deactivate this Survey")."' /></a>\n" ;
}
else
{
$surveysummary .= "<img src='$imagefiles/blank.gif' alt='' width='14' />\n";
}
}
$surveysummary .= "<img src='$imagefiles/seperator.gif' alt='' />\n";
// survey rights
if ($activated == "N")
{
$icontext=$clang->gT("Test This Survey");
$icontext2=$clang->gTview("Test This Survey");
} else
{
$icontext=$clang->gT("Execute This Survey");
$icontext2=$clang->gTview("Execute This Survey");
}
$baselang = GetBaseLanguageFromSurveyID($surveyid);
if (count(GetAdditionalLanguagesFromSurveyID($surveyid)) == 0)
{
$surveysummary .= "<a href=\"#\" accesskey='d' onclick=\"window.open('"
. $publicurl."/index.php?sid=$surveyid&newtest=Y&lang=$baselang', '_blank')\" title=\"".$icontext2."\" >"
. "<img src='$imagefiles/do.png' name='DoSurvey2' alt='$icontext' />"
. "</a>\n";
} else {
$surveysummary .= "<a href=\"#\" onclick=\"$('#printpopup').css('visibility','hidden'); $('#langpopup2').css('visibility','visible');\" "
. "title=\"".$icontext2."\" accesskey='d'>"
. "<img src='$imagefiles/do.png' name='DoSurvey2' alt='$icontext' />"
. "</a>\n";
$tmp_survlangs = GetAdditionalLanguagesFromSurveyID($surveyid);
$tmp_survlangs[] = $baselang;
rsort($tmp_survlangs);
// Test Survey Language Selection Popup
$surveysummary .="<div class=\"langpopup2\" id=\"langpopup2\">".$clang->gT("Please select a language:")."<ul>";
foreach ($tmp_survlangs as $tmp_lang)
{
$surveysummary .= "<li><a href=\"#\" accesskey='d' onclick=\"document.getElementById('langpopup2').style.visibility='hidden'; window.open('".$publicurl."/index.php?sid=$surveyid&newtest=Y&lang=".$tmp_lang."', '_blank')\"><font color=\"#097300\"><b>".getLanguageNameFromCode($tmp_lang,false)."</b></font></a></li>";
}
$surveysummary .= "<li class='cancellink'><a href=\"#\" accesskey='d' onclick=\"document.getElementById('langpopup2').style.visibility='hidden';\"><span style='color:#DF3030'>".$clang->gT("Cancel")."</span></a></li>"
."</ul></div>";
}
$surveysummary .= "<img src='$imagefiles/seperator.gif' alt='' />\n";
if($activated == "Y" && bHasRight($surveyid,'browse_response'))
{
$surveysummary .= "<a href=\"#\" onclick=\"window.open('".$homeurl."/".$scriptname."?action=dataentry&sid=$surveyid', '_top')\""
. " title=\"".$clang->gTview("Data entry screen for survey")."\" >"
. "<img src='$imagefiles/dataentry.png' alt='".$clang->gT("Data entry screen for survey")."' name='DoDataentry' />"
. "</a>\n";
}
else if (!bHasRight($surveyid,'browse_response'))
{
$surveysummary .= "<img src='$imagefiles/blank.gif' alt='' width='40' />\n";
} else {
$surveysummary .= "<a href=\"#\" onclick=\"alert('".$clang->gT("This survey is not active, data entry is not allowed","js")."')\""
. " title=\"".$clang->gTview("Data entry screen for survey")."\">"
. "<img src='$imagefiles/dataentry_disabled.png' alt='".$clang->gT("Data entry screen for survey")."' name='DoDataentry' />"
. "</a>\n";
}
if (bHasRight($surveyid,'edit_survey_property'))
{
$surveysummary .= "<a href=\"#\" onclick=\"window.open('$scriptname?action=assessments&sid=$surveyid', '_top')\" "
. "title=\"".$clang->gTview("Set Assessment Rules")."\" >"
. "<img src='$imagefiles/assessments.png' alt='". $clang->gT("Set Assessment Rules")."' name='SurveyAssessment' /></a>\n";
}
else
{
$surveysummary .= "<img src='$imagefiles/blank.gif' alt='' width='40' />\n";
}
if (bHasRight($surveyid,'edit_survey_property'))
{
$surveysummary .= "<a href=\"#\" onclick=\"window.open('$scriptname?action=quotas&sid=$surveyid', '_top')\" "
. "title=\"".$clang->gTview("Set Survey Quotas")."\" >"
. "<img src='$imagefiles/quota.png' alt='". $clang->gT("Set Survey Quotas")."' name='SurveyQuotas' /></a>\n" ;
}
else
{
$surveysummary .= "<img src='$imagefiles/blank.gif' alt='' width='40' />\n";
}
if (bHasRight($surveyid,'define_questions'))
{
if ($sumcount6 > 0) {
$surveysummary .= "<a href=\"#\" onclick=\"".get2post("$scriptname?action=resetsurveylogic&sid=$surveyid")."\" "
. "title=\"".$clang->gTview("Reset Survey Logic")."\" >"
. "<img src='$imagefiles/resetsurveylogic.png' name='ResetSurveyLogic' alt='".$clang->gT("Reset Survey Logic")."' /></a>\n";
}
else
{
$surveysummary .= "<a href=\"#\" onclick=\"alert('".$clang->gT("Currently there are no conditions configured for this survey.", "js")."');\" "
. "title=\"".$clang->gTview("Reset Survey Logic")."\" >"
. "<img src='$imagefiles/resetsurveylogic_disabled.png' name='ResetSurveyLogic' alt='".$clang->gT("Reset Survey Logic")."' />"
. "</a>\n";
}
}
else
{
$surveysummary .= "<img src='$imagefiles/blank.gif' alt='' width='40' />\n";
}
/* if (bHasRight($surveyid,'define_questions'))
{
$surveysummary .= "<a href=\"#\" onclick=\"".get2post("$scriptname?action=quicktranslate&sid=$surveyid")."\" "
. "title=\"".$clang->gTview("Quick-translation")."\" >"
. "<img src='$imagefiles/translate.png' name='QuickTranslation' alt='".$clang->gT("Quick-translation")."' /></a>\n";
}
else
{
$surveysummary .= "<img src='$imagefiles/blank.gif' alt='' width='40' />\n";
}*/
$surveysummary .="</div>"
// End of survey toolbat 2nd page
. "<div class='menubar-right'>\n";
$surveysummary .= "<span class=\"boxcaption\">".$clang->gT("Question groups").":</span>"
. "<select name='groupselect' onchange=\"window.open(this.options[this.selectedIndex].value,'_top')\">\n";
if (getgrouplistlang($gid, $baselang))
{
$surveysummary .= getgrouplistlang($gid, $baselang);
}
else
{
$surveysummary .= "<option>".$clang->gT("None")."</option>\n";
}
$surveysummary .= "</select>\n";
if ($activated == "Y")
{
$surveysummary .= "<img src='$imagefiles/blank.gif' alt='' width='40' />\n";
}
elseif(bHasRight($surveyid,'define_questions'))
{
$surveysummary .= "<a href=\"#\" onclick=\"window.open('$scriptname?action=addgroup&sid=$surveyid', '_top')\""
. " title=\"".$clang->gTview("Add new group to survey")."\">"
. "<img src='$imagefiles/add.png' alt='".$clang->gT("Add new group to survey")."' name='AddNewGroup' /></a>\n";
}
$surveysummary .= "<img src='$imagefiles/seperator.gif' alt='' />\n"
. "<img src='$imagefiles/blank.gif' width='15' alt='' />"
. "<input type='image' src='$imagefiles/minus.gif' title='". $clang->gT("Hide details of this Survey")."' "
. "alt='". $clang->gT("Hide details of this Survey")."' name='MinimiseSurveyWindow' "
. "onclick='document.getElementById(\"surveydetails\").style.display=\"none\";' />\n";
$surveysummary .= "<input type='image' src='$imagefiles/plus.gif' title='". $clang->gT("Show details of this survey")."' "
. "alt='". $clang->gT("Show details of this survey")."' name='MaximiseSurveyWindow' "
. "onclick='document.getElementById(\"surveydetails\").style.display=\"\";' />\n";
if (!$gid)
{
$surveysummary .= "<input type='image' src='$imagefiles/close.gif' title='". $clang->gT("Close this survey")."' "
. "alt='".$clang->gT("Close this survey")."' name='CloseSurveyWindow' "
. "onclick=\"window.open('$scriptname', '_top')\" />\n";
}
else
{
$surveysummary .= "<img src='$imagefiles/blank.gif' width='18' alt='' />\n";
}
$surveysummary .= "</div>\n"
. "</div>\n"
. "</div>\n";
//SURVEY SUMMARY
if ($gid || $qid || $action=="deactivate"|| $action=="activate" || $action=="surveysecurity"
|| $action=="surveyrights" || $action=="addsurveysecurity" || $action=="addusergroupsurveysecurity"
|| $action=="setsurveysecurity" || $action=="setusergroupsurveysecurity" || $action=="delsurveysecurity"
|| $action=="editsurveysettings"|| $action=="editsurveylocalesettings" || $action=="updatesurveysettingsandeditlocalesettings" || $action=="addgroup" || $action=="importgroup"
|| $action=="ordergroups" || $action=="deletesurvey" || $action=="resetsurveylogic"
|| $action=="importsurveyresources"
|| $action=="exportstructure" || $action=="quotas" || $action=="copysurvey") {$showstyle="style='display: none'";}
if (!isset($showstyle)) {$showstyle="";}
$aAdditionalLanguages = GetAdditionalLanguagesFromSurveyID($surveyid);
$surveysummary .= "<table $showstyle id='surveydetails'><tr><td align='right' valign='top' width='15%'>"
. "<strong>".$clang->gT("Title").":</strong></td>\n"
. "<td align='left' class='settingentryhighlight'><strong>{$surveyinfo['surveyls_title']} "
. "(".$clang->gT("ID")." {$surveyinfo['sid']})</strong></td></tr>\n";
$surveysummary2 = "";
if ($surveyinfo['private'] != "N") {$surveysummary2 .= $clang->gT("Answers to this survey are anonymized.")."<br />\n";}
else {$surveysummary2 .= $clang->gT("This survey is NOT anonymous.")."<br />\n";}
if ($surveyinfo['format'] == "S") {$surveysummary2 .= $clang->gT("It is presented question by question.")."<br />\n";}
elseif ($surveyinfo['format'] == "G") {$surveysummary2 .= $clang->gT("It is presented group by group.")."<br />\n";}
else {$surveysummary2 .= $clang->gT("It is presented on one single page.")."<br />\n";}
if ($surveyinfo['datestamp'] == "Y") {$surveysummary2 .= $clang->gT("Responses will be date stamped")."<br />\n";}
if ($surveyinfo['ipaddr'] == "Y") {$surveysummary2 .= $clang->gT("IP Addresses will be logged")."<br />\n";}
if ($surveyinfo['refurl'] == "Y") {$surveysummary2 .= $clang->gT("Referer-URL will be saved")."<br />\n";}
if ($surveyinfo['usecookie'] == "Y") {$surveysummary2 .= $clang->gT("It uses cookies for access control.")."<br />\n";}
if ($surveyinfo['allowregister'] == "Y") {$surveysummary2 .= $clang->gT("If tokens are used, the public may register for this survey")."<br />\n";}
if ($surveyinfo['allowsave'] == "Y") {$surveysummary2 .= $clang->gT("Participants can save partially finished surveys")."<br />\n";}
switch ($surveyinfo['notification'])
{
case 0:
$surveysummary2 .= $clang->gT("No email notification")."<br />\n";
break;
case 1:
$surveysummary2 .= $clang->gT("Basic email notification")."<br />\n";
break;
case 2:
$surveysummary2 .= $clang->gT("Detailed email notification with result codes")."<br />\n";
break;
}
if(bHasRight($surveyid,'edit_survey_property'))
{
$surveysummary2 .= $clang->gT("Regenerate question codes:")
. " [<a href='#' "
. "onclick=\"if (confirm('".$clang->gT("Are you sure you want regenerate the question codes?","js")."')) {".get2post("$scriptname?action=renumberquestions&sid=$surveyid&style=straight")."}\" "
. ">".$clang->gT("Straight")."</a>] "
. " [<a href='#' "
. "onclick=\"if (confirm('".$clang->gT("Are you sure you want regenerate the question codes?","js")."')) {".get2post("$scriptname?action=renumberquestions&sid=$surveyid&style=bygroup")."}\" "
. ">".$clang->gT("By Group")."</a>]";
$surveysummary2 .= "</td></tr>\n";
}
$surveysummary .= "<tr>"
. "<td align='right' valign='top'><strong>"
. $clang->gT("Survey URL") ." (".getLanguageNameFromCode($surveyinfo['language'],false)."):</strong></td>\n";
if ( $modrewrite ) {
$tmp_url = $GLOBALS['publicurl'] . '/' . $surveyinfo['sid'];
$surveysummary .= "<td align='left'> <a href='$tmp_url/lang-".$surveyinfo['language']."' target='_blank'>$tmp_url/lang-".$surveyinfo['language']."</a>";
foreach ($aAdditionalLanguages as $langname)
{
$surveysummary .= " <a href='$tmp_url/lang-$langname' target='_blank'><img title='".$clang->gT("Survey URL for language:")." ".getLanguageNameFromCode($langname,false)."' alt='".getLanguageNameFromCode($langname,false)." ".$clang->gT("Flag")."' src='../images/flags/$langname.png' /></a>";
}
} else {
$tmp_url = $GLOBALS['publicurl'] . '/index.php?sid=' . $surveyinfo['sid'];
$surveysummary .= "<td align='left'> <a href='$tmp_url&lang=".$surveyinfo['language']."' target='_blank'>$tmp_url&lang=".$surveyinfo['language']."</a>";
foreach ($aAdditionalLanguages as $langname)
{
$surveysummary .= " <a href='$tmp_url&lang=$langname' target='_blank'><img title='".$clang->gT("Survey URL for language:")." ".getLanguageNameFromCode($langname,false)."' alt='".getLanguageNameFromCode($langname,false)." ".$clang->gT("Flag")."' src='../images/flags/$langname.png' /></a>";
}
}
$surveysummary .= "</td></tr>\n"
. "<tr><td align='right' valign='top'><strong>"
. $clang->gT("Description:")."</strong></td>\n<td align='left'>";
if (trim($surveyinfo['surveyls_description'])!='') {$surveysummary .= " {$surveyinfo['surveyls_description']}";}
$surveysummary .= "</td></tr>\n"
. "<tr >\n"
. "<td align='right' valign='top'><strong>"
. $clang->gT("Welcome:")."</strong></td>\n"
. "<td align='left'> {$surveyinfo['surveyls_welcometext']}</td></tr>\n"
. "<tr ><td align='right' valign='top'><strong>"
. $clang->gT("Administrator:")."</strong></td>\n"
. "<td align='left'> {$surveyinfo['admin']} ({$surveyinfo['adminemail']})</td></tr>\n"
. "<tr><td align='right' valign='top'><strong>"
. $clang->gT("Fax To:")."</strong></td>\n<td align='left'>";
if (trim($surveyinfo['faxto'])!='') {$surveysummary .= " {$surveyinfo['faxto']}";}
$surveysummary .= "</td></tr>\n"
. "<tr><td align='right' valign='top'><strong>"
. $clang->gT("Start date/time:")."</strong></td>\n";
$dateformatdetails=getDateFormatData($_SESSION['dateformat']);
if (trim($surveyinfo['startdate'])!= '')
{
$datetimeobj = new Date_Time_Converter($surveyinfo['startdate'] , "Y-m-d H:i:s");
$startdate=$datetimeobj->convert($dateformatdetails['phpdate'].' H:i');
}
else
{
$startdate="-";
}
$surveysummary .= "<td align='left'>$startdate</td></tr>\n"
. "<tr><td align='right' valign='top'><strong>"
. $clang->gT("Expiry date/time:")."</strong></td>\n";
if (trim($surveyinfo['expires'])!= '')
{
$datetimeobj = new Date_Time_Converter($surveyinfo['expires'] , "Y-m-d H:i:s");
$expdate=$datetimeobj->convert($dateformatdetails['phpdate'].' H:i');
}
else
{
$expdate="-";
}
$surveysummary .= "<td align='left'>$expdate</td></tr>\n"
. "<tr ><td align='right' valign='top'><strong>"
. $clang->gT("Template:")."</strong></td>\n"
. "<td align='left'> {$surveyinfo['template']}</td></tr>\n"
. "<tr><td align='right' valign='top'><strong>"
. $clang->gT("Base Language:")."</strong></td>\n";
if (!$surveyinfo['language']) {$language=getLanguageNameFromCode($currentadminlang,false);} else {$language=getLanguageNameFromCode($surveyinfo['language'],false);}
$surveysummary .= "<td align='left'>$language</td></tr>\n";
// get the rowspan of the Additionnal languages row
// is at least 1 even if no additionnal language is present
$additionnalLanguagesCount = count($aAdditionalLanguages);
if ($additionnalLanguagesCount == 0) $additionnalLanguagesCount = 1;
$surveysummary .= "<tr><td align='right' valign='top'><strong>"
. $clang->gT("Additional Languages").":</strong></td>\n";
$first=true;
foreach ($aAdditionalLanguages as $langname)
{
if ($langname)
{
if (!$first) {$surveysummary .= "<tr><td> </td>";}
$first=false;
$surveysummary .= "<td align='left'>".getLanguageNameFromCode($langname,false)."</td></tr>\n";
}
}
if ($first) $surveysummary .= "</tr>";
if ($surveyinfo['surveyls_urldescription']==""){$surveyinfo['surveyls_urldescription']=htmlspecialchars($surveyinfo['surveyls_url']);}
$surveysummary .= "<tr><td align='right' valign='top'><strong>"
. $clang->gT("Exit Link").":</strong></td>\n"
. "<td align='left'>";
if ($surveyinfo['surveyls_url']!="") {$surveysummary .=" <a href=\"".htmlspecialchars($surveyinfo['surveyls_url'])."\" title=\"".htmlspecialchars($surveyinfo['surveyls_url'])."\">{$surveyinfo['surveyls_urldescription']}</a>";}
$surveysummary .="</td></tr>\n";
$surveysummary .= "<tr><td align='right' valign='top'><strong>"
. $clang->gT("Number of questions/groups").":</strong></td><td>$sumcount3/$sumcount2</td></tr>\n";
$surveysummary .= "<tr><td align='right' valign='top'><strong>"
. $clang->gT("Survey currently active").":</strong></td><td>";
if ($activated == "N")
{
$surveysummary .= $clang->gT("No");
}
else
{
$surveysummary .= $clang->gT("Yes");
}
$surveysummary .="</td></tr>\n";
if ($activated == "Y")
{
$surveysummary .= "<tr><td align='right' valign='top'><strong>"
. $clang->gT("Survey table name").":</strong></td><td>".$dbprefix."survey_$surveyid</td></tr>\n";
}
$surveysummary .= "<tr><td align='right' valign='top'><strong>"
. $clang->gT("Hints").":</strong></td><td>\n";
if ($activated == "N" && $sumcount3 == 0)
{
$surveysummary .= $clang->gT("Survey cannot be activated yet.")."<br />\n";
if ($sumcount2 == 0 && bHasRight($surveyid,'define_questions'))
{
$surveysummary .= "<span class='statusentryhighlight'>[".$clang->gT("You need to add question groups")."]</span><br />";
}
if ($sumcount3 == 0 && bHasRight($surveyid,'define_questions'))
{
$surveysummary .= "<span class='statusentryhighlight'>[".$clang->gT("You need to add questions")."]</span><br />";
}
}
$surveysummary .= $surveysummary2
. "</table>\n";
}
else
{
include("access_denied.php");
}
}
if (isset($surveyid) && $surveyid && $gid ) // Show the group toolbar
{
// TODO: check that surveyid and thus baselang are always set here
$sumquery4 = "SELECT * FROM ".db_table_name('questions')." WHERE sid=$surveyid AND
gid=$gid AND language='".$baselang."'"; //Getting a count of questions for this survey
$sumresult4 = $connect->Execute($sumquery4); //Checked
$sumcount4 = $sumresult4->RecordCount();
$grpquery ="SELECT * FROM ".db_table_name('groups')." WHERE gid=$gid AND
language='".$baselang."' ORDER BY ".db_table_name('groups').".group_order";
$grpresult = db_execute_assoc($grpquery); //Checked
// Check if other questions/groups are dependent upon this group
$condarray=GetGroupDepsForConditions($surveyid,"all",$gid,"by-targgid");
$groupsummary = "<div class='menubar'>\n"
. "<div class='menubar-title'>\n";
while ($grow = $grpresult->FetchRow())
{
$grow = array_map('FlattenText', $grow);
//$grow = array_map('htmlspecialchars', $grow);
$groupsummary .= '<strong>'.$clang->gT("Question group").'</strong> '
. "<span class='basic'>{$grow['group_name']} (".$clang->gT("ID").":$gid)</span>\n"
. "</div>\n"
. "<div class='menubar-main'>\n"
. "<div class='menubar-left'>\n"
. "<img src='$imagefiles/blank.gif' alt='' width='54' height='20' />\n"
. "<img src='$imagefiles/seperator.gif' alt='' />"
. "<img src='$imagefiles/blank.gif' alt='' width='180' height='20' />"
. "<img src='$imagefiles/seperator.gif' alt='' />\n";
if(bHasRight($surveyid,'define_questions'))
{
$groupsummary .= "<a href=\"#\" onclick=\"window.open('$scriptname?action=editgroup&sid=$surveyid&gid=$gid','_top')\""
. " title=\"".$clang->gTview("Edit current question group")."\">"
. "<img src='$imagefiles/edit.png' alt='".$clang->gT("Edit current question group")."' name='EditGroup' /></a>\n" ;
}
else
{
$groupsummary .= "<img src='$imagefiles/blank.gif' alt='' width='40' />\n";
}