ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilMStListCoursesGUI.php
Go to the documentation of this file.
1<?php
2
5
15{
16 const CMD_APPLY_FILTER = 'applyFilter';
17 const CMD_INDEX = 'index';
18 const CMD_GET_ACTIONS = "getActions";
19 const CMD_RESET_FILTER = 'resetFilter';
23 protected $table;
27 protected $access;
31 protected $help;
32
33
37 public function __construct()
38 {
39 global $DIC;
40 $this->access = ilMyStaffAccess::getInstance();
41 $this->help = $DIC->help();
42 $this->help->setScreenIdComponent('msta');
43 }
44
45
49 protected function checkAccessOrFail()
50 {
51 global $DIC;
52
53 if ($this->access->hasCurrentUserAccessToCourseMemberships()) {
54 return;
55 } else {
56 ilUtil::sendFailure($DIC->language()->txt("permission_denied"), true);
57 $DIC->ctrl()->redirectByClass(ilDashboardGUI::class, "");
58 }
59 }
60
61
65 public function executeCommand()
66 {
67 global $DIC;
68
69 $cmd = $DIC->ctrl()->getCmd();
70 $next_class = $DIC->ctrl()->getNextClass();
71
72 switch ($next_class) {
73 case strtolower(ilFormPropertyDispatchGUI::class):
74 $this->checkAccessOrFail();
75
76 $DIC->ctrl()->setReturn($this, self::CMD_INDEX);
77 $this->table = new ilMStListCoursesTableGUI($this, self::CMD_INDEX);
78 $this->table->executeCommand();
79 break;
80 default:
81 switch ($cmd) {
82
85 case self::CMD_INDEX:
87 $this->$cmd();
88 break;
89 default:
90 $this->index();
91 break;
92 }
93 break;
94 }
95 }
96
97
101 public function index()
102 {
103 $this->listUsers();
104 }
105
106
110 public function listUsers()
111 {
112 global $DIC;
113
114 $this->checkAccessOrFail();
115 $this->help->setScreenId('courses_list');
116
117 $this->table = new ilMStListCoursesTableGUI($this, self::CMD_INDEX);
118 $DIC->ui()->mainTemplate()->setTitle($DIC->language()->txt('mst_list_courses'));
119 $DIC->ui()->mainTemplate()->setTitleIcon(ilUtil::getImagePath('icon_enrl.svg'));
120 $DIC->ui()->mainTemplate()->setContent($this->table->getHTML());
121 }
122
123
127 public function applyFilter()
128 {
129 $this->table = new ilMStListCoursesTableGUI($this, self::CMD_APPLY_FILTER);
130 $this->table->writeFilterToSession();
131 $this->table->resetOffset();
132 $this->index();
133 }
134
135
139 public function resetFilter()
140 {
141 $this->table = new ilMStListCoursesTableGUI($this, self::CMD_RESET_FILTER);
142 $this->table->resetOffset();
143 $this->table->resetFilter();
144 $this->index();
145 }
146
147
151 public function getId()
152 {
153 $this->table = new ilMStListCoursesTableGUI($this, self::CMD_INDEX);
154
155 return $this->table->getId();
156 }
157
158
162 public function cancel()
163 {
164 global $DIC;
165
166 $DIC->ctrl()->redirect($this);
167 }
168}
An exception for terminatinating execution or to throw for unit testing.
Class ilMStListCoursesGUI.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
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
help()
Definition: help.php:2