本文整理汇总了PHP中getLanguageRTL函数的典型用法代码示例。如果您正苦于以下问题:PHP getLanguageRTL函数的具体用法?PHP getLanguageRTL怎么用?PHP getLanguageRTL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getLanguageRTL函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPdfLanguageSettings
/**
* getPdfLanguageSettings
*
* Usage: getPdfLanguageSettings($language)
*
* @return array ('pdffont','pdffontsize','lg'=>array('a_meta_charset','a_meta_dir','a_meta_language','w_page')
* @param string $language : language code for the PDF
*/
public static function getPdfLanguageSettings($language)
{
Yii::import('application.libraries.admin.pdf', true);
Yii::import('application.helpers.surveytranslator_helper', true);
$pdffont = Yii::app()->getConfig('pdfdefaultfont');
if ($pdffont == 'auto') {
$pdffont = PDF_FONT_NAME_DATA;
}
$pdfcorefont = array("freesans", "dejavusans", "courier", "helvetica", "freemono", "symbol", "times", "zapfdingbats");
if (in_array($pdffont, $pdfcorefont)) {
$alternatepdffontfile = Yii::app()->getConfig('alternatepdffontfile');
if (array_key_exists($language, $alternatepdffontfile)) {
$pdffont = $alternatepdffontfile[$language];
// Actually use only core font
}
}
$pdffontsize = Yii::app()->getConfig('pdffontsize');
if ($pdffontsize == 'auto') {
$pdffontsize = PDF_FONT_SIZE_MAIN;
}
$lg = array();
$lg['a_meta_charset'] = 'UTF-8';
if (getLanguageRTL($language)) {
$lg['a_meta_dir'] = 'rtl';
} else {
$lg['a_meta_dir'] = 'ltr';
}
$lg['a_meta_language'] = $language;
$lg['w_page'] = gT("page");
return array('pdffont' => $pdffont, 'pdffontsize' => $pdffontsize, 'lg' => $lg);
}
示例2: init
public function init()
{
parent::init();
// Register assets.
Yii::app()->getClientScript()->registerPackage('jquery');
if (getLanguageRTL(App()->language)) {
Yii::app()->getClientScript()->registerCssFile(App()->getAssetManager()->publish(dirname(__FILE__) . '/assets/settingswidget-rtl.css'));
} else {
Yii::app()->getClientScript()->registerCssFile(App()->getAssetManager()->publish(dirname(__FILE__) . '/assets/settingswidget.css'));
}
Yii::app()->getClientScript()->registerScriptFile(App()->getAssetManager()->publish(dirname(__FILE__) . '/assets/settingswidget.js'));
// Add default form class.
$this->formHtmlOptions['class'] = isset($this->formHtmlOptions['class']) ? $this->formHtmlOptions['class'] . " settingswidget form-horizontal" : 'settingswidget form-horizontal';
// Start form
$this->beginForm();
}
示例3: createTemplatePackage
/**
* Create a package for the asset manager.
* The asset manager will push to tmp/assets/xyxyxy/ the whole template directory (with css, js, files, etc.)
* And it will publish the CSS and the JS defined in config.xml. So CSS can use relative path for pictures.
* The publication of the package itself is done for now in replacements_helper, to respect the old logic of {TEMPLATECSS} replacement keyword
*
* NOTE 1 : To refresh the assets, the base directory of the template must be updated.
*
* NOTE 2: By default, Asset Manager is off when debug mode is on.
* Developers should then think about :
* 1. refreshing their brower's cache (ctrl + F5) to see their changes
* 2. update the config.xml last_update before pushing, to be sure that end users will have the new version
*
*
* For more detail, see :
* http://www.yiiframework.com/doc/api/1.1/CClientScript#addPackage-detail
* http://www.yiiframework.com/doc/api/1.1/YiiBase#setPathOfAlias-detail
*
*/
private function createTemplatePackage()
{
Yii::setPathOfAlias('survey.template.path', $this->path);
// The package creation/publication need an alias
Yii::setPathOfAlias('survey.template.viewpath', $this->viewPath);
$oCssFiles = $this->config->files->css->filename;
// The CSS files of this template
$oJsFiles = $this->config->files->js->filename;
// The JS files of this template
$jsDeactivateConsole = "\n <script> var dummyConsole = {\n log : function(){},\n error : function(){}\n };\n console = dummyConsole;\n window.console = dummyConsole;\n </script>";
if (getLanguageRTL(App()->language)) {
$oCssFiles = $this->config->files->rtl->css->filename;
// In RTL mode, original CSS files should not be loaded, else padding-left could be added to padding-right.)
$oJsFiles = $this->config->files->rtl->js->filename;
// In RTL mode,
}
if (Yii::app()->getConfig('debug') == 0) {
Yii::app()->clientScript->registerScriptFile(Yii::app()->baseUrl . '/scripts/deactivatedebug.js', CClientScript::POS_END);
}
$aCssFiles = (array) $oCssFiles;
$aJsFiles = (array) $oJsFiles;
// The package "survey-template" will be available from anywhere in the app now.
// To publish it : Yii::app()->clientScript->registerPackage( 'survey-template' );
// It will create the asset directory, and publish the css and js files
Yii::app()->clientScript->addPackage('survey-template', array('basePath' => 'survey.template.path', 'css' => $aCssFiles, 'js' => $aJsFiles, 'depends' => $this->depends));
}
示例4: templatereplace
//.........这里部分代码省略.........
$_templatecss = "";
$_templatejs = "";
/**
* Template css/js files from the template config files are loaded.
* It use the asset manager (so user never need to empty the cache, even if template is updated)
* If debug mode is on, no asset manager is used.
*
* oTemplate is defined in controller/survey/index
*
* If templatereplace is called from the template editor, a $oTemplate is provided.
*/
$oTemplate = Template::model()->getInstance($templatename);
$aCssFiles = $oTemplate->config->files->css->filename;
$aJsFiles = $oTemplate->config->files->js->filename;
$aOtherFiles = $oTemplate->otherFiles;
//var_dump($aOtherFiles); die();
if (stripos($line, "{TEMPLATECSS}")) {
// If the template has files for css, we can't publish the files one by one, but we must publish them as a whole directory
// TODO : extend asset manager so it check for file modification even in directory mode
if (!YII_DEBUG || count($aOtherFiles) < 0) {
foreach ($aCssFiles as $sCssFile) {
if (file_exists($oTemplate->path . DIRECTORY_SEPARATOR . $sCssFile)) {
Yii::app()->getClientScript()->registerCssFile(App()->getAssetManager()->publish($oTemplate->path . DIRECTORY_SEPARATOR . $sCssFile), $sCssFile['media']);
}
}
} else {
foreach ($aCssFiles as $sCssFile) {
if (file_exists($oTemplate->path . DIRECTORY_SEPARATOR . $sCssFile)) {
Yii::app()->getClientScript()->registerCssFile("{$templateurl}{$sCssFile}", $sCssFile['media']);
}
}
}
/* RTL CSS */
if (getLanguageRTL(App()->language)) {
$aCssFiles = (array) $oTemplate->config->files->rtl->css->filename;
if (!YII_DEBUG) {
foreach ($aCssFiles as $sCssFile) {
if (file_exists($oTemplate->path . DIRECTORY_SEPARATOR . $sCssFile)) {
Yii::app()->getClientScript()->registerCssFile(App()->getAssetManager()->publish($oTemplate->path . DIRECTORY_SEPARATOR . $sCssFile), $sCssFile['media']);
}
}
} else {
foreach ($aCssFiles as $sCssFile) {
if (file_exists($oTemplate->path . DIRECTORY_SEPARATOR . $sCssFile)) {
Yii::app()->getClientScript()->registerCssFile("{$templateurl}{$sCssFile}", $sCssFile['media']);
}
}
}
}
}
if (stripos($line, "{TEMPLATEJS}")) {
if (!YII_DEBUG) {
foreach ($aJsFiles as $sJsFile) {
if (file_exists($oTemplate->path . DIRECTORY_SEPARATOR . $sJsFile)) {
App()->getClientScript()->registerScriptFile(App()->getAssetManager()->publish($oTemplate->path . DIRECTORY_SEPARATOR . $sJsFile));
}
}
} else {
foreach ($aJsFiles as $sJsFile) {
if (file_exists($oTemplate->path . DIRECTORY_SEPARATOR . $sJsFile)) {
Yii::app()->getClientScript()->registerScriptFile("{$templateurl}{$sJsFile}");
}
}
}
/* RTL JS */
if (getLanguageRTL(App()->language)) {
示例5: getHeader
function getHeader($meta = false)
{
global $embedded, $surveyid;
Yii::app()->loadHelper('surveytranslator');
// Set Langage // TODO remove one of the Yii::app()->session see bug #5901
if (Yii::app()->session['survey_' . $surveyid]['s_lang']) {
$languagecode = Yii::app()->session['survey_' . $surveyid]['s_lang'];
} elseif (isset($surveyid) && $surveyid && Survey::model()->findByPk($surveyid)) {
$languagecode = Survey::model()->findByPk($surveyid)->language;
} else {
$languagecode = Yii::app()->getConfig('defaultlang');
}
$header = "<!DOCTYPE html>\n" . "<html lang=\"{$languagecode}\"";
if (getLanguageRTL($languagecode)) {
$header .= " dir=\"rtl\" ";
}
$header .= ">\n\t<head>\n";
if ($meta) {
$header .= $meta;
}
if (!$embedded) {
return $header;
}
global $embedded_headerfunc;
if (function_exists($embedded_headerfunc)) {
return $embedded_headerfunc($header);
}
}
示例6: generate_statistics
//.........这里部分代码省略.........
//Pie Chart
else
{
// this block is to remove the items with value == 0
$i = 0;
while (isset ($gdata[$i]))
{
if ($gdata[$i] == 0)
{
array_splice ($gdata, $i, 1);
array_splice ($lbl, $i, 1);
}
else
{$i++;}
}
$lblout=array();
if ($language=='ar')
{
$lblout=$lbl; //reset text order to original
include_once($rootdir.'/classes/core/Arabic.php');
$Arabic = new Arabic('ArGlyphs');
foreach($lblout as $kkey => $kval){
if (preg_match("^[A-Za-z]^", $kval)) { //auto detect if english
//eng
//no reversing
}
else{
$kval = $Arabic->utf8Glyphs($kval,50,false);
$lblout[$kkey] = $kval;
}
}
}
elseif (getLanguageRTL($language))
{
$lblout=$lblrtl;
}
else
{
$lblout=$lbl;
}
//create new 3D pie chart
if ($usegraph==1)
{
$DataSet = new pData;
$DataSet->AddPoint($gdata,"Serie1");
$DataSet->AddPoint($lblout,"Serie2");
$DataSet->AddAllSeries();
$DataSet->SetAbsciseLabelSerie("Serie2");
if ($MyCache->IsInCache("graph".$surveyid,$DataSet->GetData()))
{
$cachefilename=basename($MyCache->GetFileFromCache("graph".$surveyid,$DataSet->GetData()));
}
else
{
$gheight=ceil($gheight);
$graph = new pChart(690,$gheight);
$graph->loadColorPalette($homedir.'/styles/'.$admintheme.'/limesurvey.pal');
$graph->drawFilledRoundedRectangle(7,7,687,$gheight-3,5,254,255,254);
$graph->drawRoundedRectangle(5,5,689,$gheight-1,5,230,230,230);
// Draw the pie chart
示例7: makegraph
function makegraph($currentstep, $total)
{
global $thissurvey;
$clang = Yii::app()->lang;
Yii::app()->getClientScript()->registerCssFile(Yii::app()->getConfig('publicstyleurl') . 'lime-progress.css');
$size = intval(($currentstep - 1) / $total * 100);
$graph = '<script type="text/javascript">
$(document).ready(function() {
$("#progressbar").progressbar({
value: ' . $size . '
});
;});';
if (getLanguageRTL($clang->langcode)) {
$graph .= '
$(document).ready(function() {
$("div.ui-progressbar-value").removeClass("ui-corner-left");
$("div.ui-progressbar-value").addClass("ui-corner-right");
});';
}
$graph .= '
</script>
<div id="progress-wrapper">
<span class="hide">' . sprintf($clang->gT('You have completed %s%% of this survey'), $size) . '</span>
<div id="progress-pre">';
if (getLanguageRTL($clang->langcode)) {
$graph .= '100%';
} else {
$graph .= '0%';
}
$graph .= '</div>
<div id="progressbar"></div>
<div id="progress-post">';
if (getLanguageRTL($clang->langcode)) {
$graph .= '0%';
} else {
$graph .= '100%';
}
$graph .= '</div>
</div>';
if ($size == 0) {
$graph .= '
<script type="text/javascript">
$(document).ready(function() {
$("div.ui-progressbar-value").hide();
});
</script>';
}
return $graph;
}
示例8: _getAdminHeader
/**
* Prints Admin Header
*
* @access protected
* @param bool $meta
* @param bool $return
* @return mixed
*/
public function _getAdminHeader($meta = false, $return = false)
{
if (empty(Yii::app()->session['adminlang'])) {
Yii::app()->session["adminlang"] = Yii::app()->getConfig("defaultlang");
}
$data = array();
$data['adminlang'] = Yii::app()->session['adminlang'];
//$data['admin'] = getLanguageRTL;
$data['test'] = "t";
$data['languageRTL'] = "";
$data['styleRTL'] = "";
Yii::app()->loadHelper("surveytranslator");
if (getLanguageRTL(Yii::app()->session["adminlang"])) {
$data['languageRTL'] = " dir=\"rtl\" ";
$data['bIsRTL'] = true;
} else {
$data['bIsRTL'] = false;
}
$data['meta'] = "";
if ($meta) {
$data['meta'] = $meta;
}
$data['baseurl'] = Yii::app()->baseUrl . '/';
$data['datepickerlang'] = "";
if (Yii::app()->session["adminlang"] != 'en') {
$data['datepickerlang'] = "<script type=\"text/javascript\" src=\"" . Yii::app()->getConfig('generalscripts') . "jquery/locale/jquery.ui.datepicker-" . Yii::app()->session["adminlang"] . ".js\"></script>\n";
}
$data['sitename'] = Yii::app()->getConfig("sitename");
$data['admintheme'] = Yii::app()->getConfig("admintheme");
$data['firebug'] = useFirebug();
if (!empty(Yii::app()->session['dateformat'])) {
$data['formatdata'] = getDateFormatData(Yii::app()->session['dateformat']);
}
// Prepare flashmessage
if (!empty(Yii::app()->session['flashmessage']) && Yii::app()->session['flashmessage'] != '') {
$data['flashmessage'] = Yii::app()->session['flashmessage'];
unset(Yii::app()->session['flashmessage']);
}
$data['css_admin_includes'] = $this->_css_admin_includes(array(), true);
return $this->renderPartial("/admin/super/header", $data, $return);
}
示例9: init
public function init(SurveyObj $survey, $sLanguageCode, FormattingOptions $oOptions)
{
parent::init($survey, $sLanguageCode, $oOptions);
$pdfdefaultfont = Yii::app()->getConfig('pdfdefaultfont');
$pdffontsize = Yii::app()->getConfig('pdffontsize');
$pdforientation = Yii::app()->getConfig('pdforientation');
$clang = new limesurvey_lang($sLanguageCode);
if ($oOptions->output == 'file') {
$this->pdfDestination = 'F';
} else {
$this->pdfDestination = 'D';
}
Yii::import('application.libraries.admin.pdf', true);
if ($pdfdefaultfont == 'auto') {
$pdfdefaultfont = PDF_FONT_NAME_DATA;
}
// Array of PDF core fonts: are replaced by according fonts according to the alternatepdffontfile array.Maybe just courier,helvetica and times but if a user want symbol: why not ....
$pdfcorefont = array("courier", "helvetica", "symbol", "times", "zapfdingbats");
$pdffontsize = Yii::app()->getConfig('pdffontsize');
// create new PDF document
$this->pdf = new pdf();
if (in_array($pdfdefaultfont, $pdfcorefont)) {
$alternatepdffontfile = Yii::app()->getConfig('alternatepdffontfile');
if (array_key_exists($sLanguageCode, $alternatepdffontfile)) {
$pdfdefaultfont = $alternatepdffontfile[$sLanguageCode];
// Actually use only core font
}
}
if ($pdffontsize == 'auto') {
$pdffontsize = PDF_FONT_SIZE_MAIN;
}
$this->pdf = new pdf();
$this->pdf->SetFont($pdfdefaultfont, '', $pdffontsize);
$this->pdf->AddPage();
$this->pdf->intopdf("PDF export " . date("Y.m.d-H:i", time()));
//Set some pdf metadata
Yii::app()->loadHelper('surveytranslator');
$lg = array();
$lg['a_meta_charset'] = 'UTF-8';
if (getLanguageRTL($sLanguageCode)) {
$lg['a_meta_dir'] = 'rtl';
} else {
$lg['a_meta_dir'] = 'ltr';
}
$lg['a_meta_language'] = $sLanguageCode;
$lg['w_page'] = $clang->gT("page");
$this->pdf->setLanguageArray($lg);
$this->separator = "\t";
$this->rowCounter = 0;
$this->surveyName = $survey->languageSettings[0]['surveyls_title'];
$this->pdf->titleintopdf($this->surveyName, $survey->languageSettings[0]['surveyls_description']);
}
示例10: _getAdminHeader
/**
* Prints Admin Header
*
* @access protected
* @param bool $meta
* @param bool $return
* @return mixed
*/
public function _getAdminHeader($meta = false, $return = false)
{
if (empty(Yii::app()->session['adminlang'])) {
Yii::app()->session["adminlang"] = Yii::app()->getConfig("defaultlang");
}
$aData = array();
$aData['adminlang'] = Yii::app()->language;
$aData['languageRTL'] = "";
$aData['styleRTL'] = "";
Yii::app()->loadHelper("surveytranslator");
if (getLanguageRTL(Yii::app()->language)) {
$aData['languageRTL'] = " dir=\"rtl\" ";
$aData['bIsRTL'] = true;
} else {
$aData['languageRTL'] = " dir=\"ltr\" ";
$aData['bIsRTL'] = false;
}
$aData['meta'] = "";
if ($meta) {
$aData['meta'] = $meta;
}
$aData['baseurl'] = Yii::app()->baseUrl . '/';
$aData['datepickerlang'] = "";
if ($aData['adminlang'] != 'en') {
Yii::app()->getClientScript()->registerScriptFile(App()->baseUrl . "/third_party/jqueryui/development-bundle/ui/i18n/jquery.ui.datepicker-" . $aData['adminlang'] . ".js");
}
$aData['sitename'] = Yii::app()->getConfig("sitename");
$aData['firebug'] = useFirebug();
if (!empty(Yii::app()->session['dateformat'])) {
$aData['formatdata'] = getDateFormatData(Yii::app()->session['dateformat']);
}
// Register admin theme package with asset manager
$oAdmintheme = Template::model()->getAdminTheme();
// We get the package datas from the model
$aData['sAdmintheme'] = $oAdmintheme->name;
$aData['sAdminthemePackageName'] = $oAdmintheme->packagename;
$aData['aPackageScripts'] = (array) $oAdmintheme->config->files->js->filename;
$aData['aPackageStyles'] = (array) $oAdmintheme->config->files->css->filename;
if ($aData['bIsRTL']) {
foreach ($aData['aPackageStyles'] as &$filename) {
$filename = str_replace('.css', '-rtl.css', $filename);
}
}
$sOutput = $this->renderPartial("/admin/super/header", $aData, true);
// Define images url
define('LOGO_URL', App()->getAssetManager()->publish(dirname(Yii::app()->request->scriptFile) . '/styles/' . $oAdmintheme->name . '/images/logo.png'));
// Define presentation text on welcome page
if ($oAdmintheme->config->metadatas->presentation) {
define('PRESENTATION', $oAdmintheme->config->metadatas->presentation);
} else {
define('PRESENTATION', gT('This is the LimeSurvey admin interface. Start to build your survey from here.'));
}
if ($return) {
return $sOutput;
} else {
echo $sOutput;
}
}
示例11: registerStylesAndScripts
/**
* Register all the styles and scripts of the current template.
* Check if RTL is needed, use asset manager if needed.
* This function is public because it appears that sometime, the package need to be register again in header (probably a cache problem)
*/
public function registerStylesAndScripts()
{
// First we register the different needed packages
// Bootstrap Registration
// We don't want to use bootstrap extension's register functionality, to be able to set dependencies between packages
// ie: to control load order setting 'depends' in our package
// So, we take the usual Bootstrap extensions TbApi::register (called normally with App()->bootstrap->register()) see: https://github.com/LimeSurvey/LimeSurvey/blob/master/application/extensions/bootstrap/components/TbApi.php#l162-l169
// keep here the necessary (registerMetaTag and registerAllScripts),
// and move the rest to the bootstrap package.
// NB: registerAllScripts could be replaced by js definition in package. If needed: not a problem to do it
if (!Yii::app()->request->getQuery('isAjax', false)) {
Yii::app()->getClientScript()->registerMetaTag('width=device-width, initial-scale=1.0', 'viewport');
// See: https://github.com/LimeSurvey/LimeSurvey/blob/master/application/extensions/bootstrap/components/TbApi.php#l108-l115
App()->bootstrap->registerAllScripts();
// See : https://github.com/LimeSurvey/LimeSurvey/blob/master/application/extensions/bootstrap/components/TbApi.php#l153-l160
App()->getClientScript()->registerPackage('jqueryui');
// jqueryui
App()->getClientScript()->registerPackage('jquery-cookie');
// jquery-cookie
App()->getClientScript()->registerPackage('fontawesome');
// fontawesome ??? TODO: check if neede
}
$aCssFiles = array();
$aJsFiles = array();
// Then we add the different CSS/JS files to load in arrays
// It will check if it needs or not the RTL files
// and it will add the directory prefix to the file name (css/ or js/ )
// This last step is needed for the package (yii package use a single baseUrl / basePath for css and js files )
// We check if RTL is needed
if (getLanguageRTL(Yii::app()->language)) {
if (!isset($this->config->files->rtl) || !isset($this->config->files->rtl->css)) {
throw new CException("Invalid template configuration: No CSS files found for right-to-left languages");
}
foreach ($this->config->files->rtl->css->filename as $cssfile) {
$aCssFiles[] = 'css/' . $cssfile;
// add the 'css/' prefix to the RTL css files
}
$aCssFiles[] = 'css/adminstyle-rtl.css';
// This file is needed for rtl
} else {
// Non-RTL style
foreach ($this->config->files->css->filename as $cssfile) {
$aCssFiles[] = 'css/' . $cssfile;
// add the 'css/' prefix to the css files
}
}
foreach ($this->config->files->js->filename as $jsfile) {
$aJsFiles[] = 'scripts/' . $jsfile;
// add the 'js/' prefix to the RTL css files
}
$package = array();
// We check if the asset manager should be use.
// When defining the package with a base path (a directory on the file system), the asset manager is used
// When defining the package with a base url, the file is directly registerd without the asset manager
// See : http://www.yiiframework.com/doc/api/1.1/CClientScript#packages-detail
if (!YII_DEBUG || self::$use_asset_manager || Yii::app()->getConfig('use_asset_manager')) {
Yii::setPathOfAlias('admin.theme.path', $this->path);
$package['basePath'] = 'admin.theme.path';
// add the base path to the package, so it will use the asset manager
} else {
$package['baseUrl'] = $this->sTemplateUrl;
// add the base url to the package, so it will not use the asset manager
}
$package['css'] = $aCssFiles;
// add the css files to the package
$package['js'] = $aJsFiles;
// add the js files to the package
$package['depends'] = array('bootstrap');
Yii::app()->clientScript->addPackage('admin-theme', $package);
// add the package
Yii::app()->clientScript->registerPackage('admin-theme');
// register the package
Yii::app()->clientScript->registerPackage('moment');
// register moment for correct dateTime calculation
}
示例12: registerClientScript
/**
* Registers required client script for bootstrap typeahead. It is not used through bootstrap->registerPlugin
* in order to attach events if any
*/
public function registerClientScript()
{
/* publish assets dir */
$path = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'assets';
$assetsUrl = $this->getAssetsUrl($path);
$id = TbArray::getValue('id', $this->htmlOptions);
/* @var $cs CClientScript */
$cs = Yii::app()->getClientScript();
$min = $this->debugMode ? '.min' : '';
if (getLanguageRTL($_SESSION['adminlang'])) {
$cs->registerCssFile($assetsUrl . '/css/bootstrap-switch-rtl.css');
} else {
$cs->registerCssFile($assetsUrl . '/css/bootstrap-switch.css');
}
$cs->registerScriptFile($assetsUrl . '/js/bootstrap-switch' . $min . '.js', CClientScript::POS_END);
$selector = '#' . $id;
$this->getApi()->registerPlugin('bootstrapSwitch', $selector);
$this->getApi()->registerEvents($selector, $this->events);
}
示例13: _getAdminHeader
/**
* Prints Admin Header
*
* @access protected
* @param bool $meta
* @param bool $return
* @return mixed
*/
public function _getAdminHeader($meta = false, $return = false)
{
if (empty(Yii::app()->session['adminlang'])) {
Yii::app()->session["adminlang"] = Yii::app()->getConfig("defaultlang");
}
$aData = array();
$aData['adminlang'] = Yii::app()->language;
$aData['languageRTL'] = "";
$aData['styleRTL'] = "";
Yii::app()->loadHelper("surveytranslator");
if (getLanguageRTL(Yii::app()->language)) {
$aData['languageRTL'] = " dir=\"rtl\" ";
$aData['bIsRTL'] = true;
} else {
$aData['languageRTL'] = " dir=\"ltr\" ";
$aData['bIsRTL'] = false;
}
$aData['meta'] = "";
if ($meta) {
$aData['meta'] = $meta;
}
$aData['baseurl'] = Yii::app()->baseUrl . '/';
$aData['datepickerlang'] = "";
if ($aData['adminlang'] != 'en') {
Yii::app()->getClientScript()->registerScriptFile(App()->baseUrl . "/third_party/jqueryui/development-bundle/ui/i18n/jquery.ui.datepicker-" . $aData['adminlang'] . ".js");
}
$aData['sitename'] = Yii::app()->getConfig("sitename");
$aData['admintheme'] = Yii::app()->getConfig("admintheme");
$aData['firebug'] = useFirebug();
if (!empty(Yii::app()->session['dateformat'])) {
$aData['formatdata'] = getDateFormatData(Yii::app()->session['dateformat']);
}
$sOutput = $this->renderPartial("/admin/super/header", $aData, true);
if ($return) {
return $sOutput;
} else {
echo $sOutput;
}
}
示例14: getHeader
function getHeader($meta = false)
{
global $embedded, $surveyid, $rooturl, $defaultlang, $js_header_includes, $css_header_includes;
$js_header_includes = array_unique($js_header_includes);
$css_header_includes = array_unique($css_header_includes);
$interviewer = returnglobal('interviewer');
if (!empty($interviewer) || isset($_SESSION['interviewer']) && $_SESSION['interviewer'] == true) {
$interviewer = true;
$_SESSION['interviewer'] = true;
} else {
$interviewer = false;
}
if ($interviewer) {
$js_header_includes[] = '/../../js/popup.js';
//queXS Addition
include_once "quexs.php";
if (AUTO_LOGOUT_MINUTES !== false) {
$js_header_includes[] = $rooturl . "/../../js/childnap.js";
//queXS Addition
}
}
if (isset($_SESSION['s_lang']) && $_SESSION['s_lang']) {
$surveylanguage = $_SESSION['s_lang'];
} elseif (isset($surveyid) && $surveyid) {
$surveylanguage = GetBaseLanguageFromSurveyID($surveyid);
} else {
$surveylanguage = $defaultlang;
}
$js_header = '';
$css_header = '';
foreach ($js_header_includes as $jsinclude) {
if (substr($jsinclude, 0, 4) == 'http') {
$js_header .= "<script type=\"text/javascript\" src=\"{$jsinclude}\"></script>\n";
} else {
$js_header .= "<script type=\"text/javascript\" src=\"" . $rooturl . "{$jsinclude}\"></script>\n";
}
}
foreach ($css_header_includes as $cssinclude) {
$css_header .= "<link rel=\"stylesheet\" type=\"text/css\" media=\"all\" href=\"" . $rooturl . $cssinclude . "\" />\n";
}
$header = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n" . "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"" . $surveylanguage . "\" lang=\"" . $surveylanguage . "\"";
if (getLanguageRTL($surveylanguage)) {
$header .= " dir=\"rtl\" ";
}
$header .= ">\n\t<head>\n" . $css_header . "<script type=\"text/javascript\" src=\"" . $rooturl . "/scripts/jquery/jquery.js\"></script>\n" . "<script type=\"text/javascript\" src=\"" . $rooturl . "/scripts/jquery/jquery-ui.js\"></script>\n" . "<script type=\"text/javascript\" src=\"" . $rooturl . "/scripts/jquery/jquery.ui.touch-punch.min.js\"></script>\n" . "<link href=\"" . $rooturl . "/scripts/jquery/css/start/jquery-ui.css\" media=\"all\" type=\"text/css\" rel=\"stylesheet\" />" . "<link href=\"" . $rooturl . "/scripts/jquery/css/start/lime-progress.css\" media=\"all\" type=\"text/css\" rel=\"stylesheet\" />" . $js_header;
if ($meta) {
$header .= $meta;
}
if (!$embedded) {
return $header;
} else {
global $embedded_headerfunc;
if (function_exists($embedded_headerfunc)) {
return $embedded_headerfunc($header);
}
}
}
示例15: getHeader
function getHeader($meta = false)
{
global $embedded, $surveyid;
Yii::app()->loadHelper('surveytranslator');
// Set Langage // TODO remove one of the Yii::app()->session see bug #5901
if (Yii::app()->session['s_lang']) {
$languagecode = Yii::app()->session['s_lang'];
} elseif (Yii::app()->session['survey_' . $surveyid]['s_lang']) {
$languagecode = Yii::app()->session['survey_' . $surveyid]['s_lang'];
} elseif (isset($surveyid) && $surveyid) {
$languagecode = Survey::model()->findByPk($surveyid)->language;
} else {
$languagecode = Yii::app()->getConfig('defaultlang');
}
$header = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n" . "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"{$languagecode}\" lang=\"{$languagecode}\"";
if (getLanguageRTL($languagecode)) {
$header .= " dir=\"rtl\" ";
}
$header .= ">\n\t<head>\n";
if ($meta) {
$header .= $meta;
}
if (!$embedded) {
return $header;
}
global $embedded_headerfunc;
if (function_exists($embedded_headerfunc)) {
return $embedded_headerfunc($header);
}
}