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


PHP Zend_Currency::toCurrency方法代码示例

本文整理汇总了PHP中Zend_Currency::toCurrency方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Currency::toCurrency方法的具体用法?PHP Zend_Currency::toCurrency怎么用?PHP Zend_Currency::toCurrency使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend_Currency的用法示例。


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

示例1: filter

 /**
  * Filter value
  *
  * @param   double $value
  * @return  string
  */
 public function filter($value)
 {
     $value = floatval($value);
     $value = Mage::app()->getStore()->roundPrice($this->_rate * $value);
     //$value = round($value, 2);
     return $this->_currency->toCurrency($value);
 }
开发者ID:arslbbt,项目名称:mangentovies,代码行数:13,代码来源:Filter.php

示例2: filter

 /**
  * Filter value
  *
  * @param   double $value
  * @return  string
  */
 public function filter($value)
 {
     $value = Mage::app()->getLocale()->getNumber($value);
     $value = Mage::app()->getStore()->roundPrice($this->_rate * $value);
     //$value = round($value, 2);
     $value = sprintf("%f", $value);
     return $this->_currency->toCurrency($value);
 }
开发者ID:hirentricore,项目名称:devmagento,代码行数:14,代码来源:Filter.php

示例3: Nice

 /**
  * @return string
  */
 public function Nice($options = array())
 {
     $amount = $this->getAmount();
     if (!isset($options['display'])) {
         $options['display'] = Zend_Currency::USE_SYMBOL;
     }
     if (!isset($options['currency'])) {
         $options['currency'] = $this->getCurrency();
     }
     if (!isset($options['symbol'])) {
         $options['symbol'] = $this->currencyLib->getSymbol($this->getCurrency(), $this->getLocale());
     }
     return is_numeric($amount) ? $this->currencyLib->toCurrency($amount, $options) : '';
 }
开发者ID:ivoba,项目名称:silverstripe-framework,代码行数:17,代码来源:Money.php

示例4: format

 /**
  * Formats a given value
  * @see library/Bvb/Grid/Formatter/Bvb_Grid_Formatter_FormatterInterface::format()
  */
 public function format($value)
 {
     if ($this->_locale === null || !is_numeric($value)) {
         return $value;
     }
     $currency = new Zend_Currency($this->_locale);
     return $currency->toCurrency($value);
 }
开发者ID:ocpyosep78,项目名称:Booking,代码行数:12,代码来源:Currency.php

示例5: getFormat

 /**
  * Retrives pattern with local date format
  * @return string
  */
 public function getFormat()
 {
     $currency = new Zend_Currency(Mage::app()->getStore()->getBaseCurrency()->getCode(), Mage::app()->getLocale()->getLocaleCode());
     $format = $currency->toCurrency('0');
     $format = preg_replace('/\\d+.\\d+/', '%f', $format);
     $format = str_replace(' ', '', $format);
     return $format;
 }
开发者ID:bevello,项目名称:bevello,代码行数:12,代码来源:Explain.php

示例6: currency

 /**
  * Output a formatted currency
  *
  * @param  integer|float                    $value    Currency value to output
  * @param  string|Zend_Locale|Zend_Currency $currency OPTIONAL Currency to use for this call
  * @return string Formatted currency
  */
 public function currency($value = null, $currency = null)
 {
     if ($value === null) {
         return $this;
     }
     if (is_string($currency) || $currency instanceof Zend_Locale) {
         if (Zend_Locale::isLocale($currency)) {
             $currency = array('locale' => $currency);
         }
     }
     if (is_string($currency)) {
         $currency = array('currency' => $currency);
     }
     if (is_array($currency)) {
         return $this->_currency->toCurrency($value, $currency);
     }
     return $this->_currency->toCurrency($value);
 }
开发者ID:bradley-holt,项目名称:zf2,代码行数:25,代码来源:Currency.php

示例7: _getShippingMultiOptions

 private function _getShippingMultiOptions()
 {
     $currency = new Zend_Currency();
     $shipping = new Storefront_Model_Shipping();
     $options = array(0 => 'Please Select');
     foreach ($shipping->getShippingOptions() as $key => $value) {
         $options["{$value}"] = $key . ' - ' . $currency->toCurrency($value);
     }
     return $options;
 }
开发者ID:AkimBolushbek,项目名称:zendframeworkstorefront,代码行数:10,代码来源:Cart.php

示例8: formatPrice

 /**
  * Format Price to locale
  *
  * @param $price
  * @return string
  */
 public static function formatPrice($price)
 {
     try {
         $zCurrency = new \Zend_Currency("de_DE");
         //TODO: fix to use Zend_Locale
         return $zCurrency->toCurrency($price, array('symbol' => Tool::getCurrency()->getSymbol()));
     } catch (\Exception $ex) {
         echo $ex;
     }
     return $price;
 }
