ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilMStListUsersGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
23
30{
31 public const string CMD_RESET_FILTER = 'resetFilter';
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_ADD_USER_AUTO_COMPLETE = 'addUserAutoComplete';
38 private \ilGlobalTemplateInterface $main_tpl;
42
43 public function __construct()
44 {
45 global $DIC;
46 $this->main_tpl = $DIC->ui()->mainTemplate();
47 $this->access = ilMyStaffAccess::getInstance();
48 $this->help = $DIC->help();
49 $this->ctrl = $DIC->ctrl();
50 $this->language = $DIC->language();
51 $this->help->setScreenIdComponent('msta');
52 }
53
54 protected function checkAccessOrFail(): void
55 {
56 if ($this->access->hasCurrentUserAccessToMyStaff()) {
57 return;
58 } else {
59 $this->main_tpl->setOnScreenMessage('failure', $this->language->txt("permission_denied"), true);
60 $this->ctrl->redirectByClass(ilDashboardGUI::class, "");
61 }
62 }
63
64 final public function executeCommand(): void
65 {
66 global $DIC;
67
68 $this->checkAccessOrFail();
69
70 $cmd = $DIC->ctrl()->getCmd();
71
72 switch ($cmd) {
75 case self::CMD_INDEX:
78 $this->$cmd();
79 break;
80 default:
81 $this->index();
82 break;
83 }
84 }
85
86 final public function index(): void
87 {
88 $this->listUsers();
89 }
90
91 final public function listUsers(): void
92 {
93 global $DIC;
94
95 $this->help->setScreenId('users_list');
96 $this->table = new ilMStListUsersTableGUI($this, self::CMD_INDEX);
97 $DIC->ui()->mainTemplate()->setTitle($DIC->language()->txt('mst_list_users'));
98 $DIC->ui()->mainTemplate()->setTitleIcon(ilUtil::getImagePath('standard/icon_stff.svg'));
99 $DIC->ui()->mainTemplate()->setContent($this->table->getHTML());
100 }
101
102 final public function applyFilter(): void
103 {
104 $this->table = new ilMStListUsersTableGUI($this, self::CMD_APPLY_FILTER);
105 $this->table->writeFilterToSession();
106 $this->table->resetOffset();
107 $this->index();
108 }
109
110 final public function resetFilter(): void
111 {
112 $this->table = new ilMStListUsersTableGUI($this, self::CMD_RESET_FILTER);
113 $this->table->resetOffset();
114 $this->table->resetFilter();
115 $this->index();
116 }
117
118 final public function cancel(): void
119 {
120 global $DIC;
121
122 $DIC->ctrl()->redirect($this);
123 }
124}
Help GUI class.
language handling
Class ilMStListUsersGUI.
ilMStListUsersTableGUI $table
ilGlobalTemplateInterface $main_tpl
const string CMD_ADD_USER_AUTO_COMPLETE
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: shib_login.php:26