ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilMStListUsersGUI.php
Go to the documentation of this file.
1 <?php
2 
11 {
12  const CMD_RESET_FILTER = 'resetFilter';
13  const CMD_APPLY_FILTER = 'applyFilter';
14  const CMD_INDEX = 'index';
15  const CMD_GET_ACTIONS = "getActions";
16  const CMD_ADD_USER_AUTO_COMPLETE = 'addUserAutoComplete';
20  protected $table;
24  protected $access;
25 
26 
30  public function __construct()
31  {
32  $this->access = ilMyStaffAccess::getInstance();
33  }
34 
35 
39  protected function checkAccessOrFail()
40  {
41  global $DIC;
42 
43  if ($this->access->hasCurrentUserAccessToMyStaff()) {
44  return;
45  } else {
46  ilUtil::sendFailure($DIC->language()->txt("permission_denied"), true);
47  $DIC->ctrl()->redirectByClass(ilPersonalDesktopGUI::class, "");
48  }
49  }
50 
51 
55  public function executeCommand()
56  {
57  global $DIC;
58 
59  $this->checkAccessOrFail();
60 
61  $cmd = $DIC->ctrl()->getCmd();
62 
63  switch ($cmd) {
64  case self::CMD_RESET_FILTER:
65  case self::CMD_APPLY_FILTER:
66  case self::CMD_INDEX:
67  case self::CMD_ADD_USER_AUTO_COMPLETE:
68  case self::CMD_GET_ACTIONS:
69  $this->$cmd();
70  break;
71  default:
72  $this->index();
73  break;
74  }
75  }
76 
77 
81  public function index()
82  {
83  $this->listUsers();
84  }
85 
86 
90  public function listUsers()
91  {
92  global $DIC;
93 
94  $this->table = new ilMStListUsersTableGUI($this, self::CMD_INDEX);
95  $this->table->setTitle($DIC->language()->txt('mst_list_users'));
96  $DIC->ui()->mainTemplate()->setContent($this->table->getHTML());
97  }
98 
99 
103  public function applyFilter()
104  {
105  $this->table = new ilMStListUsersTableGUI($this, self::CMD_APPLY_FILTER);
106  $this->table->writeFilterToSession();
107  $this->table->resetOffset();
108  $this->index();
109  }
110 
111 
115  public function resetFilter()
116  {
117  $this->table = new ilMStListUsersTableGUI($this, self::CMD_RESET_FILTER);
118  $this->table->resetOffset();
119  $this->table->resetFilter();
120  $this->index();
121  }
122 
123 
127  public function cancel()
128  {
129  global $DIC;
130 
131  $DIC->ctrl()->redirect($this);
132  }
133 
134 
138  public function getActions()
139  {
140  global $DIC;
141 
142  $mst_lus_usr_id = $DIC->http()->request()->getQueryParams()['mst_lus_usr_id'];
143  if ($mst_lus_usr_id > 0) {
144  $selection = new ilAdvancedSelectionListGUI();
145 
146  $DIC->ctrl()->setParameterByClass(ilMStShowUserGUI::class, 'usr_id', $mst_lus_usr_id);
147  $selection->addItem($DIC->language()->txt('mst_show_courses'), '', $DIC->ctrl()->getLinkTargetByClass(array(
148  ilPersonalDesktopGUI::class,
149  ilMyStaffGUI::class,
150  ilMStShowUserGUI::class,
151  )));
152 
153  $selection = ilMyStaffGUI::extendActionMenuWithUserActions($selection, $mst_lus_usr_id, rawurlencode($DIC->ctrl()
154  ->getLinkTarget($this, self::CMD_INDEX)));
155 
156  echo $selection->getHTML(true);
157  }
158  exit;
159  }
160 }
global $DIC
Definition: saml.php:7
Class ilMStListUsersTableGUI.
Create styles array
The data for the language used.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
User interface class for advanced drop-down selection lists.
Class ilMStListUsersGUI.