public function editPriceObject() { $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.main_view.html', 'Services/Payment'); $price_id = $_GET['price_id'] ? $_GET['price_id'] : $_POST['price_id']; $price = ilPaymentPrices::_getPrice($price_id); $this->ctrl->setParameter($this, 'pobject_id', (int) $_GET['pobject_id']); $tmp_pobject = ilPaymentObject::_getObjectData($_GET['pobject_id']); include_once 'Services/Form/classes/class.ilPropertyFormGUI.php'; $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this)); $tmp_obj = ilObjectFactory::getInstanceByRefId($tmp_pobject['ref_id'], false); if ($tmp_obj) { $form->setTitle($tmp_obj->getTitle()); } else { $form->setTitle($this->lng->txt('object_not_found')); } //price_type $radio_group = new ilRadioGroupInputGUI('', 'price_type'); $radio_group->setTitle($this->lng->txt('duration')); $radio_group->setRequired(true); $radio_group->setValue($price['price_type']); $radio_group->setPostVar('price_type'); $radio_option_1 = new ilRadioOption($this->lng->txt('duration_month'), ilPaymentPrices::TYPE_DURATION_MONTH); // duration month $oDuration = new ilNumberInputGUI(); $oDuration->setTitle($this->lng->txt('paya_months')); $oDuration->setSize('20%'); $oDuration->setValue($price['duration']); $oDuration->setPostVar('duration_month'); $radio_option_1->addSubItem($oDuration); $radio_group->addOption($radio_option_1); $radio_option_3 = new ilRadioOption($this->lng->txt('duration_date'), ilPaymentPrices::TYPE_DURATION_DATE); // duration_date from $o_date_from = new ilDateTimeInputGUI(); $o_date_from->setTitle($this->lng->txt('cal_from')); $o_date_from->setDate(new ilDate($price['duration_from'], IL_CAL_DATE)); $o_date_from->setPostVar('duration_date_from'); $radio_option_3->addSubItem($o_date_from); // duration_date until $o_date_until = new ilDateTimeInputGUI(); $o_date_until->setTitle($this->lng->txt('cal_until')); $o_date_until->setDate(new ilDate($price['duration_until'], IL_CAL_DATE)); $o_date_until->setPostVar('duration_date_until'); $radio_option_3->addSubItem($o_date_until); $radio_group->addOption($radio_option_3); $radio_option_2 = new ilRadioOption($this->lng->txt('unlimited_duration'), ilPaymentPrices::TYPE_UNLIMITED_DURATION); $radio_group->addOption($radio_option_2); $form->addItem($radio_group); // description $oDescription = new ilTextAreaInputGUI($this->lng->txt('description'), 'description'); $oDescription->setRows(4); $oDescription->setCols(35); $oDescription->setValue($price['description']); $form->addItem($oDescription); // price $oPrice = new ilNumberInputGUI(); $oPrice->setTitle($this->lng->txt('price_a')); $oPrice->setSize('20%'); $oPrice->setRequired(true); $oPrice->setValue($price['price']); include_once './Services/Payment/classes/class.ilPaymentSettings.php'; $genSet = ilPaymentSettings::_getInstance(); $oPrice->setInfo($genSet->get('currency_unit')); $oPrice->setPostVar('price'); $oPrice->allowDecimals(true); $form->addItem($oPrice); //extension $oExtension = new ilCheckboxInputGUI($this->lng->txt('extension_price'), 'extension'); $oExtension->setChecked($price['extension']); $form->addItem($oExtension); $o_hidden_1 = new ilHiddenInputGUI('pobject_id'); $o_hidden_1->setValue((int) $_GET['pobject_id']); $o_hidden_1->setPostVar('pobject_id'); $o_hidden_2 = new ilHiddenInputGUI('price_id'); $o_hidden_2->setValue((int) $_GET['price_id']); $o_hidden_2->setPostVar('price_id'); $form->addItem($o_hidden_1); $form->addItem($o_hidden_2); $form->addCommandButton('updatePrice', $this->lng->txt('save')); $form->addCommandButton('editPrices', $this->lng->txt('cancel')); $this->tpl->setVariable('FORM', $form->getHTML()); }