Public Member Functions | |
| ilPaymentPrices ($a_pobject_id=0) | |
| getPobjectId () | |
| getPrices () | |
| getPrice ($a_price_id) | |
| _getPrice ($a_price_id) | |
| _countPrices ($a_pobject_id) | |
| _getPriceString ($a_price_id) | |
| _getTotalAmount ($a_price_ids) | |
| setUnitValue ($a_value=0) | |
| setSubUnitValue ($a_value=0) | |
| setCurrency ($a_currency_id) | |
| setDuration ($a_duration) | |
| add () | |
| update ($a_price_id) | |
| delete ($a_price_id) | |
| deleteAllPrices () | |
| validate () | |
| _priceExists ($a_price_id, $a_pobject_id) | |
| __getUnitValue () | |
| __getSubUnitValue () | |
| __getCurrency () | |
| __getDuration () | |
| __read () | |
Data Fields | |
| $ilDB | |
| $pobject_id | |
| $unit_value | |
| $sub_unit_value | |
| $currency | |
| $duration | |
| $prices | |
Definition at line 31 of file class.ilPaymentPrices.php.
| ilPaymentPrices::__getCurrency | ( | ) |
Definition at line 309 of file class.ilPaymentPrices.php.
{
return $this->currency;
}
| ilPaymentPrices::__getDuration | ( | ) |
Definition at line 313 of file class.ilPaymentPrices.php.
Referenced by validate().
{
return $this->duration;
}
Here is the caller graph for this function:| ilPaymentPrices::__getSubUnitValue | ( | ) |
Definition at line 305 of file class.ilPaymentPrices.php.
Referenced by validate().
{
return $this->sub_unit_value;
}
Here is the caller graph for this function:| ilPaymentPrices::__getUnitValue | ( | ) |
Definition at line 301 of file class.ilPaymentPrices.php.
Referenced by validate().
{
return $this->unit_value;
}
Here is the caller graph for this function:| ilPaymentPrices::__read | ( | ) |
Definition at line 318 of file class.ilPaymentPrices.php.
References $query, $res, and $row.
Referenced by add(), delete(), deleteAllPrices(), ilPaymentPrices(), and update().
{
$this->prices = array();
$query = "SELECT * FROM payment_prices ".
"WHERE pobject_id = '".$this->getPobjectId()."' ".
"ORDER BY duration";
$res = $this->db->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$this->prices[$row->price_id]['pobject_id'] = $row->pobject_id;
$this->prices[$row->price_id]['price_id'] = $row->price_id;
$this->prices[$row->price_id]['currency'] = $row->currency;
$this->prices[$row->price_id]['duration'] = $row->duration;
$this->prices[$row->price_id]['unit_value'] = $row->unit_value;
$this->prices[$row->price_id]['sub_unit_value'] = $row->sub_unit_value;
}
}
Here is the caller graph for this function:| ilPaymentPrices::_countPrices | ( | $ | a_pobject_id | ) |
Definition at line 89 of file class.ilPaymentPrices.php.
References $query, $res, and $row.
Referenced by ilPaymentShoppingCartGUI::showItems().
{
$query = "SELECT count(price_id) FROM payment_prices ".
"WHERE pobject_id = '".$a_pobject_id."'";
$res = $this->db->query($query);
$row = $res->fetchRow(DB_FETCHMODE_ARRAY);
return ($row[0]);
}
Here is the caller graph for this function:| ilPaymentPrices::_getPrice | ( | $ | a_price_id | ) |
Definition at line 70 of file class.ilPaymentPrices.php.
References $ilDB, $query, $res, and $row.
Referenced by ilPurchaseBMFGUI::__addBookings(), ilPurchaseBMFGUI::__showShoppingCart(), _getPriceString(), _getTotalAmount(), ilPaymentShoppingCart::getShoppingCart(), and ilPaymentShoppingCartGUI::showItems().
{
global $ilDB;
$query = "SELECT * FROM payment_prices ".
"WHERE price_id = '".$a_price_id."'";
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$price['duration'] = $row->duration;
$price['currency'] = $row->currency;
$price['unit_value'] = $row->unit_value;
$price['sub_unit_value'] = $row->sub_unit_value;
}
return count($price) ? $price : array();
}
Here is the caller graph for this function:| ilPaymentPrices::_getPriceString | ( | $ | a_price_id | ) |
Definition at line 100 of file class.ilPaymentPrices.php.
References $lng, and _getPrice().
Referenced by ilPurchaseBMFGUI::__addBookings(), ilPurchaseBMFGUI::__showShoppingCart(), ilPaymentPurchaseGUI::showDetails(), and ilPaymentShoppingCartGUI::showItems().
{
include_once './payment/classes/class.ilPaymentCurrency.php';
include_once './payment/classes/class.ilGeneralSettings.php';
global $lng;
$genSet = new ilGeneralSettings();
$unit_string = $genSet->get("currency_unit");
$pr_str = '';
$price = ilPaymentPrices::_getPrice($a_price_id);
$pr_str = number_format( ((int) $price["unit_value"]) . "." . ((int) $price["sub_unit_value"]) , 2, ",", ".");
return $pr_str . " " . $unit_string;
/* $unit_string = $lng->txt('currency_'.ilPaymentCurrency::_getUnit($price['currency']));
$subunit_string = $lng->txt('currency_'.ilPaymentCurrency::_getSubUnit($price['currency']));
if((int) $price['unit_value'])
{
$pr_str .= $price['unit_value'].' '.$unit_string.' ';
}
if((int) $price['sub_unit_value'])
{
$pr_str .= $price['sub_unit_value'].' '.$subunit_string;
}
return $pr_str; */
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilPaymentPrices::_getTotalAmount | ( | $ | a_price_ids | ) |
Definition at line 130 of file class.ilPaymentPrices.php.
References $id, $ilDB, $lng, and _getPrice().
Referenced by ilPaymentShoppingCart::__read().
{
include_once './payment/classes/class.ilPaymentPrices.php';
# include_once './payment/classes/class.ilPaymentCurrency.php';
include_once './payment/classes/class.ilGeneralSettings.php';
global $ilDB,$lng;
$genSet = new ilGeneralSettings();
$unit_string = $genSet->get("currency_unit");
$amount = 0.0;
foreach($a_price_ids as $id)
{
$price_data = ilPaymentPrices::_getPrice($id);
$price = ((int) $price_data["unit_value"]) . "." . ((int) $price_data["sub_unit_value"]);
$amount += (float) $price;
}
return $amount;
/* foreach($a_price_ids as $id)
{
$price_data = ilPaymentPrices::_getPrice($id);
$price_arr["$price_data[currency]"]['unit'] += (int) $price_data['unit_value'];
$price_arr["$price_data[currency]"]['subunit'] += (int) $price_data['sub_unit_value'];
}
if(is_array($price_arr))
{
foreach($price_arr as $key => $value)
{
// CHECK cent bigger 100
$value['unit'] += (int) ($value['subunit'] / 100);
$value['subunit'] = (int) ($value['subunit'] % 100);
$unit_string = $lng->txt('currency_'.ilPaymentCurrency::_getUnit($key));
$subunit_string = $lng->txt('currency_'.ilPaymentCurrency::_getSubUnit($key));
if((int) $value['unit'])
{
$pr_str .= $value['unit'].' '.$unit_string.' ';
}
if((int) $value['subunit'])
{
$pr_str .= $value['subunit'].' '.$subunit_string;
}
// in the moment only one price
return $pr_str;
}
}
return 0;*/
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilPaymentPrices::_priceExists | ( | $ | a_price_id, | |
| $ | a_pobject_id | |||
| ) |
Definition at line 285 of file class.ilPaymentPrices.php.
References $ilDB, $query, and $res.
Referenced by ilPaymentShoppingCart::__read().
{
global $ilDB;
$query = "SELECT * FROM payment_prices ".
"WHERE price_id = '".$a_price_id."' ".
"AND pobject_id = '".$a_pobject_id."'";
$res = $ilDB->query($query);
return $res->numRows() ? true : false;
}
Here is the caller graph for this function:| ilPaymentPrices::add | ( | ) |
Definition at line 207 of file class.ilPaymentPrices.php.
References $query, $res, and __read().
{
$query = "INSERT INTO payment_prices SET ".
"pobject_id = '".$this->getPobjectId()."', ".
"currency = '".$this->__getCurrency()."', ".
"duration = '".$this->__getDuration()."', ".
"unit_value = '".$this->__getUnitValue()."', ".
"sub_unit_value = '".$this->__getSubUnitValue()."'";
$res = $this->db->query($query);
$this->__read();
return true;
}
Here is the call graph for this function:| ilPaymentPrices::delete | ( | $ | a_price_id | ) |
| ilPaymentPrices::deleteAllPrices | ( | ) |
| ilPaymentPrices::getPobjectId | ( | ) |
Definition at line 55 of file class.ilPaymentPrices.php.
{
return $this->pobject_id;
}
| ilPaymentPrices::getPrice | ( | $ | a_price_id | ) |
Definition at line 64 of file class.ilPaymentPrices.php.
{
return $this->prices[$a_price_id] ? $this->prices[$a_price_id] : array();
}
| ilPaymentPrices::getPrices | ( | ) |
Definition at line 60 of file class.ilPaymentPrices.php.
{
return $this->prices ? $this->prices : array();
}
| ilPaymentPrices::ilPaymentPrices | ( | $ | a_pobject_id = 0 |
) |
| ilPaymentPrices::setCurrency | ( | $ | a_currency_id | ) |
Definition at line 198 of file class.ilPaymentPrices.php.
{
$this->currency = $a_currency_id;
}
| ilPaymentPrices::setDuration | ( | $ | a_duration | ) |
Definition at line 202 of file class.ilPaymentPrices.php.
{
$this->duration = $a_duration;
}
| ilPaymentPrices::setSubUnitValue | ( | $ | a_value = 0 |
) |
Definition at line 194 of file class.ilPaymentPrices.php.
{
$this->sub_unit_value = $a_value;
}
| ilPaymentPrices::setUnitValue | ( | $ | a_value = 0 |
) |
Definition at line 189 of file class.ilPaymentPrices.php.
{
// substitute leading zeros with ''
$this->unit_value = preg_replace('/^0+/','',$a_value);
}
| ilPaymentPrices::update | ( | $ | a_price_id | ) |
Definition at line 222 of file class.ilPaymentPrices.php.
References $query, $res, and __read().
{
$query = "UPDATE payment_prices SET ".
"currency = '".$this->__getCurrency()."', ".
"duration = '".$this->__getDuration()."', ".
"unit_value = '".$this->__getUnitValue()."', ".
"sub_unit_value = '".$this->__getSubUnitValue()."' ".
"WHERE price_id = '".$a_price_id."'";
$res = $this->db->query($query);
$this->__read();
return true;
}
Here is the call graph for this function:| ilPaymentPrices::validate | ( | ) |
Definition at line 262 of file class.ilPaymentPrices.php.
References __getDuration(), __getSubUnitValue(), and __getUnitValue().
{
$duration_valid = false;
$price_valid = false;
if(preg_match('/^[1-9][0-9]{0,1}$/',$this->__getDuration()))
{
$duration_valid = true;
}
if(preg_match('/^[1-9]\d{0,4}$/',$this->__getUnitValue()) and
preg_match('/^\d{0,2}$/',$this->__getSubUnitValue()))
{
$price_valid = true;
}
else if(preg_match('/^\d{0,5}$/',$this->__getUnitValue()) and
preg_match('/[1-9]/',$this->__getSubUnitValue()))
{
return true;
}
return $duration_valid and $price_valid;
}
Here is the call graph for this function:| ilPaymentPrices::$currency |
Definition at line 38 of file class.ilPaymentPrices.php.
| ilPaymentPrices::$duration |
Definition at line 39 of file class.ilPaymentPrices.php.
| ilPaymentPrices::$ilDB |
Definition at line 33 of file class.ilPaymentPrices.php.
Referenced by _getPrice(), _getTotalAmount(), _priceExists(), and ilPaymentPrices().
| ilPaymentPrices::$pobject_id |
Definition at line 35 of file class.ilPaymentPrices.php.
| ilPaymentPrices::$prices |
Definition at line 41 of file class.ilPaymentPrices.php.
| ilPaymentPrices::$sub_unit_value |
Definition at line 37 of file class.ilPaymentPrices.php.
| ilPaymentPrices::$unit_value |
Definition at line 36 of file class.ilPaymentPrices.php.
1.7.1