开发者ID:Cube-Solutions,项目名称:pimcore-coreshop,代码行数:17,代码来源:Tool.php

示例9: preco

 public function preco($especialidade_id, $simbol = true)
 {
     $salao_id = Zend_Auth::getInstance()->getIdentity()->salao_id;
     $modelEspecialidadePreco = new Model_DbTable_EspecialidadePreco();
     $preco = $modelEspecialidadePreco->getPrecoEspecialidadeSalao($especialidade_id, $salao_id);
     if (!$preco) {
         return "";
     }
     $zendCurrency = new Zend_Currency();
     $options = array();
     if (!$simbol) {
         $options = array('precision' => 2, 'symbol' => '');
     }
     return $zendCurrency->toCurrency($preco->especialidade_preco_preco, $options);
 }
开发者ID:nandorodpires2,项目名称:homemakes,代码行数:15,代码来源:Preco.php

示例10: _getDataColumn

 /**
  * Muestra el dato de la columna
  * @param /Model/Entity/xxxx $item
  * @return array 
  */
 protected function _getDataColumn($item)
 {
     $this->load->library(array("core/fecha/fecha_conversion"));
     $salida = array();
     foreach ($this->_data['columns'] as $key => $value) {
         if (count($value) > 0) {
             if (is_array($value['column_table'])) {
                 $obj = $item;
                 foreach ($value['column_table'] as $i => $metodo) {
                     if ((string) $i == "json") {
                         //fb($value['column_json']);
                         $sha = sha1($obj[$metodo]);
                         if (Zend_Registry::isRegistered($sha)) {
                             $json = Zend_Registry::get($sha);
                         } else {
                             $json = Zend_Json::decode($obj[$metodo]);
                             Zend_Registry::set($sha, $json);
                         }
                         $obj = $json[$value['column_json']];
                     } else {
                         $obj = $obj[$metodo];
                     }
                 }
                 $valor = $obj;
             } else {
                 if (isset($value['column_table']) && isset($item[$value['column_table']])) {
                     $valor = $item[$value['column_table']];
                 } else {
                     $valor = "";
                 }
             }
             switch ($value['column_type']) {
                 case "date":
                     $fecha = $this->fecha_conversion->fechaToDateTime($valor, $value['column_formato']);
                     if ($fecha instanceof DateTime) {
                         $salida[] = $fecha->format($value['column_formato_salida']);
                     } else {
                         $salida[] = "";
                     }
                     break;
                 case "html":
                     $salida[] = str_replace("?", $valor, $value["column_html"]);
                     break;
                 case "helper":
                     $this->load->helper($value["column_helper_path"]);
                     $parametros = array();
                     foreach ($value["column_helper_params"] as $h => $param) {
                         if ((string) $h == "json") {
                             $sha = sha1($valor);
                             if (Zend_Registry::isRegistered($sha)) {
                                 $json = Zend_Registry::get($sha);
                             } else {
                                 $json = Zend_Json::decode($valor);
                                 Zend_Registry::set($sha, $json);
                             }
                             if (isset($json[$param])) {
                                 $parametros[] = $json[$param];
                             } else {
                                 $parametros[] = "";
                             }
                         } else {
                             $parametros[] = $item[$param];
                         }
                     }
                     $salida[] = call_user_func_array($value["column_helper"], $parametros);
                     break;
                 case "money":
                     if (!is_numeric($valor)) {
                         $valor = 0;
                     }
                     $currency = new Zend_Currency(array('value' => $valor));
                     $currency->setFormat(array("precision" => 0));
                     $salida[] = $currency->toCurrency();
                     break;
                 default:
                     $salida[] = $valor;
                     break;
             }
         }
     }
     return $salida;
 }
开发者ID:CarlosAyala,项目名称:midas-codeigniter-modulo-emergencias,代码行数:87,代码来源:Controller.php

示例11: toCurrency

 public static function toCurrency($value)
 {
     $zendCurrency = new Zend_Currency();
     return $zendCurrency->toCurrency($value);
 }
开发者ID:nandorodpires2,项目名称:naopresta,代码行数:5,代码来源:Currency.php

示例12: testSetValueByOutput

 /**
  * @ZF-9941
  */
 public function testSetValueByOutput()
 {
     $currency = new Zend_Currency(array('value' => 1000, 'locale' => 'de_AT'));
     $this->assertEquals('€ 2.000,00', $currency->toCurrency(null, array('value' => 2000)));
 }
