当前位置: 首页>>代码示例>>PHP>>正文


PHP getLanguageData函数代码示例

本文整理汇总了PHP中getLanguageData函数的典型用法代码示例。如果您正苦于以下问题:PHP getLanguageData函数的具体用法?PHP getLanguageData怎么用?PHP getLanguageData使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了getLanguageData函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run

 public function run()
 {
     /*
      * Instead of manually rendering scripts after this function returns we
      * use the callback. This ensures that scripts are always rendered, even
      * if we call exit at some point in the code. (Which we shouldn't, but
      * it happens.)
      */
     // Ensure to set some var, but script are replaced in SurveyRuntimeHelper
     $aLSJavascriptVar = array();
     $aLSJavascriptVar['bFixNumAuto'] = (int) (bool) Yii::app()->getConfig('bFixNumAuto', 1);
     $aLSJavascriptVar['bNumRealValue'] = (int) (bool) Yii::app()->getConfig('bNumRealValue', 0);
     $aLangData = getLanguageData();
     $aRadix = getRadixPointData($aLangData[Yii::app()->getConfig('defaultlang')]['radixpoint']);
     $aLSJavascriptVar['sLEMradix'] = $aRadix['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();
     ob_start(function ($buffer, $phase) {
         App()->getClientScript()->render($buffer);
         App()->getClientScript()->reset();
         return $buffer;
     });
     ob_implicit_flush(false);
     $this->action();
     ob_flush();
 }
开发者ID:rouben,项目名称:LimeSurvey,代码行数:32,代码来源:index.php

示例2: getInstance

 /**
  * Converts a locale ID to its canonical form.
  * In canonical form, a locale ID consists of only underscores and lower-case letters.
  * @param string $id the locale ID to be converted
  * @return string the locale ID in canonical form
  */
 public static function getInstance($id)
 {
     // Fix up the LimeSurvey language code for Yii
     $aLanguageData = getLanguageData();
     if (isset($aLanguageData[$id]['cldr'])) {
         $id = $aLanguageData[$id]['cldr'];
     }
     static $locales = array();
     if (isset($locales[$id])) {
         return $locales[$id];
     } else {
         return $locales[$id] = new CLocale($id);
     }
 }
开发者ID:wrenchpilot,项目名称:LimeSurvey,代码行数:20,代码来源:LSYii_Locale.php

示例3: run

 public function run()
 {
     /*
      * Instead of manually rendering scripts after this function returns we
      * use the callback. This ensures that scripts are always rendered, even
      * if we call exit at some point in the code. (Which we shouldn't, but
      * it happens.)
      */
     // Ensure to set some var, but script are replaced in SurveyRuntimeHelper
     $aLSJavascriptVar = array();
     $aLSJavascriptVar['bFixNumAuto'] = (int) (bool) Yii::app()->getConfig('bFixNumAuto', 1);
     $aLSJavascriptVar['bNumRealValue'] = (int) (bool) Yii::app()->getConfig('bNumRealValue', 0);
     $aLangData = getLanguageData();
     $aRadix = getRadixPointData($aLangData[Yii::app()->getConfig('defaultlang')]['radixpoint']);
     $aLSJavascriptVar['sLEMradix'] = $aRadix['separator'];
     $sLSJavascriptVar = "LSvar=" . json_encode($aLSJavascriptVar) . ';';
     // Template configuration
     $param = $this->_getParameters(func_get_args(), $_POST);
     $surveyid = $param['sid'];
     // Font awesome
     if (!YII_DEBUG) {
         App()->getClientScript()->registerCssFile(App()->getAssetManager()->publish(dirname(Yii::app()->request->scriptFile) . '/styles-public/font-awesome-43.min.css'));
     } else {
         App()->getClientScript()->registerCssFile(Yii::app()->getBaseUrl(true) . '/styles-public/font-awesome-43-debugmode.min.css');
     }
     global $oTemplate;
     $oTemplate = Template::model()->getTemplateConfiguration('', $surveyid);
     $this->oTemplate = $oTemplate;
     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)
     foreach ($oTemplate->packages as $package) {
         App()->getClientScript()->registerPackage($package);
     }
     App()->getClientScript()->registerScriptFile(Yii::app()->getConfig('generalscripts') . "survey_runtime.js");
     if ($oTemplate->cssFramework == 'bootstrap') {
         App()->bootstrap->register();
     }
     useFirebug();
     ob_start(function ($buffer, $phase) {
         App()->getClientScript()->render($buffer);
         App()->getClientScript()->reset();
         return $buffer;
     });
     ob_implicit_flush(false);
     $this->action();
     ob_flush();
 }
开发者ID:kochichi,项目名称:LimeSurvey,代码行数:48,代码来源:index.php

