ILIAS  trunk Revision v11.0_alpha-1689-g66c127b4ae8
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator 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 ilHelpGUI $help;
39 
40  public function __construct()
41  {
42  global $DIC;
44 
45  $this->main_tpl = $DIC->ui()->mainTemplate();
46  $this->access = ilMyStaffAccess::getInstance();
47  $this->help = $DIC->help();
48  $this->help->setScreenIdComponent('msta');
49  }
50 
51  protected function checkAccessOrFail(): void
52  {
53  if ($this->access->hasCurrentUserAccessToCourseMemberships()) {
54  return;
55  } else {
56  $this->main_tpl->setOnScreenMessage('failure', $this->lng->txt("permission_denied"), true);
57  $this->ctrl->redirectByClass(ilDashboardGUI::class, "");
58  }
59  }
60 
61  final public function executeCommand(): void
62  {
63  $cmd = $this->ctrl->getCmd();
64  $next_class = $this->ctrl->getNextClass();
65 
66  switch ($next_class) {
67  case strtolower(\ilMStListCoursesTableGUI::class):
68  $this->checkAccessOrFail();
69 
70  $this->ctrl->setReturn($this, self::CMD_INDEX);
71  $this->table = new \ilMStListCoursesTableGUI($this, self::CMD_INDEX);
72  $this->ctrl->forwardCommand($this->table);
73  break;
74  default:
75  switch ($cmd) {
76  case self::CMD_RESET_FILTER:
77  case self::CMD_APPLY_FILTER:
78  case self::CMD_INDEX:
79  case self::CMD_GET_ACTIONS:
80  $this->$cmd();
81  break;
82  default:
83  $this->index();
84  break;
85  }
86  break;
87  }
88  }
89 
90  final public function index(): void
91  {
92  $this->listUsers();
93  }
94 
95  final public function listUsers(): void
96  {
97  global $DIC;
98 
99  $this->checkAccessOrFail();
100  $this->help->setScreenId('courses_list');
101 
102  $this->table = new ilMStListCoursesTableGUI($this, self::CMD_INDEX);
103  $DIC->ui()->mainTemplate()->setTitle($DIC->language()->txt('mst_list_courses'));
104  $DIC->ui()->mainTemplate()->setTitleIcon(ilUtil::getImagePath('standard/icon_enrl.svg'));
105  $DIC->ui()->mainTemplate()->setContent($this->table->getHTML());
106  }
107 
108  final public function applyFilter(): void
109  {
110  $this->table = new ilMStListCoursesTableGUI($this, self::CMD_APPLY_FILTER);
111  $this->table->writeFilterToSession();
112  $this->table->resetOffset();
113  $this->index();
114  }
115 
116  final public function resetFilter(): void
117  {
118  $this->table = new ilMStListCoursesTableGUI($this, self::CMD_RESET_FILTER);
119  $this->table->resetOffset();
120  $this->table->resetFilter();
121  $this->index();
122  }
123 
124  final public function getId(): string
125  {
126  $this->table = new ilMStListCoursesTableGUI($this, self::CMD_INDEX);
127 
128  return $this->table->getId();
129  }
130 
131  final public function cancel(): void
132  {
133  global $DIC;
134  $DIC->ctrl()->redirect($this);
135  }
136 }
Help GUI class.
Class ilMStListCoursesTableGUI.
ilGlobalTemplateInterface $main_tpl
global $DIC
Definition: shib_login.php:22
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)