ILIAS  trunk Revision v11.0_alpha-1731-gff9cd7e2bd3
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
class.ilMStListCertificatesGUI.php
Go to the documentation of this file.
1 <?php
2 
22 
31 {
32  public const string CMD_APPLY_FILTER = 'applyFilter';
33  public const string CMD_INDEX = 'index';
34  public const string CMD_GET_ACTIONS = "getActions";
35  public const string CMD_RESET_FILTER = 'resetFilter';
36  protected ilTable2GUI $table;
41 
42  public function __construct()
43  {
44  global $DIC;
45  $this->main_tpl = $DIC->ui()->mainTemplate();
46  $this->ctrl = $DIC->ctrl();
47  $this->language = $DIC->language();
48  $this->access = ilMyStaffAccess::getInstance();
49  }
50 
51  protected function checkAccessOrFail(): void
52  {
53  if ($this->access->hasCurrentUserAccessToCertificates()) {
54  return;
55  } else {
56  $this->main_tpl->setOnScreenMessage('failure', $this->language->txt("permission_denied"), true);
57  $this->ctrl->redirectByClass(ilDashboardGUI::class, "");
58  }
59  }
60 
61  final public function executeCommand(): void
62  {
63  $cmd = $this->ctrl->getCmd();
64  $next_class = $this->ctrl->getNextClass();
65 
66  switch ($next_class) {
67  case strtolower(ilFormPropertyDispatchGUI::class):
68  $this->checkAccessOrFail();
69 
70  $this->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  $this->ctrl->forwardCommand(new ilUserCertificateApiGUI());
77  break;
78  default:
79  switch ($cmd) {
80  case self::CMD_RESET_FILTER:
81  case self::CMD_APPLY_FILTER:
82  case self::CMD_INDEX:
83  case self::CMD_GET_ACTIONS:
84  $this->$cmd();
85  break;
86  default:
87  $this->index();
88  break;
89  }
90  break;
91  }
92  }
93 
94  final public function index(): void
95  {
96  $this->listUsers();
97  }
98 
99  final public function listUsers(): void
100  {
101  $this->checkAccessOrFail();
102 
103  $this->table = new ilMStListCertificatesTableGUI($this, self::CMD_INDEX);
104  $this->main_tpl->setTitle($this->language->txt('mst_list_certificates'));
105  $this->main_tpl->setTitleIcon(ilUtil::getImagePath('standard/icon_cert.svg'));
106  $this->main_tpl->setContent($this->table->getHTML());
107  }
108 
109  final public function applyFilter(): void
110  {
111  $this->table = new ilMStListCertificatesTableGUI($this, self::CMD_APPLY_FILTER);
112  $this->table->writeFilterToSession();
113  $this->table->resetOffset();
114  $this->index();
115  }
116 
117  final public function resetFilter(): void
118  {
119  $this->table = new ilMStListCertificatesTableGUI($this, self::CMD_RESET_FILTER);
120  $this->table->resetOffset();
121  $this->table->resetFilter();
122  $this->index();
123  }
124 
125  final public function getId(): string
126  {
127  $this->table = new ilMStListCertificatesTableGUI($this, self::CMD_INDEX);
128 
129  return $this->table->getId();
130  }
131 
132  final public function cancel(): void
133  {
134  $this->ctrl->redirect($this);
135  }
136 }
global $DIC
Definition: shib_login.php:22
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
language()
description: > Example for rendring a language glyph.
Definition: language.php:41