7
* This source file is subject to the new BSD license that is bundled
8
* with this package in the file LICENSE.txt.
9
* It is also available through the world-wide-web at this URL:
10
* http://framework.zend.com/license/new-bsd
11
* If you did not receive a copy of the license and are unable to
12
* obtain it through the world-wide-web, please send an email
13
* to license@zend.com so we can send you a copy immediately.
17
* @subpackage Form_Element
18
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
19
* @license http://framework.zend.com/license/new-bsd New BSD License
22
/** Zend_Dojo_Form_Element_NumberTextBox */
23
require_once 'Zend/Dojo/Form/Element/NumberTextBox.php';
26
* CurrencyTextBox dijit
28
* @uses Zend_Dojo_Form_Element_NumberTextBox
30
* @subpackage Form_Element
31
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
32
* @license http://framework.zend.com/license/new-bsd New BSD License
33
* @version $Id: CurrencyTextBox.php 10079 2008-07-14 10:56:37Z matthew $
35
class Zend_Dojo_Form_Element_CurrencyTextBox extends Zend_Dojo_Form_Element_NumberTextBox
38
* Use CurrencyTextBox dijit view helper
41
public $helper = 'CurrencyTextBox';
46
* @param string $currency
47
* @return Zend_Dojo_Form_Element_CurrencyTextBox
49
public function setCurrency($currency)
51
$this->setDijitParam('currency', (string) $currency);
60
public function getCurrency()
62
return $this->getDijitParam('currency');
68
* Casts to string, uppercases, and trims to three characters.
70
* @param string $symbol
71
* @return Zend_Dojo_Form_Element_CurrencyTextBox
73
public function setSymbol($symbol)
75
$symbol = strtoupper((string) $symbol);
76
$length = strlen($symbol);
78
require_once 'Zend/Form/Element/Exception.php';
79
throw new Zend_Form_Element_Exception('Invalid symbol provided; please provide ISO 4217 alphabetic currency code');
82
$symbol = substr($symbol, 0, 3);
85
$this->setConstraint('symbol', $symbol);
94
public function getSymbol()
96
return $this->getConstraint('symbol');
100
* Set whether currency is fractional
103
* @return Zend_Dojo_Form_Element_CurrencyTextBox
105
public function setFractional($flag)
107
$this->setConstraint('fractional', (bool) $flag);
112
* Get whether or not to present fractional values
116
public function getFractional()
118
return ('true' == $this->getConstraint('fractional'));