44 $this->
ctrl = $DIC->ctrl();
45 $this->
lng = $DIC->language();
46 $this->tpl = $DIC[
'tpl'];
47 $this->
tabs = $DIC->tabs();
48 $this->
user = $DIC->user();
49 $this->
access = $DIC->access();
50 $this->
factory = $DIC->ui()->factory();
51 $this->
renderer = $DIC->ui()->renderer();
74 switch ($ilCtrl->getNextClass()) {
76 $cmd = $ilCtrl->getCmd(
'listBadges');
79 $query = $DIC->http()->wrapper()->query();
81 $parameter =
'badge_table_action';
82 if ($cmd ===
'action' && $this->query->has($parameter)) {
83 $action = $this->query->retrieve($parameter, $DIC->refinery()->kindlyTo()->string());
86 if ($action ===
'obj_badge_activate') {
88 } elseif ($action ===
'obj_badge_deactivate') {
108 $this->tpl->setContent($this->
renderDeck($this->tile_view->show()));
109 $this->noti_repo->updateLastCheckedTimestamp();
114 $template =
new ilTemplate(
'tpl.badge_backpack.html',
true,
true,
'components/ILIAS/Badge/');
115 $template->setVariable(
'DECK', $deck);
116 return $template->get();
122 $tpl->renderTable(ILIAS_HTTP_PATH .
'/' . $this->
ctrl->getLinkTarget($this,
'action'));
127 $ids = $this->request->getBadgeIds();
128 if (count($ids) > 0) {
130 foreach ($ids as
$id) {
132 if ($ass->getTimestamp()) {
140 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'select_one'),
true);
141 $this->
ctrl->redirect($this,
'manageBadges');
151 if (!$ass->getPosition()) {
152 $ass->setPosition(999);
157 $this->tpl->setOnScreenMessage(
'success', $lng->
txt(
'position_updated'),
true);
158 $ilCtrl->
redirect($this,
'manageBadges');
168 if ($ass->getPosition()) {
169 $ass->setPosition(
null);
174 $this->tpl->setOnScreenMessage(
'success', $lng->
txt(
'position_updated'),
true);
175 $ilCtrl->
redirect($this,
'manageBadges');
185 if (!$ass->getPosition()) {
186 $ass->setPosition(999);
191 $this->tpl->setOnScreenMessage(
'success', $lng->
txt(
'position_updated'),
true);
192 $ilCtrl->
redirect($this,
'listBadges');
202 if ($ass->getPosition()) {
203 $ass->setPosition(
null);
208 $this->tpl->setOnScreenMessage(
'success', $lng->
txt(
'position_updated'),
true);
209 $ilCtrl->
redirect($this,
'listBadges');
220 $lng->
txt(
'obj_bdga'),
221 $ilCtrl->getLinkTarget($this,
'listBackpackGroups')
226 $lng->
txt(
'settings'),
227 $ilCtrl->getLinkTarget($this,
'editSettings')
230 $ilTabs->activateTab(
'backpack_badges');
241 $ilTabs->activateSubTab(
'backpack_badges');
243 $this->tpl->setOnScreenMessage(
'info', $lng->
txt(
'badge_backpack_gallery_info'));
246 $bp_groups = $bp->getGroups();
248 if (!count($bp_groups)) {
249 $this->tpl->setOnScreenMessage(
'info', $lng->
txt(
'badge_backpack_no_groups'));
253 $tmpl =
new ilTemplate(
'tpl.badge_backpack.html',
true,
true,
'components/ILIAS/Badge/');
255 $tmpl->setVariable(
'BACKPACK_TITLE', $lng->
txt(
'badge_backpack_list'));
259 foreach ($bp_groups as $group_id => $group) {
260 $bp_badges = $bp->getBadges($group_id);
261 if (count($bp_badges)) {
262 foreach ($bp_badges as $idx => $badge) {
263 $tmpl->setCurrentBlock(
'badge_bl');
264 $tmpl->setVariable(
'BADGE_TITLE', $badge[
'title']);
265 $tmpl->setVariable(
'BADGE_DESC', $badge[
'description']);
266 $tmpl->setVariable(
'BADGE_IMAGE', $badge[
'image_url']);
267 $tmpl->setVariable(
'BADGE_CRITERIA', $badge[
'criteria_url']);
268 $tmpl->setVariable(
'BADGE_ISSUER', $badge[
'issuer_name']);
269 $tmpl->setVariable(
'BADGE_ISSUER_URL', $badge[
'issuer_url']);
271 $tmpl->parseCurrentBlock();
275 $tmpl->setCurrentBlock(
'group_bl');
276 $tmpl->setVariable(
'GROUP_TITLE', $group[
'title']);
277 $tmpl->parseCurrentBlock();
291 $mail = $ilUser->
getPref(self::BACKPACK_EMAIL);
293 $mail = $ilUser->getEmail();
304 $form->setFormAction($ilCtrl->getFormAction($this,
'saveSettings'));
305 $form->setTitle($lng->
txt(
'settings'));
309 $email->
setInfo($lng->
txt(
'badge_backpack_email_info'));
311 $form->addItem($email);
313 $form->addCommandButton(
'saveSettings', $lng->
txt(
'save'));
324 $ilCtrl->redirect($this,
'listBadges');
334 if ($form->checkInput()) {
335 $new_email = $form->getInput(
'email');
341 if ($new_email != $old_email) {
345 $this->tpl->setOnScreenMessage(
'success', $lng->
txt(
'settings_saved'),
true);
346 $ilCtrl->redirect($this,
'editSettings');
349 $form->setValuesByPost();
static array static setUseRelativeDates(bool $a_status)
set use relative dates
ILIAS UI Renderer $renderer
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...
BadgeNotificationPrefRepository $noti_repo
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setContent(string $a_html)
Sets content for standard template.
loadLanguageModule(string $a_module)
Load language module.
Badge notification repository (using user preferences.
getSafePostCommands()
This method must return a list of safe POST commands.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
redirect(object $a_gui_obj, ?string $a_cmd=null, ?string $a_anchor=null, bool $is_async=false)
final const BACKPACK_EMAIL
getPref(string $a_keyword)
ilGlobalTemplateInterface $tpl
editSettings(?ilPropertyFormGUI $a_form=null)
ILIAS UI Factory $factory
getUnsafeGetCommands()
This method must return a list of unsafe GET commands.
static clearBadgeCache(int $a_user_id)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
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...
readonly TileView $tile_view
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...