ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilPaymentPrices Class Reference
+ Collaboration diagram for ilPaymentPrices:

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)
 _getPriceStringFromAmount ($a_price)
 _getTotalAmount ($a_price_ids)
 setPrice ($a_price=0)
 setCurrency ($a_currency_id)
 setDuration ($a_duration)
 setUnlimitedDuration ($a_unlimited_duration)
 add ()
 update ($a_price_id)
 delete ($a_price_id)
 deleteAllPrices ()
 validate ()
 _priceExists ($a_price_id, $a_pobject_id)
 __getPrice ()
 __getCurrency ()
 __getDuration ()
 __getUnlimitedDuration ()
 __read ()
 getNumberOfPrices ()
 getLowestPrice ()

Static Public Member Functions

static _formatPriceToString ($a_price)

Data Fields

 $ilDB
 $pobject_id
 $price
 $currency
 $duration
 $unlimited_duration = 0

Private Attributes

 $prices = array()

Detailed Description

Definition at line 31 of file class.ilPaymentPrices.php.

Member Function Documentation

ilPaymentPrices::__getCurrency ( )

Definition at line 339 of file class.ilPaymentPrices.php.

References $currency.

Referenced by add(), and update().

{
}

+ Here is the caller graph for this function:

ilPaymentPrices::__getDuration ( )

Definition at line 343 of file class.ilPaymentPrices.php.

References $duration.

Referenced by add(), update(), and validate().

{
}

+ Here is the caller graph for this function:

ilPaymentPrices::__getPrice ( )

Definition at line 335 of file class.ilPaymentPrices.php.

References $price.

Referenced by add(), update(), and validate().

{
return $this->price;
}

+ Here is the caller graph for this function:

ilPaymentPrices::__getUnlimitedDuration ( )

Definition at line 347 of file class.ilPaymentPrices.php.

References $unlimited_duration.

Referenced by add(), update(), and validate().

+ Here is the caller graph for this function:

ilPaymentPrices::__read ( )

Definition at line 352 of file class.ilPaymentPrices.php.

References $res, $row, and getPobjectId().

Referenced by add(), delete(), deleteAllPrices(), ilPaymentPrices(), and update().

{
$this->prices = array();
$res = $this->db->queryf('
SELECT * FROM payment_prices
WHERE pobject_id = %s
ORDER BY duration',
array('integer'),
array($this->getPobjectId()));
while($row = $this->db->fetchObject($res))
{
$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]['unlimited_duration'] = $row->unlimited_duration;
$this->prices[$row->price_id]['price'] = $row->price;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPaymentPrices::_countPrices (   $a_pobject_id)

Definition at line 93 of file class.ilPaymentPrices.php.

References $ilDB, $res, and $row.

{
global $ilDB;
$res = $ilDB->queryf('
SELECT count(price_id) FROM payment_prices
WHERE pobject_id = %s',
array('integer'),
array($a_pobject_id));
$row = $res->fetchRow(DB_FETCHMODE_ARRAY);
return ($row[0]);
}
static ilPaymentPrices::_formatPriceToString (   $a_price)
static

Definition at line 123 of file class.ilPaymentPrices.php.

Referenced by _getPriceString(), and ilShopResultPresentationGUI\renderItems().

{
include_once './payment/classes/class.ilGeneralSettings.php';
$genSet = new ilGeneralSettings();
$currency_unit = $genSet->get('currency_unit');
return $a_price . ' ' . $currency_unit;
}

+ Here is the caller graph for this function:

ilPaymentPrices::_getPrice (   $a_price_id)
ilPaymentPrices::_getPriceStringFromAmount (   $a_price)

Definition at line 134 of file class.ilPaymentPrices.php.

References $lng.

Referenced by ilPurchaseBillGUI\__addBookings(), ilPurchaseBMFGUI\__addBookings(), ilPurchasePaypal\__saveTransaction(), ilPurchaseBillGUI\__saveTransaction(), ilPaymentShoppingCartGUI\addBookings(), and ilShopShoppingCartGUI\addBookings().

{
include_once './payment/classes/class.ilPaymentCurrency.php';
include_once './payment/classes/class.ilGeneralSettings.php';
global $lng;
$genSet = new ilGeneralSettings();
$currency_unit = $genSet->get("currency_unit");
$pr_str = '';
$pr_str = number_format($a_price , 2, ",", ".");
return $pr_str . " " . $currency_unit;
}

+ Here is the caller graph for this function:

ilPaymentPrices::_getTotalAmount (   $a_price_ids)

Definition at line 151 of file class.ilPaymentPrices.php.

References $ilDB, $lng, $price, 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();
$currency_unit = $genSet->get("currency_unit");
$amount = array();
if (is_array($a_price_ids))
{
for ($i = 0; $i < count($a_price_ids); $i++)
{
$price_data = ilPaymentPrices::_getPrice($a_price_ids[$i]["id"]);
$price = (float) $price_data["price"];
$amount[$a_price_ids[$i]["pay_method"]] += (float) $price;
}
}
return $amount;
}

