Overview

Packages

  • Core
    • Authentication
    • Backend
    • Cache
    • CEC
    • Chain
    • ContentType
    • Database
    • Datatype
    • Debug
    • Exception
    • Frontend
      • Search
      • URI
      • Util
    • GenericDB
      • Model
    • GUI
      • HTML
    • I18N
    • LayoutHandler
    • Log
    • Security
    • Session
    • Util
    • Validation
    • Versioning
    • XML
  • Module
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
  • mpAutoloaderClassMap
  • None
  • Plugin
    • ContentAllocation
    • CronjobOverview
    • FormAssistant
    • FrontendLogic
    • FrontendUsers
    • Linkchecker
    • ModRewrite
    • Newsletter
    • Repository
      • FrontendNavigation
      • KeywordDensity
    • SearchSolr
    • SmartyWrapper
    • UrlShortener
    • UserForum
    • Workflow
  • PluginManager
  • Setup
    • Form
    • GUI
    • Helper
      • Environment
      • Filesystem
      • MySQL
      • PHP
    • UpgradeJob

Classes

  • cDatatype
  • cDatatypeCurrency
  • cDatatypeDateTime
  • cDatatypeNumber
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo
  1: <?php
  2: /**
  3:  * This file contains the currency datatype class.
  4:  *
  5:  * @package Core
  6:  * @subpackage Datatype
  7:  * @version SVN Revision $Rev:$
  8:  *
  9:  * @author unknown
 10:  * @copyright four for business AG <www.4fb.de>
 11:  * @license http://www.contenido.org/license/LIZENZ.txt
 12:  * @link http://www.4fb.de
 13:  * @link http://www.contenido.org
 14:  */
 15: 
 16: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
 17: 
 18: /**
 19:  * Currency datatype class.
 20:  * @deprecated 2013-11-17 This class is not longer supported.
 21:  * @package Core
 22:  * @subpackage Datatype
 23:  */
 24: class cDatatypeCurrency extends cDatatypeNumber {
 25: 
 26:     /**
 27:      * Currency symbol is displayed left of value.
 28:      *
 29:      * @var int
 30:      */
 31:     const LEFT = 1;
 32: 
 33:     /**
 34:      * Currency symbol is displayed right of value.
 35:      *
 36:      * @var int
 37:      */
 38:     const RIGHT = 2;
 39: 
 40:     /**
 41:      * Position of currency symbol relative to its value.
 42:      * Can be either cDatatypeCurrency::LEFT or cDatatypeCurrency::RIGHT.
 43:      *
 44:      * @var int
 45:      */
 46:     protected $_cCurrencyLocation;
 47: 
 48:     /**
 49:      * Currency symbol to be displayed.
 50:      *
 51:      * @var string
 52:      */
 53:     protected $_sCurrencySymbol;
 54: 
 55:     /**
 56:      * Create new instance.
 57:      */
 58:     public function __construct() {
 59:         parent::__construct();
 60: 
 61:         $this->setCurrencySymbolLocation(self::RIGHT);
 62:         $this->setCurrencySymbol("�");
 63:     }
 64: 
 65:     /**
 66:      * Return current currency symbol to display.
 67:      *
 68:      * @return string
 69:      */
 70:     public function getCurrencySymbol() {
 71:         return ($this->_sCurrencySymbol);
 72:     }
 73: 
 74:     /**
 75:      * Sets current currency symbol to display.
 76:      *
 77:      * @param string $sSymbol
 78:      */
 79:     public function setCurrencySymbol($sSymbol) {
 80:         $this->_sCurrencySymbol = $sSymbol;
 81:     }
 82: 
 83:     /**
 84:      * Sets current currency symbol location.
 85:      * Can be either cDatatypeCurrency::LEFT or cDatatypeCurrency::RIGHT.
 86:      *
 87:      * @param int $cLocation
 88:      * @throws cInvalidArgumentException if the given location is not one of the
 89:      *         constants cDatatypeCurrency::LEFT and cDatatypeCurrency::RIGHT
 90:      */
 91:     public function setCurrencySymbolLocation($cCurrencyLocation) {
 92:         switch ($cCurrencyLocation) {
 93:             case self::LEFT:
 94:             case self::RIGHT:
 95:                 $this->_cCurrencyLocation = $cCurrencyLocation;
 96:                 break;
 97:             default:
 98:                 throw new cInvalidArgumentException('Warning: No valid cDatatypeCurrency::* Constant given. Available values: cDatatypeCurrency::LEFT, cDatatypeCurrency::RIGHT');
 99:         }
100:     }
101: 
102:     /**
103:      * (non-PHPdoc)
104:      *
105:      * @see cDatatypeNumber::render()
106:      */
107:     public function render() {
108:         $value = parent::render();
109: 
110:         switch ($this->_cCurrencyLocation) {
111:             case self::LEFT:
112:                 return sprintf("%s %s", $this->_sCurrencySymbol, $value);
113:                 break;
114:             case self::RIGHT:
115:                 return sprintf("%s %s", $value, $this->_sCurrencySymbol);
116:                 break;
117:         }
118:     }
119: }
120: 
121: ?>
CMS CONTENIDO 4.9.5 API documentation generated by ApiGen 2.8.0