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";
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")
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();
232 foreach ($handler->getInactiveTypes() as
$type) {
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");
312 $ilCtrl = $this->ctrl;
315 $form->setFormAction($ilCtrl->getFormAction($this,
"saveBadge"));
316 $form->setTitle(
$lng->txt(
"badge_image_template_form"));
319 $title->setRequired(
true);
320 $form->addItem($title);
323 $img->setSuffixes(array(
"png",
"svg"));
324 if ($a_mode ===
"create") {
325 $img->setRequired(
true);
327 $img->setUseCache(
false);
328 $img->setAllowDeletion(
false);
329 $form->addItem(
$img);
332 $types_mode->setRequired(
true);
333 $types_mode->setValue(
"all");
334 $form->addItem($types_mode);
337 $types_mode->addOption($type_all);
339 $type_spec =
new ilRadioOption(
$lng->txt(
"badge_template_types_specific"),
"spec");
340 $types_mode->addOption($type_spec);
343 $types->setRequired(
true);
344 $type_spec->addSubItem($types);
350 if ($a_mode ===
"create") {
351 $form->addCommandButton(
"saveImageTemplate",
$lng->txt(
"save"));
353 $form->addCommandButton(
"updateImageTemplate",
$lng->txt(
"save"));
355 $form->addCommandButton(
"listImageTemplates",
$lng->txt(
"cancel"));
362 $ilCtrl = $this->ctrl;
365 $this->checkPermission(
"write");
367 $form = $this->initImageTemplateForm(
"create");
368 if ($form->checkInput()) {
370 $tmpl->setTitle($form->getInput(
"title"));
371 $tmpl->setTypes($form->getInput(
"type"));
374 $tmpl->uploadImage($_FILES[
"img"]);
376 $this->tpl->setOnScreenMessage(
'success',
$lng->txt(
"settings_saved"),
true);
377 $ilCtrl->redirect($this,
"listImageTemplates");
380 $form->setValuesByPost();
381 $this->addImageTemplate($form);
387 $ilCtrl = $this->
ctrl;
390 $this->checkPermission(
"write");
392 $this->assertActive();
393 $this->tabs_gui->setTabActive(
"imgtmpl");
395 $tmpl_id = $this->badge_request->getTemplateId();
397 $ilCtrl->redirect($this,
"listImageTemplates");
400 $ilCtrl->setParameter($this,
"tid", $tmpl_id);
405 $a_form = $this->initImageTemplateForm(
"edit");
406 $this->setImageTemplateFormValues($a_form, $tmpl);
409 $tpl->setContent($a_form->getHTML());
416 $a_form->getItemByPostVar(
"title")->setValue($a_tmpl->getTitle());
430 $ilCtrl = $this->ctrl;
433 $this->checkPermission(
"write");
435 $tmpl_id = $this->badge_request->getTemplateId();
437 $ilCtrl->redirect($this,
"listImageTemplates");
440 $ilCtrl->setParameter($this,
"tid", $tmpl_id);
444 $form = $this->initImageTemplateForm(
"update");
445 if ($form->checkInput()) {
446 $tmpl->setTitle($form->getInput(
"title"));
448 if ($form->getInput(
"tmode") !==
"all") {
449 $tmpl->setTypes($form->getInput(
"type"));
451 $tmpl->setTypes(
null);
456 $tmpl->uploadImage($_FILES[
"img"]);
458 $this->tpl->setOnScreenMessage(
'success',
$lng->txt(
"settings_saved"),
true);
459 $ilCtrl->redirect($this,
"listImageTemplates");
462 $this->setImageTemplateFormValues($form, $tmpl);
463 $form->setValuesByPost();
464 $this->editImageTemplate($form);
469 $ilCtrl = $this->ctrl;
472 $ilTabs = $this->tabs;
474 $this->checkPermission(
"write");
476 $tmpl_ids = $this->badge_request->getIds();
478 $ilCtrl->redirect($this,
"listImageTemplates");
481 $ilTabs->clearTargets();
482 $ilTabs->setBackTarget(
484 $ilCtrl->getLinkTarget($this,
"listImageTemplates")
488 $confirmation_gui->setFormAction($ilCtrl->getFormAction($this));
489 $confirmation_gui->setHeaderText(
$lng->txt(
"badge_template_deletion_confirmation"));
490 $confirmation_gui->setCancel(
$lng->txt(
"cancel"),
"listImageTemplates");
491 $confirmation_gui->setConfirm(
$lng->txt(
"delete"),
"deleteImageTemplates");
493 foreach ($tmpl_ids as $tmpl_id) {
495 $confirmation_gui->addItem(
"id[]", $tmpl_id, $tmpl->getTitle());
498 $tpl->setContent($confirmation_gui->getHTML());
503 $ilCtrl = $this->ctrl;
506 $this->checkPermission(
"write");
508 $tmpl_ids = $this->badge_request->getIds();
510 foreach ($tmpl_ids as $tmpl_id) {
515 $this->tpl->setOnScreenMessage(
'success',
$lng->txt(
"settings_saved"),
true);
518 $ilCtrl->redirect($this,
"listImageTemplates");
528 $ilAccess = $this->access;
531 $this->assertActive();
532 $this->tabs_gui->setTabActive(
"obj_badges");
537 $ilAccess->checkAccess(
"write",
"", $this->object->getRefId())
539 $tpl->setContent($tbl->getHTML());
544 $ilAccess = $this->access;
549 $ilAccess->checkAccess(
"write",
"", $this->object->getRefId())
552 $tbl->writeFilterToSession();
553 $this->listObjectBadges();
558 $ilAccess = $this->access;
563 $ilAccess->checkAccess(
"write",
"", $this->object->getRefId())
567 $this->listObjectBadges();
572 $ilCtrl = $this->ctrl;
576 $parent_obj_id = $this->badge_request->getParentId();
577 if (!$parent_obj_id) {
578 $ilCtrl->redirect($this,
"listObjectBadges");
581 $this->assertActive();
583 $this->tabs_gui->clearTargets();
584 $this->tabs_gui->setBackTarget(
586 $ilCtrl->getLinkTarget($this,
"listObjectBadges")
589 $ilCtrl->saveParameter($this,
"pid");
591 $tbl =
new ilBadgeUserTableGUI($this,
"listObjectBadgeUsers", 0,
null, $parent_obj_id, $this->badge_request->getBadgeId());
592 $tpl->setContent($tbl->getHTML());
597 $tbl =
new ilBadgeUserTableGUI($this,
"listObjectBadgeUsers", 0,
null, 0, $this->badge_request->getBadgeId());
599 $tbl->writeFilterToSession();
600 $this->listObjectBadgeUsers();
605 $tbl =
new ilBadgeUserTableGUI($this,
"listObjectBadgeUsers", 0,
null, 0, $this->badge_request->getBadgeId());
608 $this->listObjectBadgeUsers();
618 $ilAccess = $this->access;
619 $ilCtrl = $this->ctrl;
621 $badge_ids = $this->badge_request->getIds();
623 !$ilAccess->checkAccess(
"write",
"", $this->object->getRefId())) {
624 $ilCtrl->redirect($this,
"listObjectBadges");
632 $ilCtrl = $this->ctrl;
635 $badge_ids = $this->getObjectBadgesFromMultiAction();
637 foreach ($badge_ids as $badge_id) {
638 $badge =
new ilBadge($badge_id);
639 $badge->setActive($a_status);
643 $this->tpl->setOnScreenMessage(
'success',
$lng->txt(
"settings_saved"),
true);
644 $ilCtrl->redirect($this,
"listObjectBadges");
649 $this->toggleObjectBadges(
true);
654 $this->toggleObjectBadges(
false);
659 $ilCtrl = $this->ctrl;
662 $ilTabs = $this->tabs;
664 $badge_ids = $this->getObjectBadgesFromMultiAction();
666 $ilTabs->clearTargets();
667 $ilTabs->setBackTarget(
669 $ilCtrl->getLinkTarget($this,
"listObjectBadges")
673 $confirmation_gui->setFormAction($ilCtrl->getFormAction($this));
674 $confirmation_gui->setHeaderText(
$lng->txt(
"badge_deletion_confirmation"));
675 $confirmation_gui->setCancel(
$lng->txt(
"cancel"),
"listObjectBadges");
676 $confirmation_gui->setConfirm(
$lng->txt(
"delete"),
"deleteObjectBadges");
678 foreach ($badge_ids as $badge_id) {
679 $badge =
new ilBadge($badge_id);
680 $parent = $badge->getParentMeta();
684 $parent[
"id"] .
") " .
686 if ($parent[
"deleted"]) {
687 $container .=
' <span class="il_ItemAlertProperty">' .
$lng->txt(
"deleted") .
'</span>';
690 $confirmation_gui->addItem(
699 $tpl->setContent($confirmation_gui->getHTML());
704 $ilCtrl = $this->ctrl;
707 $badge_ids = $this->getObjectBadgesFromMultiAction();
709 foreach ($badge_ids as $badge_id) {
710 $badge =
new ilBadge($badge_id);
714 $this->tpl->setOnScreenMessage(
'success',
$lng->txt(
"settings_saved"),
true);
715 $ilCtrl->redirect($this,
"listObjectBadges");
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
static getInstancesByBadgeId(int $a_badge_id)
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...
Class ilBadgeManagementGUI.
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...
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...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
initImageTemplateForm(string $a_mode)
confirmDeleteObjectBadges()
applylistObjectBadgeUsers()
setImageTemplateFormValues(ilPropertyFormGUI $a_form, ilBadgeImageTemplate $a_tmpl)
editImageTemplate(ilPropertyFormGUI $a_form=null)
resetlistObjectBadgeUsers()
confirmDeleteImageTemplates()
addImageTemplate(ilPropertyFormGUI $a_form=null)
ilBadgeGUIRequest $badge_request
getAdminTabs()
administration tabs show only permissions and trash folder
toggleObjectBadges(bool $a_status)
getObjectBadgesFromMultiAction()
__construct( $a_data, int $a_id, bool $a_call_by_reference=true, bool $a_prepare_output=true)
editSettings(ilPropertyFormGUI $a_form=null)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilObjectGUI Basic methods of all Output classes.
ilGlobalTemplateInterface $tpl
checkPermission(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
prepareOutput(bool $show_sub_objects=true)
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
class ilRbacSystem system function like checkAccess, addActiveRole ... Supporting system functions ar...
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 ...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a text property in a property form.
setContent(string $a_html)
Sets content for standard template.
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc