ILIAS  release_8 Revision v8.24
class.ilAchievementsGUI.php
Go to the documentation of this file.
1<?php
2
23{
24 protected ilCtrl $ctrl;
26 protected ilLanguage $lng;
27 protected ilTabsGUI $tabs;
29
30 public function __construct()
31 {
32 global $DIC;
33 $this->ctrl = $DIC->ctrl();
34 $this->achievements = new ilAchievements();
35 $this->lng = $DIC->language();
36 $this->tabs = $DIC->tabs();
37 $this->main_tpl = $DIC->ui()->mainTemplate();
38 }
39
43 public function executeCommand(): void
44 {
48
49 $lng->loadLanguageModule("lhist");
50
51 $next_class = $ctrl->getNextClass($this);
52 $cmd = $ctrl->getCmd("show");
53
54
55 switch ($next_class) {
56 case "illearningprogressgui":
57 $main_tpl->setTitle($lng->txt("learning_progress"));
60 $ctrl->forwardCommand($new_gui);
61 break;
62
63 case 'illearninghistorygui':
64 $main_tpl->setTitle($lng->txt("lhist_learning_history"));
66 $lhistgui = new ilLearningHistoryGUI();
67 $ctrl->forwardCommand($lhistgui);
68 $this->main_tpl->printToStdout();
69 break;
70
71 case 'ilpersonalskillsgui':
72 $main_tpl->setTitle($lng->txt("skills"));
74 $skgui = new ilPersonalSkillsGUI();
75 $ctrl->forwardCommand($skgui);
76 $this->main_tpl->printToStdout();
77 break;
78
79 case 'ilbadgeprofilegui':
80 $main_tpl->setTitle($lng->txt("obj_bdga"));
82 $bgui = new ilBadgeProfileGUI();
83 $ctrl->forwardCommand($bgui);
84 $this->main_tpl->printToStdout();
85 break;
86
87 case 'ilusercertificategui':
88 $main_tpl->setTitle($lng->txt("obj_cert"));
90 $cgui = new ilUserCertificateGUI();
91 $ctrl->forwardCommand($cgui);
92 $this->main_tpl->printToStdout();
93 break;
94
95 default:
96 if (in_array($cmd, array("show"))) {
97 $this->$cmd();
98 }
99 $this->main_tpl->printToStdout();
100 break;
101 }
102 }
103
107 protected function show(): void
108 {
110
111 $gui_classes = $this->getGUIClasses();
112 $first_service = current($this->achievements->getActiveServices());
113 if ($first_service) {
114 $ctrl->redirectByClass(["ildashboardgui", "ilachievementsgui", $gui_classes[$first_service]]);
115 }
116 }
117
118 protected function setTabs(string $activate): void
119 {
121 $links = $this->getLinks();
122
123 foreach ($this->achievements->getActiveServices() as $s) {
124 $tabs->addTab("achieve_" . $s, $links[$s]["txt"], $links[$s]["link"]);
125 }
126 $tabs->activateTab("achieve_" . $activate);
127 }
128
132 protected function getLinks(): array
133 {
136
137 $lng->loadLanguageModule("lhist");
138 $gui_classes = $this->getGUIClasses();
139
140 $links = [
142 "txt" => $lng->txt("lhist_learning_history")
143 ],
145 "txt" => $lng->txt("skills")
146 ],
148 "txt" => $lng->txt("learning_progress")
149 ],
151 "txt" => $lng->txt('obj_bdga')
152 ],
154 "txt" => $lng->txt("obj_cert")
155 ]
156 ];
157
158 foreach ($links as $k => $v) {
159 $links[$k]["link"] = $ctrl->getLinkTargetByClass(["ildashboardgui", "ilachievementsgui", $gui_classes[$k]]);
160 }
161
162 return $links;
163 }
164
169 protected function getGUIClasses(): array
170 {
171 return [
172 ilAchievements::SERV_LEARNING_HISTORY => strtolower(ilLearningHistoryGUI::class),
173 ilAchievements::SERV_COMPETENCES => strtolower(ilPersonalSkillsGUI::class),
174 ilAchievements::SERV_LEARNING_PROGRESS => strtolower(ilLearningProgressGUI::class),
175 ilAchievements::SERV_BADGES => strtolower(ilBadgeProfileGUI::class),
176 ilAchievements::SERV_CERTIFICATES => strtolower(ilUserCertificateGUI::class)
177 ];
178 }
179}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
show()
Show (redirects to first active service)
ilGlobalTemplateInterface $main_tpl
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilBadgeProfileGUI.
Class ilCtrl provides processing control methods.
getLinkTargetByClass( $a_class, string $a_cmd=null, string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
@inheritDoc
redirectByClass( $a_class, string $a_cmd=null, string $a_anchor=null, bool $is_async=false)
@inheritDoc
getNextClass($a_gui_class=null)
@inheritDoc
getCmd(string $fallback_command=null)
@inheritDoc
forwardCommand(object $a_gui_object)
@inheritDoc
language handling
loadLanguageModule(string $a_module)
Load language module.
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...
Learning history main GUI class.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Personal skills GUI class.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addTab(string $a_id, string $a_text, string $a_link, string $a_frame="")
Add a Tab.
activateTab(string $a_id)
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
global $DIC
Definition: feed.php:28
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setTitleIcon(string $a_icon_path, string $a_icon_desc="")
set title icon
setTitle(string $a_title, bool $hidden=false)
Sets title in standard template.