ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilMStListCertificatesGUI.php
Go to the documentation of this file.
1 <?php
22 
31 {
32  public const CMD_APPLY_FILTER = 'applyFilter';
33  public const CMD_INDEX = 'index';
34  public const CMD_GET_ACTIONS = "getActions";
35  public const CMD_RESET_FILTER = 'resetFilter';
36  protected ilTable2GUI $table;
44 
45  public function __construct()
46  {
47  global $DIC;
48  $this->main_tpl = $DIC->ui()->mainTemplate();
49  $this->ctrl = $DIC->ctrl();
50  $this->language = $DIC->language();
51  $this->httpWrapper = $DIC->http()->wrapper();
52  $this->refinery = $DIC->refinery();
53  $this->access = ilMyStaffAccess::getInstance();
54  $this->accessHandler = $DIC->access();
55  }
56 
57  protected function checkAccessOrFail(): void
58  {
59  if ($this->access->hasCurrentUserAccessToCertificates()) {
60  return;
61  } else {
62  $this->main_tpl->setOnScreenMessage('failure', $this->language->txt("permission_denied"), true);
63  $this->ctrl->redirectByClass(ilDashboardGUI::class, "");
64  }
65  }
66 
67  final public function executeCommand(): void
68  {
69  $cmd = $this->ctrl->getCmd();
70  $next_class = $this->ctrl->getNextClass();
71 
72  switch ($next_class) {
73  case strtolower(ilFormPropertyDispatchGUI::class):
74  $this->checkAccessOrFail();
75 
76  $this->ctrl->setReturn($this, self::CMD_INDEX);
77  $this->table = new ilMStListCertificatesTableGUI($this, self::CMD_INDEX);
78  $this->table->executeCommand();
79  break;
80  case strtolower(ilUserCertificateApiGUI::class):
81  $this->checkAccessOrFail();
82  $this->ctrl->forwardCommand(new ilUserCertificateApiGUI());
83  break;
84  default:
85  switch ($cmd) {
86  case self::CMD_RESET_FILTER:
87  case self::CMD_APPLY_FILTER:
88  case self::CMD_INDEX:
89  case self::CMD_GET_ACTIONS:
90  $this->$cmd();
91  break;
92  default:
93  $this->index();
94  break;
95  }
96  break;
97  }
98  }
99 
100  final public function index(): void
101  {
102  $this->listUsers();
103  }
104 
105  final public function listUsers(): void
106  {
107  $this->checkAccessOrFail();
108 
109  $this->table = new ilMStListCertificatesTableGUI($this, self::CMD_INDEX);
110  $this->main_tpl->setTitle($this->language->txt('mst_list_certificates'));
111  $this->main_tpl->setTitleIcon(ilUtil::getImagePath('icon_cert.svg'));
112  $this->main_tpl->setContent($this->table->getHTML());
113  }
114 
115  final public function applyFilter(): void
116  {
117  $this->table = new ilMStListCertificatesTableGUI($this, self::CMD_APPLY_FILTER);
118  $this->table->writeFilterToSession();
119  $this->table->resetOffset();
120  $this->index();
121  }
122 
123  final public function resetFilter(): void
124  {
125  $this->table = new ilMStListCertificatesTableGUI($this, self::CMD_RESET_FILTER);
126  $this->table->resetOffset();
127  $this->table->resetFilter();
128  $this->index();
129  }
130 
131  final public function getId(): string
132  {
133  $this->table = new ilMStListCertificatesTableGUI($this, self::CMD_INDEX);
134 
135  return $this->table->getId();
136  }
137 
138  final public function cancel(): void
139  {
140  $this->ctrl->redirect($this);
141  }
142 }
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
global $DIC
Definition: feed.php:28
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...