4 include_once(
"./Services/Object/classes/class.ilObjectGUI.php");
5 include_once(
"./Services/Badge/classes/class.ilBadgeHandler.php");
20 public function __construct($a_data, $a_id, $a_call_by_reference =
true, $a_prepare_output =
true)
23 parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
25 $this->lng->loadLanguageModule(
"badge");
30 $next_class = $this->ctrl->getNextClass($this);
31 $cmd = $this->ctrl->getCmd();
37 case 'ilpermissiongui':
38 $this->tabs_gui->setTabActive(
'perm_settings');
39 include_once(
"Services/AccessControl/classes/class.ilPermissionGUI.php");
41 $this->ctrl->forwardCommand($perm_gui);
44 case 'ilbadgemanagementgui':
46 $this->tabs_gui->setTabActive(
'activity');
47 include_once
"Services/Badge/classes/class.ilBadgeManagementGUI.php";
49 $this->ctrl->forwardCommand($gui);
55 $cmd =
"editSettings";
68 if ($rbacsystem->checkAccess(
"visible,read",$this->object->getRefId()))
70 $this->tabs_gui->addTab(
"settings",
71 $this->lng->txt(
"settings"),
72 $this->ctrl->getLinkTarget($this,
"editSettings"));
76 $this->tabs_gui->addTab(
"types",
77 $this->lng->txt(
"badge_types"),
78 $this->ctrl->getLinkTarget($this,
"listTypes"));
80 $this->tabs_gui->addTab(
"imgtmpl",
81 $this->lng->txt(
"badge_image_templates"),
82 $this->ctrl->getLinkTarget($this,
"listImageTemplates"));
84 $this->tabs_gui->addTab(
"activity",
85 $this->lng->txt(
"badge_activity_badges"),
86 $this->ctrl->getLinkTargetByClass(
"ilbadgemanagementgui",
""));
88 $this->tabs_gui->addTab(
"obj_badges",
89 $this->lng->txt(
"badge_object_badges"),
90 $this->ctrl->getLinkTarget($this,
"listObjectBadges"));
94 if ($rbacsystem->checkAccess(
'edit_permission',$this->object->getRefId()))
96 $this->tabs_gui->addTab(
"perm_settings",
97 $this->lng->txt(
"perm_settings"),
98 $this->ctrl->getLinkTargetByClass(
'ilpermissiongui',
"perm"));
106 $this->ctrl->redirect($this,
"editSettings");
117 $this->tabs_gui->setTabActive(
"settings");
124 $this->tpl->setContent($a_form->getHTML());
134 if($form->checkInput())
136 $obi = (bool)$form->getInput(
"act")
137 ? (bool)$form->getInput(
"obi")
141 $handler->setActive((
bool)$form->getInput(
"act"));
142 $handler->setObiActive($obi);
143 $handler->setObiOrganisation(trim($form->getInput(
"obi_org")));
144 $handler->setObiContact(trim($form->getInput(
"obi_cont")));
145 $handler->setObiSalt(trim($form->getInput(
"obi_salt")));
147 $handler->rebuildIssuerStaticUrl();
150 $ilCtrl->redirect($this,
"editSettings");
153 $form->setValuesByPost();
161 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
163 $form->setFormAction($this->ctrl->getFormAction($this));
164 $form->setTitle($this->lng->txt(
"badge_settings"));
166 if ($ilAccess->checkAccess(
"write",
"", $this->object->getRefId()))
168 $form->addCommandButton(
"saveSettings", $this->lng->txt(
"save"));
169 $form->addCommandButton(
"editSettings", $this->lng->txt(
"cancel"));
173 $act->
setInfo($this->lng->txt(
"badge_service_activate_info"));
174 $form->addItem($act);
198 $act->setChecked($handler->isActive());
220 $this->tabs_gui->setTabActive(
"types");
222 include_once
"Services/Badge/classes/class.ilBadgeTypesTableGUI.php";
224 $ilAccess->checkAccess(
"write",
"", $this->object->getRefId()));
225 $this->tpl->setContent(
$tbl->getHTML());
240 foreach($handler->getInactiveTypes() as $type)
242 if(!in_array($type, $ids))
247 $handler->setInactiveTypes($inactive);
251 $this->ctrl->redirect($this,
"listTypes");
265 $inactive = array_merge($handler->getInactiveTypes(), $ids);
266 $handler->setInactiveTypes($inactive);
270 $this->ctrl->redirect($this,
"listTypes");
283 $this->tabs_gui->setTabActive(
"imgtmpl");
287 $ilToolbar->addButton($lng->txt(
"badge_add_template"),
288 $ilCtrl->getLinkTarget($this,
"addImageTemplate"));
291 include_once
"Services/Badge/classes/class.ilBadgeImageTemplateTableGUI.php";
293 $ilAccess->checkAccess(
"write",
"", $this->object->getRefId()));
294 $this->tpl->setContent(
$tbl->getHTML());
304 $this->tabs_gui->setTabActive(
"imgtmpl");
311 $tpl->setContent($a_form->getHTML());
318 include_once
"Services/Form/classes/class.ilPropertyFormGUI.php";
320 $form->setFormAction($ilCtrl->getFormAction($this,
"saveBadge"));
321 $form->setTitle($lng->txt(
"badge_image_template_form"));
324 $title->setRequired(
true);
329 if($a_mode ==
"create")
331 $img->setRequired(
true);
333 $img->setALlowDeletion(
false);
334 $form->addItem(
$img);
338 $form->addItem($types_mode);
340 $type_all =
new ilRadioOption($lng->txt(
"badge_template_types_all"),
"all");
341 $types_mode->addOption($type_all);
343 $type_spec =
new ilRadioOption($lng->txt(
"badge_template_types_specific"),
"spec");
344 $types_mode->addOption($type_spec);
348 $type_spec->addSubItem($types);
355 if($a_mode ==
"create")
357 $form->addCommandButton(
"saveImageTemplate", $lng->txt(
"save"));
361 $form->addCommandButton(
"updateImageTemplate", $lng->txt(
"save"));
363 $form->addCommandButton(
"listImageTemplates", $lng->txt(
"cancel"));
375 if($form->checkInput())
377 include_once
"Services/Badge/classes/class.ilBadgeImageTemplate.php";
379 $tmpl->setTitle($form->getInput(
"title"));
380 $tmpl->setTypes($form->getInput(
"type"));
383 $tmpl->uploadImage($_FILES[
"img"]);
386 $ilCtrl->redirect($this,
"listImageTemplates");
389 $form->setValuesByPost();
400 $this->tabs_gui->setTabActive(
"imgtmpl");
402 $tmpl_id = $_REQUEST[
"tid"];
405 $ilCtrl->redirect($this,
"listImageTemplates");
408 $ilCtrl->setParameter($this,
"tid", $tmpl_id);
410 include_once
"Services/Badge/classes/class.ilBadgeImageTemplate.php";
419 $tpl->setContent($a_form->getHTML());
445 $tmpl_id = $_REQUEST[
"tid"];
448 $ilCtrl->redirect($this,
"listImageTemplates");
451 $ilCtrl->setParameter($this,
"tid", $tmpl_id);
453 include_once
"Services/Badge/classes/class.ilBadgeImageTemplate.php";
457 if($form->checkInput())
459 $tmpl->setTitle($form->getInput(
"title"));
461 if($form->getInput(
"tmode") !=
"all")
463 $tmpl->setTypes($form->getInput(
"type"));
467 $tmpl->setTypes(null);
472 $tmpl->uploadImage($_FILES[
"img"]);
475 $ilCtrl->redirect($this,
"listImageTemplates");
479 $form->setValuesByPost();
489 $tmpl_ids = $_REQUEST[
"id"];
492 $ilCtrl->redirect($this,
"listImageTemplates");
495 $ilTabs->clearTargets();
496 $ilTabs->setBackTarget($lng->txt(
"back"),
497 $ilCtrl->getLinkTarget($this,
"listImageTemplates"));
499 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
501 $confirmation_gui->setFormAction($ilCtrl->getFormAction($this));
502 $confirmation_gui->setHeaderText($lng->txt(
"badge_template_deletion_confirmation"));
503 $confirmation_gui->setCancel($lng->txt(
"cancel"),
"listImageTemplates");
504 $confirmation_gui->setConfirm($lng->txt(
"delete"),
"deleteImageTemplates");
506 include_once(
"./Services/Badge/classes/class.ilBadgeImageTemplate.php");
507 foreach($tmpl_ids as $tmpl_id)
510 $confirmation_gui->addItem(
"id[]", $tmpl_id, $tmpl->getTitle());
513 $tpl->setContent($confirmation_gui->getHTML());
522 $tmpl_ids = $_REQUEST[
"id"];
525 include_once(
"./Services/Badge/classes/class.ilBadgeImageTemplate.php");
526 foreach($tmpl_ids as $tmpl_id)
535 $ilCtrl->redirect($this,
"listImageTemplates");
545 global $ilAccess,
$tpl;
548 $this->tabs_gui->setTabActive(
"obj_badges");
550 include_once(
"./Services/Badge/classes/class.ilObjectBadgeTableGUI.php");
552 $ilAccess->checkAccess(
"write",
"", $this->object->getRefId()));
553 $tpl->setContent(
$tbl->getHTML());
560 include_once
"Services/Badge/classes/class.ilObjectBadgeTableGUI.php";
562 $ilAccess->checkAccess(
"write",
"", $this->object->getRefId()));
564 $tbl->writeFilterToSession();
572 include_once
"Services/Badge/classes/class.ilObjectBadgeTableGUI.php";
574 $ilAccess->checkAccess(
"write",
"", $this->object->getRefId()));
584 $parent_obj_id = $_REQUEST[
"pid"];
587 $ilCtrl->redirect($this,
"listObjectBadges");
592 $this->tabs_gui->clearTargets();
593 $this->tabs_gui->setBackTarget($lng->txt(
"back"),
594 $ilCtrl->getLinkTarget($this,
"listObjectBadges"));
596 $ilCtrl->saveParameter($this,
"pid");
598 include_once
"Services/Badge/classes/class.ilBadgeUserTableGUI.php";
600 $tpl->setContent(
$tbl->getHTML());
605 include_once
"Services/Badge/classes/class.ilBadgeUserTableGUI.php";
608 $tbl->writeFilterToSession();
614 include_once
"Services/Badge/classes/class.ilBadgeUserTableGUI.php";
630 $badge_ids = $_REQUEST[
"id"];
632 !$ilAccess->checkAccess(
"write",
"", $this->object->getRefId()))
634 $ilCtrl->redirect($this,
"listObjectBadges");
646 include_once
"Services/Badge/classes/class.ilBadge.php";
647 foreach($badge_ids as $badge_id)
649 $badge =
new ilBadge($badge_id);
650 $badge->setActive($a_status);
655 $ilCtrl->redirect($this,
"listObjectBadges");
674 $ilTabs->clearTargets();
675 $ilTabs->setBackTarget($lng->txt(
"back"),
676 $ilCtrl->getLinkTarget($this,
"listObjectBadges"));
678 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
680 $confirmation_gui->setFormAction($ilCtrl->getFormAction($this));
681 $confirmation_gui->setHeaderText($lng->txt(
"badge_deletion_confirmation"));
682 $confirmation_gui->setCancel($lng->txt(
"cancel"),
"listObjectBadges");
683 $confirmation_gui->setConfirm($lng->txt(
"delete"),
"deleteObjectBadges");
685 include_once
"Services/Badge/classes/class.ilBadge.php";
686 include_once
"Services/Badge/classes/class.ilBadgeAssignment.php";
687 foreach($badge_ids as $badge_id)
689 $badge =
new ilBadge($badge_id);
690 $parent = $badge->getParentMeta();
693 $container =
"(".$parent[
"type"].
"/".
696 if((
bool)$parent[
"deleted"])
698 $container .=
' <span class="il_ItemAlertProperty">'.$lng->txt(
"deleted").
'</span>';
701 $confirmation_gui->addItem(
710 $tpl->setContent($confirmation_gui->getHTML());
719 include_once
"Services/Badge/classes/class.ilBadge.php";
720 foreach($badge_ids as $badge_id)
722 $badge =
new ilBadge($badge_id);
727 $ilCtrl->redirect($this,
"listObjectBadges");
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
This class represents an option in a radio group.
__construct($a_data, $a_id, $a_call_by_reference=true, $a_prepare_output=true)
toggleObjectBadges($a_status)
This class represents an option in a checkbox group.
getObjectBadgesFromMultiAction()
confirmDeleteImageTemplates()
editSettings($a_form=null)
setImageTemplateFormValues(ilPropertyFormGUI $a_form, ilBadgeImageTemplate $a_tmpl)
TableGUI class for badge type listing.
Badge Administration Settings.
prepareOutput($a_show_subobjects=true)
prepare output
editImageTemplate(ilPropertyFormGUI $a_form=null)
addImageTemplate(ilPropertyFormGUI $a_form=null)
Class ilObjectGUI Basic methods of all Output classes.
This class represents a text property in a property form.
TableGUI class for badge listing.
Create styles array
The data for the language used.
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission and redirect on error.
TableGUI class for badge template listing.
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
initImageTemplateForm($a_mode)
static getInstancesByBadgeId($a_badge_id)
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission.
TableGUI class for badge user listing.
Confirmation screen class.
static getInstance()
Constructor.
confirmDeleteObjectBadges()