ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilMStListCoursesGUI.php
Go to the documentation of this file.
1 <?php
18 declare(strict_types=1);
19 
22 
30 {
31  public const CMD_APPLY_FILTER = 'applyFilter';
32  public const CMD_INDEX = 'index';
33  public const CMD_GET_ACTIONS = "getActions";
34  public const CMD_RESET_FILTER = 'resetFilter';
35  protected ilTable2GUI $table;
37  private \ilGlobalTemplateInterface $main_tpl;
38  private \ILIAS\HTTP\Wrapper\ArrayBasedRequestWrapper $queryWrapper;
39  private ilHelpGUI $help;
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->queryWrapper = $DIC->http()->wrapper()->query();
50  $this->help->setScreenIdComponent('msta');
51  }
52 
53  protected function checkAccessOrFail(): void
54  {
55  if ($this->access->hasCurrentUserAccessToCourseMemberships()) {
56  return;
57  } else {
58  $this->main_tpl->setOnScreenMessage('failure', $this->lng->txt("permission_denied"), true);
59  $this->ctrl->redirectByClass(ilDashboardGUI::class, "");
60  }
61  }
62 
63  final public function executeCommand(): void
64  {
65  $cmd = $this->ctrl->getCmd();
66  $next_class = $this->ctrl->getNextClass();
67 
68  switch ($next_class) {
69  case strtolower(\ilMStListCoursesTableGUI::class):
70  $this->checkAccessOrFail();
71 
72  $this->ctrl->setReturn($this, self::CMD_INDEX);
73  $this->table = new \ilMStListCoursesTableGUI($this, self::CMD_INDEX);
74  $this->ctrl->forwardCommand($this->table);
75  break;
76  default:
77  switch ($cmd) {
78 
79  case self::CMD_RESET_FILTER:
80  case self::CMD_APPLY_FILTER:
81  case self::CMD_INDEX:
82  case self::CMD_GET_ACTIONS:
83  $this->$cmd();
84  break;
85  default:
86  $this->index();
87  break;
88  }
89  break;
90  }
91  }
92 
93  final public function index(): void
94  {
95  $this->listUsers();
96  }
97 
98  final public function listUsers(): void
99  {
100  global $DIC;
101 
102  $this->checkAccessOrFail();
103  $this->help->setScreenId('courses_list');
104 
105  $this->table = new ilMStListCoursesTableGUI($this, self::CMD_INDEX);
106  $DIC->ui()->mainTemplate()->setTitle($DIC->language()->txt('mst_list_courses'));
107  $DIC->ui()->mainTemplate()->setTitleIcon(ilUtil::getImagePath('icon_enrl.svg'));
108  $DIC->ui()->mainTemplate()->setContent($this->table->getHTML());
109  }
110 
111  final public function applyFilter(): void
112  {
113  $this->table = new ilMStListCoursesTableGUI($this, self::CMD_APPLY_FILTER);
114  $this->table->writeFilterToSession();
115  $this->table->resetOffset();
116  $this->index();
117  }
118 
119  final public function resetFilter(): void
120  {
121  $this->table = new ilMStListCoursesTableGUI($this, self::CMD_RESET_FILTER);
122  $this->table->resetOffset();
123  $this->table->resetFilter();
124  $this->index();
125  }
126 
127  final public function getId(): string
128  {
129  $this->table = new ilMStListCoursesTableGUI($this, self::CMD_INDEX);
130 
131  return $this->table->getId();
132  }
133 
134  final public function cancel(): void
135  {
136  global $DIC;
137  $DIC->ctrl()->redirect($this);
138  }
139 }
ILIAS HTTP Wrapper ArrayBasedRequestWrapper $queryWrapper
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
Help GUI class.
Class ilMStListCoursesTableGUI.
global $DIC
Definition: feed.php:28
ilGlobalTemplateInterface $main_tpl
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(Container $dic, ilPlugin $plugin)