ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
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 
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 
19 
21 {
22  private $pobject = null;
23 
24  public function ilPaymentStatisticGUI($user_obj)
25  {
27 
28  $this->ctrl->saveParameter($this, 'baseClass');
29 
30  $this->user_obj = $user_obj;
31  $this->pobject = new ilPaymentObject($this->user_obj);
32 
33  }
34 
35  protected function prepareOutput()
36  {
37  global $ilTabs;
38 
39  $this->setSection(6);
40 
42 
43  $ilTabs->setTabActive('paya_header');
44  $ilTabs->setSubTabActive('bookings');
45  }
46 
47  public function executeCommand()
48  {
49  $cmd = $this->ctrl->getCmd();
50 
51  switch ($this->ctrl->getNextClass($this))
52  {
53  default:
54  if(!$cmd = $this->ctrl->getCmd())
55  {
56  $cmd = 'showStatistics';
57  }
58  $this->prepareOutput();
59  $this->$cmd();
60  break;
61  }
62  }
63 
64  function resetFilter()
65  {
66  unset($_SESSION["pay_statistics"]);
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"]);
75  unset($_POST["payed"]);
76  unset($_POST["access"]);
77  unset($_POST["customer"]);
78  unset($_POST["pay_method"]);
79  unset($_POST["updateView"]);
80  unset($_POST["filter_title_id"]);
81 
82  $this->showStatistics();
83  }
84 
85  function showStatistics()
86  {
87  global $rbacsystem, $ilToolbar, $ilObjDataCache;
88 
89  // MINIMUM ACCESS LEVEL = 'read'
90  /* if(!$rbacsystem->checkAccess('read', $this->getRefId()))
91  {
92  $this->ilias->raiseError($this->lng->txt('msg_no_perm_read'),$this->ilias->error_obj->MESSAGE);
93  }
94  */
95 
96 
97  $ilToolbar->addButton($this->lng->txt('paya_add_customer'), $this->ctrl->getLinkTarget($this, 'showObjectSelector'));
98  if(!$_POST['show_filter'] && $_POST['updateView'] == '1')
99  {
100  $this->resetFilter();
101  }
102  else
103  if ($_POST['updateView'] == 1)
104  {
105  $_SESSION['pay_statistics']['show_filter']= $_POST['show_filter'];
106  $_SESSION['pay_statistics']['updateView'] = true;
107  $_SESSION['pay_statistics']['until_check'] = $_POST['until_check'];
108  $_SESSION['pay_statistics']['from_check'] = $_POST['from_check'];
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'];
112 
113  if($_SESSION['pay_statistics']['from_check'] == '1')
114  {
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'];
118  }
119  else
120  {
121  $_SESSION['pay_statistics']['from']['date']['d'] = '';
122  $_SESSION['pay_statistics']['from']['date']['m'] = '';
123  $_SESSION['pay_statistics']['from']['date']['y'] = '';
124  }
125 
126  if($_SESSION['pay_statistics']['until_check']== '1')
127  {
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'];
131  }
132  else
133  {
134  $_SESSION['pay_statistics']['til']['date']['d'] = '';
135  $_SESSION['pay_statistics']['til']['date']['m'] = '';
136  $_SESSION['pay_statistics']['til']['date']['y'] = '';
137  }
138 
139  $_SESSION['pay_statistics']['payed'] = $_POST['payed'];
140  $_SESSION['pay_statistics']['access'] = $_POST['access'];
141  $_SESSION['pay_statistics']['pay_method'] = $_POST['pay_method'];
142  $_SESSION['pay_statistics']['customer'] = isset ($_POST['customer']) ? $_POST['customer'] : '';
143  $_SESSION['pay_statistics']['vendor'] = isset ($_POST['vendor']) ? $_POST['vendor']: '';
144  }
145 
146  $this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.main_view.html','Services/Payment');
147 
148  include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
149  // FILTER FORM
150  $filter_form = new ilPropertyFormGUI();
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 %');
155 
156 
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);
160 
161  $o_hidden = new ilHiddenInputGUI('updateView');
162  $o_hidden->setValue(1);
163  $o_hidden->setPostVar('updateView');
164  $o_hide_check->addSubItem($o_hidden);
165 
166  $o_transaction_type = new ilSelectInputGUI();
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);
174 
175  $o_transaction_val = new ilTextInputGUI();
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);
179 
180  $o_customer = new ilTextInputGUI();
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);
185 
186  $o_vendor = new ilTextInputGUI();
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);
191 
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);
195 
196  $o_date_from = new ilDateTimeInputGUI();
197  $o_date_from->setPostVar('from');
198  $_POST['from'] = $_SESSION['pay_statistics']['from'];
199 
200  if($_SESSION['pay_statistics']['from_check'] == '1')
201  {
202  $o_date_from->checkInput();
203  }
204 
205  $o_from_check->addSubItem($o_date_from);
206  $o_hide_check->addSubItem($o_from_check);
207 
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);
211 
212  $o_date_until = new ilDateTimeInputGUI();
213  $o_date_until->setPostVar('til');
214  $_POST['til'] = $_SESSION['pay_statistics']['til'];
215 
216  if($_SESSION['pay_statistics']['until_check'] == '1')
217  {
218  $o_date_until->checkInput();
219  }
220 
221  $o_until_check->addSubItem($o_date_until);
222  $o_hide_check->addSubItem($o_until_check);
223 
224 
225  // title filter
226  $this->__initBookingObject();
227  $title_options['all']=$this->lng->txt('pay_all');
228  $unique_titles = $this->booking_obj->getUniqueTitles();
229 
230  if(is_array($unique_titles) && count($unique_titles))
231  {
232  foreach($unique_titles as $ref_id)
233  {
234  $title_options[$ref_id] = $ilObjDataCache->lookupTitle($ilObjDataCache->lookupObjId($ref_id));
235  }
236  }
237 
238  $o_object_title = new ilSelectInputGUI();
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);
244 
245  $o_payed = new ilSelectInputGUI();
246  $payed_option = array('all'=>$this->lng->txt('pay_all'),'1'=>$this->lng->txt('yes'),'0'=>$this->lng->txt('no'));
247 
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');
252 
253  $o_hide_check->addSubItem($o_payed);
254 
255  $o_access = new ilSelectInputGUI();
256  $access_option = array('all'=>$this->lng->txt('pay_all'),'1'=>$this->lng->txt('yes'),'0'=>$this->lng->txt('no'));
257 
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);
263 
264  $o_paymethod = new ilSelectInputGUI();
265  $o_paymethod->setTitle($this->lng->txt('payment_system'));
266  $o_paymethod->setOptions(ilPayMethods::getPayMethodsOptions('all'));
267  $o_paymethod->setValue($_SESSION['pay_statistics']['pay_method']);
268  $o_paymethod->setPostVar('pay_method');
269  $o_hide_check->addSubItem($o_paymethod);
270 
271  $filter_form->addCommandButton('showStatistics', $this->lng->txt('pay_update_view'));
272  $filter_form->addCommandButton('resetFilter', $this->lng->txt('pay_reset_filter'));
273 
274  $filter_form->addItem($o_hide_check);
275 
276  $this->tpl->setVariable('FORM', $filter_form->getHTML());
277 
278 
279 // STATISTICS TABLE
280  $this->__initBookingObject();
281 
282  if(!count($bookings = $this->booking_obj->getBookings()))
283  {
284  ilUtil::sendInfo($this->lng->txt('paya_no_bookings'));
285 
286  return true;
287  }
288 # $this->__showButton('excelExport',$this->lng->txt('excel_export'));
289 
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\"/>";
293 
294  include_once 'Services/User/classes/class.ilObjUser.php';
295  $object_title_cache = array();
296  $user_title_cache = array();
297 
298  $counter = 0;
299  foreach($bookings as $booking)
300  {
301  if(array_key_exists($booking['ref_id'], $object_title_cache))
302  {
303  $tmp_obj = $object_title_cache[$booking['ref_id']];
304  }
305  else
306  {
307  $tmp_obj = ilObject::_lookupTitle(ilObject::_lookupObjId($booking['ref_id']));
308  $object_title_cache[$booking['ref_id']] = $tmp_obj;
309  }
310  if(array_key_exists($booking['b_vendor_id'], $user_title_cache))
311  {
312  $tmp_vendor = $user_title_cache[$booking['b_vendor_id']];
313  }
314  else
315  {
316  $tmp_vendor = ilObjUser::_lookupLogin($booking['b_vendor_id']);
317  $user_title_cache[$booking['b_vendor_id']] = $tmp_vendor;
318  }
319  if(array_key_exists($booking['customer_id'], $user_title_cache))
320  {
321  $tmp_purchaser = $user_title_cache[$booking['customer_id']];
322  }
323  else
324  {
325  $tmp_purchaser = ilObjUser::_lookupLogin($booking['customer_id']);
326  $user_title_cache[$booking['customer_id']] = $tmp_purchaser;
327  }
328 
329  $transaction = $booking['transaction_extern'];
330  $str_paymethod = ilPayMethods::getStringByPaymethod($booking['b_pay_method']);
331  $transaction .= " (" . $str_paymethod . ")";
332 
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'));
337  $f_result[$counter]['order_date'] = ilDatePresentation::formatDate(new ilDateTime($booking['order_date'], IL_CAL_UNIX));
338 
339  if($booking['duration'] == 0)
340  {
341  $booking['duration'] = $this->lng->txt('unlimited_duration');
342  }
343 
344  $f_result[$counter]['duration'] = $booking['duration'];
345  $f_result[$counter]['price'] = ilFormat::_getLocalMoneyFormat($booking['price']).' '.$booking['currency_unit'];
346  $f_result[$counter]['discount'] = $booking['discount'].' '.$booking['currency_unit'];
347 
348  $payed_access = $booking['payed'] ?
349  $this->lng->txt('yes') :
350  $this->lng->txt('no');
351 
352  $payed_access .= '/';
353  $payed_access .= $booking['access_granted'] ?
354  $this->lng->txt('yes') :
355  $this->lng->txt('no');
356 
357  $f_result[$counter]['payed_access'] = $payed_access;
358 
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>";
361 
362  $f_result[$counter]['edit'] = $link_change;
363 
364  unset($tmp_obj);
365  unset($tmp_vendor);
366  unset($tmp_purchaser);
367 
368  ++$counter;
369  }
370  return $this->__showStatisticTable($f_result);
371  }
372 
373  function excelExport()
374  {
375  include_once './Services/Payment/classes/class.ilPaymentExcelWriterAdapter.php';
376 
377  $pewa = new ilPaymentExcelWriterAdapter('payment_vendors.xls');
378 
379  // add/fill worksheet
380  $this->addStatisticWorksheet($pewa);
381 
382  // HEADER SENT
383 
384  $workbook = $pewa->getWorkbook();
385  @$workbook->close();
386  }
387 
388  function addStatisticWorksheet($pewa)
389  {
390  include_once './Services/Payment/classes/class.ilPaymentVendors.php';
391 
392  $this->__initBookingObject();
393 
394  $workbook = $pewa->getWorkbook();
395  $worksheet = $workbook->addWorksheet($this->lng->txt('bookings'));
396 
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);
408 
409  $title = $this->lng->txt('bookings');
410  $title .= ' '.$this->lng->txt('as_of');
411  $title .= strftime('%Y-%m-%d %R',time());
412 
413  $worksheet->writeString(0,0,$title,$pewa->getFormatTitle());
414 
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());
425 
426  if(!count($bookings = $this->booking_obj->getBookings()))
427  {
428  return false;
429  }
430 
431  include_once 'Services/User/classes/class.ilObjUser.php';
432  $object_title_cache = array();
433  $user_title_cache = array();
434 
435  $counter = 2;
436  foreach($bookings as $booking)
437  {
438  if(array_key_exists($booking['ref_id'], $object_title_cache))
439  {
440  $tmp_obj = $object_title_cache[$booking['ref_id']];
441  }
442  else
443  {
444  $tmp_obj = ilObject::_lookupTitle(ilObject::_lookupObjId($booking['ref_id']));
445  $object_title_cache[$booking['ref_id']] = $tmp_obj;
446  }
447  if(array_key_exists($booking['b_vendor_id'], $user_title_cache))
448  {
449  $tmp_vendor = $user_title_cache[$booking['b_vendor_id']];
450  }
451  else
452  {
453  $tmp_vendor = ilObjUser::_lookupLogin($booking['b_vendor_id']);
454  $user_title_cache[$booking['b_vendor_id']] = $tmp_vendor;
455  }
456  if(array_key_exists($booking['customer_id'], $user_title_cache))
457  {
458  $tmp_purchaser = $user_title_cache[$booking['customer_id']];
459  }
460  else
461  {
462  $tmp_purchaser = ilObjUser::_lookupLogin($booking['customer_id']);
463  $user_title_cache[$booking['customer_id']] = $tmp_purchaser;
464  }
465 
466  $pay_method = ilPayMethods::getStringByPaymethod($booking['b_pay_method']);
467 
468  $worksheet->writeString($counter,0,$pay_method);
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')));
472  $worksheet->writeString($counter,4,ilPaymentVendors::_getCostCenter($booking['b_vendor_id']));
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']);
477 
478  $payed_access = $booking['payed'] ?
479  $this->lng->txt('yes') :
480  $this->lng->txt('no');
481 
482  $payed_access .= '/';
483  $payed_access .= $booking['access_granted'] ?
484  $this->lng->txt('yes') :
485  $this->lng->txt('no');
486 
487  $worksheet->writeString($counter,9,$payed_access);
488 
489  unset($tmp_obj);
490  unset($tmp_vendor);
491  unset($tmp_purchaser);
492 
493  ++$counter;
494  }
495  }
496 
497  function editStatistic($a_show_confirm_delete = false)
498  {
499  global $ilToolbar;
500 
501  if(!isset($_GET['booking_id']))
502  {
503  ilUtil::sendInfo($this->lng->txt('paya_no_booking_id_given'));
504  $this->showStatistics();
505 
506  return true;
507  }
508 
509  include_once './Services/Utilities/classes/class.ilConfirmationGUI.php';
510  $ilToolbar->addButton($this->lng->txt('back'), $this->ctrl->getLinkTarget($this, 'showStatistics'));
511 
512  $this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.main_view.html','Services/Payment');
513 
514  $this->ctrl->setParameter($this,'booking_id',(int) $_GET['booking_id']);
515  $this->__initBookingObject();
516  $bookings = $this->booking_obj->getBookings();
517  $booking = $bookings[(int) $_GET['booking_id']];
518 
519  // confirm delete
520  if($a_show_confirm_delete)
521  {
522  $oConfirmationGUI = new ilConfirmationGUI();
523 
524  // set confirm/cancel commands
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");
529 
530  $pObj = new ilPaymentObject($this->user_obj, $booking['pobject_id']);
531  $tmp_obj = ilObject::_lookupTitle(ilObject::_lookupObjId($pObj->getRefId()));
532 
533  $oConfirmationGUI->addItem('booking_id', $_GET['booking_id'], $tmp_obj);
534 
535  $this->tpl->setVariable('CONFIRMATION', $oConfirmationGUI->getHTML());
536  return true;
537  }
538 
539 
540  // get customer_obj
541  $tmp_user = ilObjectFactory::getInstanceByObjId($booking['customer_id'], false);
542  $oForm = new ilPropertyFormGUI();
543  $oForm->setFormAction($this->ctrl->getFormAction($this));
544  $oForm->setId('stat_form');
545  $oForm->setTableWidth('50 %');
546  $oForm->setTitleIcon(ilUtil::getImagePath('icon_usr.gif'));
547  if(is_object($tmp_user))
548  {
549  $frm_user = $tmp_user->getFullname().' ['.$tmp_user->getLogin().']';
550  }
551  else
552  {
553  $frm_user = $this->lng->txt('user_deleted');
554  }
555  $oForm->setTitle($frm_user);
556 
557  $pObj = new ilPaymentObject($this->user_obj, $booking['pobject_id']);
558  $tmp_obj = ilObject::_lookupTitle(ilObject::_lookupObjId($pObj->getRefId()));
559 
560  // object_title
561  $oTitleGUI = new ilNonEditableValueGUI($this->lng->txt('title'));
562  $oTitleGUI->setValue($tmp_obj != '' ? $tmp_obj : $this->lng->txt('object_deleted'));
563  $oForm->addItem($oTitleGUI);
564 
565  // transaction
566  $oTransactionGUI = new ilNonEditableValueGUI($this->lng->txt('paya_transaction'));
567  $oTransactionGUI->setValue($booking['transaction']);
568  $oForm->addItem($oTransactionGUI);
569 
570  //vendor
571  $oVendorGUI = new ilNonEditableValueGUI($this->lng->txt('paya_vendor'));
572  $tmp_vendor = ilObjectFactory::getInstanceByObjId($booking['b_vendor_id'], false);
573  if(is_object($tmp_vendor))
574  {
575  $frm_vendor = $tmp_vendor->getFullname().' ['.$tmp_vendor->getLogin().']';
576  }
577  else
578  {
579  $frm_vendor = $this->lng->txt('user_deleted');
580  }
581  $oVendorGUI->setValue($frm_vendor);
582  $oForm->addItem($oVendorGUI);
583 
584  // paymethod
585  $oPaymethodGUI = new ilNonEditableValueGUI($this->lng->txt('paya_pay_method'));
586  $oPaymethodGUI->setValue(ilPayMethods::getStringByPaymethod($booking['b_pay_method']));
587  $oForm->addItem($oPaymethodGUI);
588 
589  // order_date
590  $oOrderdateGUI = new ilNonEditableValueGUI($this->lng->txt('paya_order_date'));
591  $oOrderdateGUI->setValue(ilDatePresentation::formatDate(new ilDateTime($booking["order_date"],IL_CAL_UNIX)));
592  $oForm->addItem($oOrderdateGUI);
593 
594  // duration
595  $oDurationGUI = new ilNonEditableValueGUI($this->lng->txt('duration'));
596  if($booking['duration'] != 0)
597  {
598  $frm_duration = $booking['duration'].' '.$this->lng->txt('paya_months');
599  }
600  else
601  {
602  $frm_duration = $this->lng->txt("unlimited_duration");
603  }
604  $oDurationGUI->setValue($frm_duration);
605  $oForm->addItem($oDurationGUI);
606 
607  // price
608  $oPriceGUI = new ilNonEditableValueGUI($this->lng->txt('price_a'));
609  $oPriceGUI->setValue($booking['price'].' '.$booking['currency_unit'] );
610  $oForm->addItem($oPriceGUI);
611 
612  // payed
613  $oPayedGUI = new ilSelectInputGUI();
614  $payed_option = array(0 => $this->lng->txt('no'),1 => $this->lng->txt('yes'));
615 
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);
621 
622  // access
623  $oAccessGUI = new ilSelectInputGUI();
624  $access_option = array(0 => $this->lng->txt('no'),1 => $this->lng->txt('yes'));
625 
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);
631 
632  $oForm->addCommandButton('updateStatistic',$this->lng->txt('save'));
633  $oForm->addCommandButton('deleteStatistic',$this->lng->txt('delete'));
634 
635  $this->tpl->setVariable('FORM',$oForm->getHTML());
636 
637 
638 
639 /* //Same output as in ilobjpaymentsettingsgui->statistics
640  // show CUSTOMER_DATA if isset -> setting: save_user_address
641  if(ilPayMethods::isCustomerAddressEnabled($booking['b_pay_method']))
642  {
643  $oForm2 = new ilPropertyFormGUI();
644  $oForm2->setId('cust_form');
645  $oForm2->setTableWidth('50 %');
646  $oForm2->setTitle($frm_user);
647 
648  // email
649  $oEmailGUI = new ilNonEditableValueGUI($this->lng->txt('email'));
650  $email = (!isset($tmp_user)) ? $this->lng->txt('user_deleted') : $tmp_user->getEmail();
651  $oEmailGUI->setValue($email);
652  $oForm2->addItem($oEmailGUI);
653 
654  // street
655  $oStreetGUI = new ilNonEditableValueGUI($this->lng->txt('street'));
656  $oStreetGUI->setValue($booking['street']);
657  $oForm2->addItem($oStreetGUI);
658 
659  // pobox
660  $oPoBoxGUI = new ilNonEditableValueGUI($this->lng->txt('pay_bmf_po_box'));
661  $oPoBoxGUI->setValue($booking['po_box']);
662  $oForm2->addItem($oPoBoxGUI);
663 
664  // zipcode
665  $oPoBoxGUI = new ilNonEditableValueGUI($this->lng->txt('zipcode'));
666  $oPoBoxGUI->setValue($booking['zipcode']);
667  $oForm2->addItem($oPoBoxGUI);
668 
669  // city
670  $oCityGUI = new ilNonEditableValueGUI($this->lng->txt('city'));
671  $oCityGUI->setValue($booking['city']);
672  $oForm2->addItem($oCityGUI);
673 
674  // country
675  $oCountryGUI = new ilNonEditableValueGUI($this->lng->txt('country'));
676  $oCountryGUI->setValue($booking['country']);
677  $oForm2->addItem($oCountryGUI);
678  }
679 
680  $this->tpl->setVariable('FORM_2',$oForm2->getHTML());
681 */
682  return true;
683  }
684 
685  function updateStatistic()
686  {
687  if(!isset($_GET['booking_id']))
688  {
689  ilUtil::sendInfo($this->lng->txt('paya_no_booking_id_given'));
690  $this->showStatistics();
691 
692  return true;
693  }
694  $this->__initBookingObject();
695 
696  $this->booking_obj->setBookingId((int) $_GET['booking_id']);
697  $this->booking_obj->setAccess((int) $_POST['access']);
698  $this->booking_obj->setPayed((int) $_POST['payed']);
699 
700  if($this->booking_obj->update())
701  {
702  ilUtil::sendInfo($this->lng->txt('paya_updated_booking'));
703 
704  $this->showStatistics();
705  return true;
706  }
707  else
708  {
709  ilUtil::sendInfo($this->lng->txt('paya_error_update_booking'));
710  $this->showStatistics();
711 
712  return true;
713  }
714  }
715 
716  function deleteStatistic()
717  {
718  if(!isset($_GET['booking_id']))
719  {
720  ilUtil::sendInfo($this->lng->txt('paya_no_booking_id_given'));
721  $this->showStatistics();
722 
723  return true;
724  }
725 
726  $this->editStatistic(true);
727 
728  return true;
729  }
730 
731  function performDelete()
732  {
733  if(!isset($_GET['booking_id']))
734  {
735  ilUtil::sendInfo($this->lng->txt('paya_no_booking_id_given'));
736  $this->showStatistics();
737 
738  return true;
739  }
740 
741  $this->__initBookingObject();
742  $this->booking_obj->setBookingId((int) $_GET['booking_id']);
743  if(!$this->booking_obj->delete())
744  {
745  die('Error deleting booking');
746  }
747  ilUtil::sendInfo($this->lng->txt('pay_deleted_booking'));
748 
749  $this->showStatistics();
750 
751  return true;
752  }
753 
755  {
756  global $tree, $ilToolbar;
757 
758  include_once './Services/Payment/classes/class.ilPaymentObjectSelector.php';
759 
760  $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.paya_object_selector.html",'Services/Payment');
761  $ilToolbar->addButton($this->lng->txt('back'), $this->ctrl->getLinkTarget($this, 'showStatistics'));
762 
763  ilUtil::sendInfo($this->lng->txt("paya_select_object_to_sell"));
764 
765  $exp = new ilPaymentObjectSelector($this->ctrl->getLinkTarget($this,'showObjectSelector'), strtolower(get_class($this)));
766  $exp->setExpand($_GET["paya_link_expand"] ? $_GET["paya_link_expand"] : $tree->readRootId());
767  $exp->setExpandTarget($this->ctrl->getLinkTarget($this,'showObjectSelector'));
768 
769  $exp->setOutput(0);
770 
771  $this->tpl->setVariable("EXPLORER",$exp->getOutput());
772 
773  return true;
774  }
775 
776  function searchUser()
777  {
778  global $ilToolbar;
779 
780  if(!isset($_GET['sell_id']))
781  {
782  ilUtil::sendInfo($this->lng->txt('paya_no_booking_id_given'));
783  $this->showObjectSelector();
784 
785  return false;
786  }
787 
788  $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.main_view.html','Services/Payment');
789 
790  $ilToolbar->addButton($this->lng->txt('back'), $this->ctrl->getLinkTarget($this, 'showObjectSelector'));
791 
792  $this->lng->loadLanguageModule('search');
793  $this->ctrl->setParameter($this, "sell_id", $_GET["sell_id"]);
794 
795  $form_gui = new ilPropertyFormGUI();
796  $form_gui->setFormAction($this->ctrl->getFormAction($this),'performSearch');
797  $form_gui->setTitle($this->lng->txt('grp_search_members'));
798  $form_gui->setId('search_form');
799 
800  $oTitle = new ilTextInputGUI($this->lng->txt('search_search_term'), 'search_str');
801  $oTitle->setMaxLength(255);
802  $oTitle->setSize(40);
803  $oTitle->setValue($_POST['search_str']);
804  $form_gui->addItem($oTitle);
805 
806  // buttons
807  $form_gui->addCommandButton('performSearch', $this->lng->txt('search'));
808  $form_gui->addCommandButton('showStatistics', $this->lng->txt('cancel'));
809 
810  $this->tpl->setVariable('FORM',$form_gui->getHTML());
811  return true;
812  }
813 
814  function performSearch()
815  {
816  global $ilToolbar;
817  // SAVE it to allow sort in tables
818  $_SESSION["pays_search_str_user_sp"] = $_POST["search_str"] = $_POST["search_str"] ? $_POST["search_str"] : $_SESSION["pays_search_str_user_sp"];
819 
820 
821  if(!trim($_POST["search_str"]))
822  {
823  ilUtil::sendInfo($this->lng->txt("search_no_search_term"));
824  $this->showStatistics();
825 
826  return false;
827  }
828  if(!count($result = $this->__search(ilUtil::stripSlashes($_POST["search_str"]))))
829  {
830  ilUtil::sendInfo($this->lng->txt("search_no_match"));
831  $this->searchUser();
832 
833  return false;
834  }
835 
836  if(!isset($_GET['sell_id']))
837  {
838  ilUtil::sendInfo($this->lng->txt('paya_no_booking_id_given'));
839  $this->showObjectSelector();
840 
841  return false;
842  }
843 
844  $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.main_view.html",'Services/Payment');
845  $this->ctrl->setParameter($this, "sell_id", $_GET["sell_id"]);
846 
847  $ilToolbar->addButton($this->lng->txt('back'), $this->ctrl->getLinkTarget($this, 'searchUser'));
848 
849  $counter = 0;
850  $f_result = array();
851  foreach($result as $user)
852  {
853  if(!$tmp_obj = ilObjectFactory::getInstanceByObjId($user["id"],false))
854  {
855  continue;
856  }
857  // $f_result[$counter]['user_id'] = ilUtil::formRadiobutton(0,"user_id",$user["id"]);
858  $f_result[$counter]['user_id'] = $user["id"];
859  $f_result[$counter]['login'] = $tmp_obj->getLogin();
860  $f_result[$counter]['firstname'] = $tmp_obj->getFirstname();
861  $f_result[$counter]['lastname'] = $tmp_obj->getLastname();
862 
863  unset($tmp_obj);
864  ++$counter;
865  }
866  $this->__showSearchUserTable($f_result);
867  }
868 
869  function addCustomer()
870  {
871  global $ilToolbar,$ilCtrl;
872 
873 
874  isset($_POST['sell_id']) ? $sell_id = $_POST['sell_id'] : $sell_id = $_GET['sell_id'];
875  isset($_POST['user_id']) ? $user_id = $_POST['user_id'] : $user_id = $_GET['user_id'];
876 /*
877  if ($_POST["sell_id"] != "") $_GET["sell_id"] = $_POST["sell_id"];
878  if ($_GET["user_id"] != "") $_POST["user_id"] = $_GET["user_id"];
879 
880  if(!isset($_GET['sell_id']))
881  {
882  ilUtil::sendInfo($this->lng->txt('paya_no_booking_id_given'));
883  $this->showObjectSelector();
884 
885  return true;
886  }
887 
888  if(!isset($_POST['user_id']))
889  {
890  ilUtil::sendInfo($this->lng->txt('paya_no_user_id_given'));
891  $this->searchUser();
892 
893  return true;
894  }
895 */
896  $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.main_view.html",'Services/Payment');
897  $ilToolbar->addButton($this->lng->txt('back'), $this->ctrl->getLinkTarget($this, 'searchUser'));
898  $ilCtrl->setParameter($this, "sell_id", $sell_id);
899  $ilCtrl->setParameter($this, "user_id", $user_id);
900 
901  $pObjectId = ilPaymentObject::_lookupPobjectId($sell_id);
902  $obj = new ilPaymentObject($this->user_obj, $pObjectId);
903 
904  // get obj
905  $tmp_obj = ilObjectFactory::getInstanceByRefId($sell_id, false);
906  if($tmp_obj)
907  {
908  $tmp_object['title'] = $tmp_obj->getTitle();
909  }
910  else
911  {
912  $tmp_object['title'] = $this->lng->txt('object_not_found');
913  }
914 
915  // get customer_obj
916  $tmp_user = ilObjectFactory::getInstanceByObjId($user_id);
917  // get vendor_obj
918  $tmp_vendor = ilObjectFactory::getInstanceByObjId($obj->getVendorId());
919 
920  $oForm = new ilPropertyFormGUI();
921  $oForm->setFormAction($ilCtrl->getFormAction($this, 'saveCustomer'));
922 
923  $oForm->setTitle($this->lng->txt($tmp_user->getFullname().' ['.$tmp_user->getLogin().']'));
924 
925  //transaction
926  $oTransaction = new ilTextInputGUI();
927  $oTransaction->setTitle($this->lng->txt('paya_transaction'));
928  $oTransaction->setValue(ilUtil::prepareFormOutput($_POST['transaction'], true));
929  $oTransaction->setPostVar('transaction');
930  $oForm->addItem($oTransaction);
931 
932  //object
933  $oObject = new ilNonEditableValueGUI($this->lng->txt('title'));
934  $oObject->setValue($tmp_object['title']);
935  $oForm->addItem($oObject);
936 
937  //vendor
938  $oVendor = new ilNonEditableValueGUI($this->lng->txt('paya_vendor'));
939  $oVendor->setValue($tmp_vendor->getFullname().' ['.$tmp_vendor->getLogin().']');
940  $oForm->addItem($oVendor);
941 
942  // pay methods
943  $oPayMethods = new ilSelectInputGUI($this->lng->txt('paya_pay_method'), 'pay_method');
944  $payOptions = ilPayMethods::getPayMethodsOptions(false);
945 
946  $oPayMethods->setOptions($payOptions);
947  $oPayMethods->setValue($_POST['pay_method']);
948  $oPayMethods->setPostVar('pay_method');
949  $oForm->addItem($oPayMethods);
950 
951  //duration
952  $duration_opions = array();
953  $prices_obj = new ilPaymentPrices($pObjectId);
954  if (is_array($prices = $prices_obj->getPrices()))
955  {
956  foreach($prices as $price)
957  {
958  $duration_options[$price['price_id']] =
959  $price['duration'].' '.$this->lng->txt('paya_months').', '.$price['price'].' '. ilPaymentCurrency::_getUnit($price['currency']);
960  }
961  }
962 
963  $oDuration = new ilSelectInputGUI($this->lng->txt('duration'), 'duration');
964  $oDuration->setOptions($duration_options);
965  $oDuration->setValue($_POST['duration']);
966  $oForm->addItem($oDuration);
967 
968  //payed
969  $o_payed = new ilSelectInputGUI();
970  $payed_option = array('1'=>$this->lng->txt('yes'),'0'=>$this->lng->txt('no'));
971 
972  $o_payed->setTitle($this->lng->txt('paya_payed'));
973  $o_payed->setOptions($payed_option);
974  $o_payed->setValue($_POST['payed']);
975  $o_payed->setPostVar('payed');
976  $oForm->addItem($o_payed);
977 
978  $o_access = new ilSelectInputGUI();
979  $access_option = array('1'=>$this->lng->txt('yes'),'0'=>$this->lng->txt('no'));
980 
981  $o_access->setTitle($this->lng->txt('paya_access'));
982  $o_access->setOptions($access_option);
983  $o_access->setValue($_POST['access']);
984  $o_access->setPostVar('access');
985  $oForm->addItem($o_access);
986 
987  $oForm->addCommandButton('saveCustomer',$this->lng->txt('save'));
988  $oForm->addCommandButton('showStatistics', $this->lng->txt('cancel'));
989 
990  $this->tpl->setVariable('FORM', $oForm->getHTML());
991  }
992 
993  function saveCustomer()
994  {
995  global $ilias,$ilObjDataCache, $ilUser;
996 
997 
998  if(!isset($_GET['sell_id']))
999  {
1000  ilUtil::sendInfo($this->lng->txt('paya_error_no_object_id_given'));
1001  $this->showObjectSelector();
1002 
1003  return true;
1004  }
1005 
1006  if(!isset($_GET['user_id']))
1007  {
1008  ilUtil::sendInfo($this->lng->txt('paya_error_no_user_id_given'));
1009  $this->searchUser();
1010 
1011  return true;
1012  }
1013 
1014  if ($_POST["pay_method"] == "" ||
1015  $_POST["duration"] == "")
1016  {
1017  ilUtil::sendInfo($this->lng->txt('paya_error_mandatory_fields'));
1018  $this->addCustomer();
1019 
1020  return true;
1021  }
1022 
1023  $pObjectId = ilPaymentObject::_lookupPobjectId($_GET["sell_id"]);
1024  $obj = new ilPaymentObject($this->user_obj, $pObjectId);
1025 
1026  $this->__initBookingObject();
1027 
1028  $inst_id_time = $ilias->getSetting('inst_id').'_'.$this->user_obj->getId().'_'.substr((string) time(),-3);
1029  $transaction = $inst_id_time.substr(md5(uniqid(rand(), true)), 0, 4);
1030  $this->booking_obj->setTransaction($transaction);
1031  $this->booking_obj->setTransactionExtern($_POST["transaction"]);
1032  $this->booking_obj->setPobjectId($pObjectId);
1033  $this->booking_obj->setCustomerId($_GET["user_id"]);
1034  $this->booking_obj->setVendorId($obj->getVendorId());
1035  $this->booking_obj->setPayMethod((int) $_POST["pay_method"]);
1036  $this->booking_obj->setOrderDate(time());
1037  $price = ilPaymentPrices::_getPrice($_POST["duration"]);
1038  // TODO:$currency = ilPaymentCurrency::_getUnit($price['currency']);
1039 
1040  $this->booking_obj->setDuration($price["duration"]);
1041  $this->booking_obj->setPrice(ilPaymentPrices::_getPriceString($_POST["duration"]));
1042 // TODO: $this->booking_obj->setPrice($price['price'].' '. $currency);
1043  $this->booking_obj->setAccess((int) $_POST['access']);
1044  $this->booking_obj->setPayed((int) $_POST['payed']);
1045  $this->booking_obj->setVoucher('');
1046 
1047  $obj_id = $ilObjDataCache->lookupObjId($obj->getRefId());
1048  $obj_type = $ilObjDataCache->lookupType($obj_id);
1049  $obj_title = $ilObjDataCache->lookupTitle($obj_id);
1050 
1051  include_once 'Services/Payment/classes/class.ilShopVatsList.php';
1052  $oVAT = new ilShopVats((int)$obj->getVatId());
1053  $obj_vat_rate = $oVAT->getRate();
1054  $obj_vat_unit = $obj->getVat($this->booking_obj->getPrice());
1055 
1056  $this->booking_obj->setObjectTitle($obj_title);
1057  $this->booking_obj->setVatRate($obj_vat_rate);
1058  $this->booking_obj->setVatUnit($obj_vat_unit);
1059 
1060  include_once './Services/Payment/classes/class.ilPayMethods.php';
1061  /* $save_user_adr_bill = (int) ilPayMethods::_enabled('save_user_adr_bill') ? 1 : 0;
1062  $save_user_adr_bmf = (int) ilPayMethods::_enabled('save_user_adr_bmf') ? 1 : 0;
1063  $save_user_adr_paypal =(int) ilPayMethods::_enabled('save_user_adr_paypal') ? 1 : 0;
1064  $save_user_adr_epay =(int) ilPayMethods::_enabled('save_user_adr_epay') ? 1 : 0;
1065 
1066  if($save_user_adr_bill == 1 || $save_user_adr_bmf == 1
1067  || $save_user_adr_paypal == 1 || $save_user_adr_epay == 1)
1068  */
1069  if(ilPayMethods::_EnabledSaveUserAddress((int) $_POST["pay_method"]) == 1)
1070  {
1071  global $ilObjUser;
1072  $user_id[] = $_GET["user_id"];
1073 
1074  $cust_obj = ilObjUser::_readUsersProfileData($user_id);
1075 
1076  $this->booking_obj->setStreet($cust_obj[$_GET["user_id"]]['street'],'');
1077 
1078  $this->booking_obj->setZipcode($cust_obj[$_GET["user_id"]]['zipcode']);
1079  $this->booking_obj->setCity($cust_obj[$_GET["user_id"]]['city']);
1080  $this->booking_obj->setCountry($cust_obj[$_GET["user_id"]]['country']);
1081  }
1082 
1083  if($this->booking_obj->add())
1084  {
1085  ilUtil::sendInfo($this->lng->txt('paya_customer_added_successfully'));
1086  $this->showStatistics();
1087  }
1088  else
1089  {
1090  ilUtil::sendInfo($this->lng->txt('paya_error_adding_customer'));
1091  $this->addCustomer();
1092  }
1093 
1094  return true;
1095  }
1096 
1097  // PRIVATE
1098  function __showStatisticTable($a_result_set)
1099  {
1100  $tbl = new ilShopTableGUI($this);
1101  $tbl->setTitle($this->lng->txt("bookings"));
1102  $tbl->setId('tbl_bookings');
1103  $tbl->setRowTemplate("tpl.shop_statistics_row.html", "Services/Payment");
1104 
1105  $tbl->addColumn($this->lng->txt('paya_transaction'), 'transaction', '10%');
1106  $tbl->addColumn($this->lng->txt('title'), 'object_title', '10%');
1107  $tbl->addColumn($this->lng->txt('paya_vendor'), 'vendor', '10%');
1108  $tbl->addColumn($this->lng->txt('paya_customer'), 'customer', '10%');
1109  $tbl->addColumn($this->lng->txt('paya_order_date'), 'order_date', '10%');
1110  $tbl->addColumn($this->lng->txt('duration'), 'duration', '10%');
1111  $tbl->addColumn($this->lng->txt('price_a'), 'price', '5%');
1112  $tbl->addColumn($this->lng->txt('paya_coupons_coupon'), 'discount', '5%');
1113  $tbl->addColumn($this->lng->txt('paya_payed_access'), 'payed_access', '5%');
1114  $tbl->addColumn($this->lng->txt('edit'), 'edit', '5%');
1115  $tbl->setData($a_result_set);
1116 
1117  $this->tpl->setVariable('TABLE', $tbl->getHTML());
1118 
1119  return true;
1120  }
1121 
1123  {
1124  include_once './Services/Payment/classes/class.ilPaymentBookings.php';
1125 
1126  $this->booking_obj = new ilPaymentBookings($this->user_obj->getId());
1127  }
1128 
1129  function __search($a_search_string)
1130  {
1131  include_once("./classes/class.ilSearch.php");
1132 
1133  $this->lng->loadLanguageModule("content");
1134 
1135  $search = new ilSearch($this->user_obj->getId());
1136  $search->setPerformUpdate(false);
1137  $search->setSearchString(ilUtil::stripSlashes($a_search_string));
1138  $search->setCombination("and");
1139  $search->setSearchFor(array(0 => 'usr'));
1140  $search->setSearchType('new');
1141 
1142  if($search->validate($message))
1143  {
1144  $search->performSearch();
1145  }
1146  else
1147  {
1148  ilUtil::sendInfo($message,true);
1149  $this->ctrl->redirect($this,"searchUser");
1150  }
1151  return $search->getResultByType('usr');
1152  }
1153  function __showSearchUserTable($a_result_set)
1154  {
1155  $this->ctrl->setParameter($this, "sell_id", $_GET["sell_id"]);
1156 
1157  $tbl = new ilShopTableGUI($this);
1158  $tbl->setTitle($this->lng->txt("users"));
1159  $tbl->setId('tbl_users_search');
1160  $tbl->setRowTemplate("tpl.shop_users_row.html", "Services/Payment");
1161  $tbl->addColumn('', 'user_id', '1%', true);
1162  $tbl->addColumn($this->lng->txt('login'), 'login', '10%');
1163  $tbl->addColumn($this->lng->txt('firstname'), 'firstname', '10%');
1164  $tbl->addColumn($this->lng->txt('lastname'), 'lastname', '10%');
1165 
1166  $tbl->addMultiCommand('addCustomer', $this->lng->txt('add'));
1167  $tbl->setData($a_result_set);
1168 
1169  $this->tpl->setVariable('TABLE', $tbl->getHTML());
1170  return true;
1171  }
1172 }
1173 ?>