示例#1
0
 /**
  * Constructor of TypeManager, set locale with $localCode parameter
  *
  * @param string $localeCode
  * @return void
  **/
 public function __construct($localeCode = "")
 {
     //try to set correct locale for current language as defined in app.inc section I18n
     $currentLanguage = I18n::getCurrentLangCode();
     $localeCode = $GLOBALS["local"][$currentLanguage];
     setlocale(LC_ALL, $localeCode);
     $this->_localeInfo = localeconv();
     if ($this->_localeInfo['frac_digits'] > 10) {
         $this->_localeInfo = null;
     }
 }
示例#2
0
 /**
  * Get \Zend Template
  * @return \Zend_View zend view template object
  */
 public static function getZendTemplate()
 {
     $view = new \Zend_View();
     if (defined('SMARTY_TPL_PATH')) {
         $view->setScriptPath(SMARTY_TPL_PATH);
     }
     $theme = Resource::getCurrentTheme();
     // load the config file which has the images and css url defined
     $view->app_url = OPENBIZ_APP_URL;
     $view->app_index = OPENBIZ_APP_INDEX_URL;
     $view->js_url = OPENBIZ_JS_URL;
     $view->css_url = OPENBIZ_THEME_URL . "/" . $theme . "/css";
     $view->resource_url = OPENBIZ_RESOURCE_URL;
     $view->theme_js_url = OPENBIZ_THEME_URL . "/" . $theme . "/js";
     $view->theme_url = OPENBIZ_THEME_URL . "/" . $theme;
     $view->image_url = OPENBIZ_THEME_URL . "/" . $theme . "/images";
     $view->lang = strtolower(I18n::getCurrentLangCode());
     return $view;
 }
示例#3
0
 /**
  * Get appended styles
  *
  * @return string
  */
 public function getAppendedStyles($comb = 0)
 {
     $extraStyles = implode("", $this->_extraStyles);
     $extraStyle_array = explode("type=\"text/css\">", $extraStyles);
     if (defined("OPENBIZ_RESOURCE_PHP") && $comb) {
         $css_scripts = OPENBIZ_RESOURCE_PHP . "?f=";
         $matches = array();
         foreach ($extraStyle_array as $style) {
             // extract href part from each line
             if (preg_match('/.+href="([^"]+)".+/', $style, $matches) > 0 && !empty($matches[1])) {
                 if (substr($css_scripts, -2) == 'f=') {
                     $css_scripts .= $matches[1];
                 } else {
                     $css_scripts .= ',' . $matches[1];
                 }
             }
         }
         return "<link rel=\"stylesheet\" href=\"" . $css_scripts . "\" type=\"text/css\"/>";
     }
     $cleanStyle_array = array();
     foreach ($extraStyle_array as $style) {
         if (in_array($style . "type=\"text/css\">", $cleanStyle_array) == FALSE and strlen($style) != 0) {
             $cleanStyle_array[] = $style . "type=\"text/css\">";
         }
     }
     $lang = I18n::getCurrentLangCode();
     $localization_css_file = OPENBIZ_APP_PATH . DIRECTORY_SEPARATOR . "languages" . DIRECTORY_SEPARATOR . $lang . DIRECTORY_SEPARATOR . "localization.css";
     if (is_file($localization_css_file)) {
         $cleanStyle_array[] = "<link rel=\"stylesheet\" href=\"" . OPENBIZ_APP_URL . "/languages/{$lang}/localization.css\" type=\"text/css\">";
     }
     return implode("\n", $cleanStyle_array);
 }
示例#4
0
 public static function addLangData($from_module, $to_module = null)
 {
     if ($to_module == null) {
         $to_module = $from_module;
     }
     $langCode = I18n::getCurrentLangCode();
     $filename = "mod.{$from_module}.ini";
     $langFile = OPENBIZ_LANGUAGE_PATH . "/{$langCode}/{$filename}";
     if (!file_exists($langFile)) {
         return false;
     }
     $inidata = parse_ini_file($langFile, false);
     if (is_array(I18n::$_langData[$to_module])) {
         I18n::$_langData[$to_module] = array_merge(I18n::$_langData[$to_module], $inidata);
     } else {
         I18n::$_langData[$to_module] = $inidata;
     }
     return true;
 }