ILIAS  Release_4_1_x_branch Revision 61804
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilPaymentCurrency Class Reference
+ Collaboration diagram for ilPaymentCurrency:

Public Member Functions

 ilPaymentCurrency ($a_currency_id= '')
 setCurrencyId ($a_currency_id)
 getCurrencyId ()
 setUnit ($a_unit)
 getUnit ()
 setIsoCode ($a_iso_code)
 getIsoCode ()
 setSymbol ($a_symbol)
 getSymbol ()
 setConversionRate ($a_conversion_rate)
 getConversionRate ()
 addCurrency ()
 deleteCurrency ()
 updateCurrency ()

Static Public Member Functions

static _getAvailableCurrencies ()
static _getCurrency ($a_currency_id)
static _getUnit ($a_currency_id)
static _getSymbol ($a_currency_id)
static _getConversionRate ($a_currency_id)
static _getCurrencyBySymbol ($a_currency_symbol)
static _getDefaultCurrency ()
static _updateIsDefault ($a_currency_id)
static _getDecimalSeparator ()
static _formatPriceToString ($a_price, $a_currency_symbol=false)
static _isDefault ($a_currency_id)

Private Attributes

 $currency_id
 $unit
 $iso_code
 $symbol
 $conversion_rate

Detailed Description

Definition at line 15 of file class.ilPaymentCurrency.php.

Member Function Documentation

static ilPaymentCurrency::_formatPriceToString (   $a_price,
  $a_currency_symbol = false 
)
static

Definition at line 254 of file class.ilPaymentCurrency.php.

References $_SESSION, $separator, and _getDecimalSeparator().

{
if(!$a_currency_symbol)
{
$currency_obj = $_SESSION['payment_currency'];
$currency_symbol = $currency_obj['symbol'];
}
else $currency_symbol = $a_currency_symbol;
$price_string = number_format($a_price,'2',$separator,'');
return $price_string . ' ' . $currency_symbol;
}

+ Here is the call graph for this function:

static ilPaymentCurrency::_getAvailableCurrencies ( )
static

Definition at line 109 of file class.ilPaymentCurrency.php.

References $ilDB, $res, and $row.

Referenced by _updateIsDefault(), ilObjPaymentSettingsGUI\currenciesObject(), ilPaymentObjectGUI\performAddPrice(), and ilObjPaymentSettingsGUI\performAddPriceObject().

{
global $ilDB;
$res = $ilDB->query('SELECT * FROM payment_currencies');
while($row = $ilDB->fetchAssoc($res))
{
$currencies[$row['currency_id']] = $row;
/* $currencies[$row->currency_id]['currency_id'] = $row->currency_id;
$currencies[$row->currency_id]['unit'] = $row->unit;
$currencies[$row->currency_id]['iso_code'] = $row->subunit;
*/
}
return $currencies ? $currencies : array();
}

+ Here is the caller graph for this function:

static ilPaymentCurrency::_getConversionRate (   $a_currency_id)
static

Definition at line 179 of file class.ilPaymentCurrency.php.

References $ilDB, $res, and $row.

Referenced by _updateIsDefault().

{
global $ilDB;
$res = $ilDB->queryF('
SELECT conversion_rate FROM payment_currencies WHERE currency_id = %s',
array('integer'), array($a_currency_id));
while($row = $ilDB->fetchObject($res))
{
return (float)$row->conversion_rate;
}
return false;
}

+ Here is the caller graph for this function:

static ilPaymentCurrency::_getCurrency (   $a_currency_id)
static

Definition at line 127 of file class.ilPaymentCurrency.php.

References $ilDB, $res, and $row.

Referenced by ilObjPaymentSettingsGUI\editCurrencyObject(), ilPaymentObjectGUI\editPrices(), and ilObjPaymentSettingsGUI\editPricesObject().

{
global $ilDB;
$res = $ilDB->queryf('
SELECT * FROM payment_currencies WHERE currency_id = %s',
array('integer'), array($a_currency_id));
while($row = $ilDB->fetchAssoc($res))
{
$currencies[$row['currency_id']] = $row;
/* while($row = $ilDB->fetchObject($res))
{
$currencies['currency_id'] = $row->currency_id;
$currencies['unit'] = $row->unit;
$currencies['subunit'] = $row->subunit;*/
}
return $currencies;
}

+ Here is the caller graph for this function:

static ilPaymentCurrency::_getCurrencyBySymbol (   $a_currency_symbol)
static

Definition at line 193 of file class.ilPaymentCurrency.php.

