/** * Smarty |currency_span modifier * * Type: function<br> * Name: localize<br> * * Examples: * <pre> * {$allCommission|currency_span} * </pre> * @author Michal Bebjak * @param string * @return string */ function smarty_modifier_currency_span($number) { $cssClass = 'CurrencyData'; if ($number < 0) { $cssClass .= ' CurrencyData-negative'; } $number = number_format($number, Pap_Common_Utils_CurrencyUtils::getDefaultCurrencyPrecision(), Gpf_Settings_Regional::getInstance()->getDecimalSeparator(), Gpf_Settings_Regional::getInstance()->getThousandsSeparator()); return '<span class="'.$cssClass.'">'.Pap_Common_Utils_CurrencyUtils::stringToCurrencyFormat($number).'</span>'; }
/** * formats the value to the number format according to the number settings * * @param number $value * @param int $precision * @return string */ public static function toStandardNumberFormat($value, $precision = 2) { if ($value == null || $value == '') { return $value; } $thousandsSeparator = Gpf_Settings_Regional::getInstance()->getThousandsSeparator(); $decimalSeparator = Gpf_Settings_Regional::getInstance()->getDecimalSeparator(); if ($thousandsSeparator == NULL || $decimalSeparator == NULL) { return $value; } return self::formatNumber($value, $decimalSeparator, $thousandsSeparator, $precision); }
protected function loadSetting() { $this->addValue("theme", Gpf_Session::getAuthUser()->getTheme()); $this->addValue("date_time_format", 'MM/d/yyyy HH:mm:ss'); $this->addValue("programVersion", Gpf_Application::getInstance()->getVersion()); $this->addValue(Gpf_Settings_Gpf::NOT_FORCE_EMAIL_USERNAMES, Gpf_Settings::get(Gpf_Settings_Gpf::NOT_FORCE_EMAIL_USERNAMES)); $quickLaunchSettings = new Gpf_Desktop_QuickLaunch(); $this->addValue(Gpf_Desktop_QuickLaunch::SHOW_QUICK_LAUNCH, $quickLaunchSettings->getShowQuickLaunch()); $this->addValue(Gpf_Settings_Gpf::REGIONAL_SETTINGS_THOUSANDS_SEPARATOR, Gpf_Settings_Regional::getInstance()->getThousandsSeparator()); $this->addValue(Gpf_Settings_Gpf::REGIONAL_SETTINGS_DECIMAL_SEPARATOR, Gpf_Settings_Regional::getInstance()->getDecimalSeparator()); $this->addValue(Gpf_Settings_Gpf::REGIONAL_SETTINGS_DATE_FORMAT, Gpf_Settings_Regional::getInstance()->getDateFormat()); $this->addValue(Gpf_Settings_Gpf::REGIONAL_SETTINGS_TIME_FORMAT, Gpf_Settings_Regional::getInstance()->getTimeFormat()); Gpf_Plugins_Engine::extensionPoint('Core.loadSetting', $this); }
public static function getTimeInLocaleFormat($time = '') { if ($time == '') { $time = time(); } $format = Gpf_Common_DateUtils::convertDateFormatJava2PHP(Gpf_Settings_Regional::getInstance()->getTimeFormat()); return date($format, $time); }
/** * Smarty |currency modifier * * Type: function<br> * Name: localize<br> * * Examples: * <pre> * {$allCommission|currency} * </pre> * @author Michal Bebjak * @param string * @return string */ function smarty_modifier_currency($number) { $number = number_format($number, Pap_Common_Utils_CurrencyUtils::getDefaultCurrencyPrecision(), Gpf_Settings_Regional::getInstance()->getDecimalSeparator(), Gpf_Settings_Regional::getInstance()->getThousandsSeparator()); return Pap_Common_Utils_CurrencyUtils::stringToCurrencyFormat($number); }