ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
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 */
14 include_once './Services/Payment/classes/class.ilPaymentVendors.php';
15 include_once './Services/Payment/classes/class.ilShopBaseGUI.php';
16 include_once './Services/Payment/classes/class.ilPaymentTrustees.php';
17 
19 {
20  public function ilPaymentAdminGUI($user_obj)
21  {
22  $this->user_obj = $user_obj;
23  }
24 
25  public function executeCommand()
26  {
27  global $ilCtrl;
28 
29  $next_class = $ilCtrl->getNextClass($this);
30  $cmd = $ilCtrl->getCmd();
31 
32  switch($next_class)
33  {
34  case 'ilpaymenttrusteegui':
35  include_once './Services/Payment/classes/class.ilPaymentTrusteeGUI.php';
36  $ilCtrl->forwardCommand(new ilPaymentTrusteeGUI($this->user_obj));
37  break;
38 
39  case 'ilpaymentobjectgui':
40  include_once './Services/Payment/classes/class.ilPaymentObjectGUI.php';
41  $ilCtrl->forwardCommand(new ilPaymentObjectGUI($this->user_obj));
42  break;
43 
44  case 'ilpaymentstatisticgui':
45  include_once './Services/Payment/classes/class.ilPaymentStatisticGUI.php';
46  $ilCtrl->forwardCommand(new ilPaymentStatisticGUI($this->user_obj));
47  break;
48 
49  case 'ilpaymentcoupongui':
50  include_once './Services/Payment/classes/class.ilPaymentCouponGUI.php';
51  $ilCtrl->forwardCommand(new ilPaymentCouponGUI($this->user_obj));
52  break;
53 
54  default:
55  $this->forwardToDefault();
56  break;
57  }
58  }
59 
60  private function forwardToDefault()
61  {
62  global $ilCtrl, $lng;
63 
64  $is_vendor = ilPaymentVendors::_isVendor($this->user_obj->getId());
65  $has_stat_perm = ilPaymentTrustees::_hasStatisticPermission($this->user_obj->getId());
66  $has_obj_perm =ilPaymentTrustees::_hasObjectPermission($this->user_obj->getId());
67  $has_coup_perm = ilPaymentTrustees::_hasCouponsPermission($this->user_obj->getId());
68 
69  if($is_vendor || $has_stat_perm)
70  {
71  $ilCtrl->redirectByClass('ilpaymentstatisticgui');
72  }
73  else if($has_obj_perm)
74  {
75  $ilCtrl->redirectByClass('ilpaymentobjectgui');
76  }
77  else if($has_coup_perm)
78  {
79  $ilCtrl->redirectByClass('ilpaymentcoupongui');
80  }
81 
82  ilUtil::sendInfo($lng->txt("no_permission"));
83 
84  return false;
85  }
86 }
87 ?>