References $ilDB, $res, and $row.

{
global $ilDB;
$res = $ilDB->queryF('SELECT * FROM payment_currencies WHERE symbol = %s',
array('text'), array($a_currency_symbol));
$row = $ilDB->fetchAssoc($res);
return $row;
}
static ilPaymentCurrency::_getDecimalSeparator ( )
static

Definition at line 237 of file class.ilPaymentCurrency.php.

References $separator.

Referenced by _formatPriceToString().

{
global $ilUser;
$user_lang = $ilUser->getLanguage();
// look for ISO 639-1
$comma_countries = array(
'sq','es','fr','pt', 'bg','de','da','et','fo','fi','el','id','is','it',
'hr','lv','lt','lb','mk','mo','nl','no','pl','pt','ro','ru','sv','sr',
'sk','sl','af','ce','cs','tr','uk','hu');
in_array($user_lang, $comma_countries) ? $separator = ',' : $separator = '.';
return $separator;
}

+ Here is the caller graph for this function:

static ilPaymentCurrency::_getDefaultCurrency ( )
static

Definition at line 204 of file class.ilPaymentCurrency.php.

References $ilDB, $res, and $row.

{
global $ilDB;
$res = $ilDB->query('SELECT * FROM payment_currencies WHERE is_default = 1');
$row = $ilDB->fetchAssoc($res);
return $row;
}
static ilPaymentCurrency::_getSymbol (   $a_currency_id)
static

Definition at line 164 of file class.ilPaymentCurrency.php.

References $ilDB, $res, and $row.

{
global $ilDB;
$res = $ilDB->queryf('
SELECT symbol FROM payment_currencies WHERE currency_id = %s',
array('integer'), array($a_currency_id));
while($row = $ilDB->fetchObject($res))
{
return $row->symbol;
}
return false;
}
static ilPaymentCurrency::_getUnit (   $a_currency_id)
static

Definition at line 149 of file class.ilPaymentCurrency.php.

References $ilDB, $res, and $row.

Referenced by ilPurchaseBaseGUI\__showShoppingCart(), ilPaymentStatisticGUI\addCustomer(), ilObjPaymentSettingsGUI\addCustomerObject(), ilObjPaymentSettingsGUI\deleteCurrencyObject(), and ilObjPaymentSettingsGUI\saveCustomerObject().

{
global $ilDB;
$res = $ilDB->queryf('
SELECT unit FROM payment_currencies WHERE currency_id = %s',
array('integer'), array($a_currency_id));
while($row = $ilDB->fetchObject($res))
{
return $row->unit;
}
return false;
}

+ Here is the caller graph for this function:

static ilPaymentCurrency::_isDefault (   $a_currency_id)
static

Definition at line 269 of file class.ilPaymentCurrency.php.

References $ilDB, $res, and $row.

Referenced by ilObjPaymentSettingsGUI\deleteCurrencyObject().

{
global $ilDB;
$res = $ilDB->queryF('SELECT is_default FROM payment_currencies WHERE currency_id = %s',
array('integer'), array((int)$a_currency_id));
$row = $ilDB->fetchAssoc($res);
if($row['is_default'] == '1') {
return true;
}else
return false;
}

+ Here is the caller graph for this function:

static ilPaymentCurrency::_updateIsDefault (   $a_currency_id)
static

Definition at line 214 of file class.ilPaymentCurrency.php.

References $conversion_rate, $ilDB, _getAvailableCurrencies(), and _getConversionRate().

Referenced by ilObjPaymentSettingsGUI\updateDefaultCurrencyObject().

