コード例 #1
0
 public function currenciesObject()
 {
     $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.main_view.html', 'Services/Payment');
     $currency_res = ilPaymentCurrency::_getAvailableCurrencies();
     // currency table
     $counter = 0;
     foreach ($currency_res as $cur) {
         $f_result[$counter]['currency_id'] = ilUtil::formRadioButton(0, 'currency_id', $cur['currency_id']);
         $f_result[$counter]['is_default'] = $cur['is_default'] == 1 ? $this->lng->txt('yes') : $this->lng->txt('no');
         $f_result[$counter]['currency_unit'] = $cur['unit'];
         $f_result[$counter]['iso_code'] = $cur['iso_code'];
         $f_result[$counter]['currency_symbol'] = $cur['symbol'];
         $f_result[$counter]['conversion_rate'] = $cur['conversion_rate'];
         $counter++;
     }
     $tbl = new ilShopTableGUI($this);
     $tbl->setTitle($this->lng->txt("currencies"));
     $tbl->setId('tbl_show_currencies');
     $tbl->setRowTemplate("tpl.shop_currencies_row.html", "Services/Payment");
     $tbl->addColumn(' ', 'currency_id', '1%', true);
     $tbl->addColumn($this->lng->txt('is_default'), 'is_default', '5%');
     $tbl->addColumn($this->lng->txt('currency_unit'), 'currency_unit', '10%');
     $tbl->addColumn($this->lng->txt('iso_code'), 'iso_code', '20%');
     $tbl->addColumn($this->lng->txt('currency_symbol'), 'currency_symbol', '20%');
     $tbl->addColumn($this->lng->txt('conversion_rate'), 'conversion_rate', '15%');
     $tbl->addColumn('', 'options', '5%');
     $this->ctrl->setParameter($this, 'cmd', 'currencies');
     $tbl->addMultiCommand('updateDefaultCurrency', $this->lng->txt('paya_set_default_currency'));
     $tbl->addMultiCommand("editCurrency", $this->lng->txt('edit'));
     $tbl->addMultiCommand("deleteCurrency", $this->lng->txt('delete'));
     $tbl->addCommandButton('addCurrency', $this->lng->txt('add_currency'));
     $tbl->setData($f_result);
     $this->tpl->setVariable('TABLE', $tbl->getHTML());
     return true;
 }
コード例 #2
0
 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();
     }
 }