ILIAS  release_8 Revision v8.24
class.ilDashboardGUI.php
Go to the documentation of this file.
1<?php
2
32{
33 public const CMD_JUMP_TO_MY_STAFF = "jumpToMyStaff";
34 public const DISENGAGE_MAINBAR = "dash_mb_disengage";
35
36 protected ilCtrl $ctrl;
37 protected ilObjUser $user;
40 protected ilHelpGUI $help;
41 public \ilGlobalTemplateInterface $tpl;
42 public \ilLanguage $lng;
43 public string $cmdClass = '';
45 protected \ILIAS\GlobalScreen\ScreenContext\ContextServices $tool_context;
46 protected int $requested_view;
47 protected int $requested_prt_id;
48 protected int $requested_gtp;
49 protected string $requested_dsh;
50 protected int $requested_wsp_id;
51
52 public function __construct()
53 {
54 global $DIC;
55
56 $this->tool_context = $DIC->globalScreen()->tool()->context();
57 $this->user = $DIC->user();
58 $this->settings = $DIC->settings();
59 $this->rbacsystem = $DIC->rbac()->system();
60 $this->help = $DIC["ilHelp"];
61 $tpl = $DIC["tpl"];
62 $this->lng = $DIC->language();
63 $this->ctrl = $DIC->ctrl();
64
65 if ($this->user->getId() === ANONYMOUS_USER_ID) {
66 $DIC->ui()->mainTemplate()->setOnScreenMessage('failure', $this->lng->txt("msg_not_available_for_anon"), true);
67 $DIC->ctrl()->redirectToURL("login.php?cmd=force_login");
68 }
69
70 $this->tpl = $tpl;
71
72 $this->ctrl->setContextObject(
73 $this->user->getId(),
74 "user"
75 );
76
77 $this->lng->loadLanguageModule("pdesk");
78 $this->lng->loadLanguageModule("pd"); // #16813
79 $this->lng->loadLanguageModule("dash");
80 $this->lng->loadLanguageModule("mmbr");
81
82 $params = $DIC->http()->request()->getQueryParams();
83 $this->cmdClass = ($params['cmdClass'] ?? "");
84 $this->requested_view = (int) ($params['view'] ?? 0);
85 $this->requested_prt_id = (int) ($params["prt_id"] ?? 0);
86 $this->requested_gtp = (int) ($params["gtp"] ?? 0);
87 $this->requested_dsh = (string) ($params["dsh"] ?? null);
88 $this->requested_wsp_id = (int) ($params["wsp_id"] ?? 0);
89
90 $this->ctrl->saveParameter($this, array("view"));
91 $this->action_menu = new ilAdvancedSelectionListGUI();
92 }
93
94 public function executeCommand(): void
95 {
97 $context->stack()->desktop();
99
100 $next_class = $this->ctrl->getNextClass();
101 $this->ctrl->setReturn($this, "show");
102 switch ($next_class) {
103
104 // profile
105 case "ilpersonalprofilegui":
106 $this->getStandardTemplates();
107 $this->setTabs();
108 $profile_gui = new ilPersonalProfileGUI();
109 $this->ctrl->forwardCommand($profile_gui);
110 break;
111
112 // settings
113 case "ilpersonalsettingsgui":
114 $this->getStandardTemplates();
115 $this->setTabs();
116 $settings_gui = new ilPersonalSettingsGUI();
117 $this->ctrl->forwardCommand($settings_gui);
118 break;
119
120 case 'ilcalendarpresentationgui':
121 $this->getStandardTemplates();
122 $this->displayHeader();
123 $this->tpl->setTitle($this->lng->txt("calendar"));
124 $this->setTabs();
125 $cal = new ilCalendarPresentationGUI();
126 $this->ctrl->forwardCommand($cal);
127 $this->tpl->printToStdout();
128 break;
129
130 // pd notes
131 case "ilpdnotesgui":
132 if ($ilSetting->get('disable_notes') && $ilSetting->get('disable_comments')) {
133 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('permission_denied'), true);
134 ilUtil::redirect('ilias.php?baseClass=ilDashboardGUI');
135 return;
136 }
137
138 $this->getStandardTemplates();
139 $this->setTabs();
140 $pd_notes_gui = new ilPDNotesGUI();
141 $this->ctrl->forwardCommand($pd_notes_gui);
142 break;
143
144 // pd news
145 case "ilpdnewsgui":
146 $this->getStandardTemplates();
147 $this->setTabs();
148 $pd_news_gui = new ilPDNewsGUI();
149 $this->ctrl->forwardCommand($pd_news_gui);
150 break;
151
152 case "ilcolumngui":
153 $this->getStandardTemplates();
154 $this->setTabs();
155 $column_gui = new ilColumnGUI("pd");
156 $this->initColumn($column_gui);
157 $this->show();
158 break;
159
160 case "ilpdselecteditemsblockgui":
161 $block = new ilPDSelectedItemsBlockGUI();
162 $this->displayHeader();
163 $ret = $this->ctrl->forwardCommand($block);
164 if ($ret != "") {
165 $this->tpl->setContent($ret);
166 $this->tpl->printToStdout();
167 }
168 break;
169
170 case "ilpdmembershipblockgui":
171 $block = new ilPDMembershipBlockGUI();
172 $ret = $this->ctrl->forwardCommand($block);
173 if ($ret != "") {
174 $this->displayHeader();
175 $this->tpl->setContent($ret);
176 $this->tpl->printToStdout();
177 }
178 break;
179
180 case 'ilcontactgui':
181 if (!ilBuddySystem::getInstance()->isEnabled()) {
182 throw new ilPermissionException($this->lng->txt('msg_no_perm_read'));
183 }
184
185 $this->getStandardTemplates();
186 $this->setTabs();
187 $this->tpl->setTitle($this->lng->txt('mail_addressbook'));
188
189 $this->ctrl->forwardCommand(new ilContactGUI());
190 break;
191
192 case 'ilpersonalworkspacegui':
193 $wsgui = new ilPersonalWorkspaceGUI();
194 $this->ctrl->forwardCommand($wsgui);
195 $this->tpl->printToStdout();
196 break;
197
198 case 'ilportfoliorepositorygui':
199 $this->getStandardTemplates();
200 $this->setTabs();
201 $pfgui = new ilPortfolioRepositoryGUI();
202 $this->ctrl->forwardCommand($pfgui);
203 $this->tpl->printToStdout();
204 break;
205
206 case 'ilachievementsgui':
207 $this->getStandardTemplates();
208 $this->setTabs();
209 $achievegui = new ilAchievementsGUI();
210 $this->ctrl->forwardCommand($achievegui);
211 break;
212
213 case strtolower(ilMyStaffGUI::class):
214 $this->getStandardTemplates();
215 $mstgui = new ilMyStaffGUI();
216 $this->ctrl->forwardCommand($mstgui);
217 break;
218 case 'ilgroupuseractionsgui':
219 $this->getStandardTemplates();
220 $this->setTabs();
221 $ggui = new ilGroupUserActionsGUI();
222 $this->ctrl->forwardCommand($ggui);
223 $this->tpl->printToStdout();
224 break;
225
226 case "ildashboardrecommendedcontentgui":
228 $this->ctrl->forwardCommand($gui);
229 break;
230 case "ilstudyprogrammedashboardviewgui":
232 $this->ctrl->forwardCommand($gui);
233 break;
234 default:
235 $context->current()->addAdditionalData(self::DISENGAGE_MAINBAR, true);
236 $this->getStandardTemplates();
237 $this->setTabs();
238 $cmd = $this->ctrl->getCmd("show");
239 $this->$cmd();
240 break;
241 }
242 }
243
244 public function getStandardTemplates(): void
245 {
246 $this->tpl->loadStandardTemplate();
247 }
248
249 public function show(): void
250 {
251 // preload block settings
253
254 $this->tpl->setTitle($this->lng->txt("dash_dashboard"));
255 $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_dshs.svg"), $this->lng->txt("dash_dashboard"));
256 $this->tpl->setVariable("IMG_SPACE", ilUtil::getImagePath("spacer.png", false));
257
258 $this->tpl->setContent($this->getCenterColumnHTML());
259 $this->tpl->setRightContent($this->getRightColumnHTML());
260
261 if (count($this->action_menu->getItems())) {
264
265 $this->action_menu->setAsynch(false);
266 $this->action_menu->setAsynchUrl('');
267 $this->action_menu->setListTitle($lng->txt('actions'));
268 $this->action_menu->setId('act_pd');
269 $this->action_menu->setSelectionHeaderClass('small');
270 $this->action_menu->setItemLinkClass('xsmall');
271 $this->action_menu->setLinksMode('il_ContainerItemCommand2');
272 $this->action_menu->setHeaderIcon(ilAdvancedSelectionListGUI::DOWN_ARROW_DARK);
273 $this->action_menu->setUseImages(false);
274
275 $htpl = new ilTemplate('tpl.header_action.html', true, true, 'Services/Repository');
276 $htpl->setVariable('ACTION_DROP_DOWN', $this->action_menu->getHTML());
277
278 $tpl->setHeaderActionMenu($htpl->get());
279 }
280
281 $this->tpl->printToStdout();
282 }
283
284 public function getCenterColumnHTML(): string
285 {
286 $ilCtrl = $this->ctrl;
287
288 $html = "";
289 $column_gui = new ilColumnGUI("pd", IL_COL_CENTER);
290 $this->initColumn($column_gui);
291
292 if ($ilCtrl->getNextClass() == "ilcolumngui" &&
293 $column_gui->getCmdSide() == IL_COL_CENTER) {
294 $html = $ilCtrl->forwardCommand($column_gui);
295 } else {
296 if (!$ilCtrl->isAsynch()) {
297 if ($column_gui->getScreenMode() != IL_SCREEN_SIDE) {
298 // right column wants center
299 if ($column_gui->getCmdSide() == IL_COL_RIGHT) {
300 $column_gui = new ilColumnGUI("pd", IL_COL_RIGHT);
301 $this->initColumn($column_gui);
302 $html = $ilCtrl->forwardCommand($column_gui);
303 }
304 // left column wants center
305 if ($column_gui->getCmdSide() == IL_COL_LEFT) {
306 $column_gui = new ilColumnGUI("pd", IL_COL_LEFT);
307 $this->initColumn($column_gui);
308 $html = $ilCtrl->forwardCommand($column_gui);
309 }
310 } else {
311 $html = "";
312
313 // user interface plugin slot + default rendering
314 $uip = new ilUIHookProcessor(
315 "Services/Dashboard",
316 "center_column",
317 array("personal_desktop_gui" => $this)
318 );
319 if (!$uip->replaced()) {
320 $html = $this->getMainContent();
321 //$html = $ilCtrl->getHTML($column_gui);
322 }
323 $html = $uip->getHTML($html);
324 }
325 }
326 }
327 return $html;
328 }
329
330 public function getRightColumnHTML(): string
331 {
332 $ilCtrl = $this->ctrl;
333
334 $html = "";
335
336 $column_gui = new ilColumnGUI("pd", IL_COL_RIGHT);
337 $this->initColumn($column_gui);
338
339 if ($column_gui->getScreenMode() == IL_SCREEN_FULL) {
340 return "";
341 }
342
343 if ($ilCtrl->getNextClass() == "ilcolumngui" &&
344 $column_gui->getCmdSide() == IL_COL_RIGHT &&
345 $column_gui->getScreenMode() == IL_SCREEN_SIDE) {
346 $html = $ilCtrl->forwardCommand($column_gui);
347 } else {
348 if (!$ilCtrl->isAsynch()) {
349 $html = "";
350
351 // user interface plugin slot + default rendering
352 $uip = new ilUIHookProcessor(
353 "Services/Dashboard",
354 "right_column",
355 array("personal_desktop_gui" => $this)
356 );
357 if (!$uip->replaced()) {
358 $html = $ilCtrl->getHTML($column_gui);
359 }
360 $html = $uip->getHTML($html);
361 }
362 }
363
364 return $html;
365 }
366
367 public function prepareContentView(): void
368 {
369 $this->tpl->loadStandardTemplate();
370
371 $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_pd.svg"));
372 $this->tpl->setTitle($this->lng->txt("personal_desktop"));
373 $this->tpl->setVariable("IMG_SPACE", ilUtil::getImagePath("spacer.png", false));
374 }
375
376 public function setTabs(): void
377 {
378 $ilHelp = $this->help;
379
380 $ilHelp->setScreenIdComponent("pd");
381 }
382
383 public function jumpToMemberships(): void
384 {
385 $viewSettings = new ilPDSelectedItemsBlockViewSettings($GLOBALS['DIC']->user(), $this->requested_view);
386 if ($viewSettings->enabledMemberships()) {
387 $this->ctrl->setParameter($this, "view", $viewSettings->getMembershipsView());
388 }
389 $this->ctrl->redirect($this, "show");
390 }
391
392 public function jumpToSelectedItems(): void
393 {
394 $viewSettings = new ilPDSelectedItemsBlockViewSettings($GLOBALS['DIC']->user(), $this->requested_view);
395 if ($viewSettings->enabledSelectedItems()) {
396 $this->ctrl->setParameter($this, "view", $viewSettings->getSelectedItemsView());
397 }
398 $this->show();
399 }
400
401 public function jumpToProfile(): void
402 {
403 $this->ctrl->redirectByClass("ilpersonalprofilegui");
404 }
405
406 public function jumpToPortfolio(): void
407 {
408 // incoming back link from shared resource
409 $cmd = "";
410 if ($this->requested_dsh != "") {
411 $this->ctrl->setParameterByClass("ilportfoliorepositorygui", "shr_id", $this->requested_dsh);
412 $cmd = "showOther";
413 }
414
415 // used for goto links
416 if ($this->requested_prt_id > 0) {
417 $this->ctrl->setParameterByClass("ilobjportfoliogui", "prt_id", $this->requested_prt_id);
418 $this->ctrl->setParameterByClass("ilobjportfoliogui", "gtp", $this->requested_gtp);
419 $this->ctrl->redirectByClass(array("ilportfoliorepositorygui", "ilobjportfoliogui"), "preview");
420 } else {
421 $this->ctrl->redirectByClass("ilportfoliorepositorygui", $cmd);
422 }
423 }
424
425 public function jumpToSettings(): void
426 {
427 $this->ctrl->redirectByClass("ilpersonalsettingsgui");
428 }
429
430 public function jumpToNews(): void
431 {
432 $this->ctrl->redirectByClass("ilpdnewsgui");
433 }
434
435 public function jumpToCalendar(): void
436 {
437 global $DIC;
438 $request = $DIC->http()->request();
439
440 $query_params = $request->getQueryParams();
441
442 if (array_key_exists("cal_view", $query_params) && $query_params["cal_view"]) {
443 $cal_view = $query_params["cal_view"];
444 $this->ctrl->setParameter($this, "cal_view", $cal_view);
445 }
446
447 if (!empty($query_params["cal_agenda_per"])) {
448 $cal_period = $query_params["cal_agenda_per"];
449 $this->ctrl->setParameter($this, "cal_agenda_per", $cal_period);
450 }
451
452 $this->ctrl->redirectByClass("ilcalendarpresentationgui");
453 }
454
455 public function jumpToWorkspace(): void
456 {
457 // incoming back link from shared resource
458 $cmd = "";
459 if ($this->requested_dsh != "") {
460 $this->ctrl->setParameterByClass("ilpersonalworkspacegui", "shr_id", $this->requested_dsh);
461 $cmd = "share";
462 }
463
464 if ($this->requested_wsp_id > 0) {
465 $this->ctrl->setParameterByClass("ilpersonalworkspacegui", "wsp_id", $this->requested_wsp_id);
466 }
467
468 if ($this->requested_gtp) {
469 $this->ctrl->setParameterByClass("ilpersonalworkspacegui", "gtp", $this->requested_gtp);
470 }
471
472 $this->ctrl->redirectByClass("ilpersonalworkspacegui", $cmd);
473 }
474
475 protected function jumpToMyStaff(): void
476 {
477 $this->ctrl->redirectByClass(ilMyStaffGUI::class);
478 }
479
480 public function jumpToBadges(): void
481 {
482 $this->ctrl->redirectByClass(["ilAchievementsGUI", "ilbadgeprofilegui"]);
483 }
484
485 public function jumpToSkills(): void
486 {
487 $this->ctrl->redirectByClass("ilpersonalskillsgui");
488 }
489
490 public function initColumn(ilColumnGUI $a_column_gui): void
491 {
492 $a_column_gui->setActionMenu($this->action_menu);
493 }
494
495 public function displayHeader(): void
496 {
497 $this->tpl->setTitle($this->lng->txt("dash_dashboard"));
498 }
499
500 protected function toggleHelp(): void
501 {
502 if (ilSession::get("show_help_tool") == "1") {
503 ilSession::set("show_help_tool", "0");
504 } else {
505 ilSession::set("show_help_tool", "1");
506 }
507 $this->ctrl->redirect($this, "show");
508 }
509
510 protected function getMainContent(): string
511 {
512 $html = "";
513 $tpl = new ilTemplate("tpl.dashboard.html", true, true, "Services/Dashboard");
515
516 if ($settings->enabledSelectedItems()) {
517 $html = $this->renderFavourites();
518 }
519 $html .= $this->renderRecommendedContent();
520 $html .= $this->renderStudyProgrammes();
521 $html .= $this->renderLearningSequences();
522 if ($settings->enabledMemberships()) {
523 $html .= $this->renderMemberships();
524 }
525
526 $tpl->setVariable("CONTENT", $html);
527
528 return $tpl->get();
529 }
530
531 protected function renderFavourites(): string
532 {
533 $block = new ilPDSelectedItemsBlockGUI();
534 return $block->getHTML();
535 }
536
537 protected function renderRecommendedContent(): string
538 {
539 $db_rec_content = new ilDashboardRecommendedContentGUI();
540 return $db_rec_content->render();
541 }
542
543 protected function renderStudyProgrammes(): string
544 {
545 $st_block = ilStudyProgrammeDIC::dic()['ilStudyProgrammeDashboardViewGUI'];
546 return $st_block->getHTML();
547 }
548
549 protected function renderMemberships(): string
550 {
551 $block = new ilPDMembershipBlockGUI();
552 return $block->getHTML();
553 }
554
555 protected function renderLearningSequences(): string
556 {
557 $st_block = new ilDashboardLearningSequenceGUI();
558 return $st_block->getHTML();
559 }
560}
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
const IL_SCREEN_SIDE
const IL_COL_RIGHT
const IL_SCREEN_FULL
const IL_COL_CENTER
const IL_COL_LEFT
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static preloadPDBlockSettings()
Preload pd info.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Column user interface class.
setActionMenu(ilAdvancedSelectionListGUI $action_menu)
Class ilCtrl provides processing control methods.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ILIAS GlobalScreen ScreenContext ContextServices $tool_context
ilAdvancedSelectionListGUI $action_menu
ilGlobalTemplateInterface $tpl
ilRbacSystem $rbacsystem
initColumn(ilColumnGUI $a_column_gui)
Personal Desktop-Presentation for the LearningSequence.
Help GUI class.
setScreenIdComponent(string $a_comp)
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
Class ilMyStaffGUI.
User class.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Private Notes on PD.
@ilCtrl_IsCalledBy ilPDSelectedItemsBlockGUI: ilColumnGUI @ilCtrl_Calls ilPDSelectedItemsBlockGUI: il...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
GUI class for personal profile.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
GUI class for personal workspace.
Portfolio repository gui class.
class ilRbacSystem system function like checkAccess, addActiveRole ... Supporting system functions ar...
static get(string $a_var)
static set(string $a_var, $a_val)
Set a value.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
special template class to simplify handling of ITX/PEAR
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
static redirect(string $a_script)
const ANONYMOUS_USER_ID
Definition: constants.php:27
global $DIC
Definition: feed.php:28
Interface ilCtrlBaseClassInterface describes ilCtrl base classes.
setHeaderActionMenu(string $a_header)
Set header action menu.
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
Definition: ltiregstart.php:33
global $ilSetting
Definition: privfeed.php:17
$context
Definition: webdav.php:29