+ 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 319 of file class.ilPaymentPrices.php.

References $ilDB, and $res.

Referenced by ilPaymentShoppingCart\__read().

{
global $ilDB;
$res = $ilDB->queryf('
SELECT * FROM payment_prices
WHERE price_id = %s
AND pobject_id = %s',
array('integer', 'integer'),
array($a_price_id, $a_pobject_id));
return $res->numRows() ? true : false;
}

+ Here is the caller graph for this function:

ilPaymentPrices::add ( )

Definition at line 217 of file class.ilPaymentPrices.php.

References $res, __getCurrency(), __getDuration(), __getPrice(), __getUnlimitedDuration(), __read(), and getPobjectId().

{
$next_id = $this->db->nextId('payment_prices');
$res = $this->db->manipulateF('
INSERT INTO payment_prices
( price_id,
pobject_id,
currency,
duration,
unlimited_duration,
price
)
VALUES (%s, %s, %s, %s, %s, %s)',
array('integer','integer', 'integer', 'integer', 'integer', 'float'),
array( $next_id,
$this->getPobjectId(),
$this->__getCurrency(),
$this->__getDuration(),
$this->__getPrice()
));
$this->__read();
return true;
}

+ Here is the call graph for this function:

ilPaymentPrices::delete (   $a_price_id)

Definition at line 267 of file class.ilPaymentPrices.php.

References __read().

{
$statement = $this->db->manipulateF('
DELETE FROM payment_prices
WHERE price_id = %s',
array('integer'), array($a_price_id));
$this->__read();
return true;
}

+ Here is the call graph for this function:

ilPaymentPrices::deleteAllPrices ( )

Definition at line 278 of file class.ilPaymentPrices.php.

References __read(), and getPobjectId().

{
$statement = $this->db->manipulateF('
DELETE FROM payment_prices
WHERE pobject_id = %s',
array('integer'),
array($this->getPobjectId()));
$this->__read();
return true;
}

+ Here is the call graph for this function:

ilPaymentPrices::getLowestPrice ( )

Definition at line 380 of file class.ilPaymentPrices.php.

References $data.

Referenced by ilShopResultPresentationGUI\renderItems().

{
$lowest_price_id = 0;
$lowest_price = 0;
foreach ($this->prices as $price_id => $data)
{
$current_price = $data['price'];
if($lowest_price == 0||
$lowest_price > (float)$current_price)
{
$lowest_price = (float)$current_price;
$lowest_price_id = $price_id;
}
}
return is_array($this->prices[$lowest_price_id]) ? $this->prices[$lowest_price_id] : array();
}

+ Here is the caller graph for this function:

ilPaymentPrices::getNumberOfPrices ( )

Definition at line 375 of file class.ilPaymentPrices.php.

{
return count($this->prices);
}
ilPaymentPrices::getPobjectId ( )

Definition at line 57 of file class.ilPaymentPrices.php.

