45 $this->
ctrl = $DIC->ctrl();
46 $this->
lng = $DIC->language();
47 $this->tpl = $DIC[
"tpl"];
48 $this->
tabs = $DIC->tabs();
49 $this->
user = $DIC->user();
50 $this->
access = $DIC->access();
51 $this->factory = $DIC->ui()->factory();
52 $this->renderer = $DIC->ui()->renderer();
69 switch ($ilCtrl->getNextClass()) {
72 $cmd = $ilCtrl->getCmd(
"listBadges");
93 $lng->
txt(
"badge_profile_view"),
94 $ilCtrl->getLinkTarget($this,
"listBadges")
98 $lng->
txt(
"badge_profile_manage"),
99 $ilCtrl->getLinkTarget($this,
"manageBadges")
101 $ilTabs->activateTab($a_active);
115 $badge =
new ilBadge($ass->getBadgeId());
118 "id" => $badge->getId(),
119 "title" => $badge->getTitle(),
120 "description" => $badge->getDescription(),
121 "image" => $badge->getImagePath(),
122 "name" => $badge->getImage(),
123 "issued_on" => $ass->getTimestamp(),
124 "active" => (bool) $ass->getPosition(),
125 "object" => $badge->getParentMeta(),
133 $tmpl =
new ilTemplate(
"tpl.badge_backpack.html",
true,
true,
"Services/Badge");
138 $badge_components = array();
140 foreach ($data as $badge) {
141 $modal = $this->factory->modal()->roundtrip(
143 $this->factory->legacy($badge[
"renderer"]->renderModalContent())
144 )->withCancelButtonLabel(
"ok");
146 ->withAction($modal->getShowSignal());
148 $this->
ctrl->setParameter($this,
"badge_id", $badge[
"id"]);
149 $url = $this->
ctrl->getLinkTarget($this, $badge[
"active"]
152 $this->
ctrl->setParameter($this,
"badge_id",
"");
153 $profile_button = $this->factory->button()->standard(
154 $this->
lng->txt(!$badge[
"active"] ?
"badge_add_to_profile" :
"badge_remove_from_profile"),
158 if ($badge[
"object"][
"type"] !==
"bdga") {
159 $parent_icon = $this->factory->symbol()->icon()->custom(
161 $this->
lng->txt(
"obj_" . $badge[
"object"][
"type"]),
166 $parent_ref_id = array_shift($ref_ids);
167 if ($parent_ref_id && $this->
access->checkAccess(
"read",
"", $parent_ref_id)) {
168 $parent_link = $this->factory->link()->standard($badge[
"object"][
"title"],
ilLink::_getLink($parent_ref_id));
170 $parent_link = $this->factory->legacy($badge[
"object"][
"title"]);
174 $this->factory->listing()->descriptive([
175 $this->
lng->txt(
"object") => $this->factory->legacy(
176 $this->renderer->render($parent_icon) . $this->renderer->render($parent_link)
182 $badge_sections = [$profile_button];
185 $cards[] = $this->factory->card()->standard($badge[
"title"], $image)->withSections($badge_sections)
186 ->withTitleAction($modal->getShowSignal());
188 $badge_components[] = $modal;
191 $deck = $this->factory->deck($cards)->withSmallCardsSize();
192 $badge_components[] = $deck;
194 $tmpl->setVariable(
"DECK", $this->renderer->render($badge_components));
197 $this->noti_repo->updateLastCheckedTimestamp();
215 $tbl->writeFilterToSession();
233 $ids = $this->request->getBadgeIds();
234 if (count($ids) > 0) {
236 foreach ($ids as
$id) {
238 if ($ass->getTimestamp()) {
246 $this->tpl->setOnScreenMessage(
'failure', $lng->
txt(
"select_one"),
true);
247 $ilCtrl->redirect($this,
"manageBadges");
258 if (!$ass->getPosition()) {
259 $ass->setPosition(999);
264 $this->tpl->setOnScreenMessage(
'success', $lng->
txt(
"settings_saved"),
true);
265 $ilCtrl->
redirect($this,
"manageBadges");
275 if ($ass->getPosition()) {
276 $ass->setPosition(null);
281 $this->tpl->setOnScreenMessage(
'success', $lng->
txt(
"settings_saved"),
true);
282 $ilCtrl->
redirect($this,
"manageBadges");
292 if (!$ass->getPosition()) {
293 $ass->setPosition(999);
298 $this->tpl->setOnScreenMessage(
'success', $lng->
txt(
"settings_saved"),
true);
299 $ilCtrl->
redirect($this,
"listBadges");
309 if ($ass->getPosition()) {
310 $ass->setPosition(null);
315 $this->tpl->setOnScreenMessage(
'success', $lng->
txt(
"settings_saved"),
true);
316 $ilCtrl->
redirect($this,
"listBadges");
329 $lng->
txt(
"obj_bdga"),
330 $ilCtrl->getLinkTarget($this,
"listBackpackGroups")
335 $lng->
txt(
"settings"),
336 $ilCtrl->getLinkTarget($this,
"editSettings")
339 $ilTabs->activateTab(
"backpack_badges");
350 $ilTabs->activateSubTab(
"backpack_badges");
352 $this->tpl->setOnScreenMessage(
'info', $lng->
txt(
"badge_backpack_gallery_info"));
355 $bp_groups = $bp->getGroups();
357 if (!count($bp_groups)) {
358 $this->tpl->setOnScreenMessage(
'info', $lng->
txt(
"badge_backpack_no_groups"));
362 $tmpl =
new ilTemplate(
"tpl.badge_backpack.html",
true,
true,
"Services/Badge");
364 $tmpl->setVariable(
"BACKPACK_TITLE", $lng->
txt(
"badge_backpack_list"));
368 foreach ($bp_groups as $group_id => $group) {
369 $bp_badges = $bp->getBadges($group_id);
370 if (count($bp_badges)) {
371 foreach ($bp_badges as $idx => $badge) {
372 $tmpl->setCurrentBlock(
"badge_bl");
373 $tmpl->setVariable(
"BADGE_TITLE", $badge[
"title"]);
374 $tmpl->setVariable(
"BADGE_DESC", $badge[
"description"]);
375 $tmpl->setVariable(
"BADGE_IMAGE", $badge[
"image_url"]);
376 $tmpl->setVariable(
"BADGE_CRITERIA", $badge[
"criteria_url"]);
377 $tmpl->setVariable(
"BADGE_ISSUER", $badge[
"issuer_name"]);
378 $tmpl->setVariable(
"BADGE_ISSUER_URL", $badge[
"issuer_url"]);
380 $tmpl->parseCurrentBlock();
384 $tmpl->setCurrentBlock(
"group_bl");
385 $tmpl->setVariable(
"GROUP_TITLE", $group[
"title"]);
386 $tmpl->parseCurrentBlock();
400 $mail =
$ilUser->getPref(self::BACKPACK_EMAIL);
413 $form->setFormAction($ilCtrl->getFormAction($this,
"saveSettings"));
414 $form->setTitle($lng->
txt(
"settings"));
418 $email->setInfo($lng->
txt(
"badge_backpack_email_info"));
422 $form->addCommandButton(
"saveSettings", $lng->
txt(
"save"));
433 $ilCtrl->redirect($this,
"listBadges");
443 if ($form->checkInput()) {
444 $new_email = $form->getInput(
"email");
450 if ($new_email != $old_email) {
454 $this->tpl->setOnScreenMessage(
'success', $lng->
txt(
"settings_saved"),
true);
455 $ilCtrl->redirect($this,
"editSettings");
458 $form->setValuesByPost();
ILIAS UI Renderer $renderer
static _getIcon(int $obj_id=0, string $size="big", string $type="", bool $offline=false)
Get icon for repository item.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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...
redirect(object $a_gui_obj, string $a_cmd=null, string $a_anchor=null, bool $is_async=false)
BadgeNotificationPrefRepository $noti_repo
static getInstancesByUserId(int $a_user_id)
getSubTabs(string $a_active)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getAllReferences(int $id)
get all reference ids for object ID
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
loadLanguageModule(string $a_module)
Load language module.
Badge notification repository (using user preferences.
editSettings(ilPropertyFormGUI $a_form=null)
setContent(string $a_html)
Sets content for standard template.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilGlobalTemplateInterface $tpl
ILIAS UI Factory $factory
static _getLink(?int $a_ref_id, string $a_type='', array $a_params=array(), string $append="")
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static clearBadgeCache(int $a_user_id)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
static signFile(string $path_to_file)
static _writePref(int $a_usr_id, string $a_keyword, string $a_value)
ilBadgeGUIRequest $request
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static setUseRelativeDates(bool $a_status)
set use relative dates
static sortArray(array $array, string $a_array_sortby_key, string $a_array_sortorder="asc", bool $a_numeric=false, bool $a_keep_keys=false)