13 include_once
'./Services/Payment/classes/class.ilPaymentObject.php';
14 include_once
'./Services/Payment/classes/class.ilPayMethods.php';
15 include_once
'./Services/Payment/classes/class.ilPaymentCurrency.php';
16 include_once
'./Services/Form/classes/class.ilPropertyFormGUI.php';
17 include_once
'./Services/Payment/classes/class.ilShopTableGUI.php';
18 include_once
'./Services/Payment/classes/class.ilInvoiceNumberPlaceholdersPropertyGUI.php';
28 $this->ctrl->saveParameter($this,
'baseClass');
30 $this->user_obj = $user_obj;
43 $ilTabs->setTabActive(
'paya_header');
44 $ilTabs->setSubTabActive(
'bookings');
49 $cmd = $this->ctrl->getCmd();
51 switch ($this->ctrl->getNextClass($this))
54 if(!
$cmd = $this->ctrl->getCmd())
56 $cmd =
'showStatistics';
67 unset(
$_POST[
"transaction_type"]);
68 unset(
$_POST[
"transaction_value"]);
69 unset(
$_POST[
"from"][
"day"]);
70 unset(
$_POST[
"from"][
"month"]);
71 unset(
$_POST[
"from"][
"year"]);
72 unset(
$_POST[
"til"][
"day"]);
73 unset(
$_POST[
"til"][
"month"]);
74 unset(
$_POST[
"til"][
"year"]);
78 unset(
$_POST[
"pay_method"]);
79 unset(
$_POST[
"updateView"]);
80 unset(
$_POST[
"filter_title_id"]);
87 global $rbacsystem, $ilToolbar, $ilObjDataCache;
97 $ilToolbar->addButton($this->lng->txt(
'paya_add_customer'), $this->ctrl->getLinkTarget($this,
'showObjectSelector'));
98 if(!
$_POST[
'show_filter'] &&
$_POST[
'updateView'] ==
'1')
103 if (
$_POST[
'updateView'] == 1)
106 $_SESSION[
'pay_statistics'][
'updateView'] =
true;
109 $_SESSION[
'pay_statistics'][
'transaction_type'] = isset(
$_POST[
'transaction_type']) ?
$_POST[
'transaction_type'] :
'' ;
110 $_SESSION[
'pay_statistics'][
'transaction_value'] = isset(
$_POST[
'transaction_value']) ?
$_POST[
'transaction_value'] :
'';
111 $_SESSION[
'pay_statistics'][
'filter_title_id'] = (int)
$_POST[
'filter_title_id'];
113 if(
$_SESSION[
'pay_statistics'][
'from_check'] ==
'1')
115 $_SESSION[
'pay_statistics'][
'from'][
'date'][
'd'] =
$_POST[
'from'][
'date'][
'd'];
116 $_SESSION[
'pay_statistics'][
'from'][
'date'][
'm'] =
$_POST[
'from'][
'date'][
'm'];
117 $_SESSION[
'pay_statistics'][
'from'][
'date'][
'y'] =
$_POST[
'from'][
'date'][
'y'];
121 $_SESSION[
'pay_statistics'][
'from'][
'date'][
'd'] =
'';
122 $_SESSION[
'pay_statistics'][
'from'][
'date'][
'm'] =
'';
123 $_SESSION[
'pay_statistics'][
'from'][
'date'][
'y'] =
'';
126 if(
$_SESSION[
'pay_statistics'][
'until_check']==
'1')
128 $_SESSION[
'pay_statistics'][
'til'][
'date'][
'd'] =
$_POST[
'til'][
'date'][
'd'];
129 $_SESSION[
'pay_statistics'][
'til'][
'date'][
'm'] =
$_POST[
'til'][
'date'][
'm'];
130 $_SESSION[
'pay_statistics'][
'til'][
'date'][
'y'] =
$_POST[
'til'][
'date'][
'y'];
134 $_SESSION[
'pay_statistics'][
'til'][
'date'][
'd'] =
'';
135 $_SESSION[
'pay_statistics'][
'til'][
'date'][
'm'] =
'';
136 $_SESSION[
'pay_statistics'][
'til'][
'date'][
'y'] =
'';
146 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.main_view.html',
'Services/Payment');
148 include_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
151 $filter_form->setFormAction($this->ctrl->getFormAction($this));
152 $filter_form->setTitle($this->lng->txt(
'pay_filter'));
153 $filter_form->setId(
'formular');
154 $filter_form->setTableWidth(
'100 %');
157 $o_hide_check =
new ilCheckBoxInputGUI($this->lng->txt(
'show_filter'),
'show_filter');
158 $o_hide_check->setValue(1);
159 $o_hide_check->setChecked(
$_SESSION[
'pay_statistics'][
'show_filter'] ? 1 : 0);
162 $o_hidden->setValue(1);
163 $o_hidden->setPostVar(
'updateView');
164 $o_hide_check->addSubItem($o_hidden);
167 $trans_option = array($this->lng->txt(
'pay_starting'),$this->lng->txt(
'pay_ending'));
168 $trans_value = array(
'0',
'1');
169 $o_transaction_type->setTitle($this->lng->txt(
'paya_transaction'));
170 $o_transaction_type->setOptions($trans_option);
171 $o_transaction_type->setValue(
$_SESSION[
'pay_statistics'][
'transaction_type']);
172 $o_transaction_type->setPostVar(
'transaction_type');
173 $o_hide_check->addSubItem($o_transaction_type);
176 $o_transaction_val->setValue(
$_SESSION[
'pay_statistics'][
'transaction_value']);
177 $o_transaction_val->setPostVar(
'transaction_value');
178 $o_hide_check->addSubItem($o_transaction_val);
181 $o_customer->setTitle($this->lng->txt(
'paya_customer'));
182 $o_customer->setValue(
$_SESSION[
'pay_statistics'][
'customer']);
183 $o_customer->setPostVar(
'customer');
184 $o_hide_check->addSubItem($o_customer);
187 $o_vendor->setTitle($this->lng->txt(
'paya_vendor'));
188 $o_vendor->setValue(
$_SESSION[
'pay_statistics'][
'vendor']);
189 $o_vendor->setPostVar(
'vendor');
190 $o_hide_check->addSubItem($o_vendor);
192 $o_from_check =
new ilCheckBoxInputGUI($this->lng->txt(
'pay_order_date_from'),
'from_check');
193 $o_from_check->setValue(1);
194 $o_from_check->setChecked(
$_SESSION[
'pay_statistics'][
'from_check'] ? 1 : 0);
197 $o_date_from->setPostVar(
'from');
200 if(
$_SESSION[
'pay_statistics'][
'from_check'] ==
'1')
202 $o_date_from->checkInput();
205 $o_from_check->addSubItem($o_date_from);
206 $o_hide_check->addSubItem($o_from_check);
208 $o_until_check =
new ilCheckBoxInputGUI($this->lng->txt(
'pay_order_date_til'),
'until_check');
209 $o_until_check->setValue(1);
210 $o_until_check->setChecked(
$_SESSION[
'pay_statistics'][
'until_check'] ? 1 : 0);
213 $o_date_until->setPostVar(
'til');
216 if(
$_SESSION[
'pay_statistics'][
'until_check'] ==
'1')
218 $o_date_until->checkInput();
221 $o_until_check->addSubItem($o_date_until);
222 $o_hide_check->addSubItem($o_until_check);
227 $title_options[
'all']=$this->lng->txt(
'pay_all');
228 $unique_titles = $this->booking_obj->getUniqueTitles();
230 if(is_array($unique_titles) && count($unique_titles))
232 foreach($unique_titles as
$ref_id)
234 $title_options[
$ref_id] = $ilObjDataCache->lookupTitle($ilObjDataCache->lookupObjId($ref_id));
239 $o_object_title->setTitle($this->lng->txt(
'title'));
240 $o_object_title->setOptions($title_options);
241 $o_object_title->setValue(
$_SESSION[
"pay_statistics"][
"filter_title_id"]);
242 $o_object_title->setPostVar(
'filter_title_id');
243 $o_hide_check->addSubItem($o_object_title);
246 $payed_option = array(
'all'=>$this->lng->txt(
'pay_all'),
'1'=>$this->lng->txt(
'yes'),
'0'=>$this->lng->txt(
'no'));
248 $o_payed->setTitle($this->lng->txt(
'paya_payed'));
249 $o_payed->setOptions($payed_option);
250 $o_payed->setValue(
$_SESSION[
'pay_statistics'][
'payed']);
251 $o_payed->setPostVar(
'payed');
253 $o_hide_check->addSubItem($o_payed);
256 $access_option = array(
'all'=>$this->lng->txt(
'pay_all'),
'1'=>$this->lng->txt(
'yes'),
'0'=>$this->lng->txt(
'no'));
258 $o_access->setTitle($this->lng->txt(
'paya_access'));
259 $o_access->setOptions($access_option);
260 $o_access->setValue(
$_SESSION[
'pay_statistics'][
'access']);
261 $o_access->setPostVar(
'access');
262 $o_hide_check->addSubItem($o_access);
265 $o_paymethod->setTitle($this->lng->txt(
'payment_system'));
267 $o_paymethod->setValue(
$_SESSION[
'pay_statistics'][
'pay_method']);
268 $o_paymethod->setPostVar(
'pay_method');
269 $o_hide_check->addSubItem($o_paymethod);
271 $filter_form->addCommandButton(
'showStatistics', $this->lng->txt(
'pay_update_view'));
272 $filter_form->addCommandButton(
'resetFilter', $this->lng->txt(
'pay_reset_filter'));
274 $filter_form->addItem($o_hide_check);
276 $this->tpl->setVariable(
'FORM', $filter_form->getHTML());
282 if(!count($bookings = $this->booking_obj->getBookings()))
288 # $this->__showButton('excelExport',$this->lng->txt('excel_export'));
290 $img_change =
"<img src=\"".ilUtil::getImagePath(
"edit.gif").
"\" alt=\"".
291 $this->lng->txt(
"edit").
"\" title=\"".$this->lng->txt(
"edit").
292 "\" border=\"0\" vspace=\"0\"/>";
294 include_once
'Services/User/classes/class.ilObjUser.php';
295 $object_title_cache = array();
296 $user_title_cache = array();
299 foreach($bookings as $booking)
301 if(array_key_exists($booking[
'ref_id'], $object_title_cache))
303 $tmp_obj = $object_title_cache[$booking[
'ref_id']];
308 $object_title_cache[$booking[
'ref_id']] = $tmp_obj;
310 if(array_key_exists($booking[
'b_vendor_id'], $user_title_cache))
312 $tmp_vendor = $user_title_cache[$booking[
'b_vendor_id']];
317 $user_title_cache[$booking[
'b_vendor_id']] = $tmp_vendor;
319 if(array_key_exists($booking[
'customer_id'], $user_title_cache))
321 $tmp_purchaser = $user_title_cache[$booking[
'customer_id']];
326 $user_title_cache[$booking[
'customer_id']] = $tmp_purchaser;
329 $transaction = $booking[
'transaction_extern'];
331 $transaction .=
" (" . $str_paymethod .
")";
333 $f_result[$counter][
'transaction'] = $transaction;
334 $f_result[$counter][
'object_title'] = ($tmp_obj !=
'' ? $tmp_obj : $this->lng->txt(
'object_deleted'));
335 $f_result[$counter][
'vendor'] = ($tmp_vendor !=
'' ?
'['.$tmp_vendor.
']' : $this->lng->txt(
'user_deleted'));
336 $f_result[$counter][
'customer'] = ($tmp_purchaser !=
'' ?
'['.$tmp_purchaser.
']' : $this->lng->txt(
'user_deleted'));
339 if($booking[
'duration'] == 0)
341 $booking[
'duration'] = $this->lng->txt(
'unlimited_duration');
344 $f_result[$counter][
'duration'] = $booking[
'duration'];
346 $f_result[$counter][
'discount'] = $booking[
'discount'].
' '.$booking[
'currency_unit'];
348 $payed_access = $booking[
'payed'] ?
349 $this->lng->txt(
'yes') :
350 $this->lng->txt(
'no');
352 $payed_access .=
'/';
353 $payed_access .= $booking[
'access_granted'] ?
354 $this->lng->txt(
'yes') :
355 $this->lng->txt(
'no');
357 $f_result[$counter][
'payed_access'] = $payed_access;
359 $this->ctrl->setParameter($this,
"booking_id",$booking[
'booking_id']);
360 $link_change =
"<div class=\"il_ContainerItemCommands\"><a class=\"il_ContainerItemCommand\" href=\"".$this->ctrl->getLinkTarget($this,
"editStatistic").
"\">".$this->lng->txt(
"edit").
"</a></div>";
362 $f_result[$counter][
'edit'] = $link_change;
366 unset($tmp_purchaser);
375 include_once
'./Services/Payment/classes/class.ilPaymentExcelWriterAdapter.php';
384 $workbook = $pewa->getWorkbook();
390 include_once
'./Services/Payment/classes/class.ilPaymentVendors.php';
394 $workbook = $pewa->getWorkbook();
395 $worksheet = $workbook->addWorksheet($this->lng->txt(
'bookings'));
397 $worksheet->mergeCells(0,0,0,8);
398 $worksheet->setColumn(0,0,16);
399 $worksheet->setColumn(0,1,32);
400 $worksheet->setColumn(0,2,32);
401 $worksheet->setColumn(0,3,16);
402 $worksheet->setColumn(0,4,16);
403 $worksheet->setColumn(0,5,16);
404 $worksheet->setColumn(0,6,24);
405 $worksheet->setColumn(0,7,8);
406 $worksheet->setColumn(0,8,12);
407 $worksheet->setColumn(0,9,16);
409 $title = $this->lng->txt(
'bookings');
410 $title .=
' '.$this->lng->txt(
'as_of');
411 $title .= strftime(
'%Y-%m-%d %R',time());
413 $worksheet->writeString(0,0,
$title,$pewa->getFormatTitle());
415 $worksheet->writeString(1,0,$this->lng->txt(
'payment_system'),$pewa->getFormatHeader());
416 $worksheet->writeString(1,1,$this->lng->txt(
'paya_transaction'),$pewa->getFormatHeader());
417 $worksheet->writeString(1,2,$this->lng->txt(
'title'),$pewa->getFormatHeader());
418 $worksheet->writeString(1,3,$this->lng->txt(
'paya_vendor'),$pewa->getFormatHeader());
419 $worksheet->writeString(1,4,$this->lng->txt(
'pays_cost_center'),$pewa->getFormatHeader());
420 $worksheet->writeString(1,5,$this->lng->txt(
'paya_customer'),$pewa->getFormatHeader());
421 $worksheet->writeString(1,6,$this->lng->txt(
'paya_order_date'),$pewa->getFormatHeader());
422 $worksheet->writeString(1,7,$this->lng->txt(
'duration'),$pewa->getFormatHeader());
423 $worksheet->writeString(1,8,$this->lng->txt(
'price_a'),$pewa->getFormatHeader());
424 $worksheet->writeString(1,9,$this->lng->txt(
'paya_payed_access'),$pewa->getFormatHeader());
426 if(!count($bookings = $this->booking_obj->getBookings()))
431 include_once
'Services/User/classes/class.ilObjUser.php';
432 $object_title_cache = array();
433 $user_title_cache = array();
436 foreach($bookings as $booking)
438 if(array_key_exists($booking[
'ref_id'], $object_title_cache))
440 $tmp_obj = $object_title_cache[$booking[
'ref_id']];
445 $object_title_cache[$booking[
'ref_id']] = $tmp_obj;
447 if(array_key_exists($booking[
'b_vendor_id'], $user_title_cache))
449 $tmp_vendor = $user_title_cache[$booking[
'b_vendor_id']];
454 $user_title_cache[$booking[
'b_vendor_id']] = $tmp_vendor;
456 if(array_key_exists($booking[
'customer_id'], $user_title_cache))
458 $tmp_purchaser = $user_title_cache[$booking[
'customer_id']];
463 $user_title_cache[$booking[
'customer_id']] = $tmp_purchaser;
469 $worksheet->writeString($counter,1,$booking[
'transaction_extern']);
470 $worksheet->writeString($counter,2,($tmp_obj !=
'' ? $tmp_obj : $this->lng->txt(
'object_deleted')));
471 $worksheet->writeString($counter,3,($tmp_vendor !=
'' ? $tmp_vendor : $this->lng->txt(
'user_deleted')));
473 $worksheet->writeString($counter,5,($tmp_purchaser !=
'' ? $tmp_purchaser : $this->lng->txt(
'user_deleted')));
474 $worksheet->writeString($counter,6,strftime(
'%Y-%m-%d %R',$booking[
'order_date']));
475 $worksheet->writeString($counter,7,$booking[
'duration']);
476 $worksheet->writeString($counter,8,$booking[
'price']);
478 $payed_access = $booking[
'payed'] ?
479 $this->lng->txt(
'yes') :
480 $this->lng->txt(
'no');
482 $payed_access .=
'/';
483 $payed_access .= $booking[
'access_granted'] ?
484 $this->lng->txt(
'yes') :
485 $this->lng->txt(
'no');
487 $worksheet->writeString($counter,9,$payed_access);
491 unset($tmp_purchaser);
501 if(!isset(
$_GET[
'booking_id']))
509 include_once
'./Services/Utilities/classes/class.ilConfirmationGUI.php';
510 $ilToolbar->addButton($this->lng->txt(
'back'), $this->ctrl->getLinkTarget($this,
'showStatistics'));
512 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.main_view.html',
'Services/Payment');
514 $this->ctrl->setParameter($this,
'booking_id',(
int)
$_GET[
'booking_id']);
516 $bookings = $this->booking_obj->getBookings();
517 $booking = $bookings[(int) $_GET[
'booking_id']];
520 if($a_show_confirm_delete)
525 $oConfirmationGUI->setFormAction($this->ctrl->getFormAction($this,
"performDelete"));
526 $oConfirmationGUI->setHeaderText($this->lng->txt(
"paya_sure_delete_stat"));
527 $oConfirmationGUI->setCancel($this->lng->txt(
"cancel"),
"editStatistic");
528 $oConfirmationGUI->setConfirm($this->lng->txt(
"confirm"),
"performDelete");
533 $oConfirmationGUI->addItem(
'booking_id', $_GET[
'booking_id'], $tmp_obj);
535 $this->tpl->setVariable(
'CONFIRMATION', $oConfirmationGUI->getHTML());
543 $oForm->setFormAction($this->ctrl->getFormAction($this));
544 $oForm->setId(
'stat_form');
545 $oForm->setTableWidth(
'50 %');
547 if(is_object($tmp_user))
549 $frm_user = $tmp_user->getFullname().
' ['.$tmp_user->getLogin().
']';
553 $frm_user = $this->lng->txt(
'user_deleted');
555 $oForm->setTitle($frm_user);
562 $oTitleGUI->
setValue($tmp_obj !=
'' ? $tmp_obj : $this->lng->txt(
'object_deleted'));
563 $oForm->addItem($oTitleGUI);
567 $oTransactionGUI->
setValue($booking[
'transaction']);
568 $oForm->addItem($oTransactionGUI);
573 if(is_object($tmp_vendor))
575 $frm_vendor = $tmp_vendor->getFullname().
' ['.$tmp_vendor->getLogin().
']';
579 $frm_vendor = $this->lng->txt(
'user_deleted');
582 $oForm->addItem($oVendorGUI);
587 $oForm->addItem($oPaymethodGUI);
592 $oForm->addItem($oOrderdateGUI);
596 if($booking[
'duration'] != 0)
598 $frm_duration = $booking[
'duration'].
' '.$this->lng->txt(
'paya_months');
602 $frm_duration = $this->lng->txt(
"unlimited_duration");
604 $oDurationGUI->
setValue($frm_duration);
605 $oForm->addItem($oDurationGUI);
609 $oPriceGUI->
setValue($booking[
'price'].
' '.$booking[
'currency_unit'] );
610 $oForm->addItem($oPriceGUI);
614 $payed_option = array(0 => $this->lng->txt(
'no'),1 => $this->lng->txt(
'yes'));
616 $oPayedGUI->setTitle($this->lng->txt(
'paya_payed'));
617 $oPayedGUI->setOptions($payed_option);
618 $oPayedGUI->setValue($booking[
'payed']);
619 $oPayedGUI->setPostVar(
'payed');
620 $oForm->addItem($oPayedGUI);
624 $access_option = array(0 => $this->lng->txt(
'no'),1 => $this->lng->txt(
'yes'));
626 $oAccessGUI->setTitle($this->lng->txt(
'paya_access'));
627 $oAccessGUI->setOptions($payed_option);
628 $oAccessGUI->setValue($booking[
'access_granted']);
629 $oAccessGUI->setPostVar(
'access');
630 $oForm->addItem($oAccessGUI);
632 $oForm->addCommandButton(
'updateStatistic',$this->lng->txt(
'save'));
633 $oForm->addCommandButton(
'deleteStatistic',$this->lng->txt(
'delete'));
635 $this->tpl->setVariable(
'FORM',$oForm->getHTML());
688 if(!isset(
$_GET[
'booking_id']))
697 $this->booking_obj->setBookingId((
int)
$_GET[
'booking_id']);
698 $this->booking_obj->setAccess((
int)
$_POST[
'access']);
699 $this->booking_obj->setPayed((
int) $_POST[
'payed']);
701 if($this->booking_obj->update())
719 if(!isset(
$_GET[
'booking_id']))
734 if(!isset(
$_GET[
'booking_id']))
743 $this->booking_obj->setBookingId((
int)
$_GET[
'booking_id']);
744 if(!$this->booking_obj->delete())
746 die(
'Error deleting booking');
757 global $tree, $ilToolbar;
759 include_once
'./Services/Payment/classes/class.ilPaymentObjectSelector.php';
761 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.paya_object_selector.html",
'Services/Payment');
762 $ilToolbar->addButton($this->lng->txt(
'back'), $this->ctrl->getLinkTarget($this,
'showStatistics'));
766 $exp =
new ilPaymentObjectSelector($this->ctrl->getLinkTarget($this,
'showObjectSelector'), strtolower(get_class($this)));
767 $exp->
setExpand(
$_GET[
"paya_link_expand"] ?
$_GET[
"paya_link_expand"] : $tree->readRootId());
768 $exp->setExpandTarget($this->ctrl->getLinkTarget($this,
'showObjectSelector'));
772 $this->tpl->setVariable(
"EXPLORER",$exp->getOutput());
781 if(!isset(
$_GET[
'sell_id']))
789 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.main_view.html',
'Services/Payment');
791 $ilToolbar->addButton($this->lng->txt(
'back'), $this->ctrl->getLinkTarget($this,
'showObjectSelector'));
793 $this->lng->loadLanguageModule(
'search');
794 $this->ctrl->setParameter($this,
"sell_id",
$_GET[
"sell_id"]);
797 $form_gui->setFormAction($this->ctrl->getFormAction($this),
'performSearch');
798 $form_gui->setTitle($this->lng->txt(
'grp_search_members'));
799 $form_gui->setId(
'search_form');
801 $oTitle =
new ilTextInputGUI($this->lng->txt(
'search_search_term'),
'search_str');
803 $oTitle->setSize(40);
804 $oTitle->setValue(
$_POST[
'search_str']);
805 $form_gui->addItem($oTitle);
808 $form_gui->addCommandButton(
'performSearch', $this->lng->txt(
'search'));
809 $form_gui->addCommandButton(
'showStatistics', $this->lng->txt(
'cancel'));
811 $this->tpl->setVariable(
'FORM',$form_gui->getHTML());
822 if(!trim(
$_POST[
"search_str"]))
837 if(!isset(
$_GET[
'sell_id']))
845 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.main_view.html",
'Services/Payment');
846 $this->ctrl->setParameter($this,
"sell_id",
$_GET[
"sell_id"]);
848 $ilToolbar->addButton($this->lng->txt(
'back'), $this->ctrl->getLinkTarget($this,
'searchUser'));
859 $f_result[$counter][
'user_id'] = $user[
"id"];
860 $f_result[$counter][
'login'] = $tmp_obj->getLogin();
861 $f_result[$counter][
'firstname'] = $tmp_obj->getFirstname();
862 $f_result[$counter][
'lastname'] = $tmp_obj->getLastname();
875 isset(
$_POST[
'sell_id']) ? $sell_id =
$_POST[
'sell_id'] : $sell_id =
$_GET[
'sell_id'];
876 isset(
$_POST[
'user_id']) ? $user_id =
$_POST[
'user_id'] : $user_id =
$_GET[
'user_id'];
897 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.main_view.html",
'Services/Payment');
898 $ilToolbar->addButton($this->lng->txt(
'back'), $this->ctrl->getLinkTarget($this,
'searchUser'));
899 $ilCtrl->setParameter($this,
"sell_id", $sell_id);
900 $ilCtrl->setParameter($this,
"user_id", $user_id);
909 $tmp_object[
'title'] = $tmp_obj->getTitle();
913 $tmp_object[
'title'] = $this->lng->txt(
'object_not_found');
922 $oForm->setFormAction($ilCtrl->getFormAction($this,
'saveCustomer'));
924 $oForm->setTitle($this->lng->txt($tmp_user->getFullname().
' ['.$tmp_user->getLogin().
']'));
928 $oTransaction->setTitle($this->lng->txt(
'paya_transaction'));
930 $oTransaction->setPostVar(
'transaction');
931 $oForm->addItem($oTransaction);
935 $oObject->
setValue($tmp_obj->getTitle());
936 $oForm->addItem($oObject);
940 $oVendor->
setValue($tmp_vendor->getFullname().
' ['.$tmp_vendor->getLogin().
']');
941 $oForm->addItem($oVendor);
944 $oPayMethods =
new ilSelectInputGUI($this->lng->txt(
'paya_pay_method'),
'pay_method');
947 $oPayMethods->setOptions($payOptions);
948 $oPayMethods->setValue(
$_POST[
'pay_method']);
949 $oPayMethods->setPostVar(
'pay_method');
950 $oForm->addItem($oPayMethods);
953 $duration_opions = array();
955 if (is_array($prices = $prices_obj->getPrices()))
957 include_once
'./Services/Payment/classes/class.ilPaymentSettings.php';
959 $currency_unit = $genSet->get(
'currency_unit');
961 foreach($prices as $price)
964 if($price[
'extension'] == 1)
966 $txt_extension =
' ('.$this->lng->txt(
'extension_price').
') ';
968 $duration_options[$price[
'price_id']] =
969 $price[
'duration'].
' '.$this->lng->txt(
'paya_months').
', '.$price[
'price'].
' '.$currency_unit.
' '
976 $oDuration->setValue(
$_POST[
'duration']);
977 $oForm->addItem($oDuration);
981 $payed_option = array(
'1'=>$this->lng->txt(
'yes'),
'0'=>$this->lng->txt(
'no'));
983 $o_payed->setTitle($this->lng->txt(
'paya_payed'));
984 $o_payed->setOptions($payed_option);
985 $o_payed->setValue(
$_POST[
'payed']);
986 $o_payed->setPostVar(
'payed');
987 $oForm->addItem($o_payed);
990 $access_option = array(
'1'=>$this->lng->txt(
'yes'),
'0'=>$this->lng->txt(
'no'));
992 $o_access->setTitle($this->lng->txt(
'paya_access'));
993 $o_access->setOptions($access_option);
994 $o_access->setValue(
$_POST[
'access']);
995 $o_access->setPostVar(
'access');
996 $oForm->addItem($o_access);
998 $oForm->addCommandButton(
'saveCustomer',$this->lng->txt(
'save'));
999 $oForm->addCommandButton(
'showStatistics', $this->lng->txt(
'cancel'));
1001 $this->tpl->setVariable(
'FORM', $oForm->getHTML());
1006 global
$ilias,$ilObjDataCache, $ilUser;
1009 if(!isset(
$_GET[
'sell_id']))
1017 if(!isset(
$_GET[
'user_id']))
1025 if (
$_POST[
"pay_method"] ==
"" ||
1026 $_POST[
"duration"] ==
"")
1040 $this->booking_obj->setTransaction($transaction);
1041 $this->booking_obj->setTransactionExtern(
$_POST[
"transaction"]);
1042 $this->booking_obj->setPobjectId($pObjectId);
1043 $this->booking_obj->setCustomerId(
$_GET[
"user_id"]);
1044 $this->booking_obj->setVendorId($obj->getVendorId());
1045 $this->booking_obj->setPayMethod((
int)
$_POST[
"pay_method"]);
1046 $this->booking_obj->setOrderDate(time());
1050 $this->booking_obj->setDuration($price[
"duration"]);
1051 $this->booking_obj->setAccessExtension($price[
'extension']);
1076 $this->booking_obj->setAccess((
int) $_POST[
'access']);
1077 $this->booking_obj->setPayed((
int) $_POST[
'payed']);
1078 $this->booking_obj->setVoucher(
'');
1080 $obj_id = $ilObjDataCache->lookupObjId($obj->getRefId());
1081 $obj_type = $ilObjDataCache->lookupType($obj_id);
1082 $obj_title = $ilObjDataCache->lookupTitle($obj_id);
1084 include_once
'Services/Payment/classes/class.ilShopVatsList.php';
1085 $oVAT =
new ilShopVats((
int)$obj->getVatId());
1086 $obj_vat_rate = $oVAT->
getRate();
1087 $obj_vat_unit = $obj->getVat($this->booking_obj->getPrice());
1089 $this->booking_obj->setObjectTitle($obj_title);
1090 $this->booking_obj->setVatRate($obj_vat_rate);
1091 $this->booking_obj->setVatUnit($obj_vat_unit);
1093 include_once
'./Services/Payment/classes/class.ilPaymentSettings.php';
1095 $this->booking_obj->setCurrencyUnit( $genSet->get(
'currency_unit'));
1097 include_once
'./Services/Payment/classes/class.ilPayMethods.php';
1101 $user_id[] =
$_GET[
"user_id"];
1105 $this->booking_obj->setStreet($cust_obj[
$_GET[
"user_id"]][
'street'],
'');
1107 $this->booking_obj->setZipcode($cust_obj[$_GET[
"user_id"]][
'zipcode']);
1108 $this->booking_obj->setCity($cust_obj[$_GET[
"user_id"]][
'city']);
1109 $this->booking_obj->setCountry($cust_obj[$_GET[
"user_id"]][
'country']);
1112 if($this->booking_obj->add())
1118 if($obj_type ==
'crs')
1140 $tbl->setTitle($this->lng->txt(
"bookings"));
1141 $tbl->setId(
'tbl_bookings');
1142 $tbl->setRowTemplate(
"tpl.shop_statistics_row.html",
"Services/Payment");
1144 $tbl->addColumn($this->lng->txt(
'paya_transaction'),
'transaction',
'10%');
1145 $tbl->addColumn($this->lng->txt(
'title'),
'object_title',
'10%');
1146 $tbl->addColumn($this->lng->txt(
'paya_vendor'),
'vendor',
'10%');
1147 $tbl->addColumn($this->lng->txt(
'paya_customer'),
'customer',
'10%');
1148 $tbl->addColumn($this->lng->txt(
'paya_order_date'),
'order_date',
'10%');
1149 $tbl->addColumn($this->lng->txt(
'duration'),
'duration',
'10%');
1150 $tbl->addColumn($this->lng->txt(
'price_a'),
'price',
'5%');
1151 $tbl->addColumn($this->lng->txt(
'paya_coupons_coupon'),
'discount',
'5%');
1152 $tbl->addColumn($this->lng->txt(
'paya_payed_access'),
'payed_access',
'5%');
1153 $tbl->addColumn($this->lng->txt(
'edit'),
'edit',
'5%');
1154 $tbl->setData($a_result_set);
1156 $this->tpl->setVariable(
'TABLE', $tbl->getHTML());
1163 include_once
'./Services/Payment/classes/class.ilPaymentBookings.php';
1170 include_once(
"./classes/class.ilSearch.php");
1172 $this->lng->loadLanguageModule(
"content");
1174 $search =
new ilSearch($this->user_obj->getId());
1177 $search->setCombination(
"and");
1178 $search->setSearchFor(array(0 =>
'usr'));
1179 $search->setSearchType(
'new');
1181 if($search->validate($message))
1183 $search->performSearch();
1188 $this->ctrl->redirect($this,
"searchUser");
1190 return $search->getResultByType(
'usr');
1194 $this->ctrl->setParameter($this,
"sell_id",
$_GET[
"sell_id"]);
1197 $tbl->setTitle($this->lng->txt(
"users"));
1198 $tbl->setId(
'tbl_users_search');
1199 $tbl->setRowTemplate(
"tpl.shop_users_row.html",
"Services/Payment");
1200 $tbl->addColumn(
'',
'user_id',
'1%',
true);
1201 $tbl->addColumn($this->lng->txt(
'login'),
'login',
'10%');
1202 $tbl->addColumn($this->lng->txt(
'firstname'),
'firstname',
'10%');
1203 $tbl->addColumn($this->lng->txt(
'lastname'),
'lastname',
'10%');
1205 $tbl->addMultiCommand(
'addCustomer', $this->lng->txt(
'add'));
1206 $tbl->setData($a_result_set);
1208 $this->tpl->setVariable(
'TABLE', $tbl->getHTML());