示例4: run

 public function run()
 {
     /*
      * Instead of manually rendering scripts after this function returns we
      * use the callback. This ensures that scripts are always rendered, even
      * if we call exit at some point in the code. (Which we shouldn't, but
      * it happens.)
      */
     // Ensure to set some var, but script are replaced in SurveyRuntimeHelper
     $aLSJavascriptVar = array();
     $aLSJavascriptVar['bFixNumAuto'] = (int) (bool) Yii::app()->getConfig('bFixNumAuto', 1);
     $aLSJavascriptVar['bNumRealValue'] = (int) (bool) Yii::app()->getConfig('bNumRealValue', 0);
     $aLangData = getLanguageData();
     $aRadix = getRadixPointData($aLangData[Yii::app()->getConfig('defaultlang')]['radixpoint']);
     $aLSJavascriptVar['sLEMradix'] = $aRadix['separator'];
     $sLSJavascriptVar = "LSvar=" . json_encode($aLSJavascriptVar) . ';';
     // Template configuration
     $param = $this->_getParameters(func_get_args(), $_POST);
     $surveyid = $param['sid'];
     $oTemplate = Template::model()->getInstance('', $surveyid);
     $this->oTemplate = $oTemplate;
     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)
     foreach ($oTemplate->packages as $package) {
         App()->getClientScript()->registerPackage((string) $package);
     }
     App()->getClientScript()->registerScriptFile(Yii::app()->getConfig('generalscripts') . "survey_runtime.js");
     if ($oTemplate->cssFramework == 'bootstrap') {
         // We now use the bootstrap package isntead of the Yiistrap TbApi::register() method
         // Then instead of using the composer dependency system for templates
         // We can use the package dependency system
         Yii::app()->getClientScript()->registerMetaTag('width=device-width, initial-scale=1.0', 'viewport');
         App()->bootstrap->registerAllScripts();
     }
     useFirebug();
     ob_start(function ($buffer, $phase) {
         App()->getClientScript()->render($buffer);
         App()->getClientScript()->reset();
         return $buffer;
     });
     ob_implicit_flush(false);
     $this->action();
     ob_flush();
 }
开发者ID:mfavetti,项目名称:LimeSurvey,代码行数:45,代码来源:index.php

示例5: makeLanguageChangerSurvey

/**
 * This function creates the language selector for a particular survey
 *
 * @param mixed $sSelectedLanguage The language in which all information is shown
 */
function makeLanguageChangerSurvey($sSelectedLanguage)
{
    $surveyid = Yii::app()->getConfig('surveyID');
    Yii::app()->loadHelper("surveytranslator");
    $slangs = Survey::model()->findByPk($surveyid)->getAdditionalLanguages();
    $slangs[] = GetBaseLanguageFromSurveyID($surveyid);
    $aAllLanguages = getLanguageData();
    $slangs = array_keys(array_intersect_key($aAllLanguages, array_flip($slangs)));
    // Sort languages by their locale name
    if (count($slangs) > 1) {
        $route = "/survey/index/sid/{$surveyid}";
        if (Yii::app()->request->getParam('action', 'none') == 'previewgroup' && intval(Yii::app()->request->getParam('gid', 0))) {
            $route .= "/action/previewgroup/gid/" . intval(Yii::app()->request->getParam('gid', 0));
        }
        if (Yii::app()->request->getParam('token') != '') {
            $route .= "/token/" . Yii::app()->request->getParam('token');
        }
        $sHTMLCode = "<select id='languagechanger' name='languagechanger' class='languagechanger' onchange='javascript:window.location=this.value'>\n";
        foreach ($slangs as $sLanguage) {
            $sTargetURL = Yii::app()->getController()->createUrl($route . "/lang/{$sLanguage}");
            $sHTMLCode .= "<option value=\"{$sTargetURL}\" ";
            if ($sLanguage == $sSelectedLanguage) {
                $sHTMLCode .= " selected='selected'";
            }
            $sHTMLCode .= ">" . $aAllLanguages[$sLanguage]['nativedescription'] . "</option>\n";
        }
        $sHTMLCode .= "</select>\n";
        return $sHTMLCode;
    } else {
        return false;
    }
}
开发者ID:pmaonline,项目名称:limesurvey-quickstart,代码行数:37,代码来源:frontend_helper.php

示例6: makeLanguageChangerSurvey

