mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-09-18 23:46:21 +02:00
b1d2e3906b
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@47766 467b73ca-7a2a-4603-9d3b-597d59a354a9
30 lines
592 B
PHP
30 lines
592 B
PHP
<?php
|
|
|
|
/**
|
|
* @package sapphire
|
|
* @subpackage model
|
|
*/
|
|
|
|
/**
|
|
* Represents a decimal field containing a currency amount.
|
|
* Currency the currency class only supports single currencies.
|
|
* @package sapphire
|
|
* @subpackage model
|
|
*/
|
|
class Currency extends Decimal {
|
|
|
|
function Nice() {
|
|
// return "<span title=\"$this->value\">$" . number_format($this->value, 2) . '</span>';
|
|
return '$' . number_format($this->value, 2);
|
|
}
|
|
|
|
function Whole() {
|
|
return '$' . number_format($this->value, 0);
|
|
}
|
|
|
|
function setValue($value) {
|
|
$this->value = ereg_replace('[^0-9.]+','', $value);
|
|
}
|
|
}
|
|
|
|
?>
|