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
    • NavigationMain
    • 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:  *
21:  * @package          Core
22:  * @subpackage       Datatype
23:  */
24: class cDatatypeCurrency extends cDatatypeNumber {
25: 
26:     protected $_cCurrencyLocation;
27: 
28:     protected $_sCurrencySymbol;
29: 
30:     const LEFT = 1;
31: 
32:     const RIGHT = 2;
33: 
34:     public function __construct() {
35:         parent::__construct();
36: 
37:         $this->setCurrencySymbolLocation(self::RIGHT);
38:         $this->setCurrencySymbol("�");
39:     }
40: 
41:     public function setCurrencySymbol($sSymbol) {
42:         $this->_sCurrencySymbol = $sSymbol;
43:     }
44: 
45:     public function getCurrencySymbol() {
46:         return ($this->_sCurrencySymbol);
47:     }
48: 
49:     /**
50:      * @throws cInvalidArgumentException if the given location is not one of the constants cDatatypeCurrency::LEFT and cDatatypeCurrency::RIGHT
51:      */
52:     public function setCurrencySymbolLocation($cLocation) {
53:         switch ($cLocation) {
54:             case self::LEFT:
55:             case self::RIGHT:
56:                 $this->_cCurrencyLocation = $cLocation;
57:                 break;
58:             default:
59:                 throw new cInvalidArgumentException('Warning: No valid cDatatypeCurrency::* Constant given. Available values: cDatatypeCurrency::LEFT, cDatatypeCurrency::RIGHT');
60:         }
61:     }
62: 
63:     public function render() {
64:         $value = parent::render();
65: 
66:         switch ($this->_cCurrencyLocation) {
67:             case self::LEFT:
68:                 return sprintf("%s %s", $this->_sCurrencySymbol, $value);
69:                 break;
70:             case self::RIGHT:
71:                 return sprintf("%s %s", $value, $this->_sCurrencySymbol);
72:                 break;
73:         }
74:     }
75: 
76: }
77: 
78: ?>
CMS CONTENIDO 4.9.0 API documentation generated by ApiGen 2.8.0