开发者ID:ThorstenSuckow,项目名称:conjoon,代码行数:8,代码来源:CurrencyTest.php

示例13: testSetFormat

    /**
     * testing setFormat
     *
     */
    public function testSetFormat()
    {
        $locale = new Zend_Locale('en_US');
        $USD    = new Zend_Currency('USD','en_US');

        $USD->setFormat(array('script' => 'Arab'));
        $this->assertSame('$ ٥٣,٢٩٢.١٨', $USD->toCurrency(53292.18));

        $USD->setFormat(array('script' => 'Arab', 'format' => 'de_AT'));
        $this->assertSame('$ ٥٣.٢٩٢,١٨', $USD->toCurrency(53292.18));

        $USD->setFormat(array('script' => 'Latn', 'format' => 'de_AT'));
        $this->assertSame('$ 53.292,18', $USD->toCurrency(53292.18));

        $USD->setFormat(array('script' => 'Latn', 'format' => $locale));
        $this->assertSame('$ 53,292.18', $USD->toCurrency(53292.18));

        // allignment of currency signs
        $USD->setFormat(array('position' => Zend_Currency::RIGHT, 'format' => 'de_AT'));
        $this->assertSame('53.292,18 $', $USD->toCurrency(53292.18));

        $USD->setFormat(array('position' => Zend_Currency::RIGHT, 'format' => $locale));
        $this->assertSame('53,292.18 $', $USD->toCurrency(53292.18));

        $USD->setFormat(array('position' => Zend_Currency::LEFT, 'format' => 'de_AT'));
        $this->assertSame('$ 53.292,18', $USD->toCurrency(53292.18));

        $USD->setFormat(array('position' => Zend_Currency::LEFT, 'format' => $locale));
        $this->assertSame('$ 53,292.18', $USD->toCurrency(53292.18));

        $USD->setFormat(array('position' => Zend_Currency::STANDARD, 'format' => 'de_AT'));
        $this->assertSame('$ 53.292,18', $USD->toCurrency(53292.18));

        $USD->setFormat(array('position' => Zend_Currency::STANDARD, 'format' => $locale));
        $this->assertSame('$ 53,292.18', $USD->toCurrency(53292.18));

        // enable/disable currency symbols & currency names
        $USD->setFormat(array('display' => Zend_Currency::NO_SYMBOL, 'format' => 'de_AT'));
        $this->assertSame('53.292,18', $USD->toCurrency(53292.18));

        $USD->setFormat(array('display' => Zend_Currency::NO_SYMBOL, 'format' => $locale));
        $this->assertSame('53,292.18', $USD->toCurrency(53292.18));

        $USD->setFormat(array('display' => Zend_Currency::USE_SHORTNAME, 'format' => 'de_AT'));
        $this->assertSame('USD 53.292,18', $USD->toCurrency(53292.18));

        $USD->setFormat(array('display' => Zend_Currency::USE_SHORTNAME, 'format' => $locale));
        $this->assertSame('USD 53,292.18', $USD->toCurrency(53292.18));

        $USD->setFormat(array('display' => Zend_Currency::USE_NAME, 'format' => 'de_AT'));
        $this->assertSame('US Dollar 53.292,18', $USD->toCurrency(53292.18));

        $USD->setFormat(array('display' => Zend_Currency::USE_NAME, 'format' => $locale));
        $this->assertSame('US Dollar 53,292.18', $USD->toCurrency(53292.18));

        $USD->setFormat(array('display' => Zend_Currency::USE_SYMBOL, 'format' => 'de_AT'));
        $this->assertSame('$ 53.292,18', $USD->toCurrency(53292.18));

        $USD->setFormat(array('display' => Zend_Currency::USE_SYMBOL, 'format' => $locale));
        $this->assertSame('$ 53,292.18', $USD->toCurrency(53292.18));
    }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:65,代码来源:CurrencyTest.php

示例14: testToCurrencyWithLocaleWhichHasParentLocale

 /**
  * @group GH-516
  */
 public function testToCurrencyWithLocaleWhichHasParentLocale()
 {
     $currency = new Zend_Currency(null, 'es_AR');
     $this->assertEquals('$10,00', $currency->toCurrency(10));
 }
开发者ID:crodriguezn,项目名称:crossfit-milagro,代码行数:8,代码来源:CurrencyTest.php

示例15: formatCurrency

 public function formatCurrency($amount, $locale = null, $currency = null)
 {
     $currency = new Zend_Currency($currency, $locale);
     return $currency->toCurrency($amount);
 }
开发者ID:jmfontaine,项目名称:kornak,代码行数:5,代码来源:FormatCurrency.php


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