/**
* This function creates the language selector for a particular survey
*
* @param mixed $sSelectedLanguage The language in which all information is shown
*/
function makeLanguageChangerSurvey($sSelectedLanguage)
{
    $surveyid = Yii::app()->getConfig('surveyID');
    $clang = Yii::app()->lang;
    Yii::app()->loadHelper("surveytranslator");
    $aSurveyLangs = Survey::model()->findByPk($surveyid)->getAllLanguages();
    if (count($aSurveyLangs) > 1) {
        $aAllLanguages = getLanguageData(true);
        $aSurveyLangs = array_intersect_key($aAllLanguages, array_flip($aSurveyLangs));
        // Sort languages by their locale name
        $sClass = "languagechanger";
        $sHTMLCode = "";
        $sAction = Yii::app()->request->getParam('action', '');
        // Different behaviour if preview
        $sSelected = "";
        if (substr($sAction, 0, 7) == 'preview') {
            $route = "/survey/index/sid/{$surveyid}";
            if ($sAction == 'previewgroup' && intval(Yii::app()->request->getParam('gid', 0))) {
                $route .= "/action/previewgroup/gid/" . intval(Yii::app()->request->getParam('gid', 0));
            }
            if ($sAction == 'previewquestion' && intval(Yii::app()->request->getParam('gid', 0)) && intval(Yii::app()->request->getParam('qid', 0))) {
                $route .= "/action/previewquestion/gid/" . intval(Yii::app()->request->getParam('gid', 0)) . "/qid/" . intval(Yii::app()->request->getParam('qid', 0));
            }
            if (!is_null(Yii::app()->request->getParam('token'))) {
                $route .= "/token/" . Yii::app()->request->getParam('token');
            }
            $sClass .= " previewmode";
            // Maybe add other param (for prefilling by URL): then need a real createUrl with array
            #            foreach ($aSurveyLangs as $sLangCode => $aSurveyLang)
            #            {
            #                $sTargetURL=Yii::app()->getController()->createUrl($route."/lang/$sLangCode");
            #                $aListLang[$sTargetURL]=html_entity_decode($aSurveyLang['nativedescription'], ENT_COMPAT,'UTF-8');
            #                if($clang->langcode==$sLangCode)
            #                    $sSelected=$sTargetURL;
            #            }
        } else {
            $route = "/survey/index/sid/{$surveyid}";
        }
        $sTargetURL = Yii::app()->getController()->createUrl($route);
        foreach ($aSurveyLangs as $sLangCode => $aSurveyLang) {
            $aListLang[$sLangCode] = html_entity_decode($aSurveyLang['nativedescription'], ENT_COMPAT, 'UTF-8');
        }
        $sSelected = $clang->langcode;
        $sHTMLCode = CHtml::label($clang->gT("Choose another language"), 'lang', array('class' => 'hide label'));
        $sHTMLCode .= CHtml::dropDownList('lang', $sSelected, $aListLang, array('class' => $sClass, 'data-targeturl' => $sTargetURL));
        // We don't have to add this button if in previewmode
        $sHTMLCode .= CHtml::htmlButton($clang->gT("Change the language"), array('type' => 'submit', 'id' => "changelangbtn", 'value' => 'changelang', 'name' => 'changelang', 'class' => 'changelang jshide'));
        return $sHTMLCode;
    } else {
        return false;
    }
}
开发者ID:elcharlygraf,项目名称:Encuesta-YiiFramework,代码行数:57,代码来源:frontend_helper.php

示例7: Array

?>
";
    var attname = "<?php 
$clang->eT("Attribute name:");
?>
";
    removeitem = new Array(); // Array to hold values that are to be removed from langauges option
</script>
<div class='header ui-widget-header'><strong><?php 
$clang->eT("Attribute settings");
?>
</strong></div><br/>
<?php 
$options = array();
$options[''] = $clang->gT('Select...');
foreach (getLanguageData(false, Yii::app()->session['adminlang']) as $langkey2 => $langname) {
    $options[$langkey2] = $langname['description'];
}
echo CHtml::beginForm(Yii::app()->getController()->createUrl('admin/participants/sa/saveAttribute/aid/' . Yii::app()->request->getQuery('aid')) . '/', "post");
?>
<div class='commonsettings'>
    <br/>
    <table width='400px'>
        <tr>
            <th colspan='2'>
                <label for='atttype' id='atttype'>
                    <?php 
$clang->eT('Attribute type:');
?>
                 </label>
            </th>
开发者ID:pmaonline,项目名称:limesurvey-quickstart,代码行数:31,代码来源:viewAttribute_view.php

示例8: makeLanguageChangerSurvey

