public function objectsObject() { global $rbacsystem; // MINIMUM ACCESS LEVEL = 'read' if (!$rbacsystem->checkAccess('read', $this->object->getRefId())) { $this->ilErr->raiseError($this->lng->txt('msg_no_perm_read'), $this->ilErr->MESSAGE); } if ($_POST['updateView'] == 1) { $_SESSION['pay_objects']['title_type'] = $_POST['title_type']; $_SESSION['pay_objects']['title_value'] = $_POST['title_value']; $_SESSION['pay_objects']['pay_method'] = $_POST['pay_method']; $_SESSION['pay_objects']['vendor'] = $_POST['vendor']; } $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.main_view.html', 'Services/Payment'); $this->__initPaymentObject(); $this->lng->loadLanguageModule('search'); $filter_form = new ilPropertyFormGUI(); $filter_form->setFormAction($this->ctrl->getFormAction($this)); $filter_form->setTitle($this->lng->txt('pay_filter')); $filter_form->setId('filter_form'); $filter_form->setTableWidth('100 %'); //hide_filter $o_hide_check = new ilCheckBoxInputGUI($this->lng->txt('show_filter'), 'show_filter'); $o_hide_check->setValue(1); $o_hide_check->setChecked($_POST['show_filter'] ? 1 : 0); $o_hidden = new ilHiddenInputGUI('updateView'); $o_hidden->setValue(1); $o_hidden->setPostVar('updateView'); $o_hide_check->addSubItem($o_hidden); //title $radio_group = new ilRadioGroupInputGUI($this->lng->txt('search_in_title'), 'title_type'); $radio_option = new ilRadioOption($this->lng->txt('search_any_word'), 'or'); $radio_group->addOption($radio_option); $radio_option = new ilRadioOption($this->lng->txt('search_all_words'), 'and'); $radio_group->addOption($radio_option); $radio_group->setRequired(false); $radio_group->setValue('or'); $radio_group->setPostVar('title_type'); $o_title = new ilTextInputGUI(); $o_title->setValue($_SESSION['pay_objects']['title_value']); $o_title->setPostVar('title_value'); $o_title->setTitle($this->lng->txt('title')); $o_hide_check->addSubItem($radio_group); $o_hide_check->addSubItem($o_title); //vendor $o_vendor = new ilTextInputGUI(); $o_vendor->setTitle($this->lng->txt('paya_vendor')); $o_vendor->setValue($_SESSION['pay_objects']['vendor']); $o_vendor->setPostVar('vendor'); $o_hide_check->addSubItem($o_vendor); // paymethod $o_paymethod = new ilSelectInputGUI(); $o_paymethod->setTitle($this->lng->txt('payment_system')); $o_paymethod->setOptions(ilPaymethods::getPayMethodsOptions('all')); $o_paymethod->setValue($_SESSION['pay_objects']['pay_method']); $o_paymethod->setPostVar('pay_method'); $o_hide_check->addSubItem($o_paymethod); $filter_form->addCommandButton('objects', $this->lng->txt('pay_update_view')); $filter_form->addCommandButton('resetObjectFilter', $this->lng->txt('pay_reset_filter')); $filter_form->addItem($o_hide_check); if (!count($objects = ilPaymentObject::_getAllObjectsData())) { ilUtil::sendInfo($this->lng->txt('paya_no_objects_assigned')); return true; } $this->tpl->setVariable('FORM', $filter_form->getHTML()); $counter = 0; foreach ($objects as $data) { $tmp_obj = ilObjectFactory::getInstanceByRefId($data['ref_id'], false); if ($tmp_obj) { $f_result[$counter]['title'] = $tmp_obj->getTitle(); } else { $f_result[$counter]['title'] = $this->lng->txt('object_not_found'); } switch ($data['status']) { case $this->pobject->STATUS_BUYABLE: $f_result[$counter]['status'] = $this->lng->txt('paya_buyable'); break; case $this->pobject->STATUS_NOT_BUYABLE: $f_result[$counter]['status'] = $this->lng->txt('paya_not_buyable'); break; case $this->pobject->STATUS_EXPIRES: $f_result[$counter]['status'] = $this->lng->txt('paya_expires'); break; } include_once './Services/Payment/classes/class.ilPayMethods.php'; $str_paymethod = ilPayMethods::getStringByPaymethod($data['pay_method']); $f_result[$counter]['pay_method'] = $str_paymethod; if ($data['vat_id'] <= 0) { $vat_rate = $this->lng->txt('payment_vat_has_to_be_defined_by_administration_short'); } else { try { $oVAT = new ilShopVats((int) $data['vat_id']); $vat_rate = ilShopUtils::_formatVAT((double) $oVAT->getRate()); } catch (ilShopException $e) { $vat_rate = $this->lng->txt('payment_vat_has_to_be_defined_by_administration_short'); } } $f_result[$counter]['vat_rate'] = $vat_rate; $tmp_user = ilObjectFactory::getInstanceByObjId($data['vendor_id'], false); if ($tmp_user) { $f_result[$counter]['vendor'] = $tmp_user->getFullname() . ' [' . $tmp_user->getLogin() . ']'; } else { $f_result[$counter]['vendor'] = $this->lng->txt('user_not_found'); } // Get number of purchasers $f_result[$counter]['purchasers'] = ilPaymentBookings::_getCountBookingsByObject($data['pobject_id']); // edit link $this->ctrl->setParameter($this, 'pobject_id', $data['pobject_id']); $link_change = "<div class=\"il_ContainerItemCommands\"><a class=\"il_ContainerItemCommand\" href=\"" . $this->ctrl->getLinkTarget($this, "editDetails") . "\">" . $this->lng->txt("edit") . "</a></div>"; $f_result[$counter]['options'] = $link_change; unset($tmp_user); unset($tmp_obj); ++$counter; } return $this->__showObjectsTable($f_result); //return true; }
public function deleteObject() { include_once './Services/Payment/classes/class.ilPaymentBookings.php'; if (!$_GET['pobject_id']) { ilUtil::sendFailure($this->lng->txt('paya_no_object_selected')); $this->showObjects(); return true; } if (ilPaymentBookings::_getCountBookingsByObject((int) $_GET['pobject_id'])) { ilUtil::sendInfo($this->lng->txt('paya_bookings_available')); $this->editDetails(); return false; } else { $this->editDetails(true); return true; } }