ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilPaymentAdminGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
11include_once './Services/Payment/classes/class.ilPaymentVendors.php';
12include_once './Services/Payment/classes/class.ilShopBaseGUI.php';
13include_once './Services/Payment/classes/class.ilPaymentTrustees.php';
14include_once './Services/Payment/classes/class.ilPaymentObjectSelector.php';
15include_once './Services/Payment/classes/class.ilPaymentSettings.php';
16
18{
19 public function ilPaymentAdminGUI($user_obj)
20 {
21 $this->user_obj = $user_obj;
22 }
23
24 protected function buildSubTabs()
25 {
26 global $ilUser, $ilTabs, $ilCtrl;
27
29
30 if(ilPaymentVendors::_isVendor($ilUser->getId()) ||
32 {
33 $ilTabs->addSubTabTarget('bookings', $ilCtrl->getLinkTargetByClass('ilpaymentstatisticgui'), '', '', '');
34 }
35
36 if(ilPaymentVendors::_isVendor($ilUser->getId()) ||
38 {
39 $ilTabs->addSubTabTarget('paya_object', $ilCtrl->getLinkTargetByClass('ilpaymentobjectgui'), '', '', '');
40
41 }
42
43 if(ilPaymentVendors::_isVendor($ilUser->getId()))
44 {
45 $ilTabs->addSubTabTarget('paya_trustees', $ilCtrl->getLinkTargetByClass('ilpaymenttrusteegui'), '', '', '');
46 }
47
48 if(!(bool)$settings->get('hide_coupons'))
49 {
50 if(ilPaymentVendors::_isVendor($ilUser->getId()) ||
52 {
53 $ilTabs->addSubTabTarget('paya_coupons_coupons', $ilCtrl->getLinkTargetByClass('ilpaymentcoupongui'), '', '', '');
54 }
55 }
56 }
57
58 public function executeCommand()
59 {
60 global $ilCtrl;
61
62 $next_class = $ilCtrl->getNextClass($this);
63 $this->buildSubTabs();
64
65 switch($next_class)
66 {
67 case 'ilpaymenttrusteegui':
68 include_once './Services/Payment/classes/class.ilPaymentTrusteeGUI.php';
69 $ilCtrl->forwardCommand(new ilPaymentTrusteeGUI($this->user_obj));
70 break;
71
72 case 'ilpaymentobjectgui':
73 include_once './Services/Payment/classes/class.ilPaymentObjectGUI.php';
74 $ilCtrl->forwardCommand(new ilPaymentObjectGUI($this->user_obj));
75 break;
76
77 case 'ilpaymentstatisticgui':
78 include_once './Services/Payment/classes/class.ilPaymentStatisticGUI.php';
79 $ilCtrl->forwardCommand(new ilPaymentStatisticGUI($this->user_obj));
80 break;
81
82 case 'ilpaymentcoupongui':
83 include_once './Services/Payment/classes/class.ilPaymentCouponGUI.php';
84 $ilCtrl->forwardCommand(new ilPaymentCouponGUI($this->user_obj));
85 break;
86
87 default:
88 $this->forwardToDefault();
89 break;
90 }
91 }
92
93 private function forwardToDefault()
94 {
95 global $ilCtrl, $lng;
96
97 $is_vendor = ilPaymentVendors::_isVendor($this->user_obj->getId());
98 $has_stat_perm = ilPaymentTrustees::_hasStatisticPermission($this->user_obj->getId());
99 $has_obj_perm = ilPaymentTrustees::_hasObjectPermission($this->user_obj->getId());
100 $has_coup_perm = ilPaymentTrustees::_hasCouponsPermission($this->user_obj->getId());
101
102 if($is_vendor || $has_stat_perm)
103 {
104 $ilCtrl->redirectByClass('ilpaymentstatisticgui');
105 }
106 else if($has_obj_perm)
107 {
108 $ilCtrl->redirectByClass('ilpaymentobjectgui');
109 }
110 else if($has_coup_perm)
111 {
112 $ilCtrl->redirectByClass('ilpaymentcoupongui');
113 }
114
115 ilUtil::sendInfo($lng->txt("no_permission"));
116
117 return false;
118 }
119}
static _hasCouponsPermission($a_trustee)
static _hasStatisticPermission($a_trustee)
static _hasObjectPermission($a_trustee)
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:40
global $ilUser
Definition: imgupload.php:15