/**
* This function creates the language selector for a particular survey
*
* @param mixed $sSelectedLanguage The language in which all information is shown
*/
function makeLanguageChangerSurvey($sSelectedLanguage)
{
    $surveyid = Yii::app()->getConfig('surveyID');
    Yii::app()->loadHelper("surveytranslator");
    $aSurveyLangs = Survey::model()->findByPk($surveyid)->getAllLanguages();
    if (count($aSurveyLangs) > 1) {
        $aAllLanguages = getLanguageData(true);
        $aSurveyLangs = array_intersect_key($aAllLanguages, array_flip($aSurveyLangs));
        // Sort languages by their locale name
        $sClass = "languagechanger";
        $sHTMLCode = "";
        $sAction = Yii::app()->request->getParam('action', '');
        // Different behaviour if preview
        $sSelected = "";
        if (substr($sAction, 0, 7) == 'preview') {
            $route = "/survey/index/sid/{$surveyid}";
            if ($sAction == 'previewgroup' && intval(Yii::app()->request->getParam('gid', 0))) {
                $route .= "/action/previewgroup/gid/" . intval(Yii::app()->request->getParam('gid', 0));
            }
            if ($sAction == 'previewquestion' && intval(Yii::app()->request->getParam('gid', 0)) && intval(Yii::app()->request->getParam('qid', 0))) {
                $route .= "/action/previewquestion/gid/" . intval(Yii::app()->request->getParam('gid', 0)) . "/qid/" . intval(Yii::app()->request->getParam('qid', 0));
            }
            if (!is_null(Yii::app()->request->getParam('token'))) {
                $route .= "/token/" . Yii::app()->request->getParam('token');
            }
            $sClass .= " previewmode";
            // Maybe add other param (for prefilling by URL): then need a real createUrl with array
            #            foreach ($aSurveyLangs as $sLangCode => $aSurveyLang)
            #            {
            #                $sTargetURL=Yii::app()->getController()->createUrl($route."/lang/$sLangCode");
            #                $aListLang[$sTargetURL]=html_entity_decode($aSurveyLang['nativedescription'], ENT_COMPAT,'UTF-8');
            #                if(App()->language==$sLangCode)
            #                    $sSelected=$sTargetURL;
            #            }
        } else {
            $route = "/survey/index/sid/{$surveyid}";
        }
        $sTargetURL = Yii::app()->getController()->createUrl($route);
        foreach ($aSurveyLangs as $sLangCode => $aSurveyLang) {
            $aListLang[$sLangCode] = html_entity_decode($aSurveyLang['nativedescription'], ENT_COMPAT, 'UTF-8');
        }
        $sSelected = App()->language;
        $sClass .= ' form-control ';
        $languageChangerDatas = array('sSelected' => $sSelected, 'aListLang' => $aListLang, 'sClass' => $sClass, 'sTargetURL' => $sTargetURL);
        $sHTMLCode = Yii::app()->getController()->renderPartial('/survey/system/LanguageChanger/LanguageChanger', $languageChangerDatas, true);
        return $sHTMLCode;
    } else {
        return false;
    }
}
开发者ID:joaocc,项目名称:LimeSurvey--LimeSurvey,代码行数:55,代码来源:frontend_helper.php

示例9: foreach

if (Yii::app()->getConfig("userideditable") == 'Y') {
    $uid = '{ "name":"owner_uid", "index":"owner_uid", "width":150, "sorttype":"int", "sortable": true, "align":"center", "editable":true, "edittype":"select", "editoptions":{ "value":"';
    $i = 0;
    foreach ($names as $row) {
        $name[$i] = $row->uid . ":" . $row->full_name;
        $i++;
    }
    $unames = implode(";", $name) . '"}}';
    $uidNames[] = $uid . $unames;
} else {
    $uidNames[] = '{ "name":"owner_uid", "index":"owner_uid", "width":150, "sorttype":"int", "sortable": true, "align":"center", "editable":false}';
}
/* Build the options for additional languages */
$j = 1;
$lang = '{ "name":"language", "index":"language", "sorttype":"string", "sortable": true, "align":"center", "editable":true, "formatter":"select", "edittype":"select", "editoptions":{ "value":"';
$getlangvalues = getLanguageData(false, Yii::app()->session['adminlang']);
if (Yii::app()->session['adminlang'] != 'auto') {
    $lname[0] = Yii::app()->session['adminlang'] . ":" . $getlangvalues[Yii::app()->session['adminlang']]['description'];
}
foreach ($getlangvalues as $keycode => $keydesc) {
    if (Yii::app()->session['adminlang'] != $keycode) {
        $cleanlangdesc = str_replace(";", " -", $keydesc['description']);
        $lname[$j] = $keycode . ":" . $cleanlangdesc;
        $j++;
    }
}
$langnames = implode(";", $lname) . '"}}';
$langNames[] = $lang . $langnames;
/* Build the columnNames for the extra attributes */
/* and, build the columnModel */
$autowidth = 'true';
开发者ID:wrenchpilot,项目名称:LimeSurvey,代码行数:31,代码来源:displayParticipants_view.php

示例10: writeSortedCsvFiles

