ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilMStListCoursesGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
23
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';
38 private \ilGlobalTemplateInterface $main_tpl;
40
41 public function __construct()
42 {
43 global $DIC;
45
46 $this->main_tpl = $DIC->ui()->mainTemplate();
47 $this->access = ilMyStaffAccess::getInstance();
48 $this->help = $DIC->help();
49 $this->help->setScreenIdComponent('msta');
50 }
51
52 protected function checkAccessOrFail(): void
53 {
54 if ($this->access->hasCurrentUserAccessToCourseMemberships()) {
55 return;
56 } else {
57 $this->main_tpl->setOnScreenMessage('failure', $this->lng->txt("permission_denied"), true);
58 $this->ctrl->redirectByClass(ilDashboardGUI::class, "");
59 }
60 }
61
62 final public function executeCommand(): void
63 {
64 $cmd = $this->ctrl->getCmd();
65 $next_class = $this->ctrl->getNextClass();
66
67 switch ($next_class) {
68 case strtolower(\ilMStListCoursesTableGUI::class):
69 $this->checkAccessOrFail();
70
71 $this->ctrl->setReturn($this, self::CMD_INDEX);
72 $this->table = new \ilMStListCoursesTableGUI($this, self::CMD_INDEX);
73 $this->ctrl->forwardCommand($this->table);
74 break;
75 default:
76 switch ($cmd) {
79 case self::CMD_INDEX:
81 $this->$cmd();
82 break;
83 default:
84 $this->index();
85 break;
86 }
87 break;
88 }
89 }
90
91 final public function index(): void
92 {
93 $this->listUsers();
94 }
95
96 final public function listUsers(): void
97 {
98 global $DIC;
99
100 $this->checkAccessOrFail();
101 $this->help->setScreenId('courses_list');
102
103 $this->table = new ilMStListCoursesTableGUI($this, self::CMD_INDEX);
104 $DIC->ui()->mainTemplate()->setTitle($DIC->language()->txt('mst_list_courses'));
105 $DIC->ui()->mainTemplate()->setTitleIcon(ilUtil::getImagePath('standard/icon_enrl.svg'));
106 $DIC->ui()->mainTemplate()->setContent($this->table->getHTML());
107 }
108
109 final public function applyFilter(): void
110 {
111 $this->table = new ilMStListCoursesTableGUI($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 ilMStListCoursesTableGUI($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 ilMStListCoursesTableGUI($this, self::CMD_INDEX);
128
129 return $this->table->getId();
130 }
131
132 final public function cancel(): void
133 {
134 global $DIC;
135 $DIC->ctrl()->redirect($this);
136 }
137}
Help GUI class.
Class ilMStListCoursesGUI.
ilGlobalTemplateInterface $main_tpl
Class ilMStListCoursesTableGUI.
This class represents a property form user interface.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26