3 include_once
"Services/Badge/classes/class.ilBadgeHandler.php";
48 $this->ctrl = $DIC->ctrl();
49 $this->lng = $DIC->language();
50 $this->tpl = $DIC[
"tpl"];
51 $this->tabs = $DIC->tabs();
52 $this->
user = $DIC->user();
63 $lng->loadLanguageModule(
"badge");
65 $tpl->setTitle(
$lng->txt(
"obj_bdga"));
68 switch (
$ilCtrl->getNextClass()) {
71 $cmd =
$ilCtrl->getCmd(
"listBadges");
86 $lng->txt(
"badge_personal_badges"),
87 $ilCtrl->getLinkTarget($this,
"listBadges")
92 $lng->txt(
"badge_backpack_list"),
93 $ilCtrl->getLinkTarget($this,
"listBackpackGroups")
112 $lng->txt(
"badge_profile_view"),
113 $ilCtrl->getLinkTarget($this,
"listBadges")
117 $lng->txt(
"badge_profile_manage"),
118 $ilCtrl->getLinkTarget($this,
"manageBadges")
120 $ilTabs->activateTab(
"ilias_badges");
121 $ilTabs->activateSubTab($a_active);
125 $lng->txt(
"badge_profile_view"),
126 $ilCtrl->getLinkTarget($this,
"listBadges")
130 $lng->txt(
"badge_profile_manage"),
131 $ilCtrl->getLinkTarget($this,
"manageBadges")
133 $ilTabs->activateTab($a_active);
147 include_once
"Services/Badge/classes/class.ilBadge.php";
148 include_once
"Services/Badge/classes/class.ilBadgeAssignment.php";
149 include_once
"Services/Badge/classes/class.ilBadgeRenderer.php";
151 $badge =
new ilBadge($ass->getBadgeId());
154 "id" => $badge->getId(),
155 "title" => $badge->getTitle(),
156 "description" => $badge->getDescription(),
157 "image" => $badge->getImagePath(),
158 "issued_on" => $ass->getTimestamp(),
166 $tmpl =
new ilTemplate(
"tpl.badge_backpack.html",
true,
true,
"Services/Badge");
170 foreach ($data as $badge) {
171 $tmpl->setCurrentBlock(
"badge_bl");
172 $tmpl->setVariable(
"BADGE_TITLE", $badge[
"title"]);
174 $tmpl->setVariable(
"BADGE_IMAGE", $badge[
"image"]);
175 $tmpl->setVariable(
"BADGE_CRITERIA", $badge[
"renderer"]->getHref());
177 $tmpl->parseCurrentBlock();
180 $tpl->setContent($tmpl->get());
189 include_once
"Services/Badge/classes/class.ilBadgePersonalTableGUI.php";
197 include_once
"Services/Badge/classes/class.ilBadgePersonalTableGUI.php";
200 $tbl->writeFilterToSession();
206 include_once
"Services/Badge/classes/class.ilBadgePersonalTableGUI.php";
219 $ids =
$_POST[
"badge_id"];
220 if (!$ids && is_numeric(
$_GET[
"badge_id"])) {
223 if (is_array($ids)) {
225 include_once
"Services/Badge/classes/class.ilBadge.php";
226 include_once
"Services/Badge/classes/class.ilBadgeAssignment.php";
227 foreach ($ids as
$id) {
229 if ($ass->getTimestamp()) {
237 $ilCtrl->redirect($this,
"manageBadges");
248 if (!$ass->getPosition()) {
249 $ass->setPosition(999);
255 $ilCtrl->redirect($this,
"manageBadges");
265 if ($ass->getPosition()) {
266 $ass->setPosition(null);
272 $ilCtrl->redirect($this,
"manageBadges");
290 if (
$url !==
false) {
291 $badge =
new ilBadge($ass->getBadgeId());
298 $tpl->addJavascript(
"https://backpack.openbadges.org/issuer.js",
false);
300 $tpl->addJavascript(
"Services/Badge/js/ilBadge.js");
301 $tpl->addOnloadCode(
"il.Badge.publishMulti(['" . implode(
"','",
$res) .
"']);");
303 $ilTabs->clearTargets();
304 $ilTabs->setBackTarget(
306 $ilCtrl->getLinkTarget($this,
"manageBadges")
320 $lng->txt(
"obj_bdga"),
321 $ilCtrl->getLinkTarget($this,
"listBackpackGroups")
326 $lng->txt(
"settings"),
327 $ilCtrl->getLinkTarget($this,
"editSettings")
330 $ilTabs->activateTab(
"backpack_badges");
341 $ilCtrl->redirect($this,
"listBadges");
345 $ilTabs->activateSubTab(
"backpack_badges");
349 include_once
"Services/Badge/classes/class.ilBadgeBackpack.php";
351 $bp_groups = $bp->getGroups();
353 if (!is_array($bp_groups)) {
356 } elseif (!
sizeof($bp_groups)) {
361 $tmpl =
new ilTemplate(
"tpl.badge_backpack.html",
true,
true,
"Services/Badge");
363 $tmpl->setVariable(
"BACKPACK_TITLE",
$lng->txt(
"badge_backpack_list"));
367 foreach ($bp_groups as $group_id => $group) {
368 $bp_badges = $bp->getBadges($group_id);
369 if (
sizeof($bp_badges)) {
370 foreach ($bp_badges as $idx => $badge) {
371 $tmpl->setCurrentBlock(
"badge_bl");
372 $tmpl->setVariable(
"BADGE_TITLE", $badge[
"title"]);
373 $tmpl->setVariable(
"BADGE_DESC", $badge[
"description"]);
374 $tmpl->setVariable(
"BADGE_IMAGE", $badge[
"image_url"]);
375 $tmpl->setVariable(
"BADGE_CRITERIA", $badge[
"criteria_url"]);
376 $tmpl->setVariable(
"BADGE_ISSUER", $badge[
"issuer_name"]);
377 $tmpl->setVariable(
"BADGE_ISSUER_URL", $badge[
"issuer_url"]);
379 $tmpl->parseCurrentBlock();
383 $tmpl->setCurrentBlock(
"group_bl");
384 $tmpl->setVariable(
"GROUP_TITLE", $group[
"title"]);
385 $tmpl->parseCurrentBlock();
388 $tpl->setContent($tmpl->get());
396 include_once
"Services/Badge/classes/class.ilBadgeAssignment.php";
398 if ($ass->getTimestamp()) {
401 $url = $ass->getStaticUrl();
421 $res =
new stdClass();
424 $badge_id = (int)
$_GET[
"id"];
429 if (
$url !==
false) {
434 $res->message =
"missing badge id";
437 echo json_encode(
$res);
450 $mail =
$ilUser->getPref(self::BACKPACK_EMAIL);
462 include_once
"Services/Form/classes/class.ilPropertyFormGUI.php";
464 $form->setFormAction(
$ilCtrl->getFormAction($this,
"saveSettings"));
469 $email->setInfo(
$lng->txt(
"badge_backpack_email_info"));
473 $form->addCommandButton(
"saveSettings",
$lng->txt(
"save"));
485 $ilCtrl->redirect($this,
"listBadges");
489 $ilTabs->activateSubTab(
"backpack_settings");
495 $tpl->setContent($a_form->getHTML());
505 if (
$form->checkInput()) {
506 $new_email =
$form->getInput(
"email");
512 if ($new_email != $old_email) {
513 include_once
"Services/Badge/classes/class.ilBadgeAssignment.php";
518 $ilCtrl->redirect($this,
"editSettings");
521 $form->setValuesByPost();
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static sortArray( $array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
prepareBadge($a_badge_id)
static _writePref($a_usr_id, $a_keyword, $a_value)
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false)
Format a date public.
if(!array_key_exists('StateId', $_REQUEST)) $id
static setUseRelativeDates($a_status)
set use relative dates
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
editSettings(ilPropertyFormGUI $a_form=null)
foreach($_POST as $key=> $value) $res
if(isset($_POST['submit'])) $form
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
__construct()
Constructor.
special template class to simplify handling of ITX/PEAR
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.