function writeSortedCsvFiles($directory, $csvData)
{
    foreach ($csvData as $file => $data) {
        ksort($data);
        $csvData = array_combine(array_keys($data), array_values($data));
        $fh = fopen($directory . '/' . $file, 'w');
        if (!$fh) {
            printf("Can't open file '%s' for writing, aborting\n", $directory . '/' . $file);
            exit;
        }
        // Sadly, we can't use fputcsv because it doesn't always enclose rows
        foreach ($csvData as $string => $translation) {
            $csvString = '"' . str_replace('"', '""', $string) . '","' . str_replace('"', '""', $translation) . '"' . "\n";
            fputs($fh, $csvString);
        }
        fclose($fh);
    }
}
if (!is_dir($_SERVER['argv'][1])) {
    printf("Source directory '%s' doesn't exist\n", $_SERVER['argv'][1]);
    exit;
}
if (!is_dir($_SERVER['argv'][2])) {
    printf("Target directory '%s' doesn't exist\n", $_SERVER['argv'][2]);
    exit;
}
$sourceLanguageData = getLanguageData($_SERVER['argv'][1]);
$targetLanguageData = getLanguageData($_SERVER['argv'][2]);
$mergedLanguageData = mergeLanguageData($sourceLanguageData, $targetLanguageData);
writeSortedCsvFiles($_SERVER['argv'][2], $mergedLanguageData);
echo "Done!\n";
开发者ID:LybeAB,项目名称:magento-sv_SE,代码行数:31,代码来源:diffAndSort.php

