public function editStatisticObject($a_show_confirm_delete = false) { global $ilToolbar; include_once './Services/Payment/classes/class.ilPayMethods.php'; if (!isset($_GET['booking_id'])) { ilUtil::sendInfo($this->lng->txt('paya_no_booking_id_given')); $this->showStatistics(); return true; } $ilToolbar->addButton($this->lng->txt('back'), $this->ctrl->getLinkTarget($this, 'statistic')); $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.main_view.html', 'Services/Payment'); $this->ctrl->setParameter($this, 'booking_id', (int) $_GET['booking_id']); // confirm delete if ($a_show_confirm_delete) { $oConfirmationGUI = new ilConfirmationGUI(); // set confirm/cancel commands $oConfirmationGUI->setFormAction($this->ctrl->getFormAction($this, "performDelete")); $oConfirmationGUI->setHeaderText($this->lng->txt("paya_sure_delete_stat")); $oConfirmationGUI->setCancel($this->lng->txt("cancel"), "statistic"); $oConfirmationGUI->setConfirm($this->lng->txt("confirm"), "performDelete"); $this->tpl->setVariable('CONFIRMATION', $oConfirmationGUI->getHTML()); return true; } $this->__initBookingObject(); $bookings = $this->booking_obj->getBookings(); $booking = $bookings[(int) $_GET['booking_id']]; // get customer_obj $tmp_user = ilObjectFactory::getInstanceByObjId($booking['customer_id'], false); $oForm = new ilPropertyFormGUI(); $oForm->setFormAction($this->ctrl->getFormAction($this)); $oForm->setId('stat_form'); $oForm->setTableWidth('50 %'); if (is_object($tmp_user)) { $frm_user = $tmp_user->getFullname() . ' [' . $tmp_user->getLogin() . ']'; } else { $frm_user = $this->lng->txt('user_deleted'); } $oForm->setTitle($frm_user); $pObj = new ilPaymentObject($this->user_obj, $booking['pobject_id']); $tmp_obj = ilObject::_lookupTitle(ilObject::_lookupObjId($pObj->getRefId())); // object_title $oTitleGUI = new ilNonEditableValueGUI($this->lng->txt('title')); $oTitleGUI->setValue($tmp_obj != '' ? $tmp_obj : $this->lng->txt('object_deleted')); $oForm->addItem($oTitleGUI); // transaction $oTransactionGUI = new ilNonEditableValueGUI($this->lng->txt('paya_transaction')); $oTransactionGUI->setValue($booking['transaction']); $oForm->addItem($oTransactionGUI); //vendor $oVendorGUI = new ilNonEditableValueGUI($this->lng->txt('paya_vendor')); $tmp_vendor = ilObjectFactory::getInstanceByObjId($booking['b_vendor_id'], false); if (is_object($tmp_vendor)) { $frm_vendor = $tmp_vendor->getFullname() . ' [' . $tmp_vendor->getLogin() . ']'; } else { $frm_vendor = $this->lng->txt('user_deleted'); } $oVendorGUI->setValue($frm_vendor); $oForm->addItem($oVendorGUI); // paymethod $oPaymethodGUI = new ilNonEditableValueGUI($this->lng->txt('paya_pay_method')); $oPaymethodGUI->setValue(ilPayMethods::getStringByPaymethod($booking['b_pay_method'])); $oForm->addItem($oPaymethodGUI); // order_date $oOrderdateGUI = new ilNonEditableValueGUI($this->lng->txt('paya_order_date')); $oOrderdateGUI->setValue(ilDatePresentation::formatDate(new ilDate($booking['order_date'], IL_CAL_UNIX))); $oForm->addItem($oOrderdateGUI); // duration $oDurationGUI = new ilNonEditableValueGUI($this->lng->txt('duration')); if ($booking['duration'] == 0 && $booking['access_enddate'] == NULL) { $frm_duration = $this->lng->txt("unlimited_duration"); } else { if ($booking['duration'] > 0) { $frm_duration = $booking['duration'] . ' ' . $this->lng->txt('paya_months') . '</br>'; } $frm_duration .= ilDatePresentation::formatDate(new ilDate($booking['access_startdate'], IL_CAL_DATETIME)) . ' - ' . ilDatePresentation::formatDate(new ilDate($booking['access_enddate'], IL_CAL_DATETIME)); } $oDurationGUI->setValue($frm_duration); $oForm->addItem($oDurationGUI); // price $oPriceGUI = new ilNonEditableValueGUI($this->lng->txt('price_a')); $oPriceGUI->setValue($booking['price'] . ' ' . $booking['currency_unit']); $oForm->addItem($oPriceGUI); //discount $oDiscountGUI = new ilNonEditableValueGUI($this->lng->txt('paya_coupons_coupon')); $oDiscountGUI->setValue($booking['discount'] . ' ' . $booking['currency_unit']); $oForm->addItem($oDiscountGUI); // payed $oPayedGUI = new ilSelectInputGUI(); $payed_option = array(0 => $this->lng->txt('no'), 1 => $this->lng->txt('yes')); $oPayedGUI->setTitle($this->lng->txt('paya_payed')); $oPayedGUI->setOptions($payed_option); $oPayedGUI->setValue($booking['payed']); $oPayedGUI->setPostVar('payed'); $oForm->addItem($oPayedGUI); // access $oAccessGUI = new ilSelectInputGUI(); $access_option = array(0 => $this->lng->txt('no'), 1 => $this->lng->txt('yes')); $oAccessGUI->setTitle($this->lng->txt('paya_access')); $oAccessGUI->setOptions($access_option); $oAccessGUI->setValue($booking['access_granted']); $oAccessGUI->setPostVar('access'); $oForm->addItem($oAccessGUI); $oForm->addCommandButton('updateStatistic', $this->lng->txt('save')); $oForm->addCommandButton('deleteStatistic', $this->lng->txt('delete')); // show CUSTOMER_DATA if isset -> setting: save_user_address if (ilPayMethods::_PMEnabled($booking['b_pay_method'])) { $oForm2 = new ilPropertyFormGUI(); $oForm2->setId('cust_form'); $oForm2->setTableWidth('50%'); $oForm2->setTitle($frm_user); // email $oEmailGUI = new ilNonEditableValueGUI($this->lng->txt('email')); $email = !$tmp_user ? $this->lng->txt('user_deleted') : $tmp_user->getEmail(); $oEmailGUI->setValue($email); $oForm2->addItem($oEmailGUI); // street $oStreetGUI = new ilNonEditableValueGUI($this->lng->txt('street')); $oStreetGUI->setValue($booking['street']); $oForm2->addItem($oStreetGUI); // pobox $oPoBoxGUI = new ilNonEditableValueGUI($this->lng->txt('pay_bmf_po_box')); $oPoBoxGUI->setValue($booking['po_box']); $oForm2->addItem($oPoBoxGUI); // zipcode $oPoBoxGUI = new ilNonEditableValueGUI($this->lng->txt('zipcode')); $oPoBoxGUI->setValue($booking['zipcode']); $oForm2->addItem($oPoBoxGUI); // city $oCityGUI = new ilNonEditableValueGUI($this->lng->txt('city')); $oCityGUI->setValue($booking['city']); $oForm2->addItem($oCityGUI); // country $oCountryGUI = new ilNonEditableValueGUI($this->lng->txt('country')); $oCountryGUI->setValue($booking['country']); $oForm2->addItem($oCountryGUI); } $this->tpl->setVariable('FORM', $oForm->getHTML()); $this->tpl->setVariable('FORM_2', $oForm2->getHTML()); return true; }