예제 #1
0
 /**
  * @return Gpf_Common_NumberUtils
  */
 public static function getInstance()
 {
     if (self::$instance == NULL) {
         self::$instance = new self();
     }
     return self::$instance;
 }
/**
 * Smarty {localize} function plugin
 *
 * Type:     function<br>
 * Name:     localize<br>
 *
 * Examples:
 * <pre>
 * {ratioPercentage p1='25' p2='35'}
 * </pre>
 * @author   Andrej Harsani, Michal Bebjak   
 * @param    array
 * @param    Smarty
 * @return   string
 */
function smarty_function_ratioPercentage($params, &$smarty) {
	if ($params['p2']!=0) {
	    $number = round($params['p1']/$params['p2']*100,Pap_Common_Utils_CurrencyUtils::getDefaultCurrencyPrecision());
    	return Gpf_Common_NumberUtils::toStandardNumberFormat($number, Pap_Common_Utils_CurrencyUtils::getDefaultCurrencyPrecision()) . ' %';
	} else {
		return '0';
	}
}
예제 #3
0
/**
 * Smarty |number modifier
 *
 * Type:     function<br>
 * Name:     localize<br>
 *
 * Examples:
 * <pre>
 * {$allCommission|number}
 * </pre>
 * @author   Michal Bebjak
 * @param    string
 * @return   string
 */
function smarty_modifier_number($number)
{
    return Gpf_Common_NumberUtils::toStandardNumberFormat($number, 0);
}
/**
 * Smarty |number_span modifier
 *
 * Type:     function<br>
 * Name:     localize<br>
 *
 * Examples:
 * <pre>
 * {$allCommission|number}
 * </pre>
 * @author   Michal Bebjak
 * @param    string
 * @return   string
 */
function smarty_modifier_number_span($number)
{
    return '<span class="NumberData">' . Gpf_Common_NumberUtils::toStandardNumberFormat($number, 0) . '</span>';
}