1<?php
2/**
3 * This subview render the javaScript variables for subQuestion_view and answerOptions_view
4 * @var $jsVariableType  Define which type of javascript variables should be render
5 */
6
7
8$scriptVariables = "
9    // Common variables between subquestions / answers options
10    var cancel                  = '".gT('Cancel')."';
11    var check                   = true;
12    var lafail                  = '".gT('Sorry, the request failed!')."';
13    var lanameurl               = '".Yii::app()->createUrl('/admin/labels/sa/getAllSets')."';
14    var langs                   = '".implode(';',$anslangs)."';
15    var languagecount           =  ".count($anslangs).";
16    var lasaveurl               = '".Yii::app()->createUrl('/admin/labels/sa/ajaxSets')."';
17    var lasuccess               = '".gT('The records have been saved successfully!')."';
18    var lsbrowsertitle          = '".gT('Label set browser','js')."';
19    var lsdetailurl             = '".Yii::app()->createUrl('/admin/questions/sa/ajaxlabelsetdetails')."';
20    var lspickurl               = '".Yii::app()->createUrl('/admin/questions/sa/ajaxlabelsetpicker')."';
21    var ok                      = '".gT('OK')."';
22    var saveaslabletitle        = '".gT('Save as label set','js')."';
23    var sCheckLabelURL          = '".Yii::app()->createUrl('/admin/questions/sa/ajaxchecklabel')."';
24    var sImageURL               = '".Yii::app()->getConfig('adminimageurl')."';
25    var sLabelSetName           = '".gT('Label set name','js')."';
26    var strcode                 = '".gT('Code','js')."';
27    var strlabel                = '".gT('Label','js')."';
28    var strNoLabelSet           = '".gT('There are no label sets which match the survey default language','js')."';
29";
30if ($viewType=='subQuestions') {
31    $scriptVariables .= "
32        // variables with different values in subqestions / answer options
33        var newansweroption_text     = '".gT('New answer option','js')."';
34        var quickaddtitle            = '".gT('Quick-add answers','js')."';
35        var strCantDeleteLastAnswer  = '".gT('You cannot delete the last answer option.','js')."';
36        var duplicatesubquestioncode = '".gT('Error: You are trying to use duplicate subquestion codes.','js')."';
37        var clickToExpand            = '".gT('Click to expand')."';
38    ";
39} elseif($viewType=='answerOptions') {
40    $scriptVariables .= "
41        // variables with different values in subqestions / answer options
42        var newansweroption_text    = '".gT('New answer option','js')."';
43        var quickaddtitle           = '".gT('Quick-add answers','js')."';
44        var strCantDeleteLastAnswer = '".gT('You cannot delete the last answer option.','js')."';
45
46        // answer options variables
47        var assessmentvisible       =  ".( $assessmentvisible ? 'true' : 'false' ).";
48        var duplicateanswercode     = '".gT('Error: You are trying to use duplicate answer codes.','js')."';
49        var sAssessmentValue        = '".gT('Assessment value','js')."';
50        var scalecount              =  ".$scalecount.";
51
52    ";
53}
54
55Yii::app()->getClientScript()->registerCssFile( Yii::app()->getConfig('publicstyleurl').'subquestionandansweroptions.css');
56Yii::app()->getClientScript()->registerScript('SubquestionandAnswers-variables',  $scriptVariables, LSYii_ClientScript::POS_BEGIN );
57
58echo PrepareEditorScript(true, $this);
59