2016-10-06 15:57:01 +00:00
|
|
|
|
<?php
|
2018-12-10 12:13:27 +00:00
|
|
|
|
|
2016-10-06 15:57:01 +00:00
|
|
|
|
/**
|
|
|
|
|
* Project:
|
|
|
|
|
* Contenido Content Management System
|
|
|
|
|
*
|
|
|
|
|
* Description:
|
|
|
|
|
*
|
|
|
|
|
* Requirements:
|
|
|
|
|
* @con_php_req 5.0
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
* @package Contenido Backend classes
|
|
|
|
|
* @version 1.0
|
|
|
|
|
* @author
|
|
|
|
|
* @copyright four for business AG <www.4fb.de>
|
|
|
|
|
* @license http://www.contenido.org/license/LIZENZ.txt
|
|
|
|
|
* @link http://www.4fb.de
|
|
|
|
|
* @link http://www.contenido.org
|
|
|
|
|
*
|
|
|
|
|
* {@internal
|
|
|
|
|
*
|
|
|
|
|
* $Id: class.datatype.currency.php 306 2014-03-13 23:03:26Z oldperl $:
|
|
|
|
|
* }}
|
|
|
|
|
*
|
|
|
|
|
*/
|
2018-12-10 12:13:27 +00:00
|
|
|
|
if (!defined('CON_FRAMEWORK')) {
|
|
|
|
|
die('Illegal call');
|
2016-10-06 15:57:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
define("cDatatypeCurrency_Left", 1);
|
|
|
|
|
define("cDatatypeCurrency_Right", 2);
|
|
|
|
|
|
2018-12-10 12:13:27 +00:00
|
|
|
|
class cDatatypeCurrency extends cDatatypeNumber {
|
|
|
|
|
|
|
|
|
|
var $_cCurrencyLocation;
|
|
|
|
|
var $_sCurrencySymbol;
|
|
|
|
|
|
|
|
|
|
function __construct() {
|
|
|
|
|
cDatatypeNumber::__construct();
|
|
|
|
|
|
|
|
|
|
$this->setCurrencySymbolLocation(cDatatypeCurrency_Right);
|
|
|
|
|
$this->setCurrencySymbol("<EFBFBD>");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function setCurrencySymbol($sSymbol) {
|
|
|
|
|
$this->_sCurrencySymbol = $sSymbol;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getCurrencySymbol() {
|
|
|
|
|
return ($this->_sCurrencySymbol);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function setCurrencySymbolLocation($cLocation) {
|
|
|
|
|
switch ($cLocation) {
|
|
|
|
|
case cDatatypeCurrency_Left:
|
|
|
|
|
case cDatatypeCurrency_Right:
|
|
|
|
|
$this->_cCurrencyLocation = $cLocation;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
cWarning(__FILE__, __LINE__, "Warning: No valid cDatatypeCurrency_* Constant given. Available values: cDatatypeCurrency_Left, cDatatypeCurrency_Right");
|
|
|
|
|
return;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function render() {
|
|
|
|
|
$value = parent::render();
|
|
|
|
|
|
|
|
|
|
switch ($this->_cCurrencyLocation) {
|
|
|
|
|
case cDatatypeCurrency_Left:
|
|
|
|
|
return sprintf("%s %s", $this->_sCurrencySymbol, $value);
|
|
|
|
|
break;
|
|
|
|
|
case cDatatypeCurrency_Right:
|
|
|
|
|
return sprintf("%s %s", $value, $this->_sCurrencySymbol);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-10-06 15:57:01 +00:00
|
|
|
|
}
|
2018-12-10 12:13:27 +00:00
|
|
|
|
|
2016-10-06 15:57:01 +00:00
|
|
|
|
?>
|