3 include_once
"Services/Badge/classes/class.ilBadgeHandler.php";
21 $lng->loadLanguageModule(
"badge");
23 $tpl->setTitle($lng->txt(
"obj_bdga"));
26 switch($ilCtrl->getNextClass())
30 $cmd = $ilCtrl->getCmd(
"listBadges");
42 $ilTabs->addTab(
"ilias_badges",
43 $lng->txt(
"badge_personal_badges"),
44 $ilCtrl->getLinkTarget($this,
"listBadges"));
46 $ilTabs->addTab(
"backpack_badges",
47 $lng->txt(
"badge_backpack_list"),
48 $ilCtrl->getLinkTarget($this,
"listBackpackGroups"));
63 $ilTabs->addSubTab(
"list",
64 $lng->txt(
"badge_profile_view"),
65 $ilCtrl->getLinkTarget($this,
"listBadges"));
66 $ilTabs->addSubTab(
"manage",
67 $lng->txt(
"badge_profile_manage"),
68 $ilCtrl->getLinkTarget($this,
"manageBadges"));
69 $ilTabs->activateTab(
"ilias_badges");
70 $ilTabs->activateSubTab($a_active);
74 $ilTabs->addTab(
"list",
75 $lng->txt(
"badge_profile_view"),
76 $ilCtrl->getLinkTarget($this,
"listBadges"));
77 $ilTabs->addTab(
"manage",
78 $lng->txt(
"badge_profile_manage"),
79 $ilCtrl->getLinkTarget($this,
"manageBadges"));
80 $ilTabs->activateTab($a_active);
94 include_once
"Services/Badge/classes/class.ilBadge.php";
95 include_once
"Services/Badge/classes/class.ilBadgeAssignment.php";
96 include_once
"Services/Badge/classes/class.ilBadgeRenderer.php";
99 $badge =
new ilBadge($ass->getBadgeId());
102 "id" => $badge->getId(),
103 "title" => $badge->getTitle(),
104 "description" => $badge->getDescription(),
105 "image" => $badge->getImagePath(),
106 "issued_on" => $ass->getTimestamp(),
114 $tmpl =
new ilTemplate(
"tpl.badge_backpack.html",
true,
true,
"Services/Badge");
118 foreach($data as $badge)
120 $tmpl->setCurrentBlock(
"badge_bl");
121 $tmpl->setVariable(
"BADGE_TITLE", $badge[
"title"]);
123 $tmpl->setVariable(
"BADGE_IMAGE", $badge[
"image"]);
124 $tmpl->setVariable(
"BADGE_CRITERIA", $badge[
"renderer"]->getHref());
126 $tmpl->parseCurrentBlock();
129 $tpl->setContent($tmpl->get());
138 include_once
"Services/Badge/classes/class.ilBadgePersonalTableGUI.php";
141 $tpl->setContent(
$tbl->getHTML());
146 include_once
"Services/Badge/classes/class.ilBadgePersonalTableGUI.php";
149 $tbl->writeFilterToSession();
155 include_once
"Services/Badge/classes/class.ilBadgePersonalTableGUI.php";
166 $ids =
$_POST[
"badge_id"];
167 if(!$ids && is_numeric(
$_GET[
"badge_id"]))
174 include_once
"Services/Badge/classes/class.ilBadge.php";
175 include_once
"Services/Badge/classes/class.ilBadgeAssignment.php";
179 if($ass->getTimestamp())
190 $ilCtrl->redirect($this,
"manageBadges");
201 if(!$ass->getPosition())
203 $ass->setPosition(999);
209 $ilCtrl->redirect($this,
"manageBadges");
219 if($ass->getPosition())
221 $ass->setPosition(null);
227 $ilCtrl->redirect($this,
"manageBadges");
245 $badge =
new ilBadge($ass->getBadgeId());
252 $tpl->addJavascript(
"https://backpack.openbadges.org/issuer.js",
false);
254 $tpl->addJavascript(
"Services/Badge/js/ilBadge.js");
255 $tpl->addOnloadCode(
"il.Badge.publishMulti(['".implode(
"','",
$res).
"']);");
257 $ilTabs->clearTargets();
258 $ilTabs->setBackTarget($lng->txt(
"back"),
259 $ilCtrl->getLinkTarget($this,
"manageBadges"));
261 ilUtil::sendInfo(sprintf($lng->txt(
"badge_add_to_backpack_multi"), implode(
", ", $titles)));
268 $ilTabs->addSubTab(
"backpack_badges",
269 $lng->txt(
"obj_bdga"),
270 $ilCtrl->getLinkTarget($this,
"listBackpackGroups"));
272 $ilTabs->addSubTab(
"backpack_settings",
273 $lng->txt(
"settings"),
274 $ilCtrl->getLinkTarget($this,
"editSettings"));
276 $ilTabs->activateTab(
"backpack_badges");
285 $ilCtrl->redirect($this,
"listBadges");
289 $ilTabs->activateSubTab(
"backpack_badges");
293 include_once
"Services/Badge/classes/class.ilBadgeBackpack.php";
295 $bp_groups = $bp->getGroups();
297 if(!is_array($bp_groups))
302 else if(!
sizeof($bp_groups))
308 $tmpl =
new ilTemplate(
"tpl.badge_backpack.html",
true,
true,
"Services/Badge");
310 $tmpl->setVariable(
"BACKPACK_TITLE", $lng->txt(
"badge_backpack_list"));
314 foreach($bp_groups as $group_id => $group)
316 $bp_badges = $bp->getBadges($group_id);
317 if(
sizeof($bp_badges))
319 foreach($bp_badges as $idx => $badge)
321 $tmpl->setCurrentBlock(
"badge_bl");
322 $tmpl->setVariable(
"BADGE_TITLE", $badge[
"title"]);
323 $tmpl->setVariable(
"BADGE_DESC", $badge[
"description"]);
324 $tmpl->setVariable(
"BADGE_IMAGE", $badge[
"image_url"]);
325 $tmpl->setVariable(
"BADGE_CRITERIA", $badge[
"criteria_url"]);
326 $tmpl->setVariable(
"BADGE_ISSUER", $badge[
"issuer_name"]);
327 $tmpl->setVariable(
"BADGE_ISSUER_URL", $badge[
"issuer_url"]);
329 $tmpl->parseCurrentBlock();
333 $tmpl->setCurrentBlock(
"group_bl");
334 $tmpl->setVariable(
"GROUP_TITLE", $group[
"title"]);
335 $tmpl->parseCurrentBlock();
338 $tpl->setContent($tmpl->get());
346 include_once
"Services/Badge/classes/class.ilBadgeAssignment.php";
348 if($ass->getTimestamp())
353 $url = $ass->getStaticUrl();
371 if(!$ilCtrl->isAsynch() ||
377 $res =
new stdClass();
380 $badge_id = (int)
$_GET[
"id"];
394 $res->message =
"missing badge id";
410 $mail = $ilUser->getPref(self::BACKPACK_EMAIL);
413 $mail = $ilUser->getEmail();
422 include_once
"Services/Form/classes/class.ilPropertyFormGUI.php";
424 $form->setFormAction($ilCtrl->getFormAction($this,
"saveSettings"));
425 $form->setTitle($lng->txt(
"settings"));
427 $email =
new ilEMailInputGUI($lng->txt(
"badge_backpack_email"),
"email");
429 $email->
setInfo($lng->txt(
"badge_backpack_email_info"));
431 $form->addItem($email);
433 $form->addCommandButton(
"saveSettings", $lng->txt(
"save"));
444 $ilCtrl->redirect($this,
"listBadges");
448 $ilTabs->activateSubTab(
"backpack_settings");
455 $tpl->setContent($a_form->getHTML());
463 if($form->checkInput())
465 $new_email = $form->getInput(
"email");
471 if($new_email != $old_email)
473 include_once
"Services/Badge/classes/class.ilBadgeAssignment.php";
478 $ilCtrl->redirect($this,
"editSettings");
481 $form->setValuesByPost();
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
prepareBadge($a_badge_id)
static _writePref($a_usr_id, $a_keyword, $a_value)
static setUseRelativeDates($a_status)
set use relative dates
static sortArray($array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
editSettings(ilPropertyFormGUI $a_form=null)
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
special template class to simplify handling of ITX/PEAR
static formatDate(ilDateTime $date)
Format a date public.
TableGUI class for user badge listing.
Create styles array
The data for the language used.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static clearBadgeCache($a_user_id)
static getInstancesByUserId($a_user_id)
static getInstance()
Constructor.