References $pobject_id.

Referenced by __read(), add(), and deleteAllPrices().

{
}

+ Here is the caller graph for this function:

ilPaymentPrices::getPrice (   $a_price_id)

Definition at line 66 of file class.ilPaymentPrices.php.

{
return $this->prices[$a_price_id] ? $this->prices[$a_price_id] : array();
}
ilPaymentPrices::getPrices ( )

Definition at line 62 of file class.ilPaymentPrices.php.

{
return $this->prices ? $this->prices : array();
}
ilPaymentPrices::ilPaymentPrices (   $a_pobject_id = 0)

Definition at line 45 of file class.ilPaymentPrices.php.

References $ilDB, and __read().

{
global $ilDB;
$this->db =& $ilDB;
$this->pobject_id = $a_pobject_id;
$this->__read();
}

+ Here is the call graph for this function:

ilPaymentPrices::setCurrency (   $a_currency_id)

Definition at line 197 of file class.ilPaymentPrices.php.

{
$this->currency = $a_currency_id;
}
ilPaymentPrices::setDuration (   $a_duration)

Definition at line 201 of file class.ilPaymentPrices.php.

{
if($this->unlimited_duration == '1' && ($a_duration == '' || null))
$a_duration = 0;
$this->duration = (int)$a_duration;
}
ilPaymentPrices::setPrice (   $a_price = 0)

Definition at line 190 of file class.ilPaymentPrices.php.

{
$this->price = preg_replace('/^0+/','',$a_price);
$this->price = $a_price;
}
ilPaymentPrices::setUnlimitedDuration (   $a_unlimited_duration)

Definition at line 209 of file class.ilPaymentPrices.php.

{
if($a_unlimited_duration)
$this->unlimited_duration = (int)$a_unlimited_duration;
else
$this->unlimited_duration = 0;
}
ilPaymentPrices::update (   $a_price_id)

Definition at line 245 of file class.ilPaymentPrices.php.

References $res, __getCurrency(), __getDuration(), __getPrice(), __getUnlimitedDuration(), and __read().

{
$res = $this->db->manipulateF('
UPDATE payment_prices SET
currency = %s,
duration = %s,
unlimited_duration = %s,
price = %s
WHERE price_id = %s',
array('integer', 'integer','integer', 'float', 'integer'),
array( $this->__getCurrency(),
$this->__getDuration(),
$this->__getPrice(),
$a_price_id
));
$this->__read();
return true;
}

+ Here is the call graph for this function:

ilPaymentPrices::validate ( )

Definition at line 291 of file class.ilPaymentPrices.php.

References __getDuration(), __getPrice(), and __getUnlimitedDuration().

{
$duration_valid = false;
$price_valid = false;
if(preg_match('/^(([1-9][0-9]{0,1})|[0])?$/',$this->__getDuration())
|| ((int)$this->__getDuration() == 0 && $this->__getUnlimitedDuration() == 1))
{
$duration_valid = true;
}
if(preg_match('/[0-9]/',$this->__getPrice()))
{
$price_valid = true;
}
if($duration_valid == true && $price_valid == true)
{
return true;
}
else return false;
}

+ Here is the call graph for this function:

Field Documentation

ilPaymentPrices::$currency

Definition at line 38 of file class.ilPaymentPrices.php.

Referenced by __getCurrency().

ilPaymentPrices::$duration

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

Referenced by __getDuration().

ilPaymentPrices::$ilDB
ilPaymentPrices::$pobject_id

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

Referenced by getPobjectId().

ilPaymentPrices::$price

Definition at line 37 of file class.ilPaymentPrices.php.

Referenced by __getPrice(), _getPrice(), _getPriceString(), and _getTotalAmount().

ilPaymentPrices::$prices = array()
private

Definition at line 43 of file class.ilPaymentPrices.php.

ilPaymentPrices::$unlimited_duration = 0

Definition at line 40 of file class.ilPaymentPrices.php.

Referenced by __getUnlimitedDuration().


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