ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilPaymentStatisticGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3
14include_once './Services/Payment/classes/class.ilPaymentObject.php';
15include_once './Services/Payment/classes/class.ilPayMethods.php';
16include_once './Services/Payment/classes/class.ilPaymentCurrency.php';
17include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
18include_once './Services/Payment/classes/class.ilShopTableGUI.php';
19include_once './Services/Payment/classes/class.ilInvoiceNumberPlaceholdersPropertyGUI.php';
20include_once("./Services/Payment/classes/class.ilPaymentObjectSelector.php");
21
23{
24 private $pobject = null;
25 public $booking_obj = null;
26
27 public function __construct($user_obj)
28 {
29 parent::__construct();
30
31 $this->ctrl->saveParameter($this, 'baseClass');
32
33 $this->user_obj = $user_obj;
34 $this->pobject = new ilPaymentObject($this->user_obj);
35
36 }
37
38 protected function prepareOutput()
39 {
40 global $ilTabs;
41
42 parent::prepareOutput();
43
44 $ilTabs->setTabActive('paya_header');
45 $ilTabs->setSubTabActive('bookings');
46 }
47
48 public function executeCommand()
49 {
50 $cmd = $this->ctrl->getCmd();
51
52 switch ($this->ctrl->getNextClass($this))
53 {
54 default:
55 if(!$cmd = $this->ctrl->getCmd())
56 {
57 $cmd = 'showStatistics';
58 }
59 $this->prepareOutput();
60 $this->$cmd();
61 break;
62 }
63 }
64
65 public function resetFilter()
66 {
67 unset($_SESSION["pay_statistics"]);
68 unset($_POST["transaction_type"]);
69 unset($_POST["transaction_value"]);
70 unset($_POST["from"]["day"]);
71 unset($_POST["from"]["month"]);
72 unset($_POST["from"]["year"]);
73 unset($_POST["til"]["day"]);
74 unset($_POST["til"]["month"]);
75 unset($_POST["til"]["year"]);
76 unset($_POST["payed"]);
77 unset($_POST["access"]);
78 unset($_POST["customer"]);
79 unset($_POST["pay_method"]);
80 unset($_POST["updateView"]);
81 unset($_POST["filter_title_id"]);
82
83 $this->showStatistics();
84 }
85
86 public function showStatistics()
87 {
88 global $rbacsystem, $ilToolbar, $ilObjDataCache;
89
90 // MINIMUM ACCESS LEVEL = 'read'
91 /* if(!$rbacsystem->checkAccess('read', $this->getRefId()))
92 {
93 $this->ilias->raiseError($this->lng->txt('msg_no_perm_read'),$this->ilias->error_obj->MESSAGE);
94 }
95 */
96
97
98 $ilToolbar->addButton($this->lng->txt('paya_add_customer'), $this->ctrl->getLinkTarget($this, 'showObjectSelector'));
99 if(!$_POST['show_filter'] && $_POST['updateView'] == '1')
100 {
101 $this->resetFilter();
102 }
103 else
104 if ($_POST['updateView'] == 1)
105 {
106 $_SESSION['pay_statistics']['show_filter']= $_POST['show_filter'];
107 $_SESSION['pay_statistics']['updateView'] = true;
108 $_SESSION['pay_statistics']['until_check'] = $_POST['until_check'];
109 $_SESSION['pay_statistics']['from_check'] = $_POST['from_check'];
110 $_SESSION['pay_statistics']['transaction_type'] = isset($_POST['transaction_type']) ? $_POST['transaction_type'] : '' ;
111 $_SESSION['pay_statistics']['transaction_value'] = isset($_POST['transaction_value']) ? $_POST['transaction_value'] : '';
112 $_SESSION['pay_statistics']['filter_title_id'] = (int)$_POST['filter_title_id'];
113
114 if($_SESSION['pay_statistics']['from_check'] == '1')
115 {
116 $_SESSION['pay_statistics']['from']['date']['d'] = $_POST['from']['date']['d'];
117 $_SESSION['pay_statistics']['from']['date']['m'] = $_POST['from']['date']['m'];
118 $_SESSION['pay_statistics']['from']['date']['y'] = $_POST['from']['date']['y'];
119 }
120 else
121 {
122 $_SESSION['pay_statistics']['from']['date']['d'] = '';
123 $_SESSION['pay_statistics']['from']['date']['m'] = '';
124 $_SESSION['pay_statistics']['from']['date']['y'] = '';
125 }
126
127 if($_SESSION['pay_statistics']['until_check']== '1')
128 {
129 $_SESSION['pay_statistics']['til']['date']['d'] = $_POST['til']['date']['d'];
130 $_SESSION['pay_statistics']['til']['date']['m'] = $_POST['til']['date']['m'];
131 $_SESSION['pay_statistics']['til']['date']['y'] = $_POST['til']['date']['y'];
132 }
133 else
134 {
135 $_SESSION['pay_statistics']['til']['date']['d'] = '';
136 $_SESSION['pay_statistics']['til']['date']['m'] = '';
137 $_SESSION['pay_statistics']['til']['date']['y'] = '';
138 }
139
140 $_SESSION['pay_statistics']['payed'] = $_POST['payed'];
141 $_SESSION['pay_statistics']['access'] = $_POST['access'];
142 $_SESSION['pay_statistics']['pay_method'] = $_POST['pay_method'];
143 $_SESSION['pay_statistics']['customer'] = isset ($_POST['customer']) ? $_POST['customer'] : '';
144 $_SESSION['pay_statistics']['vendor'] = isset ($_POST['vendor']) ? $_POST['vendor']: '';
145 }
146
147 $this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.main_view.html','Services/Payment');
148
149 include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
150 // FILTER FORM
151 $filter_form = new ilPropertyFormGUI();
152 $filter_form->setFormAction($this->ctrl->getFormAction($this));
153 $filter_form->setTitle($this->lng->txt('pay_filter'));
154 $filter_form->setId('formular');
155 $filter_form->setTableWidth('100 %');
156
157
158 $o_hide_check = new ilCheckBoxInputGUI($this->lng->txt('show_filter'),'show_filter');
159 $o_hide_check->setValue(1);
160 $o_hide_check->setChecked($_SESSION['pay_statistics']['show_filter'] ? 1 : 0);
161
162 $o_hidden = new ilHiddenInputGUI('updateView');
163 $o_hidden->setValue(1);
164 $o_hidden->setPostVar('updateView');
165 $o_hide_check->addSubItem($o_hidden);
166
167 $o_transaction_type = new ilSelectInputGUI();
168 $trans_option = array($this->lng->txt('pay_starting'),$this->lng->txt('pay_ending'));
169 $trans_value = array('0','1');
170 $o_transaction_type->setTitle($this->lng->txt('paya_transaction'));
171 $o_transaction_type->setOptions($trans_option);
172 $o_transaction_type->setValue($_SESSION['pay_statistics']['transaction_type']);
173 $o_transaction_type->setPostVar('transaction_type');
174 $o_hide_check->addSubItem($o_transaction_type);
175
176 $o_transaction_val = new ilTextInputGUI();
177 $o_transaction_val->setValue($_SESSION['pay_statistics']['transaction_value']);
178 $o_transaction_val->setPostVar('transaction_value');
179 $o_hide_check->addSubItem($o_transaction_val);
180
181 $o_customer = new ilTextInputGUI();
182 $o_customer->setTitle($this->lng->txt('paya_customer'));
183 $o_customer->setValue($_SESSION['pay_statistics']['customer']);
184 $o_customer->setPostVar('customer');
185 $o_hide_check->addSubItem($o_customer);
186
187 $o_vendor = new ilTextInputGUI();
188 $o_vendor->setTitle($this->lng->txt('paya_vendor'));
189 $o_vendor->setValue($_SESSION['pay_statistics']['vendor']);
190 $o_vendor->setPostVar('vendor');
191 $o_hide_check->addSubItem($o_vendor);
192
193 $o_from_check = new ilCheckBoxInputGUI($this->lng->txt('pay_order_date_from'),'from_check');
194 $o_from_check->setValue(1);
195 $o_from_check->setChecked($_SESSION['pay_statistics']['from_check'] ? 1 : 0);
196
197 $o_date_from = new ilDateTimeInputGUI();
198 $o_date_from->setPostVar('from');
199 $_POST['from'] = $_SESSION['pay_statistics']['from'];
200
201 if($_SESSION['pay_statistics']['from_check'] == '1')
202 {
203 $o_date_from->checkInput();
204 }
205
206 $o_from_check->addSubItem($o_date_from);
207 $o_hide_check->addSubItem($o_from_check);
208
209 $o_until_check = new ilCheckBoxInputGUI($this->lng->txt('pay_order_date_til'), 'until_check');
210 $o_until_check->setValue(1);
211 $o_until_check->setChecked($_SESSION['pay_statistics']['until_check'] ? 1 : 0);
212
213 $o_date_until = new ilDateTimeInputGUI();
214 $o_date_until->setPostVar('til');
215 $_POST['til'] = $_SESSION['pay_statistics']['til'];
216
217 if($_SESSION['pay_statistics']['until_check'] == '1')
218 {
219 $o_date_until->checkInput();
220 }
221
222 $o_until_check->addSubItem($o_date_until);
223 $o_hide_check->addSubItem($o_until_check);
224
225
226 // title filter
227 $this->__initBookingObject();
228 $title_options['all']=$this->lng->txt('pay_all');
229 $unique_titles = $this->booking_obj->getUniqueTitles();
230
231 if(is_array($unique_titles) && count($unique_titles))
232 {
233 foreach($unique_titles as $ref_id)
234 {
235 $title_options[$ref_id] = $ilObjDataCache->lookupTitle($ilObjDataCache->lookupObjId($ref_id));
236 }
237 }
238
239 $o_object_title = new ilSelectInputGUI();
240 $o_object_title->setTitle($this->lng->txt('title'));
241 $o_object_title->setOptions($title_options);
242 $o_object_title->setValue($_SESSION["pay_statistics"]["filter_title_id"]);
243 $o_object_title->setPostVar('filter_title_id');
244 $o_hide_check->addSubItem($o_object_title);
245
246 $o_payed = new ilSelectInputGUI();
247 $payed_option = array('all'=>$this->lng->txt('pay_all'),'1'=>$this->lng->txt('yes'),'0'=>$this->lng->txt('no'));
248
249 $o_payed->setTitle($this->lng->txt('paya_payed'));
250 $o_payed->setOptions($payed_option);
251 $o_payed->setValue($_SESSION['pay_statistics']['payed']);
252 $o_payed->setPostVar('payed');
253
254 $o_hide_check->addSubItem($o_payed);
255
256 $o_access = new ilSelectInputGUI();
257 $access_option = array('all'=>$this->lng->txt('pay_all'),'1'=>$this->lng->txt('yes'),'0'=>$this->lng->txt('no'));
258
259 $o_access->setTitle($this->lng->txt('paya_access'));
260 $o_access->setOptions($access_option);
261 $o_access->setValue($_SESSION['pay_statistics']['access']);
262 $o_access->setPostVar('access');
263 $o_hide_check->addSubItem($o_access);
264
265 $o_paymethod = new ilSelectInputGUI();
266 $o_paymethod->setTitle($this->lng->txt('payment_system'));
267 $o_paymethod->setOptions(ilPayMethods::getPayMethodsOptions('all'));
268 $o_paymethod->setValue($_SESSION['pay_statistics']['pay_method']);
269 $o_paymethod->setPostVar('pay_method');
270 $o_hide_check->addSubItem($o_paymethod);
271
272 $filter_form->addCommandButton('showStatistics', $this->lng->txt('pay_update_view'));
273 $filter_form->addCommandButton('resetFilter', $this->lng->txt('pay_reset_filter'));
274
275 $filter_form->addItem($o_hide_check);
276
277 $this->tpl->setVariable('FORM', $filter_form->getHTML());
278
279
280// STATISTICS TABLE
281 $this->__initBookingObject();
282
283 if(!count($bookings = $this->booking_obj->getBookings()))
284 {
285 ilUtil::sendInfo($this->lng->txt('paya_no_bookings'));
286
287 return true;
288 }
289# $this->__showButton('excelExport',$this->lng->txt('excel_export'));
290
291 include_once 'Services/User/classes/class.ilObjUser.php';
292 $object_title_cache = array();
293 $user_title_cache = array();
294
295 $counter = 0;
296 foreach($bookings as $booking)
297 {
298 if(array_key_exists($booking['ref_id'], $object_title_cache))
299 {
300 $tmp_obj = $object_title_cache[$booking['ref_id']];
301 }
302 else
303 {
304 $tmp_obj = ilObject::_lookupTitle(ilObject::_lookupObjId($booking['ref_id']));
305 $object_title_cache[$booking['ref_id']] = $tmp_obj;
306 }
307 if(array_key_exists($booking['b_vendor_id'], $user_title_cache))
308 {
309 $tmp_vendor = $user_title_cache[$booking['b_vendor_id']];
310 }
311 else
312 {
313 $tmp_vendor = ilObjUser::_lookupLogin($booking['b_vendor_id']);
314 $user_title_cache[$booking['b_vendor_id']] = $tmp_vendor;
315 }
316 if(array_key_exists($booking['customer_id'], $user_title_cache))
317 {
318 $tmp_purchaser = $user_title_cache[$booking['customer_id']];
319 }
320 else
321 {
322 $tmp_purchaser = ilObjUser::_lookupLogin($booking['customer_id']);
323 $user_title_cache[$booking['customer_id']] = $tmp_purchaser;
324 }
325
326 $transaction = $booking['transaction_extern'];
327 $str_paymethod = ilPayMethods::getStringByPaymethod($booking['b_pay_method']);
328 $transaction .= " (" . $str_paymethod . ")";
329
330 $f_result[$counter]['transaction'] = $transaction;
331 $f_result[$counter]['object_title'] = ($tmp_obj != '' ? $tmp_obj : $this->lng->txt('object_deleted'));
332 $f_result[$counter]['vendor'] = ($tmp_vendor != '' ? '['.$tmp_vendor.']' : $this->lng->txt('user_deleted'));
333 $f_result[$counter]['customer'] = ($tmp_purchaser != '' ? '['.$tmp_purchaser.']' : $this->lng->txt('user_deleted'));
334 $f_result[$counter]['order_date'] = ilDatePresentation::formatDate(new ilDateTime($booking['order_date'], IL_CAL_UNIX));
335
336 if($booking['duration'] == 0)
337 {
338 $booking['duration'] = $this->lng->txt('unlimited_duration');
339 }
340
341 $f_result[$counter]['duration'] = $booking['duration'];
342 $f_result[$counter]['price'] = ilFormat::_getLocalMoneyFormat($booking['price']).' '.$booking['currency_unit'];
343 $f_result[$counter]['discount'] = $booking['discount'].' '.$booking['currency_unit'];
344
345 $payed_access = $booking['payed'] ?
346 $this->lng->txt('yes') :
347 $this->lng->txt('no');
348
349 $payed_access .= '/';
350 $payed_access .= $booking['access_granted'] ?
351 $this->lng->txt('yes') :
352 $this->lng->txt('no');
353
354 $f_result[$counter]['payed_access'] = $payed_access;
355
356 $this->ctrl->setParameter($this,"booking_id",$booking['booking_id']);
357 $link_change = "<div class=\"il_ContainerItemCommands\"><a class=\"il_ContainerItemCommand\" href=\"".$this->ctrl->getLinkTarget($this,"editStatistic")."\">".$this->lng->txt("edit")."</a></div>";
358
359 $f_result[$counter]['edit'] = $link_change;
360
361 unset($tmp_obj);
362 unset($tmp_vendor);
363 unset($tmp_purchaser);
364
365 ++$counter;
366 }
367 return $this->__showStatisticTable($f_result);
368 }
369
370 public function excelExport()
371 {
372 include_once './Services/Payment/classes/class.ilPaymentExcelWriterAdapter.php';
373
374 $pewa = new ilPaymentExcelWriterAdapter('payment_vendors.xls');
375
376 // add/fill worksheet
377 $this->addStatisticWorksheet($pewa);
378
379 // HEADER SENT
380
381 $workbook = $pewa->getWorkbook();
382 @$workbook->close();
383 }
384
385 public function addStatisticWorksheet($pewa)
386 {
387 include_once './Services/Payment/classes/class.ilPaymentVendors.php';
388
389 $this->__initBookingObject();
390
391 $workbook = $pewa->getWorkbook();
392 $worksheet = $workbook->addWorksheet($this->lng->txt('bookings'));
393
394 $worksheet->mergeCells(0,0,0,8);
395 $worksheet->setColumn(0,0,16);
396 $worksheet->setColumn(0,1,32);
397 $worksheet->setColumn(0,2,32);
398 $worksheet->setColumn(0,3,16);
399 $worksheet->setColumn(0,4,16);
400 $worksheet->setColumn(0,5,16);
401 $worksheet->setColumn(0,6,24);
402 $worksheet->setColumn(0,7,8);
403 $worksheet->setColumn(0,8,12);
404 $worksheet->setColumn(0,9,16);
405
406 $title = $this->lng->txt('bookings');
407 $title .= ' '.$this->lng->txt('as_of');
408 $title .= strftime('%Y-%m-%d %R',time());
409
410 $worksheet->writeString(0,0,$title,$pewa->getFormatTitle());
411
412 $worksheet->writeString(1,0,$this->lng->txt('payment_system'),$pewa->getFormatHeader());
413 $worksheet->writeString(1,1,$this->lng->txt('paya_transaction'),$pewa->getFormatHeader());
414 $worksheet->writeString(1,2,$this->lng->txt('title'),$pewa->getFormatHeader());
415 $worksheet->writeString(1,3,$this->lng->txt('paya_vendor'),$pewa->getFormatHeader());
416 $worksheet->writeString(1,4,$this->lng->txt('pays_cost_center'),$pewa->getFormatHeader());
417 $worksheet->writeString(1,5,$this->lng->txt('paya_customer'),$pewa->getFormatHeader());
418 $worksheet->writeString(1,6,$this->lng->txt('paya_order_date'),$pewa->getFormatHeader());
419 $worksheet->writeString(1,7,$this->lng->txt('duration'),$pewa->getFormatHeader());
420 $worksheet->writeString(1,8,$this->lng->txt('price_a'),$pewa->getFormatHeader());
421 $worksheet->writeString(1,9,$this->lng->txt('paya_payed_access'),$pewa->getFormatHeader());
422
423 if(!count($bookings = $this->booking_obj->getBookings()))
424 {
425 return false;
426 }
427
428 include_once 'Services/User/classes/class.ilObjUser.php';
429 $object_title_cache = array();
430 $user_title_cache = array();
431
432 $counter = 2;
433 foreach($bookings as $booking)
434 {
435 if(array_key_exists($booking['ref_id'], $object_title_cache))
436 {
437 $tmp_obj = $object_title_cache[$booking['ref_id']];
438 }
439 else
440 {
441 $tmp_obj = ilObject::_lookupTitle(ilObject::_lookupObjId($booking['ref_id']));
442 $object_title_cache[$booking['ref_id']] = $tmp_obj;
443 }
444 if(array_key_exists($booking['b_vendor_id'], $user_title_cache))
445 {
446 $tmp_vendor = $user_title_cache[$booking['b_vendor_id']];
447 }
448 else
449 {
450 $tmp_vendor = ilObjUser::_lookupLogin($booking['b_vendor_id']);
451 $user_title_cache[$booking['b_vendor_id']] = $tmp_vendor;
452 }
453 if(array_key_exists($booking['customer_id'], $user_title_cache))
454 {
455 $tmp_purchaser = $user_title_cache[$booking['customer_id']];
456 }
457 else
458 {
459 $tmp_purchaser = ilObjUser::_lookupLogin($booking['customer_id']);
460 $user_title_cache[$booking['customer_id']] = $tmp_purchaser;
461 }
462
463 $pay_method = ilPayMethods::getStringByPaymethod($booking['b_pay_method']);
464
465 $worksheet->writeString($counter,0,$pay_method);
466 $worksheet->writeString($counter,1,$booking['transaction_extern']);
467 $worksheet->writeString($counter,2,($tmp_obj != '' ? $tmp_obj : $this->lng->txt('object_deleted')));
468 $worksheet->writeString($counter,3,($tmp_vendor != '' ? $tmp_vendor : $this->lng->txt('user_deleted')));
469 $worksheet->writeString($counter,4,ilPaymentVendors::_getCostCenter($booking['b_vendor_id']));
470 $worksheet->writeString($counter,5,($tmp_purchaser != '' ? $tmp_purchaser : $this->lng->txt('user_deleted')));
471 $worksheet->writeString($counter,6,strftime('%Y-%m-%d %R',$booking['order_date']));
472 $worksheet->writeString($counter,7,$booking['duration']);
473 $worksheet->writeString($counter,8,$booking['price']);
474
475 $payed_access = $booking['payed'] ?
476 $this->lng->txt('yes') :
477 $this->lng->txt('no');
478
479 $payed_access .= '/';
480 $payed_access .= $booking['access_granted'] ?
481 $this->lng->txt('yes') :
482 $this->lng->txt('no');
483
484 $worksheet->writeString($counter,9,$payed_access);
485
486 unset($tmp_obj);
487 unset($tmp_vendor);
488 unset($tmp_purchaser);
489
490 ++$counter;
491 }
492 }
493
494 public function editStatistic($a_show_confirm_delete = false)
495 {
496 global $ilToolbar;
497
498 if(!isset($_GET['booking_id']))
499 {
500 ilUtil::sendInfo($this->lng->txt('paya_no_booking_id_given'));
501 $this->showStatistics();
502
503 return true;
504 }
505
506 include_once './Services/Utilities/classes/class.ilConfirmationGUI.php';
507 $ilToolbar->addButton($this->lng->txt('back'), $this->ctrl->getLinkTarget($this, 'showStatistics'));
508
509 $this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.main_view.html','Services/Payment');
510
511 $this->ctrl->setParameter($this,'booking_id',(int) $_GET['booking_id']);
512 $this->__initBookingObject();
513 $bookings = $this->booking_obj->getBookings();
514 $booking = $bookings[(int) $_GET['booking_id']];
515
516 // confirm delete
517 if($a_show_confirm_delete)
518 {
519 $pobject_data = ilPaymentObject::_getObjectData($booking['pobject_id']);
520 $tmp_obj = ilObject::_lookupTitle(ilObject::_lookupObjId($pobject_data['ref_id']));
521 $type = ilObject::_lookupType(ilObject::_lookupObjId($pobject_data['ref_id']));
522
523 $oConfirmationGUI = new ilConfirmationGUI();
524
525 // set confirm/cancel commands
526 $oConfirmationGUI->setFormAction($this->ctrl->getFormAction($this,"performDelete"));
527 $oConfirmationGUI->setHeaderText($this->lng->txt("paya_sure_delete_stat"));
528 $oConfirmationGUI->setCancel($this->lng->txt("cancel"), "editStatistic");
529
530 if($type == 'crs')
531 {
532 $oConfirmationGUI->addButton($this->lng->txt("confirm"), "performDeleteDeassignCrs");
533 }
534 else
535 $oConfirmationGUI->setConfirm($this->lng->txt("confirm"), "performDelete");
536
537 $oConfirmationGUI->addItem('booking_id', $_GET['booking_id'], $tmp_obj);
538
539 $this->tpl->setVariable('CONFIRMATION', $oConfirmationGUI->getHTML());
540 return true;
541 }
542
543
544 // get customer_obj
545 $tmp_user = ilObjectFactory::getInstanceByObjId($booking['customer_id'], false);
546 $oForm = new ilPropertyFormGUI();
547 $oForm->setFormAction($this->ctrl->getFormAction($this));
548 $oForm->setId('stat_form');
549 $oForm->setTableWidth('50 %');
550 if(is_object($tmp_user))
551 {
552 $frm_user = $tmp_user->getFullname().' ['.$tmp_user->getLogin().']';
553 }
554 else
555 {
556 $frm_user = $this->lng->txt('user_deleted');
557 }
558 $oForm->setTitle($frm_user);
559
560 $pObj = new ilPaymentObject($this->user_obj, $booking['pobject_id']);
561 $tmp_obj = ilObject::_lookupTitle(ilObject::_lookupObjId($pObj->getRefId()));
562
563 // object_title
564 $oTitleGUI = new ilNonEditableValueGUI($this->lng->txt('title'));
565 $oTitleGUI->setValue($tmp_obj != '' ? $tmp_obj : $this->lng->txt('object_deleted'));
566 $oForm->addItem($oTitleGUI);
567
568 // transaction
569 $oTransactionGUI = new ilNonEditableValueGUI($this->lng->txt('paya_transaction'));
570 $oTransactionGUI->setValue($booking['transaction']);
571 $oForm->addItem($oTransactionGUI);
572
573 //vendor
574 $oVendorGUI = new ilNonEditableValueGUI($this->lng->txt('paya_vendor'));
575 $tmp_vendor = ilObjectFactory::getInstanceByObjId($booking['b_vendor_id'], false);
576 if(is_object($tmp_vendor))
577 {
578 $frm_vendor = $tmp_vendor->getFullname().' ['.$tmp_vendor->getLogin().']';
579 }
580 else
581 {
582 $frm_vendor = $this->lng->txt('user_deleted');
583 }
584 $oVendorGUI->setValue($frm_vendor);
585 $oForm->addItem($oVendorGUI);
586
587 // paymethod
588 $oPaymethodGUI = new ilNonEditableValueGUI($this->lng->txt('paya_pay_method'));
589 $oPaymethodGUI->setValue(ilPayMethods::getStringByPaymethod($booking['b_pay_method']));
590 $oForm->addItem($oPaymethodGUI);
591
592 // order_date
593 $oOrderdateGUI = new ilNonEditableValueGUI($this->lng->txt('paya_order_date'));
594 $oOrderdateGUI->setValue(ilDatePresentation::formatDate(new ilDateTime($booking["order_date"],IL_CAL_UNIX)));
595 $oForm->addItem($oOrderdateGUI);
596
597 // duration
598 $oDurationGUI = new ilNonEditableValueGUI($this->lng->txt('duration'));
599 if(($booking['duration'] == 0) && ($booking['access_enddate'] == NULL))
600 {
601 $frm_duration = $this->lng->txt("unlimited_duration");
602 }
603 else
604 {
605 if($booking['duration'] > 0)
606 {
607 $frm_duration = $booking['duration'].' '.$this->lng->txt('paya_months');
608 }
609 $frm_duration .= ilDatePresentation::formatDate(new ilDate($booking['access_startdate'], IL_CAL_DATETIME))
610 .' - '.ilDatePresentation::formatDate(new ilDate($booking['access_enddate'], IL_CAL_DATETIME));
611 }
612 $oDurationGUI->setValue($frm_duration);
613 $oForm->addItem($oDurationGUI);
614
615 // price
616 $oPriceGUI = new ilNonEditableValueGUI($this->lng->txt('price_a'));
617 $oPriceGUI->setValue($booking['price'].' '.$booking['currency_unit'] );
618 $oForm->addItem($oPriceGUI);
619
620 // payed
621 $oPayedGUI = new ilSelectInputGUI();
622 $payed_option = array(0 => $this->lng->txt('no'),1 => $this->lng->txt('yes'));
623
624 $oPayedGUI->setTitle($this->lng->txt('paya_payed'));
625 $oPayedGUI->setOptions($payed_option);
626 $oPayedGUI->setValue($booking['payed']);
627 $oPayedGUI->setPostVar('payed');
628 $oForm->addItem($oPayedGUI);
629
630 // access
631 $oAccessGUI = new ilSelectInputGUI();
632 $access_option = array(0 => $this->lng->txt('no'),1 => $this->lng->txt('yes'));
633
634 $oAccessGUI->setTitle($this->lng->txt('paya_access'));
635 $oAccessGUI->setOptions($access_option);
636 $oAccessGUI->setValue($booking['access_granted']);
637 $oAccessGUI->setPostVar('access');
638 $oForm->addItem($oAccessGUI);
639
640 $oForm->addCommandButton('updateStatistic',$this->lng->txt('save'));
641 $oForm->addCommandButton('deleteStatistic',$this->lng->txt('delete'));
642
643 $this->tpl->setVariable('FORM',$oForm->getHTML());
644
645
646
647/* //Same output as in ilobjpaymentsettingsgui->statistics
648 // show CUSTOMER_DATA if isset -> setting: save_user_address
649 if(ilPayMethods::isCustomerAddressEnabled($booking['b_pay_method']))
650 {
651 $oForm2 = new ilPropertyFormGUI();
652 $oForm2->setId('cust_form');
653 $oForm2->setTableWidth('50 %');
654 $oForm2->setTitle($frm_user);
655
656 // email
657 $oEmailGUI = new ilNonEditableValueGUI($this->lng->txt('email'));
658 $email = (!isset($tmp_user)) ? $this->lng->txt('user_deleted') : $tmp_user->getEmail();
659 $oEmailGUI->setValue($email);
660 $oForm2->addItem($oEmailGUI);
661
662 // street
663 $oStreetGUI = new ilNonEditableValueGUI($this->lng->txt('street'));
664 $oStreetGUI->setValue($booking['street']);
665 $oForm2->addItem($oStreetGUI);
666
667 // pobox
668 $oPoBoxGUI = new ilNonEditableValueGUI($this->lng->txt('pay_bmf_po_box'));
669 $oPoBoxGUI->setValue($booking['po_box']);
670 $oForm2->addItem($oPoBoxGUI);
671
672 // zipcode
673 $oPoBoxGUI = new ilNonEditableValueGUI($this->lng->txt('zipcode'));
674 $oPoBoxGUI->setValue($booking['zipcode']);
675 $oForm2->addItem($oPoBoxGUI);
676
677 // city
678 $oCityGUI = new ilNonEditableValueGUI($this->lng->txt('city'));
679 $oCityGUI->setValue($booking['city']);
680 $oForm2->addItem($oCityGUI);
681
682 // country
683 $oCountryGUI = new ilNonEditableValueGUI($this->lng->txt('country'));
684 $oCountryGUI->setValue($booking['country']);
685 $oForm2->addItem($oCountryGUI);
686 }
687
688 $this->tpl->setVariable('FORM_2',$oForm2->getHTML());
689*/
690
691 return true;
692 }
693
694 public function updateStatistic()
695 {
696 if(!isset($_GET['booking_id']))
697 {
698 ilUtil::sendInfo($this->lng->txt('paya_no_booking_id_given'));
699 $this->showStatistics();
700
701 return true;
702 }
703 $this->__initBookingObject();
704
705 $this->booking_obj->setBookingId((int) $_GET['booking_id']);
706 $this->booking_obj->setAccess((int) $_POST['access']);
707 $this->booking_obj->setPayed((int) $_POST['payed']);
708
709 if($this->booking_obj->update())
710 {
711 ilUtil::sendInfo($this->lng->txt('paya_updated_booking'));
712
713 $this->showStatistics();
714 return true;
715 }
716 else
717 {
718 ilUtil::sendInfo($this->lng->txt('paya_error_update_booking'));
719 $this->showStatistics();
720
721 return true;
722 }
723 }
724
725 public function deleteStatistic()
726 {
727 if(!isset($_GET['booking_id']))
728 {
729 ilUtil::sendInfo($this->lng->txt('paya_no_booking_id_given'));
730 $this->showStatistics();
731
732 return true;
733 }
734
735 $this->editStatistic(true);
736
737 return true;
738 }
739
740 public function performDelete()
741 {
742 if(!isset($_GET['booking_id']))
743 {
744 ilUtil::sendInfo($this->lng->txt('paya_no_booking_id_given'));
745 $this->showStatistics();
746
747 return true;
748 }
749
750 $this->__initBookingObject();
751 $this->booking_obj->setBookingId((int) $_GET['booking_id']);
752 if(!$this->booking_obj->delete())
753 {
754 die('Error deleting booking');
755 }
756 ilUtil::sendInfo($this->lng->txt('pay_deleted_booking'));
757
758 $this->showStatistics();
759
760 return true;
761 }
762
763 public function showObjectSelector()
764 {
765 global $ilToolbar;
766
767 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.paya_object_selector.html",'Services/Payment');
768 $ilToolbar->addButton($this->lng->txt('back'), $this->ctrl->getLinkTarget($this, 'showStatistics'));
769
770 ilUtil::sendInfo($this->lng->txt("paya_select_object_to_sell"));
771
772 $exp = new ilPaymentObjectSelector($this, "showObjectSelector");
773 if (!$exp->handleCommand())
774 {
775 $this->tpl->setVariable("EXPLORER",$exp->getHTML());
776 }
777
778
779 return true;
780 }
781
782 public function searchUser()
783 {
784 global $ilToolbar;
785
786 if(!isset($_GET['sell_id']))
787 {
788 ilUtil::sendInfo($this->lng->txt('paya_no_booking_id_given'));
789 $this->showObjectSelector();
790
791 return false;
792 }
793
794 $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.main_view.html','Services/Payment');
795
796 $ilToolbar->addButton($this->lng->txt('back'), $this->ctrl->getLinkTarget($this, 'showObjectSelector'));
797
798 $this->lng->loadLanguageModule('search');
799 $this->ctrl->setParameter($this, "sell_id", $_GET["sell_id"]);
800
801 $form_gui = new ilPropertyFormGUI();
802 $form_gui->setFormAction($this->ctrl->getFormAction($this),'performSearch');
803 $form_gui->setTitle($this->lng->txt('grp_search_members'));
804 $form_gui->setId('search_form');
805
806 $oTitle = new ilTextInputGUI($this->lng->txt('search_search_term'), 'search_str');
807 $oTitle->setMaxLength(255);
808 $oTitle->setSize(40);
809 $oTitle->setValue($_POST['search_str']);
810 $form_gui->addItem($oTitle);
811
812 // buttons
813 $form_gui->addCommandButton('performSearch', $this->lng->txt('search'));
814 $form_gui->addCommandButton('showStatistics', $this->lng->txt('cancel'));
815
816 $this->tpl->setVariable('FORM',$form_gui->getHTML());
817 return true;
818 }
819
820 public function performSearch()
821 {
822 global $ilToolbar;
823 // SAVE it to allow sort in tables
824 $_SESSION["pays_search_str_user_sp"] = $_POST["search_str"] = $_POST["search_str"] ? $_POST["search_str"] : $_SESSION["pays_search_str_user_sp"];
825
826
827 if(!trim($_POST["search_str"]))
828 {
829 ilUtil::sendInfo($this->lng->txt("search_no_search_term"));
830 $this->showStatistics();
831
832 return false;
833 }
834 if(!count($result = $this->__search(ilUtil::stripSlashes($_POST["search_str"]))))
835 {
836 ilUtil::sendInfo($this->lng->txt("search_no_match"));
837 $this->searchUser();
838
839 return false;
840 }
841
842 if(!isset($_GET['sell_id']))
843 {
844 ilUtil::sendInfo($this->lng->txt('paya_no_booking_id_given'));
845 $this->showObjectSelector();
846
847 return false;
848 }
849
850 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.main_view.html",'Services/Payment');
851 $this->ctrl->setParameter($this, "sell_id", $_GET["sell_id"]);
852
853 $ilToolbar->addButton($this->lng->txt('back'), $this->ctrl->getLinkTarget($this, 'searchUser'));
854
855 $counter = 0;
856 $f_result = array();
857 foreach($result as $user)
858 {
859 if(!$tmp_obj = ilObjectFactory::getInstanceByObjId($user["id"],false))
860 {
861 continue;
862 }
863 // $f_result[$counter]['user_id'] = ilUtil::formRadiobutton(0,"user_id",$user["id"]);
864 $f_result[$counter]['user_id'] = $user["id"];
865 $f_result[$counter]['login'] = $tmp_obj->getLogin();
866 $f_result[$counter]['firstname'] = $tmp_obj->getFirstname();
867 $f_result[$counter]['lastname'] = $tmp_obj->getLastname();
868
869 unset($tmp_obj);
870 ++$counter;
871 }
872 $this->__showSearchUserTable($f_result);
873 }
874
875 public function addCustomer()
876 {
877 global $ilToolbar,$ilCtrl;
878
879 isset($_POST['sell_id']) ? $sell_id = $_POST['sell_id'] : $sell_id = $_GET['sell_id'];
880 isset($_POST['user_id']) ? $user_id = $_POST['user_id'] : $user_id = $_GET['user_id'];
881
882 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.main_view.html",'Services/Payment');
883 $ilToolbar->addButton($this->lng->txt('back'), $this->ctrl->getLinkTarget($this, 'searchUser'));
884 $ilCtrl->setParameter($this, "sell_id", $sell_id);
885 $ilCtrl->setParameter($this, "user_id", $user_id);
886
887 $pObjectId = ilPaymentObject::_lookupPobjectId($sell_id);
888 $obj = new ilPaymentObject($this->user_obj, $pObjectId);
889
890 // get obj
891 $tmp_obj = ilObjectFactory::getInstanceByRefId($sell_id, false);
892 if($tmp_obj)
893 {
894 $tmp_object['title'] = $tmp_obj->getTitle();
895 }
896 else
897 {
898 $tmp_object['title'] = $this->lng->txt('object_not_found');
899 }
900
901 // get customer_obj
902 $tmp_user = ilObjectFactory::getInstanceByObjId($user_id);
903 // get vendor_obj
904 $tmp_vendor = ilObjectFactory::getInstanceByObjId($obj->getVendorId());
905
906 $oForm = new ilPropertyFormGUI();
907 $oForm->setFormAction($ilCtrl->getFormAction($this, 'saveCustomer'));
908
909 $oForm->setTitle($this->lng->txt($tmp_user->getFullname().' ['.$tmp_user->getLogin().']'));
910
911 //transaction
912 $oTransaction = new ilTextInputGUI();
913 $oTransaction->setTitle($this->lng->txt('paya_transaction'));
914 $oTransaction->setValue(ilUtil::prepareFormOutput($_POST['transaction'], true));
915 $oTransaction->setPostVar('transaction');
916 $oForm->addItem($oTransaction);
917
918 //object
919 $oObject = new ilNonEditableValueGUI($this->lng->txt('title'));
920 $oObject->setValue($tmp_obj->getTitle());
921 $oForm->addItem($oObject);
922
923 //vendor
924 $oVendor = new ilNonEditableValueGUI($this->lng->txt('paya_vendor'));
925 $oVendor->setValue($tmp_vendor->getFullname().' ['.$tmp_vendor->getLogin().']');
926 $oForm->addItem($oVendor);
927
928 // pay methods
929 $oPayMethods = new ilSelectInputGUI($this->lng->txt('paya_pay_method'), 'pay_method');
930 $payOptions = ilPayMethods::getPayMethodsOptions(false);
931
932 $oPayMethods->setOptions($payOptions);
933 $oPayMethods->setValue($_POST['pay_method']);
934 $oPayMethods->setPostVar('pay_method');
935 $oForm->addItem($oPayMethods);
936
937 //duration
938 $duration_options = array();
939 $price_obj = new ilPaymentPrices($pObjectId);
940
941 $standard_prices = array();
942 $extension_prices = array();
943 $standard_prices = $price_obj->getPrices();
944 $extension_prices = $price_obj->getExtensionPrices();
945
946 $prices = array_merge($standard_prices, $extension_prices );
947
948 if (is_array($prices))
949 {
951 $currency_unit = $genSet->get('currency_unit');
952
953 foreach($prices as $price)
954 {
955 switch($price['price_type'])
956 {
958 $txt_duration =
959 $price['duration'].' '.$this->lng->txt('paya_months').' -> '.$price['price'].' '. $currency_unit;
960 break;
961
963 include_once './Services/Calendar/classes/class.ilDatePresentation.php';
964 $txt_duration =
965 ilDatePresentation::formatDate(new ilDate($price['duration_from'], IL_CAL_DATE))
966 .' - '.ilDatePresentation::formatDate(new ilDate($price['duration_until'], IL_CAL_DATE))
967 ." -> ".ilPaymentPrices::_getPriceString($price["price_id"]) .' '.$currency_unit;
968 break;
969
971 $txt_duration = $this->lng->txt('unlimited_duration').' -> '.$price['price'].' '. $currency_unit;
972 break;
973 }
974 $txt_extension = '';
975 if($price['extension'] == 1)
976 {
977 $txt_extension = ' ('.$this->lng->txt('extension_price').') ';
978 }
979 $duration_options[$price['price_id']] = $txt_duration.''.$txt_extension;
980 }
981 }
982
983 $oDuration = new ilSelectInputGUI($this->lng->txt('duration'), 'duration');
984 $oDuration->setOptions($duration_options);
985 $oDuration->setValue($_POST['duration']);
986 $oForm->addItem($oDuration);
987
988 //payed
989 $o_payed = new ilSelectInputGUI();
990 $payed_option = array('1'=>$this->lng->txt('yes'),'0'=>$this->lng->txt('no'));
991
992 $o_payed->setTitle($this->lng->txt('paya_payed'));
993 $o_payed->setOptions($payed_option);
994 $o_payed->setValue($_POST['payed']);
995 $o_payed->setPostVar('payed');
996 $oForm->addItem($o_payed);
997
998 $o_access = new ilSelectInputGUI();
999 $access_option = array('1'=>$this->lng->txt('yes'),'0'=>$this->lng->txt('no'));
1000
1001 $o_access->setTitle($this->lng->txt('paya_access'));
1002 $o_access->setOptions($access_option);
1003 $o_access->setValue($_POST['access']);
1004 $o_access->setPostVar('access');
1005 $oForm->addItem($o_access);
1006
1007 $oForm->addCommandButton('saveCustomer',$this->lng->txt('save'));
1008 $oForm->addCommandButton('showStatistics', $this->lng->txt('cancel'));
1009
1010 $this->tpl->setVariable('FORM', $oForm->getHTML());
1011 }
1012
1013 public function saveCustomer()
1014 {
1015 global $ilObjDataCache;
1016
1017
1018 if(!isset($_GET['sell_id']))
1019 {
1020 ilUtil::sendInfo($this->lng->txt('paya_error_no_object_id_given'));
1021 $this->showObjectSelector();
1022
1023 return true;
1024 }
1025
1026 if(!isset($_GET['user_id']))
1027 {
1028 ilUtil::sendInfo($this->lng->txt('paya_error_no_user_id_given'));
1029 $this->searchUser();
1030
1031 return true;
1032 }
1033
1034 if ($_POST["pay_method"] == "" ||
1035 $_POST["duration"] == "")
1036 {
1037 ilUtil::sendInfo($this->lng->txt('paya_error_mandatory_fields'));
1038 $this->addCustomer();
1039
1040 return true;
1041 }
1042
1043 $pObjectId = ilPaymentObject::_lookupPobjectId($_GET["sell_id"]);
1044 $obj = new ilPaymentObject($this->user_obj, $pObjectId);
1045
1046 $this->__initBookingObject();
1048
1049 $this->booking_obj->setTransaction($transaction);
1050 $this->booking_obj->setTransactionExtern($_POST["transaction"]);
1051 $this->booking_obj->setPobjectId($pObjectId);
1052 $this->booking_obj->setCustomerId($_GET["user_id"]);
1053 $this->booking_obj->setVendorId($obj->getVendorId());
1054 $this->booking_obj->setPayMethod((int) $_POST["pay_method"]);
1055 $this->booking_obj->setOrderDate(time());
1056
1057 $price = ilPaymentPrices::_getPrice($_POST["duration"]);
1058
1059 $this->booking_obj->setDuration($price["duration"]);
1060 $this->booking_obj->setAccessExtension($price['extension']);
1061
1062 switch((int)$price['price_type'])
1063 {
1065 $this->booking_obj->setDuration(0);
1066 break;
1067
1069 $this->booking_obj->setAccessStartdate($price['duration_from']);
1070 $this->booking_obj->setAccessEnddate($price['duration_until']);
1071 $this->booking_obj->setDuration(0);
1072 break;
1073
1074 default:
1076 $this->booking_obj->setDuration($price["duration"]);
1077 break;
1078 }
1079
1080 $this->booking_obj->setPriceType($price['price_type']);
1081 $this->booking_obj->setPrice(ilPaymentPrices::_getPriceString($_POST["duration"]));
1082
1083 $this->booking_obj->setAccess((int) $_POST['access']);
1084 $this->booking_obj->setPayed((int) $_POST['payed']);
1085 $this->booking_obj->setVoucher('');
1086
1087 $obj_id = $ilObjDataCache->lookupObjId($obj->getRefId());
1088 $obj_type = $ilObjDataCache->lookupType($obj_id);
1089 $obj_title = $ilObjDataCache->lookupTitle($obj_id);
1090
1091 include_once 'Services/Payment/classes/class.ilShopVatsList.php';
1092 $oVAT = new ilShopVats((int)$obj->getVatId());
1093 $obj_vat_rate = $oVAT->getRate();
1094 $obj_vat_unit = $obj->getVat($this->booking_obj->getPrice());
1095
1096 $this->booking_obj->setObjectTitle($obj_title);
1097 $this->booking_obj->setVatRate($obj_vat_rate);
1098 $this->booking_obj->setVatUnit($obj_vat_unit);
1099
1100 include_once './Services/Payment/classes/class.ilPaymentSettings.php';
1102 $this->booking_obj->setCurrencyUnit( $genSet->get('currency_unit'));
1103
1104 include_once './Services/Payment/classes/class.ilPayMethods.php';
1105 if(ilPayMethods::_EnabledSaveUserAddress((int) $_POST["pay_method"]) == 1)
1106 {
1107
1111 global $ilObjUser;
1112 $user_id[] = $_GET["user_id"];
1113
1114 $cust_obj = ilObjUser::_readUsersProfileData($user_id);
1115
1116 $this->booking_obj->setStreet($cust_obj[$_GET["user_id"]]['street'],'');
1117
1118 $this->booking_obj->setZipcode($cust_obj[$_GET["user_id"]]['zipcode']);
1119 $this->booking_obj->setCity($cust_obj[$_GET["user_id"]]['city']);
1120 $this->booking_obj->setCountry($cust_obj[$_GET["user_id"]]['country']);
1121 }
1122
1123 if($this->booking_obj->add())
1124 {
1125 // add purchased item to desktop
1126 ilShopUtils::_addPurchasedObjToDesktop($obj, $this->booking_obj->getCustomerId());
1127
1128 // autosubscribe user if purchased object is a course
1129 if($obj_type == 'crs')
1130 {
1131 ilShopUtils::_assignPurchasedCourseMemberRole($obj, $this->booking_obj->getCustomerId());
1132 }
1133
1134 ilUtil::sendInfo($this->lng->txt('paya_customer_added_successfully'));
1135 $this->showStatistics();
1136 }
1137 else
1138 {
1139 ilUtil::sendInfo($this->lng->txt('paya_error_adding_customer'));
1140 $this->addCustomer();
1141 }
1142
1143 return true;
1144 }
1145
1146 // PRIVATE
1147 public function __showStatisticTable($a_result_set)
1148 {
1149 $tbl = new ilShopTableGUI($this);
1150 $tbl->setTitle($this->lng->txt("bookings"));
1151 $tbl->setId('tbl_bookings');
1152 $tbl->setRowTemplate("tpl.shop_statistics_row.html", "Services/Payment");
1153
1154 $tbl->addColumn($this->lng->txt('paya_transaction'), 'transaction', '10%');
1155 $tbl->addColumn($this->lng->txt('title'), 'object_title', '10%');
1156 $tbl->addColumn($this->lng->txt('paya_vendor'), 'vendor', '10%');
1157 $tbl->addColumn($this->lng->txt('paya_customer'), 'customer', '10%');
1158 $tbl->addColumn($this->lng->txt('paya_order_date'), 'order_date', '10%');
1159 $tbl->addColumn($this->lng->txt('duration'), 'duration', '10%');
1160 $tbl->addColumn($this->lng->txt('price_a'), 'price', '5%');
1161 $tbl->addColumn($this->lng->txt('paya_coupons_coupon'), 'discount', '5%');
1162 $tbl->addColumn($this->lng->txt('paya_payed_access'), 'payed_access', '5%');
1163 $tbl->addColumn($this->lng->txt('edit'), 'edit', '5%');
1164 $tbl->setData($a_result_set);
1165
1166 $this->tpl->setVariable('TABLE', $tbl->getHTML());
1167
1168 return true;
1169 }
1170
1171 public function __initBookingObject()
1172 {
1173 include_once './Services/Payment/classes/class.ilPaymentBookings.php';
1174
1175 $this->booking_obj = new ilPaymentBookings($this->user_obj->getId());
1176 }
1177
1178 public function __search($a_search_string)
1179 {
1180 include_once("./Services/Search/classes/class.ilSearch.php");
1181
1182 $this->lng->loadLanguageModule("content");
1183
1184 $search = new ilSearch($this->user_obj->getId());
1185 $search->setPerformUpdate(false);
1186 $search->setSearchString(ilUtil::stripSlashes($a_search_string));
1187 $search->setCombination("and");
1188 $search->setSearchFor(array(0 => 'usr'));
1189 $search->setSearchType('new');
1190
1191 if($search->validate($message))
1192 {
1193 $search->performSearch();
1194 }
1195 else
1196 {
1197 ilUtil::sendInfo($message,true);
1198 $this->ctrl->redirect($this,"searchUser");
1199 }
1200 return $search->getResultByType('usr');
1201 }
1202 public function __showSearchUserTable($a_result_set)
1203 {
1204 $this->ctrl->setParameter($this, "sell_id", $_GET["sell_id"]);
1205
1206 $tbl = new ilShopTableGUI($this);
1207 $tbl->setTitle($this->lng->txt("users"));
1208 $tbl->setId('tbl_users_search');
1209 $tbl->setRowTemplate("tpl.shop_users_row.html", "Services/Payment");
1210 $tbl->addColumn('', 'user_id', '1%', true);
1211 $tbl->addColumn($this->lng->txt('login'), 'login', '10%');
1212 $tbl->addColumn($this->lng->txt('firstname'), 'firstname', '10%');
1213 $tbl->addColumn($this->lng->txt('lastname'), 'lastname', '10%');
1214
1215 $tbl->addMultiCommand('addCustomer', $this->lng->txt('add'));
1216 $tbl->setData($a_result_set);
1217
1218 $this->tpl->setVariable('TABLE', $tbl->getHTML());
1219 return true;
1220 }
1221
1223 {
1224 include_once './Services/Payment/classes/class.ilShopUtils.php';
1225
1226 if(!isset($_GET['booking_id']))
1227 {
1228 ilUtil::sendInfo($this->lng->txt('paya_no_booking_id_given'));
1229 $this->showStatistics();
1230
1231 return true;
1232 }
1233
1234 $this->__initBookingObject();
1235 $bookings = $this->booking_obj->getBookings();
1236 $booking = $bookings[(int) $_GET['booking_id']];
1237
1238 $pobject_data = ilPaymentObject::_getObjectData($booking['pobject_id']);
1239 ilShopUtils::_deassignPurchasedCourseMemberRole($pobject_data['ref_id'], $booking['customer_id']);
1240
1241 $this->booking_obj->setBookingId((int) $_GET['booking_id']);
1242 if(!$this->booking_obj->delete())
1243 {
1244 die('Error deleting booking');
1245 }
1246 ilUtil::sendInfo($this->lng->txt('pay_deleted_booking'));
1247
1248 $this->showStatistics();
1249
1250 return true;
1251 }
1252}
1253?>
$result
$_GET["client_id"]
$_SESSION["AccountId"]
const IL_CAL_DATE
const IL_CAL_UNIX
const IL_CAL_DATETIME
Confirmation screen class.
static formatDate(ilDateTime $date)
Format a date @access public.
This class represents a date/time property in a property form.
@classDescription Date and time handling
Class for single dates.
static _getLocalMoneyFormat($float_number)
converts a float number to money format, depending on system language
This class represents a hidden form property in a property form.
This class represents a non editable value in a property form.
static _lookupLogin($a_user_id)
lookup login
static _readUsersProfileData($a_user_ids)
STATIC METHOD get user data of selected users.
getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
static _lookupObjId($a_id)
static _lookupTitle($a_id)
lookup object title
static _lookupType($a_id, $a_reference=false)
lookup object type
static getPayMethodsOptions($type=0)
static getStringByPaymethod($a_type)
static _EnabledSaveUserAddress($a_id)
static _getObjectData($a_id)
static _lookupPobjectId($a_ref_id)
static _getPriceString($a_price_id)
static _getPrice($a_price_id)
editStatistic($a_show_confirm_delete=false)
This class represents a property form user interface.
This class represents a selection list property in a property form.
Class ilShopBaseGUI.
Class ilShopTableGUI.
static _assignPurchasedCourseMemberRole($oPaymentObject, $a_user_id=0)
static _addPurchasedObjToDesktop($oPaymentObject, $a_user_id=0)
static _deassignPurchasedCourseMemberRole($a_ref_id, $a_user_id)
Class ilShopVats.
This class represents a text property in a property form.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public
$_POST['username']
Definition: cron.php:12
$tbl
Definition: example_048.php:81
global $ilCtrl
Definition: ilias.php:18
$cmd
Definition: sahs_server.php:35
$ref_id
Definition: sahs_server.php:39