ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilMStListCertificatesGUI.php
Go to the documentation of this file.
1 <?php
2 
5 
16 {
17  const CMD_APPLY_FILTER = 'applyFilter';
18  const CMD_INDEX = 'index';
19  const CMD_GET_ACTIONS = "getActions";
20  const CMD_RESET_FILTER = 'resetFilter';
24  protected $table;
28  protected $access;
29 
30 
34  public function __construct()
35  {
36  $this->access = ilMyStaffAccess::getInstance();
37  }
38 
39 
43  protected function checkAccessOrFail()
44  {
45  global $DIC;
46 
47  if ($this->access->hasCurrentUserAccessToCertificates()) {
48  return;
49  } else {
50  ilUtil::sendFailure($DIC->language()->txt("permission_denied"), true);
51  $DIC->ctrl()->redirectByClass(ilDashboardGUI::class, "");
52  }
53  }
54 
55 
59  public function executeCommand()
60  {
61  global $DIC;
62 
63  $cmd = $DIC->ctrl()->getCmd();
64  $next_class = $DIC->ctrl()->getNextClass();
65 
66  switch ($next_class) {
67  case strtolower(ilFormPropertyDispatchGUI::class):
68  $this->checkAccessOrFail();
69 
70  $DIC->ctrl()->setReturn($this, self::CMD_INDEX);
71  $this->table = new ilMStListCertificatesTableGUI($this, self::CMD_INDEX);
72  $this->table->executeCommand();
73  break;
74  case strtolower(ilUserCertificateApiGUI::class):
75  $this->checkAccessOrFail();
76  $DIC->ctrl()->forwardCommand(new ilUserCertificateApiGUI());
77  break;
78  default:
79  switch ($cmd) {
80 
81  case self::CMD_RESET_FILTER:
82  case self::CMD_APPLY_FILTER:
83  case self::CMD_INDEX:
84  case self::CMD_GET_ACTIONS:
85  $this->$cmd();
86  break;
87  default:
88  $this->index();
89  break;
90  }
91  break;
92  }
93  }
94 
95 
99  public function index()
100  {
101  $this->listUsers();
102  }
103 
104 
108  public function listUsers()
109  {
110  global $DIC;
111 
112  $this->checkAccessOrFail();
113 
114  $this->table = new ilMStListCertificatesTableGUI($this, self::CMD_INDEX);
115  $DIC->ui()->mainTemplate()->setTitle($DIC->language()->txt('mst_list_certificates'));
116  $DIC->ui()->mainTemplate()->setTitleIcon(ilUtil::getImagePath('icon_cert.svg'));
117  $DIC->ui()->mainTemplate()->setContent($this->table->getHTML());
118  }
119 
120 
124  public function applyFilter()
125  {
126  $this->table = new ilMStListCertificatesTableGUI($this, self::CMD_APPLY_FILTER);
127  $this->table->writeFilterToSession();
128  $this->table->resetOffset();
129  $this->index();
130  }
131 
132 
136  public function resetFilter()
137  {
138  $this->table = new ilMStListCertificatesTableGUI($this, self::CMD_RESET_FILTER);
139  $this->table->resetOffset();
140  $this->table->resetFilter();
141  $this->index();
142  }
143 
144 
148  public function getId()
149  {
150  $this->table = new ilMStListCertificatesTableGUI($this, self::CMD_INDEX);
151 
152  return $this->table->getId();
153  }
154 
155 
159  public function cancel()
160  {
161  global $DIC;
162 
163  $DIC->ctrl()->redirect($this);
164  }
165 }
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
global $DIC
Definition: goto.php:24
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.