35 bool $a_call_by_reference =
true,
36 bool $a_prepare_output =
true 40 $this->rbacsystem = $DIC->rbac()->system();
41 $this->
ctrl = $DIC->ctrl();
42 $this->
access = $DIC->access();
43 $this->
lng = $DIC->language();
44 $this->
toolbar = $DIC->toolbar();
45 $this->tpl = $DIC[
"tpl"];
46 $this->
tabs = $DIC->tabs();
55 $this->
lng->loadLanguageModule(
"badge");
60 $next_class = $this->
ctrl->getNextClass($this);
61 $cmd = $this->
ctrl->getCmd();
65 switch ($next_class) {
66 case 'ilpermissiongui':
67 $this->tabs_gui->setTabActive(
'perm_settings');
69 $this->
ctrl->forwardCommand($perm_gui);
72 case 'ilbadgemanagementgui':
74 $this->tabs_gui->setTabActive(
'activity');
76 $this->
ctrl->forwardCommand($gui);
80 if (!$cmd || $cmd ===
'view') {
81 $cmd =
"editSettings";
93 if ($rbacsystem->
checkAccess(
"visible,read", $this->object->getRefId())) {
94 $this->tabs_gui->addTab(
96 $this->
lng->txt(
"settings"),
97 $this->
ctrl->getLinkTarget($this,
"editSettings")
101 $this->tabs_gui->addTab(
103 $this->
lng->txt(
"badge_types"),
104 $this->
ctrl->getLinkTarget($this,
"listTypes")
107 $this->tabs_gui->addTab(
109 $this->
lng->txt(
"badge_image_templates"),
110 $this->
ctrl->getLinkTarget($this,
"listImageTemplates")
113 $this->tabs_gui->addTab(
115 $this->
lng->txt(
"badge_activity_badges"),
116 $this->
ctrl->getLinkTargetByClass(
"ilbadgemanagementgui",
"")
119 $this->tabs_gui->addTab(
121 $this->
lng->txt(
"badge_object_badges"),
122 $this->
ctrl->getLinkTarget($this,
"listObjectBadges")
127 if ($rbacsystem->
checkAccess(
'edit_permission', $this->object->getRefId())) {
128 $this->tabs_gui->addTab(
130 $this->
lng->txt(
"perm_settings"),
131 $this->
ctrl->getLinkTargetByClass(
'ilpermissiongui',
"perm")
139 $this->
ctrl->redirect($this,
"editSettings");
150 $this->tabs_gui->setTabActive(
"settings");
156 $this->tpl->setContent($a_form->getHTML());
166 if ($form->checkInput()) {
168 $handler->setActive((
bool) $form->getInput(
"act"));
170 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"settings_saved"),
true);
171 $ilCtrl->redirect($this,
"editSettings");
174 $form->setValuesByPost();
183 $form->setFormAction($this->
ctrl->getFormAction($this));
184 $form->setTitle($this->
lng->txt(
"badge_settings"));
186 if ($ilAccess->checkAccess(
"write",
"", $this->object->getRefId())) {
187 $form->addCommandButton(
"saveSettings", $this->
lng->txt(
"save"));
188 $form->addCommandButton(
"editSettings", $this->
lng->txt(
"cancel"));
192 $act->setInfo($this->
lng->txt(
"badge_service_activate_info"));
193 $form->addItem($act);
197 $act->setChecked(
$handler->isActive());
212 $this->tabs_gui->setTabActive(
"types");
217 $ilAccess->checkAccess(
"write",
"", $this->object->getRefId())
219 $this->tpl->setContent($tbl->getHTML());
228 $ids = $this->badge_request->getIds();
233 if (!in_array(
$type, $ids)) {
237 $handler->setInactiveTypes($inactive);
239 $this->tpl->setOnScreenMessage(
'success',
$lng->
txt(
"settings_saved"),
true);
241 $this->
ctrl->redirect($this,
"listTypes");
250 $ids = $this->badge_request->getIds();
253 $inactive = array_merge(
$handler->getInactiveTypes(), $ids);
254 $handler->setInactiveTypes($inactive);
256 $this->tpl->setOnScreenMessage(
'success',
$lng->
txt(
"settings_saved"),
true);
258 $this->
ctrl->redirect($this,
"listTypes");
274 $this->tabs_gui->setTabActive(
"imgtmpl");
277 $ilToolbar->addButton(
278 $lng->
txt(
"badge_add_template"),
279 $ilCtrl->getLinkTarget($this,
"addImageTemplate")
285 "listImageTemplates",
286 $ilAccess->checkAccess(
"write",
"", $this->object->getRefId())
288 $this->tpl->setContent($tbl->getHTML());
299 $this->tabs_gui->setTabActive(
"imgtmpl");
315 $form->setFormAction($ilCtrl->getFormAction($this,
"saveBadge"));
316 $form->setTitle(
$lng->
txt(
"badge_image_template_form"));
319 $title->setMaxLength(255);
320 $title->setRequired(
true);
321 $form->addItem($title);
325 if ($a_mode ===
"create") {
326 $img->setRequired(
true);
328 $img->setUseCache(
false);
329 $img->setAllowDeletion(
false);
330 $form->addItem($img);
334 $types_mode->setValue(
"all");
335 $form->addItem($types_mode);
338 $types_mode->addOption($type_all);
341 $types_mode->addOption($type_spec);
345 $type_spec->addSubItem($types);
351 if ($a_mode ===
"create") {
352 $form->addCommandButton(
"saveImageTemplate",
$lng->
txt(
"save"));
354 $form->addCommandButton(
"updateImageTemplate",
$lng->
txt(
"save"));
356 $form->addCommandButton(
"listImageTemplates",
$lng->
txt(
"cancel"));
369 if ($form->checkInput()) {
371 $tmpl->setTitle($form->getInput(
"title"));
372 $tmpl->setTypes($form->getInput(
"type"));
375 $tmpl->uploadImage($_FILES[
"img"]);
377 $this->tpl->setOnScreenMessage(
'success',
$lng->
txt(
"settings_saved"),
true);
378 $ilCtrl->redirect($this,
"listImageTemplates");
381 $form->setValuesByPost();
394 $this->tabs_gui->setTabActive(
"imgtmpl");
396 $tmpl_id = $this->badge_request->getTemplateId();
398 $ilCtrl->redirect($this,
"listImageTemplates");
401 $ilCtrl->setParameter($this,
"tid", $tmpl_id);
436 $tmpl_id = $this->badge_request->getTemplateId();
438 $ilCtrl->redirect($this,
"listImageTemplates");
441 $ilCtrl->setParameter($this,
"tid", $tmpl_id);
446 if ($form->checkInput()) {
447 $tmpl->setTitle($form->getInput(
"title"));
449 if ($form->getInput(
"tmode") !==
"all") {
450 $tmpl->setTypes($form->getInput(
"type"));
452 $tmpl->setTypes(null);
457 $tmpl->uploadImage($_FILES[
"img"]);
459 $this->tpl->setOnScreenMessage(
'success',
$lng->
txt(
"settings_saved"),
true);
460 $ilCtrl->redirect($this,
"listImageTemplates");
464 $form->setValuesByPost();
477 $tmpl_ids = $this->badge_request->getIds();
479 $ilCtrl->redirect($this,
"listImageTemplates");
482 $ilTabs->clearTargets();
483 $ilTabs->setBackTarget(
485 $ilCtrl->getLinkTarget($this,
"listImageTemplates")
489 $confirmation_gui->setFormAction($ilCtrl->getFormAction($this));
490 $confirmation_gui->setHeaderText(
$lng->
txt(
"badge_template_deletion_confirmation"));
491 $confirmation_gui->setCancel(
$lng->
txt(
"cancel"),
"listImageTemplates");
492 $confirmation_gui->setConfirm(
$lng->
txt(
"delete"),
"deleteImageTemplates");
494 foreach ($tmpl_ids as $tmpl_id) {
496 $confirmation_gui->addItem(
"id[]", $tmpl_id, $tmpl->getTitle());
509 $tmpl_ids = $this->badge_request->getIds();
511 foreach ($tmpl_ids as $tmpl_id) {
516 $this->tpl->setOnScreenMessage(
'success',
$lng->
txt(
"settings_saved"),
true);
519 $ilCtrl->redirect($this,
"listImageTemplates");
533 $this->tabs_gui->setTabActive(
"obj_badges");
538 $ilAccess->checkAccess(
"write",
"", $this->object->getRefId())
550 $ilAccess->checkAccess(
"write",
"", $this->object->getRefId())
553 $tbl->writeFilterToSession();
564 $ilAccess->checkAccess(
"write",
"", $this->object->getRefId())
577 $parent_obj_id = $this->badge_request->getParentId();
578 if (!$parent_obj_id) {
579 $ilCtrl->redirect($this,
"listObjectBadges");
584 $this->tabs_gui->clearTargets();
585 $this->tabs_gui->setBackTarget(
587 $ilCtrl->getLinkTarget($this,
"listObjectBadges")
590 $ilCtrl->saveParameter($this,
"pid");
592 $tbl =
new ilBadgeUserTableGUI($this,
"listObjectBadgeUsers", 0, null, $parent_obj_id, $this->badge_request->getBadgeId());
598 $tbl =
new ilBadgeUserTableGUI($this,
"listObjectBadgeUsers", 0, null, 0, $this->badge_request->getBadgeId());
600 $tbl->writeFilterToSession();
606 $tbl =
new ilBadgeUserTableGUI($this,
"listObjectBadgeUsers", 0, null, 0, $this->badge_request->getBadgeId());
622 $badge_ids = $this->badge_request->getIds();
624 !$ilAccess->checkAccess(
"write",
"", $this->object->getRefId())) {
625 $ilCtrl->
redirect($this,
"listObjectBadges");
638 foreach ($badge_ids as $badge_id) {
639 $badge =
new ilBadge($badge_id);
640 $badge->setActive($a_status);
644 $this->tpl->setOnScreenMessage(
'success',
$lng->
txt(
"settings_saved"),
true);
645 $ilCtrl->redirect($this,
"listObjectBadges");
667 $ilTabs->clearTargets();
668 $ilTabs->setBackTarget(
670 $ilCtrl->getLinkTarget($this,
"listObjectBadges")
674 $confirmation_gui->setFormAction($ilCtrl->getFormAction($this));
675 $confirmation_gui->setHeaderText(
$lng->
txt(
"badge_deletion_confirmation"));
676 $confirmation_gui->setCancel(
$lng->
txt(
"cancel"),
"listObjectBadges");
677 $confirmation_gui->setConfirm(
$lng->
txt(
"delete"),
"deleteObjectBadges");
679 foreach ($badge_ids as $badge_id) {
680 $badge =
new ilBadge($badge_id);
681 $parent = $badge->getParentMeta();
685 $parent[
"id"] .
") " .
687 if ($parent[
"deleted"]) {
688 $container .=
' <span class="il_ItemAlertProperty">' .
$lng->
txt(
"deleted") .
'</span>';
691 $confirmation_gui->addItem(
710 foreach ($badge_ids as $badge_id) {
711 $badge =
new ilBadge($badge_id);
715 $this->tpl->setOnScreenMessage(
'success',
$lng->
txt(
"settings_saved"),
true);
716 $ilCtrl->redirect($this,
"listObjectBadges");
ilBadgeGUIRequest $badge_request
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
resetlistObjectBadgeUsers()
Class ilBadgeManagementGUI.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getObjectBadgesFromMultiAction()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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)
prepareOutput(bool $show_sub_objects=true)
__construct( $a_data, int $a_id, bool $a_call_by_reference=true, bool $a_prepare_output=true)
confirmDeleteImageTemplates()
setImageTemplateFormValues(ilPropertyFormGUI $a_form, ilBadgeImageTemplate $a_tmpl)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
checkAccess(string $a_operations, int $a_ref_id, string $a_type="")
checkAccess represents the main method of the RBAC-system in ILIAS3 developers want to use With this ...
initImageTemplateForm(string $a_mode)
resetOffset(bool $a_in_determination=false)
ilGlobalTemplateInterface $tpl
setContent(string $a_html)
Sets content for standard template.
editImageTemplate(ilPropertyFormGUI $a_form=null)
addImageTemplate(ilPropertyFormGUI $a_form=null)
static getInstancesByBadgeId(int $a_badge_id)
Class ilObjectGUI Basic methods of all Output classes.
applylistObjectBadgeUsers()
TableGUI class for badge listing.
editSettings(ilPropertyFormGUI $a_form=null)
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
toggleObjectBadges(bool $a_status)
checkPermission(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
confirmDeleteObjectBadges()