示例11: fix_FCKeditor_text

                // Fix bug with FCKEditor saving strange BR types
                $_POST['short_title_' . $langname] = fix_FCKeditor_text($_POST['short_title_' . $langname]);
                $_POST['description_' . $langname] = fix_FCKeditor_text($_POST['description_' . $langname]);
                $_POST['welcome_' . $langname] = fix_FCKeditor_text($_POST['welcome_' . $langname]);
                $_POST['endtext_' . $langname] = fix_FCKeditor_text($_POST['endtext_' . $langname]);
                $usquery = "UPDATE " . db_table_name('surveys_languagesettings') . " \n" . "SET surveyls_title='" . db_quote($_POST['short_title_' . $langname]) . "', surveyls_description='" . db_quote($_POST['description_' . $langname]) . "',\n" . "surveyls_welcometext='" . db_quote($_POST['welcome_' . $langname]) . "',\n" . "surveyls_endtext='" . db_quote($_POST['endtext_' . $langname]) . "',\n" . "surveyls_url='" . db_quote($_POST['url_' . $langname]) . "',\n" . "surveyls_urldescription='" . db_quote($_POST['urldescrip_' . $langname]) . "',\n" . "surveyls_dateformat='" . db_quote($_POST['dateformat_' . $langname]) . "',\n" . "surveyls_numberformat='" . db_quote($_POST['numberformat_' . $langname]) . "'\n" . "WHERE surveyls_survey_id=" . $postsid . " and surveyls_language='" . $langname . "'";
                $usresult = $connect->Execute($usquery) or safe_die("Error updating<br />" . $usquery . "<br /><br /><strong>" . $connect->ErrorMsg());
                // Checked
            }
        }
        $_SESSION['flashmessage'] = $clang->gT("Survey text elements successfully saved.");
    }
} elseif ($action == "insertsurvey" && $_SESSION['USER_RIGHT_CREATE_SURVEY']) {
    $dateformatdetails = getDateFormatData($_SESSION['dateformat']);
    // $_POST['language']
    $supportedLanguages = getLanguageData();
    $numberformatid = $supportedLanguages[$_POST['language']]['radixpoint'];
    if ($_POST['url'] == 'http://') {
        $_POST['url'] = "";
    }
    if (!$_POST['surveyls_title']) {
        $databaseoutput .= "<script type=\"text/javascript\">\n<!--\n alert(\"" . $clang->gT("Survey could not be created because it did not have a title", "js") . "\")\n //-->\n</script>\n";
    } else {
        // Get random ids until one is found that is not used
        do {
            $surveyid = sRandomChars(5, '123456789');
            $isquery = "SELECT sid FROM " . db_table_name('surveys') . " WHERE sid={$surveyid}";
            $isresult = db_execute_assoc($isquery);
            // Checked
        } while ($isresult->RecordCount() > 0);
        if (!isset($_POST['template'])) {
开发者ID:ddrmoscow,项目名称:queXS,代码行数:31,代码来源:database.php

示例12: _getLanguageList

 private function _getLanguageList($iSurveyID, $tolang)
 {
     $language_list = "";
     $langs = Survey::model()->findByPk($iSurveyID)->additionalLanguages;
     $supportedLanguages = getLanguageData(FALSE, Yii::app()->session['adminlang']);
     $language_list .= CHtml::openTag('div', array('class' => 'menubar-right'));
     // Opens .menubar-right div
     $language_list .= CHtml::openTag('div', array('class' => 'row'));
     $language_list .= CHtml::openTag('div', array('class' => 'col-sm-12'));
     $language_list .= CHtml::tag('label', array('for' => 'translationlanguage', 'class' => 'col-sm-1  control-label'), gT("Translate to") . ":");
     $language_list .= CHtml::openTag('div', array('class' => 'col-sm-2'));
     $language_list .= CHtml::openTag('select', array('id' => 'translationlanguage', 'name' => 'translationlanguage', 'class' => 'form-control', 'onchange' => "window.open(this.options[this.selectedIndex].value,'_top')"));
     $language_list .= CHtml::closeTag('div');
     $language_list .= CHtml::closeTag('div');
     $language_list .= CHtml::closeTag('div');
     $language_list .= CHtml::closeTag('div');
     $language_list .= '';
     if (count(Survey::model()->findByPk($iSurveyID)->additionalLanguages) > 1) {
         $selected = !isset($tolang) ? "selected" : "";
         $language_list .= CHtml::tag('option', array('selected' => $selected, 'value' => $this->getController()->createUrl("admin/translate/sa/index/surveyid/{$iSurveyID}/")), gT("Please choose..."));
     }
     foreach ($langs as $lang) {
         $selected = $tolang == $lang ? "selected" : "";
         $tolangtext = $supportedLanguages[$lang]['description'];
         $language_list .= CHtml::tag('option', array('selected' => $selected, 'value' => $this->getController()->createUrl("admin/translate/sa/index/surveyid/{$iSurveyID}/lang/{$lang}")), $tolangtext);
     }
     $language_list .= CHtml::closeTag('select');
     $language_list .= CHtml::closeTag('div');
     // End of menubar-right
     return $language_list;
 }
开发者ID:joaocc,项目名称:LimeSurvey--LimeSurvey,代码行数:31,代码来源:translate.php

示例13: getTemplatePath

$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()->lang->langcode);
//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 $clang->langcode . 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__ . ']');
开发者ID:josetorerobueno,项目名称:test_repo,代码行数:31,代码来源:publicSurveyList.php

示例14: _saveSettings

 private function _saveSettings()
 {
     if ($_POST['action'] !== "globalsettingssave") {
         return;
     }
     if (!Permission::model()->hasGlobalPermission('settings', 'update')) {
         $this->getController()->redirect(array('/admin'));
     }
     Yii::app()->loadHelper('surveytranslator');
     $iPDFFontSize = sanitize_int($_POST['pdffontsize']);
     if ($iPDFFontSize < 1) {
         $iPDFFontSize = 9;
     }
     $iPDFLogoWidth = sanitize_int($_POST['pdflogowidth']);
     if ($iPDFLogoWidth < 1) {
         $iPDFLogoWidth = 50;
     }
     $maxemails = $_POST['maxemails'];
     if (sanitize_int($_POST['maxemails']) < 1) {
         $maxemails = 1;
     }
     $defaultlang = sanitize_languagecode($_POST['defaultlang']);
     $aRestrictToLanguages = explode(' ', sanitize_languagecodeS($_POST['restrictToLanguages']));
     if (!in_array($defaultlang, $aRestrictToLanguages)) {
         // Force default language in restrictToLanguages
         $aRestrictToLanguages[] = $defaultlang;
     }
     if (count(array_diff(array_keys(getLanguageData(false, Yii::app()->session['adminlang'])), $aRestrictToLanguages)) == 0) {
         $aRestrictToLanguages = '';
     } else {
         $aRestrictToLanguages = implode(' ', $aRestrictToLanguages);
     }
     setGlobalSetting('defaultlang', $defaultlang);
     setGlobalSetting('restrictToLanguages', trim($aRestrictToLanguages));
     setGlobalSetting('sitename', strip_tags($_POST['sitename']));
     setGlobalSetting('defaulthtmleditormode', sanitize_paranoid_string($_POST['defaulthtmleditormode']));
     setGlobalSetting('defaultquestionselectormode', sanitize_paranoid_string($_POST['defaultquestionselectormode']));
     setGlobalSetting('defaulttemplateeditormode', sanitize_paranoid_string($_POST['defaulttemplateeditormode']));
     if (!Yii::app()->getConfig('demoMode')) {
         $sTemplate = Yii::app()->getRequest()->getPost("defaulttemplate");
         if (array_key_exists($sTemplate, getTemplateList())) {
             setGlobalSetting('defaulttemplate', $sTemplate);
         }
     }
     setGlobalSetting('admintheme', sanitize_paranoid_string($_POST['admintheme']));
     setGlobalSetting('adminthemeiconsize', trim(file_get_contents(Yii::app()->getConfig("styledir") . DIRECTORY_SEPARATOR . sanitize_paranoid_string($_POST['admintheme']) . DIRECTORY_SEPARATOR . 'iconsize')));
     setGlobalSetting('emailmethod', strip_tags($_POST['emailmethod']));
     setGlobalSetting('emailsmtphost', strip_tags(returnGlobal('emailsmtphost')));
     if (returnGlobal('emailsmtppassword') != 'somepassword') {
         setGlobalSetting('emailsmtppassword', strip_tags(returnGlobal('emailsmtppassword')));
     }
     setGlobalSetting('bounceaccounthost', strip_tags(returnGlobal('bounceaccounthost')));
     setGlobalSetting('bounceaccounttype', strip_tags(returnGlobal('bounceaccounttype')));
     setGlobalSetting('bounceencryption', strip_tags(returnGlobal('bounceencryption')));
     setGlobalSetting('bounceaccountuser', strip_tags(returnGlobal('bounceaccountuser')));
     if (returnGlobal('bounceaccountpass') != 'enteredpassword') {
         setGlobalSetting('bounceaccountpass', strip_tags(returnGlobal('bounceaccountpass')));
     }
     setGlobalSetting('emailsmtpssl', sanitize_paranoid_string(Yii::app()->request->getPost('emailsmtpssl', '')));
     setGlobalSetting('emailsmtpdebug', sanitize_int(Yii::app()->request->getPost('emailsmtpdebug', '0')));
     setGlobalSetting('emailsmtpuser', strip_tags(returnGlobal('emailsmtpuser')));
     setGlobalSetting('filterxsshtml', strip_tags($_POST['filterxsshtml']));
     $warning = '';
     // make sure emails are valid before saving them
     if (Yii::app()->request->getPost('siteadminbounce', '') == '' || validateEmailAddress(Yii::app()->request->getPost('siteadminbounce'))) {
         setGlobalSetting('siteadminbounce', strip_tags(Yii::app()->request->getPost('siteadminbounce')));
     } else {
         $warning .= gT("Warning! Admin bounce email was not saved because it was not valid.") . '<br/>';
     }
     if (Yii::app()->request->getPost('siteadminemail', '') == '' || validateEmailAddress(Yii::app()->request->getPost('siteadminemail'))) {
         setGlobalSetting('siteadminemail', strip_tags(Yii::app()->request->getPost('siteadminemail')));
     } else {
         $warning .= gT("Warning! Admin email was not saved because it was not valid.") . '<br/>';
     }
     setGlobalSetting('siteadminname', strip_tags($_POST['siteadminname']));
     setGlobalSetting('shownoanswer', sanitize_int($_POST['shownoanswer']));
     setGlobalSetting('showxquestions', $_POST['showxquestions']);
     setGlobalSetting('showgroupinfo', $_POST['showgroupinfo']);
     setGlobalSetting('showqnumcode', $_POST['showqnumcode']);
     $repeatheadingstemp = (int) $_POST['repeatheadings'];
     if ($repeatheadingstemp == 0) {
         $repeatheadingstemp = 25;
     }
     setGlobalSetting('repeatheadings', $repeatheadingstemp);
     setGlobalSetting('maxemails', sanitize_int($maxemails));
     $iSessionExpirationTime = (int) $_POST['iSessionExpirationTime'];
     if ($iSessionExpirationTime == 0) {
         $iSessionExpirationTime = 7200;
     }
     setGlobalSetting('iSessionExpirationTime', $iSessionExpirationTime);
     setGlobalSetting('ipInfoDbAPIKey', $_POST['ipInfoDbAPIKey']);
     setGlobalSetting('pdffontsize', $iPDFFontSize);
     setGlobalSetting('pdfshowheader', $_POST['pdfshowheader']);
     setGlobalSetting('pdflogowidth', $iPDFLogoWidth);
     setGlobalSetting('pdfheadertitle', $_POST['pdfheadertitle']);
     setGlobalSetting('pdfheaderstring', $_POST['pdfheaderstring']);
     setGlobalSetting('googleMapsAPIKey', $_POST['googleMapsAPIKey']);
     setGlobalSetting('googleanalyticsapikey', $_POST['googleanalyticsapikey']);
     setGlobalSetting('googletranslateapikey', $_POST['googletranslateapikey']);
     setGlobalSetting('force_ssl', $_POST['force_ssl']);
//.........这里部分代码省略.........
开发者ID:nicbon,项目名称:LimeSurvey,代码行数:101,代码来源:globalsettings.php

示例15: showTranslateAdminmenu

/**
 * showTranslateAdminmenu() creates the main menu options for the survey translation page
 * @param string $surveyid The survey ID
 * @param string $survey_title 
 * @param string $tolang
 * @param string $activated
 * @param string $scriptname
 * @global string $imageurl, $clang, $publicurl
 * @return string
 */
function showTranslateAdminmenu($surveyid, $survey_title, $tolang, $scriptname)
{
    global $imageurl, $clang, $publicurl;
    $baselang = GetBaseLanguageFromSurveyID($surveyid);
    $supportedLanguages = getLanguageData(false);
    $langs = GetAdditionalLanguagesFromSurveyID($surveyid);
    $adminmenu = "" . "<div class='menubar'>\n" . "<div class='menubar-title ui-widget-header'>\n" . "<strong>" . $clang->gT("Translate survey") . ": {$survey_title}</strong>\n" . "</div>\n" . "<div class='menubar-main'>\n";
    $adminmenu .= "" . "<div class='menubar-left'>\n";
    // Return to survey administration button
    $adminmenu .= menuItem($clang->gT("Return to survey administration"), $clang->gTview("Return to survey administration"), "Administration", "home.png", "{$scriptname}?sid={$surveyid}");
    // Separator
    $adminmenu .= menuSeparator();
    // Test / execute survey button
    if ($tolang != "") {
        $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
        $surveyinfo = $sumresult1->FetchRow();
        $surveyinfo = array_map('FlattenText', $surveyinfo);
        $activated = $surveyinfo['active'];
        if ($activated == "N") {
            $menutext = $clang->gT("Test This Survey");
            $menutext2 = $clang->gTview("Test This Survey");
        } else {
            $menutext = $clang->gT("Execute This Survey");
            $menutext2 = $clang->gTview("Execute This Survey");
        }
        if (count(GetAdditionalLanguagesFromSurveyID($surveyid)) == 0) {
            $adminmenu .= menuItem($menutext, $menutext2, "do.png", "{$publicurl}/index.php?sid={$surveyid}&amp;newtest=Y&amp;lang={$baselang}");
        } else {
            $icontext = $clang->gT($menutext);
            $icontext2 = $clang->gT($menutext);
            $adminmenu .= "<a href='#' id='dosurvey' class='dosurvey'" . "title=\"" . $icontext2 . "\" accesskey='d'>" . "<img  src='{$imageurl}/do.png' alt='{$icontext}' />" . "</a>\n";
            $tmp_survlangs = GetAdditionalLanguagesFromSurveyID($surveyid);
            $tmp_survlangs[] = $baselang;
            rsort($tmp_survlangs);
            // Test Survey Language Selection Popup
            $adminmenu .= "<div class=\"langpopup\" id=\"dosurveylangpopup\">" . $clang->gT("Please select a language:") . "<ul>";
            foreach ($tmp_survlangs as $tmp_lang) {
                $adminmenu .= "<li><a accesskey='d' onclick=\"\$('.dosurvey').qtip('hide');" . "\" target='_blank' href='{$publicurl}/index.php?sid={$surveyid}&amp;" . "newtest=Y&amp;lang={$tmp_lang}'>" . getLanguageNameFromCode($tmp_lang, false) . "</a></li>";
            }
            $adminmenu .= "</ul></div>";
        }
    }
    // End of survey-bar-left
    $adminmenu .= "</div>";
    // Survey language list
    $selected = "";
    if (!isset($tolang)) {
        $selected = " selected='selected' ";
    }
    $adminmenu .= "" . "<div class='menubar-right'>\n" . "<span class=\"boxcaption\">" . $clang->gT("Translate to") . ":</span>" . "<select onchange=\"window.open(this.options[this.selectedIndex].value,'_top')\">\n";
    if (count(GetAdditionalLanguagesFromSurveyID($surveyid)) > 1) {
        $adminmenu .= "<option {$selected} value='{$scriptname}?action=translate&amp;sid={$surveyid}'>" . $clang->gT("Please choose...") . "</option>\n";
    }
    foreach ($langs as $lang) {
        $selected = "";
        if ($tolang == $lang) {
            $selected = " selected='selected' ";
        }
        $tolangtext = $supportedLanguages[$lang]['description'];
        $adminmenu .= "<option {$selected} value='{$scriptname}?action=translate&amp;sid={$surveyid}&amp;tolang={$lang}'> " . $tolangtext . " </option>\n";
    }
    $adminmenu .= "" . "</select>\n" . "</div>\n";
    // End of menubar-right
    $adminmenu .= "" . "</div>\n";
    $adminmenu .= "" . "</div>\n";
    return $adminmenu;
}
开发者ID:karime7gezly,项目名称:OpenConextApps-LimeSurvey,代码行数:80,代码来源:translate_functions.php


注:本文中的getLanguageData函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。