/
publicSurveyList.php
78 lines (72 loc) · 3.78 KB
/
publicSurveyList.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
<?php
$list = '';
foreach($publicSurveys as $survey)
{
$list .= CHtml::openTag('li');
$list .= CHtml::link($survey->localizedTitle, array('survey/index', 'sid' => $survey->sid, 'lang' => App()->language), array('class' => 'surveytitle'));
if ($survey->publicstatistics == "Y")
{
$list .= CHtml::link('(' . gT('View statistics') . ')', array('statistics_user/action', 'surveyid' => $survey->sid,'language' => App()->language));
}
$list .= CHtml::closeTag('li');
}
if (!empty($futureSurveys))
{
$list .= "</ul><div class=\"survey-list-heading\">". gT("Following survey(s) are not yet active but you can register for them.")."</div><ul>";
foreach($futureSurveys as $survey)
{
$list .= CHtml::openTag('li');
$list .= CHtml::link($survey->localizedTitle, array('survey/index', 'sid' => $survey->sid, 'lang' => App()->language), array('class' => 'surveytitle'));
$list .= CHtml::closeTag('li');
$list .= CHtml::tag('div', array(
'data-regformsurvey' => $survey->sid,
));
}
}
if(empty($list))
{
$list=CHtml::openTag('li',array('class'=>'surveytitle')).gT("No available surveys").CHtml::closeTag('li');
}
$data['surveylist'] = array(
"nosid"=> "",
"contact"=> sprintf(gT("Please contact %s ( %s ) for further assistance."),
Yii::app()->getConfig("siteadminname"),
encodeEmail(Yii::app()->getConfig("siteadminemail"))
),
"listheading"=> gT("The following surveys are available:"),
"list"=> $list,
);
$data['templatedir'] = getTemplatePath(Yii::app()->getConfig("defaulttemplate"));
$data['templateurl'] = getTemplateURL(Yii::app()->getConfig("defaulttemplate"))."/";
$data['templatename'] = Yii::app()->getConfig("defaulttemplate");
$data['sitename'] = Yii::app()->getConfig("sitename");
$data['languagechanger'] = makeLanguageChanger(App()->language);
//A nice exit
sendCacheHeaders();
doHeader();
// Javascript Var
$aLSJavascriptVar=array();
$aLSJavascriptVar['bFixNumAuto']=(int)(bool)Yii::app()->getConfig('bFixNumAuto',1);
$aLSJavascriptVar['bNumRealValue']=(int)(bool)Yii::app()->getConfig('bNumRealValue',0);
if(isset($thissurvey['surveyls_numberformat']))
{
$radix=getRadixPointData($thissurvey['surveyls_numberformat']);
}
else
{
$aLangData=getLanguageData();
$radix=getRadixPointData($aLangData[ Yii::app()->getConfig('defaultlang')]['radixpoint']);// or App()->language . defaultlang ensure it's same for each language ?
}
$aLSJavascriptVar['sLEMradix']=$radix['separator'];
$sLSJavascriptVar="LSvar=".json_encode($aLSJavascriptVar);
App()->clientScript->registerScript('sLSJavascriptVar',$sLSJavascriptVar,CClientScript::POS_HEAD);
App()->clientScript->registerScript('setJsVar',"setJsVar();",CClientScript::POS_BEGIN);// Ensure all js var is set before rendering the page (User can click before $.ready)
App()->getClientScript()->registerPackage('jqueryui');
App()->getClientScript()->registerPackage('jquery-touch-punch');
App()->getClientScript()->registerScriptFile(Yii::app()->getConfig('generalscripts')."survey_runtime.js");
useFirebug();
echo templatereplace(file_get_contents(getTemplatePath(Yii::app()->getConfig("defaulttemplate"))."/startpage.pstpl"),array(),$data,'survey['.__LINE__.']');
echo templatereplace(file_get_contents(getTemplatePath(Yii::app()->getConfig("defaulttemplate"))."/surveylist.pstpl"),array(),$data,'survey['.__LINE__.']');
echo templatereplace(file_get_contents(getTemplatePath(Yii::app()->getConfig("defaulttemplate"))."/endpage.pstpl"),array(),$data,'survey['.__LINE__.']');
doFooter();
?>