public static function _formatPriceToString($a_price, $a_currency_symbol = false) { if (!$a_currency_symbol) { $currency_obj = $_SESSION['payment_currency']; $currency_symbol = $currency_obj['symbol']; } else { $currency_symbol = $a_currency_symbol; } $separator = ilPaymentCurrency::_getDecimalSeparator(); $price_string = number_format($a_price, '2', $separator, ''); return $price_string . ' ' . $currency_symbol; }
public function updateCurrencyObject() { if (!$_POST['currency_id']) { return false; } $obj_currency = new ilPaymentCurrency($_POST['currency_id']); $obj_currency->setUnit($_POST['currency_unit']); $obj_currency->setIsoCode($_POST['iso_code']); $obj_currency->setSymbol($_POST['symbol']); $obj_currency->setConversionRate($_POST['conversion_rate']); $obj_currency->updateCurrency(); $this->currenciesObject(); return true; }
public function performAddPrice() { if (!(int) $_GET['pobject_id']) { ilUtil::sendInfo($this->lng->txt('paya_no_object_selected')); $this->showObjects(); return true; } include_once './Services/Payment/classes/class.ilPaymentPrices.php'; include_once './Services/Payment/classes/class.ilPaymentCurrency.php'; $currency = ilPaymentCurrency::_getAvailableCurrencies(); $po = new ilPaymentPrices((int) $_GET['pobject_id']); switch ($_POST['price_type']) { case 'unlimited_duration': $po->setPriceType(ilPaymentPrices::TYPE_UNLIMITED_DURATION); $po->setDuration(0); $po->setDurationFrom(NULL); $po->setDurationUntil(NULL); $po->setUnlimitedDuration(1); break; case 'duration_date': $po->setPriceType(ilPaymentPrices::TYPE_DURATION_DATE); $po->setDuration(NULL); $po->setDurationFrom(ilUtil::stripSlashes($_POST['duration_date_from']['date']['y'] . '-' . $_POST['duration_date_from']['date']['m'] . '-' . $_POST['duration_date_from']['date']['d'])); $po->setDurationUntil(ilUtil::stripSlashes($_POST['duration_date_until']['date']['y'] . '-' . $_POST['duration_date_until']['date']['m'] . '-' . $_POST['duration_date_until']['date']['d'])); break; default: case 'duration_month': $po->setPriceType(ilPaymentPrices::TYPE_DURATION_MONTH); $po->setDuration($_POST['duration_month']); $po->setDurationFrom(NULL); $po->setDurationUntil(NULL); break; } $po->setDescription($_POST['description'] ? ilUtil::stripSlashes($_POST['description']) : NULL); $po->setPrice(ilUtil::stripSlashes($_POST['price'])); $po->setCurrency($currency[1]['currency_id']); if ($_POST['extension_price']) { $po->setExtension(1); } else { $po->setExtension(0); } try { $po->validate(); $po->add(); ilUtil::sendInfo($this->lng->txt('paya_added_new_price')); return $this->editPrices(); } catch (ilShopException $e) { ilUtil::sendInfo($e->getMessage()); return $this->addPrice(); } }