{
global $ilDB;
// calculate other currencies to default_currency
foreach ($currencies as $tmp_cur)
{
//calculate conversion rates
$con_result = round((float)$tmp_cur['conversion_rate'] / (float)$conversion_rate, 4);
$upd = $ilDB->update('payment_currencies',
array( 'conversion_rate' => array('float', $con_result),
'is_default' => array('integer', 0)),
array('currency_id' => array('integer', $tmp_cur['currency_id'])));
}
$new_default = $ilDB->update('payment_currencies',
array( 'is_default' => array('integer', 1)),
array('currency_id' => array('integer', $a_currency_id)));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPaymentCurrency::addCurrency ( )

Definition at line 78 of file class.ilPaymentCurrency.php.

References getConversionRate(), getIsoCode(), getSymbol(), and getUnit().

{
$nextId = $this->db->nextID('payment_currencies');
$this->db->manipulateF('INSERT INTO payment_currencies
(currency_id, unit, iso_code, symbol, conversion_rate)
VALUES (%s, %s, %s, %s, %s)',
array('integer', 'text','text','text','float'),
array($nextId, $this->getUnit(), $this->getIsoCode(), $this->getSymbol(), $this->getConversionRate()));
return true;
}

+ Here is the call graph for this function:

ilPaymentCurrency::deleteCurrency ( )

Definition at line 90 of file class.ilPaymentCurrency.php.

References getCurrencyId().

{
$this->db->manipulateF('DELETE FROM payment_currencies WHERE currency_id = %s',
array('integer'), array($this->getCurrencyId()));
}

+ Here is the call graph for this function:

ilPaymentCurrency::getConversionRate ( )

Definition at line 73 of file class.ilPaymentCurrency.php.

References $conversion_rate.

Referenced by addCurrency(), and updateCurrency().

+ Here is the caller graph for this function:

ilPaymentCurrency::getCurrencyId ( )

Definition at line 39 of file class.ilPaymentCurrency.php.

References $currency_id.

Referenced by deleteCurrency(), and updateCurrency().

{
}

+ Here is the caller graph for this function:

ilPaymentCurrency::getIsoCode ( )

Definition at line 56 of file class.ilPaymentCurrency.php.

References $iso_code.

Referenced by addCurrency(), and updateCurrency().

{
}

+ Here is the caller graph for this function:

ilPaymentCurrency::getSymbol ( )

Definition at line 65 of file class.ilPaymentCurrency.php.

References $symbol.

Referenced by addCurrency(), and updateCurrency().

{
return $this->symbol;
}

+ Here is the caller graph for this function:

ilPaymentCurrency::getUnit ( )

Definition at line 48 of file class.ilPaymentCurrency.php.

References $unit.

Referenced by addCurrency(), and updateCurrency().

{
return $this->unit;
}

+ Here is the caller graph for this function:

ilPaymentCurrency::ilPaymentCurrency (   $a_currency_id = '')

Definition at line 24 of file class.ilPaymentCurrency.php.

References $ilDB.

{
global $ilDB;
$this->db = $ilDB;
$this->currency_id = $a_currency_id;
}
ilPaymentCurrency::setConversionRate (   $a_conversion_rate)

Definition at line 69 of file class.ilPaymentCurrency.php.

{
$this->conversion_rate = (float)$a_conversion_rate;
}
ilPaymentCurrency::setCurrencyId (   $a_currency_id)

Definition at line 35 of file class.ilPaymentCurrency.php.

{
$this->currency_id = $a_currency_id;
}
ilPaymentCurrency::setIsoCode (   $a_iso_code)

Definition at line 52 of file class.ilPaymentCurrency.php.

{
$this->iso_code = $a_iso_code;
}
ilPaymentCurrency::setSymbol (   $a_symbol)

Definition at line 61 of file class.ilPaymentCurrency.php.

{
$this->symbol = $a_symbol;
}
ilPaymentCurrency::setUnit (   $a_unit)

Definition at line 44 of file class.ilPaymentCurrency.php.

{
$this->unit = $a_unit;
}
ilPaymentCurrency::updateCurrency ( )

Definition at line 96 of file class.ilPaymentCurrency.php.

References getConversionRate(), getCurrencyId(), getIsoCode(), getSymbol(), and getUnit().

{
$this->db->manipulateF('UPDATE payment_currencies
SET unit = %s,
iso_code = %s,
symbol = %s,
conversion_rate = %s
WHERE currency_id = %s',
array('text','text','text','float','integer'),
array($this->getUnit(), $this->getIsoCode(), $this->getSymbol(),
$this->getConversionRate(), $this->getCurrencyId()));
}

+ Here is the call graph for this function:

Field Documentation

ilPaymentCurrency::$conversion_rate
private

Definition at line 22 of file class.ilPaymentCurrency.php.

Referenced by _updateIsDefault(), and getConversionRate().

ilPaymentCurrency::$currency_id
private

Definition at line 18 of file class.ilPaymentCurrency.php.

Referenced by getCurrencyId().

ilPaymentCurrency::$iso_code
private

Definition at line 20 of file class.ilPaymentCurrency.php.

Referenced by getIsoCode().

ilPaymentCurrency::$symbol
private

Definition at line 21 of file class.ilPaymentCurrency.php.

Referenced by getSymbol().

ilPaymentCurrency::$unit
private

Definition at line 19 of file class.ilPaymentCurrency.php.

Referenced by getUnit().


The documentation for this class was generated from the following file: