ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilPaymentObjectGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once 'Services/Payment/classes/class.ilPaymentObject.php';
5 include_once 'Services/Payment/classes/class.ilPaymentBookings.php';
6 include_once 'Services/Payment/classes/class.ilFileDataShop.php';
7 include_once 'Services/Payment/classes/class.ilShopVatsList.php';
8 include_once './Services/Payment/classes/class.ilShopTableGUI.php';
9 
10 
21 {
22  public $ctrl;
23  public $lng;
24  public $user_obj;
25  public $pobject = null;
26 
27  public function ilPaymentObjectGUI($user_obj)
28  {
30 
31  $this->user_obj = $user_obj;
32  $this->lng->loadLanguageModule('crs');
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('paya_object');
45  }
46 
47  public function executeCommand()
48  {
49  $cmd = $this->ctrl->getCmd();
50  switch($this->ctrl->getNextClass($this))
51  {
52  case 'ilpageobjectgui':
53  $this->prepareOutput();
54  $ret = $this->forwardToPageObject();
55  if($ret != '')
56  {
57  $this->tpl->setContent($ret);
58  }
59  break;
60 
61  default:
62  if(!$cmd = $this->ctrl->getCmd())
63  {
64  $cmd = 'showObjects';
65  }
66  $this->prepareOutput();
67  $this->$cmd();
68  break;
69  }
70  }
71 
72  public function forwardToPageObject()
73  {
74  global $ilTabs;
75 
76  if(!(int)$_GET['pobject_id'])
77  {
78  ilUtil::sendInfo($this->lng->txt('paya_no_object_selected'));
79  return $this->showObjects();
80  }
81  $this->ctrl->setParameter($this, 'pobject_id', (int)$_GET['pobject_id']);
82  $this->__initPaymentObject((int)$_GET['pobject_id']);
83 
84  $this->lng->loadLanguageModule('content');
85 
86  $ilTabs->clearTargets();
87  $ilTabs->clearSubTabs();
88  $ilTabs->setBackTarget($this->lng->txt('back'), $this->ctrl->getLinkTarget($this, 'editDetails'), '_top');
89 
90  // page objec
91  include_once 'Services/COPage/classes/class.ilPageObject.php';
92  include_once 'Services/COPage/classes/class.ilPageObjectGUI.php';
93  include_once('./Services/Style/classes/class.ilObjStyleSheet.php');
94 
95  $this->tpl->setVariable('LOCATION_CONTENT_STYLESHEET', ilObjStyleSheet::getContentStylePath(0));
96 
97  if(!ilPageObject::_exists('shop', $this->pobject->getPobjectId()))
98  {
99  // doesn't exist -> create new one
100  $new_page_object = new ilPageObject('shop');
101  $new_page_object->setParentId(0);
102  $new_page_object->setId($this->pobject->getPobjectId());
103  $new_page_object->createFromXML();
104  }
105 
106  $this->ctrl->setReturnByClass('ilpageobjectgui', 'edit');
107 
108  $page_gui = new ilPageObjectGUI('shop', $this->pobject->getPobjectId());
109  $this->ctrl->setParameter($page_gui, 'pobject_id', (int)$_GET['pobject_id']);
110  $page_gui->setIntLinkHelpDefault('StructureObject', $this->pobject->getPobjectId());
111  $page_gui->setTemplateTargetVar('ADM_CONTENT');
112  $page_gui->setLinkXML('');
113  $page_gui->setFileDownloadLink($this->ctrl->getLinkTargetByClass(array('ilpageobjectgui'), 'downloadFile'));
114  $page_gui->setFullscreenLink($this->ctrl->getLinkTargetByClass(array('ilpageobjectgui'), 'displayMediaFullscreen'));
115  $page_gui->setSourcecodeDownloadScript($this->ctrl->getLinkTargetByClass(array('ilpageobjectgui'), 'download_paragraph'));
116  $page_gui->setPresentationTitle('');
117  $page_gui->setTemplateOutput(false);
118  $page_gui->setHeader('');
119  $page_gui->setEnabledRepositoryObjects(false);
120  $page_gui->setEnabledFileLists(true);
121  $page_gui->setEnabledMaps(true);
122  $page_gui->setEnabledPCTabs(true);
123 
124  return $this->ctrl->forwardCommand($page_gui);
125  }
126 
127  public function resetObjectFilter()
128  {
129  unset($_SESSION['pay_objects']);
130  unset($_POST['title_type']);
131  unset($_POST['title_value']);
132  unset($_POST['vendor']);
133  unset($_POST['pay_method']);
134  unset($_POST['updateView']);
135  unset($_POST['show_filter']);
136 
137  ilUtil::sendInfo($this->lng->txt('paya_filter_reseted'));
138 
139  return $this->showObjects();
140  }
141 
142  public function showObjects()
143  {
144  global $ilToolbar;
145 
146  include_once './Services/Payment/classes/class.ilPayMethods.php';
147 
148  $ilToolbar->addButton($this->lng->txt('paya_sell_object'), $this->ctrl->getLinkTarget($this, 'showObjectSelector'));
149 
150  if(!$_POST['show_filter'] && $_POST['updateView'] == '1')
151  {
152  $this->resetObjectFilter();
153  }
154  else
155  if ($_POST['updateView'] == 1)
156  {
157  $_SESSION['pay_objects']['updateView'] = $_POST['updateView'];
158  $_SESSION['pay_objects']['show_filter'] = $_POST['show_filter'];
159  $_SESSION['pay_objects']['title_type'] = $_POST['title_type'];
160  $_SESSION['pay_objects']['title_value'] = $_POST['title_value'];
161  $_SESSION['pay_objects']['pay_method'] = $_POST['pay_method'];
162  $_SESSION['pay_objects']['vendor'] = $_POST['vendor'];
163  }
164 
165  $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.main_view.html', 'Services/Payment');
166 
167  $this->__initPaymentObject();
168  $this->lng->loadLanguageModule('search');
169 
170  $filter_form = new ilPropertyFormGUI();
171  $filter_form->setFormAction($this->ctrl->getFormAction($this));
172  $filter_form->setTitle($this->lng->txt('pay_filter'));
173  $filter_form->setId('filter_form');
174  $filter_form->setTableWidth('100 %');
175 
176  //hide_filter
177  $o_hide_check = new ilCheckBoxInputGUI($this->lng->txt('show_filter'),'show_filter');
178  $o_hide_check->setValue(1);
179  $o_hide_check->setChecked($_SESSION['pay_objects']['show_filter'] ? 1 : 0);
180 
181  $o_hidden = new ilHiddenInputGUI('updateView');
182  $o_hidden->setValue(1);
183  $o_hidden->setPostVar('updateView');
184  $o_hide_check->addSubItem($o_hidden);
185 
186  //title
187  $radio_group = new ilRadioGroupInputGUI($this->lng->txt('search_in_title'), 'title_type');
188  $radio_option = new ilRadioOption($this->lng->txt('search_any_word'), 'or');
189  $radio_group->addOption($radio_option);
190  $radio_option = new ilRadioOption($this->lng->txt('search_all_words'), 'and');
191  $radio_group->addOption($radio_option);
192 
193  $radio_group->setRequired(false);
194  $radio_group->setValue('or');
195  $radio_group->setPostVar('title_type');
196 
197  $o_title = new ilTextInputGUI();
198  $o_title->setValue($_SESSION['pay_objects']['title_value']);
199  $o_title->setPostVar('title_value');
200  $o_title->setTitle($this->lng->txt('title'));
201 
202  $o_hide_check->addSubItem($radio_group);
203  $o_hide_check->addSubItem($o_title);
204 
205  //vendor
206  $o_vendor = new ilTextInputGUI();
207  $o_vendor->setTitle($this->lng->txt('paya_vendor'));
208  $o_vendor->setValue($_SESSION['pay_objects']['vendor']);
209  $o_vendor->setPostVar('vendor');
210  $o_hide_check->addSubItem($o_vendor);
211 
212  // paymethod
213  $o_paymethod = new ilSelectInputGUI();
214  $o_paymethod->setTitle($this->lng->txt('payment_system'));
215  $o_paymethod->setOptions(ilPaymethods::getPayMethodsOptions('all'));
216  $o_paymethod->setValue($_SESSION['pay_objects']['pay_method']);
217  $o_paymethod->setPostVar('pay_method');
218  $o_hide_check->addSubItem($o_paymethod);
219 
220  $filter_form->addCommandButton('showObjects', $this->lng->txt('pay_update_view'));
221  $filter_form->addCommandButton('resetObjectFilter', $this->lng->txt('pay_reset_filter'));
222 
223  $filter_form->addItem($o_hide_check);
224  if(!count($objects = ilPaymentObject::_getObjectsData($this->user_obj->getId())))
225  {
226  ilUtil::sendInfo($this->lng->txt('paya_no_objects_assigned'));
227 
228  return true;
229  }
230  $this->tpl->setVariable('FORM', $filter_form->getHTML());
231 
232  $img_change = "<img src=\"".ilUtil::getImagePath("edit.gif")."\" alt=\"".
233  $this->lng->txt("edit")."\" title=\"".$this->lng->txt("edit").
234  "\" border=\"0\" vspace=\"0\"/>";
235 
236  $counter = 0;
237  foreach($objects as $data)
238  {
239 
240  $tmp_obj = ilObjectFactory::getInstanceByRefId($data['ref_id'], false);
241  if($tmp_obj)
242  {
243  $f_result[$counter]['title'] = $tmp_obj->getTitle();
244  }
245  else
246  {
247  $f_result[$counter]['title'] = $this->lng->txt('object_not_found');
248  }
249 
250 
251  switch($data['status'])
252  {
253  case $this->pobject->STATUS_BUYABLE:
254  $f_result[$counter]['status'] = $this->lng->txt('paya_buyable');
255  break;
256 
257  case $this->pobject->STATUS_NOT_BUYABLE:
258  $f_result[$counter]['status'] = $this->lng->txt('paya_not_buyable');
259  break;
260 
261  case $this->pobject->STATUS_EXPIRES:
262  $f_result[$counter]['status'] = $this->lng->txt('paya_expires');
263  break;
264  }
265  $str_paymethod = ilPayMethods::getStringByPaymethod($data['pay_method']);
266  $f_result[$counter]['pay_method'] = $str_paymethod;
267 
268  if($data['vat_id'] <= 0)
269  {
270  $vat_rate = $this->lng->txt('payment_vat_has_to_be_defined_by_administration_short');
271  }
272  else
273  {
274  try
275  {
276  $oVAT = new ilShopVats((int)$data['vat_id']);
277  $vat_rate = ilShopUtils::_formatVAT((float)$oVAT->getRate());
278  }
279  catch(ilShopException $e)
280  {
281  $vat_rate = $this->lng->txt('payment_vat_has_to_be_defined_by_administration_short');
282  }
283  }
284  $f_result[$counter]['vat_rate'] = $vat_rate;
285 
286  $tmp_user = ilObjectFactory::getInstanceByObjId($data['vendor_id']);
287  $f_result[$counter]['vendor'] = $tmp_user->getFullname().' ['.$tmp_user->getLogin().']';
288 
289  // Get number of purchasers
290  $f_result[$counter]['purchasers'] = ilPaymentBookings::_getCountBookingsByObject($data['pobject_id']);
291 
292  // edit link
293  $this->ctrl->setParameter($this,'pobject_id',$data['pobject_id']);
294  $link_change = "<div class=\"il_ContainerItemCommands\"><a class=\"il_ContainerItemCommand\" href=\"".$this->ctrl->getLinkTarget($this,"editDetails")."\">".$this->lng->txt("edit")."</a></div>";
295 
296  $f_result[$counter]['options'] = $link_change;
297  unset($tmp_user);
298  unset($tmp_obj);
299 
300  ++$counter;
301  }
302 
303  return $this->__showObjectsTable($f_result);
304  }
305 
306  public function editDetails($a_show_confirm = false)
307  {
308  global $ilToolbar;
309 
310  if(!(int)$_GET['pobject_id'])
311  {
312  ilUtil::sendInfo($this->lng->txt('paya_no_object_selected'));
313  return $this->showObjects();
314  }
315 
316  $this->__initPaymentObject((int)$_GET['pobject_id']);
317 
318  $this->ctrl->setParameter($this,'pobject_id', (int)$_GET['pobject_id']);
319 
320  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.main_view.html', 'Services/Payment');
321  $tmp_obj = ilObjectFactory::getInstanceByRefId($this->pobject->getRefId(), false);
322  if(is_object($tmp_obj))
323  {
324  $tmp_object['title'] = $tmp_obj->getTitle();
325  $tmp_object['type'] = $tmp_obj->getType();
326  }
327  else
328  {
329  $tmp_object['title'] = $this->lng->txt('object_not_found');
330  $tmp_object['type'] = false;
331  }
332 
333  if($a_show_confirm)
334  {
335  include_once './Services/Utilities/classes/class.ilConfirmationGUI.php';
336  $oConfirmationGUI = new ilConfirmationGUI();
337 
338  // set confirm/cancel commands
339  $oConfirmationGUI->setFormAction($this->ctrl->getFormAction($this,"performDelete"));
340  $oConfirmationGUI->setHeaderText($this->lng->txt("paya_sure_delete_object"));
341  $oConfirmationGUI->setCancel($this->lng->txt("cancel"), "editDetails");
342  $oConfirmationGUI->setConfirm($this->lng->txt("confirm"), "performDelete");
343 
344  $oConfirmationGUI->addItem('',$tmp_object['title'],$tmp_object['title']);;
345  $this->tpl->setVariable('CONFIRMATION',$oConfirmationGUI->getHTML());
346 
347  return true;
348  }
349 
350  $ilToolbar->addButton($this->lng->txt('paya_edit_details'), $this->ctrl->getLinkTarget($this, 'editDetails'));
351  $ilToolbar->addButton($this->lng->txt('paya_edit_prices'), $this->ctrl->getLinkTarget($this, 'editPrices'));
352  $ilToolbar->addButton($this->lng->txt('pay_edit_abstract'), $this->ctrl->getLinkTargetByClass(array('ilpageobjectgui'), 'edit'));
353 
354  include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
355  $oForm = new ilPropertyFormGUI();
356  $oForm->setFormAction($this->ctrl->getFormAction($this, 'updateDetails'));
357  $oForm->setTitle($tmp_object['title']);
358  if($tmp_object['type'])
359  $oForm->setTitleIcon(ilUtil::getImagePath('icon_'.$tmp_object['type'] .'_b.gif'));
360 
361  // repository path
362  $oPathGUI = new ilNonEditableValueGUI($this->lng->txt('path'));
363  $oPathGUI->setValue($this->__getHTMLPath($this->pobject->getRefId()));
364  $oForm->addItem($oPathGUI);
365 
366  // number of purchasers
367  $oPurchasersGUI = new ilNonEditableValueGUI($this->lng->txt('paya_count_purchaser'));
368  $oPurchasersGUI->setValue(ilPaymentBookings::_getCountBookingsByObject((int)$_GET['pobject_id']));
369  $oForm->addItem($oPurchasersGUI);
370 
371  // vendors
372  $oVendorsGUI = new ilSelectInputGUI($this->lng->txt('paya_vendor'), 'vendor');
373  $oVendorsGUI->setOptions($this->__getVendors());
374  $oVendorsGUI->setValue($this->pobject->getVendorId());
375  $oForm->addItem($oVendorsGUI);
376 
377  // status
378  $oStatusGUI = new ilSelectInputGUI($this->lng->txt('status'), 'status');
379  $oStatusGUI->setOptions($this->__getStatus());
380  $oStatusGUI->setValue($this->pobject->getStatus());
381  $oForm->addItem($oStatusGUI);
382 
383  // pay methods
384  $oPayMethodsGUI = new ilSelectInputGUI($this->lng->txt('paya_pay_method'), 'pay_method');
385  $PMoptions = ilPaymethods::getPayMethodsOptions('not_specified');
386  $oPayMethodsGUI->setOptions($PMoptions);
387  $oPayMethodsGUI->setValue($this->pobject->getPayMethod());
388  $oForm->addItem($oPayMethodsGUI);
389 
390  // topics
391  ilShopTopics::_getInstance()->read();
392  if(is_array($topics = ilShopTopics::_getInstance()->getTopics()) && count($topics))
393  {
394  $oTopicsGUI = new ilSelectInputGUI($this->lng->txt('topic'), 'topic_id');
395  include_once 'Services/Payment/classes/class.ilShopTopics.php';
396  ilShopTopics::_getInstance()->read();
397  $topic_options = array();
398  $topic_options[''] = $this->lng->txt('please_choose');
399 
400  foreach($topics as $oTopic)
401  {
402  $topic_options[$oTopic->getId()] = $oTopic->getTitle();
403  }
404 
405  $oTopicsGUI->setOptions($topic_options);
406  $oTopicsGUI->setValue($this->pobject->getTopicId());
407  $oForm->addItem($oTopicsGUI);
408  }
409 
410  // vats
411  $oShopVatsList = new ilShopVatsList();
412  $oShopVatsList->read();
413  if($oShopVatsList->hasItems())
414  {
415  $oVatsGUI = new ilSelectInputGUI($this->lng->txt('vat_rate'), 'vat_id');
416 
417  $vats_options = array();
418  foreach($oShopVatsList as $oVAT)
419  {
420  $vats_options[$oVAT->getId()] = ilShopUtils::_formatVAT($oVAT->getRate()).' -> '.$oVAT->getTitle();
421  }
422 
423  $oVatsGUI->setOptions($vats_options);
424  $oVatsGUI->setValue($this->pobject->getVatId());
425  $oForm->addItem($oVatsGUI);
426  }
427  else
428  {
429  $oVatsGUI = new ilNonEditableValueGUI($this->lng->txt('vat_rate'));
430  $oVatsGUI->setValue($this->lng->txt('paya_no_vats_assigned'));
431  $oForm->addItem($oVatsGUI);
432  }
433 
434  $oThumbnail = new ilImageFileInputGUI($this->lng->txt('pay_thumbnail'), 'thumbnail');
435  $oFile = new ilFileDataShop($this->pobject->getPobjectId());
436  if(($webpath_file = $oFile->getCurrentImageWebPath()) !== false)
437  {
438  $oThumbnail->setImage($webpath_file);
439  }
440  $oForm->addItem($oThumbnail);
441 
442  // buttons
443  $oForm->addCommandButton('updateDetails', $this->lng->txt('save'));
444  $oForm->addCommandButton('deleteObject', $this->lng->txt('delete'));
445 
446  $this->tpl->setVariable('FORM', $oForm->getHTML());
447  }
448 
449  public function deleteObject()
450  {
451  include_once './Services/Payment/classes/class.ilPaymentBookings.php';
452 
453  if(!$_GET['pobject_id'])
454  {
455  ilUtil::sendFailure($this->lng->txt('paya_no_object_selected'));
456 
457  $this->showObjects();
458  return true;
459  }
460  if(ilPaymentBookings::_getCountBookingsByObject((int) $_GET['pobject_id']))
461  {
462  ilUtil::sendInfo($this->lng->txt('paya_bookings_available'));
463  $this->editDetails();
464 
465  return false;
466  }
467  else
468  {
469 
470  $this->editDetails(true);
471 
472  return true;
473  }
474  }
475 
476  public function performDelete()
477  {
478  include_once './Services/Payment/classes/class.ilPaymentPrices.php';
479 
480  if(!$_GET['pobject_id'])
481  {
482  ilUtil::sendInfo($this->lng->txt('paya_no_object_selected'));
483 
484  $this->showObjects();
485  return true;
486  }
487  $this->__initPaymentObject((int) $_GET['pobject_id']);
488 
489  // delete object data
490  $this->pobject->delete();
491 
492  // delete payment prices
493  $price_obj = new ilPaymentPrices((int) $_GET['pobject_id']);
494  $price_obj->deleteAllPrices();
495  unset($price_obj);
496 
497  ilUtil::sendInfo($this->lng->txt('paya_deleted_object'));
498 
499  $this->showObjects();
500 
501  return true;
502  }
503 
504  public function editPayMethod()
505  {
506  $this->__initPaymentObject((int) $_GET['pobject_id']);
507 
508  switch($this->pobject->getPayMethod())
509  {
510  case $this->pobject->PAY_METHOD_NOT_SPECIFIED:
511  ilUtil::sendFailure($this->lng->txt('paya_select_pay_method_first'));
512  $this->editDetails();
513  return true;
514 
515  default:
516  ilUtil::sendInfo($this->lng->txt('paya_no_settings_necessary'));
517  $this->editDetails();
518  return true;
519  }
520  $this->editDetails();
521 
522  return true;
523  }
524 
525  public function editPrices($a_show_delete = false, $oConfirmationGUI = '')
526  {
527  global $ilToolbar;
528  include_once './Services/Payment/classes/class.ilPaymentPrices.php';
529  include_once './Services/Payment/classes/class.ilPaymentCurrency.php';
530  include_once './Services/Utilities/classes/class.ilConfirmationGUI.php';
531  include_once './Services/Payment/classes/class.ilGeneralSettings.php';
532  $genSet = new ilGeneralSettings();
533 
534  if($a_show_delete == false) unset($_SESSION['price_ids']);
535 
536  $_SESSION['price_ids'] = $_SESSION['price_ids'] ? $_SESSION['price_ids'] : array();
537 
538  if(!$_GET['pobject_id'])
539  {
540  ilUtil::sendInfo($this->lng->txt('paya_no_object_selected'));
541 
542  $this->objectsObject();
543  return true;
544  }
545  $this->ctrl->setParameter($this,'pobject_id',(int) $_GET['pobject_id']);
546  $this->__initPaymentObject((int) $_GET['pobject_id']);
547 
548  $this->tpl->addBlockfile("ADM_CONTENT", "adm_content",'tpl.main_view.html','Services/Payment');
549 
550  $price_obj = new ilPaymentPrices((int) $_GET['pobject_id']);
551  $prices = $price_obj->getPrices();
552 
553  // No prices created
554  if(!count($prices))
555  {
556  ilUtil::sendInfo($this->lng->txt('paya_no_price_available'));
557  $ilToolbar->addButton($this->lng->txt('paya_add_price'), $this->ctrl->getLinkTarget($this, 'addPrice'));
558 
559  return true;
560  }
561  // Show confirm delete
562  if($a_show_delete)
563  {
564  $oConfirmationGUI = new ilConfirmationGUI();
565 
566  // set confirm/cancel commands
567  $oConfirmationGUI->setFormAction($this->ctrl->getFormAction($this,"performDeletePrice"));
568  $oConfirmationGUI->setHeaderText($this->lng->txt("paya_sure_delete_selected_prices"));
569  $oConfirmationGUI->setCancel($this->lng->txt("cancel"), "editPrices");
570  $oConfirmationGUI->setConfirm($this->lng->txt("confirm"), "performDeletePrice");
571 
572  $counter = 0;
573 
574  foreach($prices as $price)
575  {
576  $currency = $genSet->get('currency_unit');
577  if(in_array($price['price_id'],$_SESSION['price_ids']))
578  {
579 
580  if ($price['unlimited_duration'] == '1')
581  {
582  $tmp_price = $this->lng->txt('unlimited_duration');
583  }
584  else
585  {
586  $tmp_price = $price['duration'].' '.$this->lng->txt('paya_months');
587  }
588  $delete_row = ''.$tmp_price.' : '.
589  ilFormat::_getLocalMoneyFormat($price['price']).' '.
590  $currency;
591 
592  $oConfirmationGUI->addItem('',$delete_row, $delete_row);
593  $delete_row = '';
594  }
595  $counter++;
596  }
597 
598  $this->tpl->setVariable('CONFIRMATION', $oConfirmationGUI->getHTML());
599 
600  return true;
601  }
602 
603  $ilToolbar->addButton($this->lng->txt('paya_edit_details'), $this->ctrl->getLinkTarget($this, 'editDetails'));
604  $ilToolbar->addButton($this->lng->txt('paya_edit_prices'), $this->ctrl->getLinkTarget($this, 'editPrices'));
605  $ilToolbar->addButton($this->lng->txt('pay_edit_abstract'), $this->ctrl->getLinkTargetByClass(array('ilpageobjectgui'), 'edit'));
606 
607  // Fill table cells
608  $tpl = new ilTemplate('tpl.table.html',true,true);
609 
610  // set table header
611  $tpl->setCurrentBlock('tbl_form_header');
612 
613  $tpl->setVariable('FORMACTION',$this->ctrl->getFormAction($this));
614  $tpl->parseCurrentBlock();
615 
616  $counter = 0;
617  foreach($prices as $price)
618  {
619  $currency = ilPaymentCurrency::_getCurrency($price['currency']);
620  if($a_show_delete == true )
621  {
622  $this->ctrl->setParameter($this, 'show_delete', 'true');
623 
624  if(in_array($price['price_id'],$_SESSION['price_ids']))
625  {
626  $data[$counter]['price_id'] = ilUtil::formCheckBox(0,
627  'price_ids[]', (int)$price['price_id']);
628  //$data[$counter]['price_id'] = '';
629  $data[$counter]['duration'] =$price['duration'] ;
630  $data[$counter]['month'] = $this->lng->txt('paya_months');
631 
632  $data[$counter]['unlimited_duration'] = ilUtil::formCheckBox($price['unlimited_duration'] ? 1 : 0,
633  'duration_ids[]', (int)$price['price_id']);
634 
635  $data[$counter]['price'] = ilFormat::_getLocalMoneyFormat($price['price']);
636  $data[$counter]['currency_unit'] = $genSet->get('currency_unit');
637  //TODO: later $data[$counter]['currency_unit'] = $currency['unit'];
638  }
639  }
640  else
641  {
642  $data[$counter]['price_id'] = ilUtil::formCheckBox(in_array($price['price_id'],$_SESSION['price_ids']) ? 1 : 0,
643  'price_ids[]', $price['price_id']);
644 
645  $data[$counter]['duration'] = ilUtil::formInput('prices['.$price['price_id'].'][duration]',$price['duration']);
646  $data[$counter]['month'] = $this->lng->txt('paya_months');
647 
648  $data[$counter]['unlimited_duration'] = ilUtil::formCheckBox($price['unlimited_duration'] ? 1 : 0,
649  'duration_ids[]', (int)$price['price_id']);
650 
651  $data[$counter]['price'] = ilUtil::formInput('prices['.$price['price_id'].'][price]', ilFormat::_getLocalMoneyFormat($price['price']));
652  $data[$counter]['currency_unit'] = $genSet->get('currency_unit');
653 /* TODO: later -> use currency table
654  * $data[$counter]['price'] = ilUtil::formInput('prices['.$price['price_id'].'][price]', ilFormat::_getLocalMoneyFormat($price['price']));
655 
656  $default_currency = ilPaymentCurrency::_getDefaultCurrency();
657 
658  $all_currencies = ilPaymentCurrency::_getAvailableCurrencies();
659  $currency_options = array();
660 
661  foreach($all_currencies as $cur)
662  {
663  $currency_options[$cur['currency_id']] = $cur['unit'];
664  }
665 
666  $data[$counter]['currency_unit'] = ilUtil::formSelect($price['currency'], 'prices['.$price['price_id'].'][currency]',
667  $currency_options,false,true);
668 
669  */
670  }
671  ++$counter;
672  }
673  $this->__editPricesTable($data);
674 
675  return true;
676  }
677 
678  private function __editPricesTable($a_result_set)
679  {
680  $tbl = new ilShopTableGUI($this);
681 
682  $tmp_obj = ilObjectFactory::getInstanceByRefId($this->pobject->getRefId(), false);
683  if($tmp_obj)
684  {
685  $tbl->setTitle($tmp_obj->getTitle());
686  }
687  else
688  {
689  $tbl->setTitle($this->lng->txt('object_not_found'));
690  }
691 
692  $tbl->setId('tbl_bookings');
693  $tbl->setRowTemplate("tpl.shop_prices_row.html", "Services/Payment");
694 
695  $tbl->addColumn(' ', 'price_id', '5%');
696  $tbl->addColumn($this->lng->txt('duration'), 'duration', '10%');
697  $tbl->addColumn('','month','10%');
698  $tbl->addColumn($this->lng->txt('unlimited_duration'), 'unlimitied_duration', '15%');
699  $tbl->addColumn($this->lng->txt('price_a'), 'price', '10%');
700  $tbl->addColumn($this->lng->txt('currency'), 'currency_unit', '50%');
701  $tbl->setSelectAllCheckbox('price_id');
702  $tbl->addCommandButton('updatePrice',$this->lng->txt('paya_update_price'));
703  $tbl->addCommandButton('addPrice',$this->lng->txt('paya_add_price'));
704 
705  $tbl->addMultiCommand("deletePrice", $this->lng->txt("paya_delete_price"));
706  $tbl->fillFooter();
707 
708  $tbl->setData($a_result_set);
709 
710  $this->tpl->setVariable('TABLE', $tbl->getHTML());
711 
712  return true;
713  }
714 
715  public function addPrice()
716  {
717  global $ilToolbar;
718 
719  if(!$_GET['pobject_id'])
720  {
721  ilUtil::sendInfo($this->lng->txt('paya_no_object_selected'));
722 
723  $this->showObjects();
724  return true;
725  }
726 
727  include_once './Services/Payment/classes/class.ilGeneralSettings.php';
728 
729  $genSet = new ilGeneralSettings();
730 
731 
732  $this->ctrl->setParameter($this,'pobject_id',(int) $_GET['pobject_id']);
733 
734  $this->__initPaymentObject((int) $_GET['pobject_id']);
735 
736  $ilToolbar->addButton($this->lng->txt('paya_edit_details'), $this->ctrl->getLinkTarget($this, 'editDetails'));
737  $ilToolbar->addButton($this->lng->txt('paya_edit_prices'), $this->ctrl->getLinkTarget($this, 'editPrices'));
738 
739  $this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.main_view.html','Services/Payment');
740  $tmp_obj = ilObjectFactory::getInstanceByRefId($this->pobject->getRefId(), false);
741  $form = new ilPropertyFormGUI();
742  $form->setFormAction($this->ctrl->getFormAction($this));
743  $form->setTitle($this->lng->txt('paya_add_price_title'));
744 
745  // object_title
746  $oTitle = new ilNonEditableValueGUI($this->lng->txt('title'));
747  if($tmp_obj)
748  {
749  $oTitle->setValue($tmp_obj->getTitle());
750  }
751  else
752  {
753  $oTitle->setValue($this->lng->txt('object_not_found'));
754  }
755  $form->addItem($oTitle);
756 
757  // duration
758  $oDuration = new ilTextInputGUI();
759  $oDuration->setTitle($this->lng->txt('duration'));
760  $oDuration->setValue($_POST['duration']);
761  $oDuration->setInfo($this->lng->txt('paya_months'));
762  $oDuration->setPostVar('duration');
763  $form->addItem($oDuration);
764  // unlimited duration
765  $oUnlimitedDuration = new ilCheckboxInputGUI($this->lng->txt('unlimited_duration'), 'unlimited_duration');
766  $oUnlimitedDuration->setChecked($_POST['unlimited_duration'] == 1);
767 
768  $form->addItem($oUnlimitedDuration);
769 
770  // price
771  $oPrice = new ilTextInputGUI();
772  $oPrice->setTitle($this->lng->txt('price_a'));
773  $oPrice->setValue($_POST['price']);
774  $oPrice->setPostVar('price');
775  $oPrice->setRequired(true);
776  $form->addItem($oPrice);
777 
778  // currency
779  $this->tpl->setVariable('TXT_PRICE_A',$genSet->get('currency_unit'));
780 /*
781  // TODO: show currency selector
782 
783  // currency
784  include_once './Services/Payment/classes/class.ilPaymentCurrency.php';
785  $objCurrency = new ilPaymentCurrency();
786  $currencies = $objCurrency->_getAvailableCurrencies();
787 
788  foreach($currencies as $currency)
789  {
790  $currency_options[$currency['currency_id']] = $currency['unit'];
791  }
792 
793  $oCurrency = new ilSelectInputGUI($this->lng->txt('currency'), 'currency_id');
794  $oCurrency->setOptions($currency_options);
795 
796  $oCurrency->setValue($_SESSION['pay_objects']['currency_value']);
797  $oCurrency->setPostVar('currency_id');
798 
799  $form->addItem($oCurrency);
800 
801  */
802  $form->addCommandButton('performAddPrice',$this->lng->txt('paya_add_price'));
803  $form->addCommandButton('editPrices', $this->lng->txt('cancel'));
804  $this->tpl->setVariable('FORM',$form->getHTML());
805 
806  return true;
807  }
808 
809  public function performAddPrice()
810  {
811 
812  if(!$_GET['pobject_id'])
813  {
814  ilUtil::sendInfo($this->lng->txt('paya_no_object_selected'));
815 
816  $this->showObjects();
817  return true;
818  }
819 
820  include_once './Services/Payment/classes/class.ilPaymentPrices.php';
821  include_once './Services/Payment/classes/class.ilPaymentCurrency.php';
822 //
824 
825  $prices = new ilPaymentPrices((int) $_GET['pobject_id']);
826 
827  $prices->setDuration($_POST['duration']);
828  $prices->setUnlimitedDuration($_POST['unlimited_duration']);
829  if($_POST['unlimited_duration'] == '1')
830  {
831  $prices->setUnlimitedDuration(1);
832  }
833 
834  $prices->setPrice($_POST['price']);
835  $prices->setCurrency($currency[1]['currency_id']);
836  //$prices->setCurrency($_POST['currency_id']);
837 
838  if(!$prices->validate())
839  {
840  ilUtil::sendInfo($this->lng->txt('paya_price_not_valid'));
841  $this->addPrice();
842 
843  return true;
844  }
845  $prices->add();
846 
847  ilUtil::sendSuccess($this->lng->txt('paya_added_new_price'));
848  $this->editPrices();
849 
850  return true;
851  }
852 
853  public function performDeletePrice()
854  {
855  if(!$_GET['pobject_id'])
856  {
857  ilUtil::sendInfo($this->lng->txt('paya_no_object_selected'));
858 
859  $this->showObjects();
860  return true;
861  }
862 
863  if(!count($_SESSION['price_ids']))
864  {
865  ilUtil::sendInfo($this->lng->txt('paya_no_prices_selected'));
866 
867  $this->editPrices();
868  return true;
869  }
870  include_once './Services/Payment/classes/class.ilPaymentPrices.php';
871 
872  $prices = new ilPaymentPrices((int) $_GET['pobject_id']);
873 
874  foreach($_SESSION['price_ids'] as $price_id)
875  {
876  $prices->delete($price_id);
877  }
878 
879  // check if it was last price otherwise set status to 'not_buyable'
880  if(!count($prices->getPrices()))
881  {
882  $this->__initPaymentObject((int) $_GET['pobject_id']);
883 
884  $this->pobject->setStatus($this->pobject->STATUS_NOT_BUYABLE);
885  $this->pobject->update();
886 
887  ilUtil::sendInfo($this->lng->txt('paya_deleted_last_price'));
888  }
889  unset($prices);
890  unset($_SESSION['price_ids']);
891 
892  return $this->editPrices();
893  }
894 
895 
896  public function deletePrice()
897  {
898  if(!$_GET['pobject_id'])
899  {
900  ilUtil::sendInfo($this->lng->txt('paya_no_object_selected'));
901 
902  $this->showObjects();
903  return true;
904  }
905 
906  if(!count($_POST['price_ids']))
907  {
908  ilUtil::sendInfo($this->lng->txt('paya_no_prices_selected'));
909 
910  $this->editPrices();
911  return true;
912  }
913  $_SESSION['price_ids'] = $_POST['price_ids'];
914 
915  $this->editPrices(true);
916  return true;
917  }
918 
919  public function updatePrice()
920  {
921  include_once './Services/Payment/classes/class.ilPaymentPrices.php';
922 
923  if(!$_GET['pobject_id'])
924  {
925  ilUtil::sendInfo($this->lng->txt('paya_no_object_selected'));
926 
927  $this->showObjects();
928  return true;
929  }
930  $po = new ilPaymentPrices((int) $_GET['pobject_id']);
931 
932  $this->ctrl->setParameter($this,'pobject_id',(int) $_GET['pobject_id']);
933 
934  // validate
935  foreach($_POST['prices'] as $price_id => $price)
936  {
937  $old_price = $po->getPrice($price_id);
938 
939  $po->setDuration($price['duration']);
940  $po->setUnlimitedDuration($price['unlimited_duration']);
941  $po->setPrice($price['price']);
942  $po->setCurrency($old_price['currency']);
943 //$po->setCurrency($price['currency']);
944  if(!$po->validate())
945  {
946  $error = true;
947  }
948  }
949  if($error)
950  {
951  ilUtil::sendInfo($this->lng->txt('paya_insert_only_numbers'));
952 
953  $this->editPrices();
954  return false;
955  }
956 
957  foreach($_POST['prices'] as $price_id => $price)
958  {
959  $old_price = $po->getPrice($price_id);
960  if(isset($_POST['duration_ids']))
961  {
962  $search = in_array((string)$price_id, $_POST['duration_ids']);
963 
964  if($_POST['duration_ids'] == NULL)
965  {
966  $po->setUnlimitedDuration(0);
967  $po->setDuration($price['duration']);
968  }
969 
970  else if( $search = in_array((string)$price_id, $_POST['duration_ids']))
971  {
972  $po->setUnlimitedDuration(1);
973  $po->setDuration(0);
974  }
975  else
976  {
977  $po->setUnlimitedDuration(0);
978  }
979  }
980 
981  $po->setDuration($price['duration']);
982 
983  $po->setPrice($price['price']);
984  $po->setCurrency($old_price['currency']);
985 //$po->setCurrency($price['currency']);
986  $po->update($price_id);
987  }
988  ilUtil::sendInfo($this->lng->txt('paya_updated_prices'));
989  $this->editPrices();
990 
991  return true;
992  }
993 
994 
995  public function updateDetails()
996  {
997  if(!$_GET['pobject_id'])
998  {
999  ilUtil::sendInfo($this->lng->txt('paya_no_object_selected'));
1000 
1001  $this->showObjects();
1002  return true;
1003  }
1004  $this->__initPaymentObject((int)$_GET['pobject_id']);
1005  $this->ctrl->setParameter($this, 'pobject_id', (int)$_GET['pobject_id']);
1006 
1007  // read old settings
1008  $old_pay_method = $this->pobject->getPayMethod();
1009  $old_status = $this->pobject->getStatus();
1010 
1011  // check status changed from not_buyable
1012  if($old_status == $this->pobject->STATUS_NOT_BUYABLE and
1013  (int) $_POST['status'] != $old_status)
1014  {
1015  // check pay_method edited
1016  switch((int) $_POST['pay_method'])
1017  {
1018  case $this->pobject->PAY_METHOD_NOT_SPECIFIED:
1019  ilUtil::sendInfo($this->lng->txt('paya_select_pay_method_first'));
1020  $this->editDetails();
1021 
1022  return false;
1023 
1024  default:
1025  ;
1026  }
1027  // check minimum one price
1028  include_once './Services/Payment/classes/class.ilPaymentPrices.php';
1029 
1030  $prices_obj = new ilPaymentPrices((int) $_GET['pobject_id']);
1031  if(!count($prices_obj->getPrices()))
1032  {
1033  ilUtil::sendInfo($this->lng->txt('paya_edit_prices_first'));
1034  $this->editDetails();
1035 
1036  return false;
1037  }
1038  }
1039 
1040  $this->pobject->setStatus((int)$_POST['status']);
1041  $this->pobject->setVendorId((int)$_POST['vendor']);
1042  $this->pobject->setPayMethod((int)$_POST['pay_method']);
1043  $this->pobject->setTopicId((int)$_POST['topic_id']);
1044  $this->pobject->setVatId((int)$_POST['vat_id']);
1045 
1046  if((int)$_POST['thumbnail_delete'])
1047  {
1048  $oFile = new ilFileDataShop($this->pobject->getPobjectId());
1050  }
1051  else if($_FILES['thumbnail']['tmp_name'] != '')
1052  {
1053  $this->lng->loadLanguageModule('form');
1054  include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
1055  $oThumbnail = new ilImageFileInputGUI($this->lng->txt('pay_thumbnail'), 'thumbnail');
1056  if($oThumbnail->checkInput())
1057  {
1058  $oFile = new ilFileDataShop($this->pobject->getPobjectId());
1059  if(($oFile->storeUploadedFile($_FILES['thumbnail'])) !== false)
1060  {
1061  $oFile->assignFileToPaymentObject();
1062  }
1063  }
1064  else
1065  {
1066  ilUtil::sendInfo($oThumbnail->getAlert());
1067  return $this->editDetails();
1068  }
1069  }
1070 
1071  $this->pobject->update();
1072 
1073  ilUtil::sendInfo($this->lng->txt('paya_details_updated'));
1074  $this->showObjects();
1075 
1076  return true;
1077  }
1078 
1079  public function showObjectSelector()
1080  {
1081  global $tree, $ilToolbar;
1082 
1083  include_once './Services/Payment/classes/class.ilPaymentObjectSelector.php';
1084 
1085  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.paya_object_selector.html','Services/Payment');
1086  $ilToolbar->addButton($this->lng->txt('back'), $this->ctrl->getLinkTarget($this, 'showObjects'));
1087 
1088 
1089  ilUtil::sendInfo($this->lng->txt('paya_select_object_to_sell'));
1090 
1091  $exp = new ilPaymentObjectSelector($this->ctrl->getLinkTarget($this,'showObjectSelector'), strtolower(get_class($this)));
1092  $exp->setExpand($_GET['paya_link_expand'] ? $_GET['paya_link_expand'] : $tree->readRootId());
1093  $exp->setExpandTarget($this->ctrl->getLinkTarget($this,'showObjectSelector'));
1094 
1095  $exp->setOutput(0);
1096 
1097  $this->tpl->setVariable("EXPLORER",$exp->getOutput());
1098 
1099  return true;
1100  }
1101 
1102  public function showSelectedObject()
1103  {
1104  global $ilToolbar;
1105 
1106  if(!(int)$_GET['sell_id'])
1107  {
1108  ilUtil::sendInfo($this->lng->txt('paya_no_object_selected'));
1109  return $this->showObjectSelector();
1110  }
1111 
1112  $ilToolbar->addButton($this->lng->txt('back'), $this->ctrl->getLinkTarget($this, 'showObjectSelector'));
1113 
1114  // save ref_id of selected object
1115  $this->ctrl->setParameter($this, 'sell_id', (int)$_GET['sell_id']);
1116 
1117  include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
1118  $oForm = new ilPropertyFormGUI();
1119  $oForm->setFormAction($this->ctrl->getFormAction($this, 'updateDetails'));
1120  $oForm->setTitle($this->lng->txt('details'));
1121  $oForm->setTitleIcon(ilUtil::getImagePath('icon_pays.gif', false));
1122 
1123  $tmp_obj = ilObjectFactory::getInstanceByRefId($_GET['sell_id'], false);
1124  if($tmp_obj)
1125  {
1126  $tmp_object['title'] = $tmp_obj->getTitle();
1127  $tmp_object['description'] = $tmp_obj->getDescription();
1128  $tmp_object['owner'] = $tmp_obj->getOwnerName();
1129  $tmp_object['path'] = $this->__getHTMLPath((int)$_GET['sell_id']);
1130  }
1131  else
1132  {
1133  $tmp_object['title'] = $this->lng->txt('object_not_found');
1134  $tmp_object['description'] = '';
1135  $tmp_object['owner'] = '';
1136  $tmp_object['path'] = '';
1137  }
1138 
1139  // title
1140  $oTitleGUI = new ilNonEditableValueGUI($this->lng->txt('title'));
1141  $oTitleGUI->setValue($tmp_object['title']);
1142  $oForm->addItem($oTitleGUI);
1143 
1144  // description
1145  $oDescriptionGUI = new ilNonEditableValueGUI($this->lng->txt('description'));
1146  $oDescriptionGUI->setValue($tmp_object['description']);
1147  $oForm->addItem($oDescriptionGUI);
1148 
1149  // owner
1150  $oOwnerGUI = new ilNonEditableValueGUI($this->lng->txt('owner'));
1151  $oOwnerGUI->setValue($tmp_object['owner']);
1152  $oForm->addItem($oOwnerGUI);
1153 
1154  // repository path
1155  $oPathGUI = new ilNonEditableValueGUI($this->lng->txt('path'));
1156  $oPathGUI->setValue($tmp_object['path']);
1157  $oForm->addItem($oPathGUI);
1158 
1159  // vendors
1160  $oVendorsGUI = new ilSelectInputGUI($this->lng->txt('paya_vendor'), 'vendor');
1161  $oVendorsGUI->setOptions($this->__getVendors());
1162  $oForm->addItem($oVendorsGUI);
1163 
1164  // buttons
1165  $oForm->addCommandButton('addObject', $this->lng->txt('next'));
1166  $oForm->addCommandButton('showObjects', $this->lng->txt('cancel'));
1167 
1168  $this->tpl->setVariable('ADM_CONTENT', $oForm->getHTML());
1169  }
1170 
1171  public function addObject()
1172  {
1173  if(!$_GET['sell_id'])
1174  {
1175  ilUtil::sendInfo($this->lng->txt('paya_no_object_selected'));
1176 
1177  return $this->showObjectSelector();
1178  }
1179  if(!(int)$_POST['vendor'])
1180  {
1181  ilUtil::sendInfo($this->lng->txt('paya_no_vendor_selected'));
1182 
1183  return $this->showSelectedObject();
1184  }
1185 
1186 
1187  if(ilPaymentObject::_isPurchasable($_GET['sell_id']))
1188  {
1189  // means that current object already exits in payment_objects _table ...
1190  ilUtil::sendInfo($this->lng->txt('paya_object_not_purchasable'));
1191 
1192  return $this->showObjectSelector();
1193  }
1194 
1195  include_once 'Services/Payment/classes/class.ilPaymentObject.php';
1196 
1197  $p_obj = new ilPaymentObject($this->user_obj);
1198 
1199  $p_obj->setRefId((int)$_GET['sell_id']);
1200  $p_obj->setStatus($p_obj->STATUS_NOT_BUYABLE);
1201  $p_obj->setPayMethod($p_obj->PAY_METHOD_NOT_SPECIFIED);
1202  $p_obj->setVendorId((int)$_POST['vendor']);
1203  $p_obj->setTopicId((int)$_POST['topic_id']);
1204  $p_obj->setVatId((int)$_POST['vat_id']);
1205 
1206  $new_id = $p_obj->add();
1207  if($new_id)
1208  {
1209  ilUtil::sendInfo($this->lng->txt('paya_added_new_object'));
1210  $_GET['pobject_id'] = $new_id;
1211  return $this->editDetails();
1212  }
1213  else
1214  {
1215  ilUtil::sendInfo($this->lng->txt('paya_err_adding_object'));
1216  return $this->showObjects();
1217  }
1218  }
1219 
1220  private function __getVendors()
1221  {
1222  include_once 'Services/Payment/classes/class.ilPaymentVendors.php';
1223 
1224  $options = array();
1225  $vendors = array();
1226  if(ilPaymentVendors::_isVendor($this->user_obj->getId()))
1227  {
1228  $vendors[] = $this->user_obj->getId();
1229  }
1230  if($vend = ilPaymentTrustees::_getVendorsForObjects($this->user_obj->getId()))
1231  {
1232  $vendors = array_merge($vendors, $vend);
1233  }
1234  foreach($vendors as $vendor)
1235  {
1236  $tmp_obj = ilObjectFactory::getInstanceByObjId($vendor, false);
1237  $options[$vendor] = $tmp_obj->getFullname().' ['.$tmp_obj->getLogin().']';
1238  }
1239 
1240  return $options;
1241  }
1242 
1243 
1244  private function __getStatus()
1245  {
1246  $option = array();
1247  $option[$this->pobject->STATUS_NOT_BUYABLE] = $this->lng->txt('paya_not_buyable');
1248  $option[$this->pobject->STATUS_BUYABLE] = $this->lng->txt('paya_buyable');
1249  $option[$this->pobject->STATUS_EXPIRES] = $this->lng->txt('paya_expires');
1250 
1251  return $option;
1252  }
1253 
1254  private function __showObjectsTable($a_result_set)
1255  {
1256  $tbl = new ilShopTableGUI($this);
1257  $tbl->setTitle($this->lng->txt('objects'));
1258 
1259  $tbl->setId('tbl_objects');
1260  $tbl->setRowTemplate("tpl.shop_objects_row.html", "Services/Payment");
1261 
1262  $tbl->addColumn($this->lng->txt('title'), 'title', '10%');
1263  $tbl->addColumn($this->lng->txt('status'), 'status', '10%');
1264  $tbl->addColumn($this->lng->txt('paya_pay_method'),'pay_method','10%');
1265  $tbl->addColumn($this->lng->txt('vat_rate'), 'vat_rate', '15%');
1266  $tbl->addColumn($this->lng->txt('paya_vendor'), 'vendor', '10%');
1267  $tbl->addColumn($this->lng->txt('paya_count_purchaser'), 'purchasers', '10%');
1268  $tbl->addColumn('','options','10%');
1269 
1270  $tbl->setData($a_result_set);
1271 
1272  $this->tpl->setVariable('TABLE', $tbl->getHTML());
1273 
1274  return true;
1275  }
1276 
1277 
1278  private function __getHTMLPath($a_ref_id)
1279  {
1280  global $tree;
1281 
1282  $path = $tree->getPathFull($a_ref_id);
1283  unset($path[0]);
1284 
1285  foreach($path as $data)
1286  {
1287  $html .= $data['title'].' > ';
1288  }
1289  return substr($html,0,-2);
1290  }
1291 
1292  private function __initPaymentObject($a_pobject_id = 0)
1293  {
1294  include_once './Services/Payment/classes/class.ilPaymentObject.php';
1295 
1296  $this->pobject = new ilPaymentObject($this->user_obj,$a_pobject_id);
1297 
1298  return true;
1299  }
1300 }
1301 ?>