4 include_once(
"./Services/Object/classes/class.ilObjectGUI.php");
5 include_once(
"./Services/Badge/classes/class.ilBadgeHandler.php");
40 public function __construct($a_data, $a_id, $a_call_by_reference =
true, $a_prepare_output =
true)
44 $this->rbacsystem = $DIC->rbac()->system();
45 $this->ctrl = $DIC->ctrl();
46 $this->access = $DIC->access();
47 $this->lng = $DIC->language();
48 $this->toolbar = $DIC->toolbar();
49 $this->tpl = $DIC[
"tpl"];
50 $this->tabs = $DIC->tabs();
52 parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
54 $this->lng->loadLanguageModule(
"badge");
59 $next_class = $this->ctrl->getNextClass($this);
60 $cmd = $this->ctrl->getCmd();
64 switch ($next_class) {
65 case 'ilpermissiongui':
66 $this->tabs_gui->setTabActive(
'perm_settings');
67 include_once(
"Services/AccessControl/classes/class.ilPermissionGUI.php");
69 $this->ctrl->forwardCommand($perm_gui);
72 case 'ilbadgemanagementgui':
74 $this->tabs_gui->setTabActive(
'activity');
75 include_once
"Services/Badge/classes/class.ilBadgeManagementGUI.php";
77 $this->ctrl->forwardCommand($gui);
81 if (!$cmd || $cmd ==
'view') {
82 $cmd =
"editSettings";
95 if (
$rbacsystem->checkAccess(
"visible,read", $this->object->getRefId())) {
96 $this->tabs_gui->addTab(
98 $this->lng->txt(
"settings"),
99 $this->ctrl->getLinkTarget($this,
"editSettings")
103 $this->tabs_gui->addTab(
105 $this->lng->txt(
"badge_types"),
106 $this->ctrl->getLinkTarget($this,
"listTypes")
109 $this->tabs_gui->addTab(
111 $this->lng->txt(
"badge_image_templates"),
112 $this->ctrl->getLinkTarget($this,
"listImageTemplates")
115 $this->tabs_gui->addTab(
117 $this->lng->txt(
"badge_activity_badges"),
118 $this->ctrl->getLinkTargetByClass(
"ilbadgemanagementgui",
"")
121 $this->tabs_gui->addTab(
123 $this->lng->txt(
"badge_object_badges"),
124 $this->ctrl->getLinkTarget($this,
"listObjectBadges")
129 if (
$rbacsystem->checkAccess(
'edit_permission', $this->object->getRefId())) {
130 $this->tabs_gui->addTab(
132 $this->lng->txt(
"perm_settings"),
133 $this->ctrl->getLinkTargetByClass(
'ilpermissiongui',
"perm")
141 $this->ctrl->redirect($this,
"editSettings");
152 $this->tabs_gui->setTabActive(
"settings");
158 $this->tpl->setContent($a_form->getHTML());
168 if (
$form->checkInput()) {
169 $obi = (bool)
$form->getInput(
"act")
170 ? (bool)
$form->getInput(
"obi")
176 $handler->setObiOrganisation(trim(
$form->getInput(
"obi_org")));
183 $ilCtrl->redirect($this,
"editSettings");
186 $form->setValuesByPost();
194 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
196 $form->setFormAction($this->ctrl->getFormAction($this));
197 $form->setTitle($this->lng->txt(
"badge_settings"));
199 if ($ilAccess->checkAccess(
"write",
"", $this->object->getRefId())) {
200 $form->addCommandButton(
"saveSettings", $this->lng->txt(
"save"));
201 $form->addCommandButton(
"editSettings", $this->lng->txt(
"cancel"));
205 $act->
setInfo($this->lng->txt(
"badge_service_activate_info"));
206 $form->addItem($act);
230 $act->setChecked(
$handler->isActive());
252 $this->tabs_gui->setTabActive(
"types");
254 include_once
"Services/Badge/classes/class.ilBadgeTypesTableGUI.php";
258 $ilAccess->checkAccess(
"write",
"", $this->object->getRefId())
260 $this->tpl->setContent(
$tbl->getHTML());
274 if (!in_array(
$type, $ids)) {
278 $handler->setInactiveTypes($inactive);
282 $this->ctrl->redirect($this,
"listTypes");
294 $inactive = array_merge(
$handler->getInactiveTypes(), $ids);
295 $handler->setInactiveTypes($inactive);
299 $this->ctrl->redirect($this,
"listTypes");
315 $this->tabs_gui->setTabActive(
"imgtmpl");
318 $ilToolbar->addButton(
319 $lng->txt(
"badge_add_template"),
320 $ilCtrl->getLinkTarget($this,
"addImageTemplate")
324 include_once
"Services/Badge/classes/class.ilBadgeImageTemplateTableGUI.php";
327 "listImageTemplates",
328 $ilAccess->checkAccess(
"write",
"", $this->object->getRefId())
330 $this->tpl->setContent(
$tbl->getHTML());
340 $this->tabs_gui->setTabActive(
"imgtmpl");
346 $tpl->setContent($a_form->getHTML());
354 include_once
"Services/Form/classes/class.ilPropertyFormGUI.php";
356 $form->setFormAction(
$ilCtrl->getFormAction($this,
"saveBadge"));
357 $form->setTitle(
$lng->txt(
"badge_image_template_form"));
360 $title->setRequired(
true);
365 if ($a_mode ==
"create") {
366 $img->setRequired(
true);
368 $img->setALlowDeletion(
false);
373 $form->addItem($types_mode);
376 $types_mode->addOption($type_all);
378 $type_spec =
new ilRadioOption(
$lng->txt(
"badge_template_types_specific"),
"spec");
379 $types_mode->addOption($type_spec);
383 $type_spec->addSubItem($types);
389 if ($a_mode ==
"create") {
390 $form->addCommandButton(
"saveImageTemplate",
$lng->txt(
"save"));
392 $form->addCommandButton(
"updateImageTemplate",
$lng->txt(
"save"));
394 $form->addCommandButton(
"listImageTemplates",
$lng->txt(
"cancel"));
407 if (
$form->checkInput()) {
408 include_once
"Services/Badge/classes/class.ilBadgeImageTemplate.php";
410 $tmpl->setTitle(
$form->getInput(
"title"));
411 $tmpl->setTypes(
$form->getInput(
"type"));
414 $tmpl->uploadImage($_FILES[
"img"]);
417 $ilCtrl->redirect($this,
"listImageTemplates");
420 $form->setValuesByPost();
432 $this->tabs_gui->setTabActive(
"imgtmpl");
434 $tmpl_id = $_REQUEST[
"tid"];
436 $ilCtrl->redirect($this,
"listImageTemplates");
439 $ilCtrl->setParameter($this,
"tid", $tmpl_id);
441 include_once
"Services/Badge/classes/class.ilBadgeImageTemplate.php";
449 $tpl->setContent($a_form->getHTML());
473 $tmpl_id = $_REQUEST[
"tid"];
475 $ilCtrl->redirect($this,
"listImageTemplates");
478 $ilCtrl->setParameter($this,
"tid", $tmpl_id);
480 include_once
"Services/Badge/classes/class.ilBadgeImageTemplate.php";
484 if (
$form->checkInput()) {
485 $tmpl->setTitle(
$form->getInput(
"title"));
487 if (
$form->getInput(
"tmode") !=
"all") {
488 $tmpl->setTypes(
$form->getInput(
"type"));
490 $tmpl->setTypes(null);
495 $tmpl->uploadImage($_FILES[
"img"]);
498 $ilCtrl->redirect($this,
"listImageTemplates");
502 $form->setValuesByPost();
515 $tmpl_ids = $_REQUEST[
"id"];
517 $ilCtrl->redirect($this,
"listImageTemplates");
520 $ilTabs->clearTargets();
521 $ilTabs->setBackTarget(
523 $ilCtrl->getLinkTarget($this,
"listImageTemplates")
526 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
528 $confirmation_gui->setFormAction(
$ilCtrl->getFormAction($this));
529 $confirmation_gui->setHeaderText(
$lng->txt(
"badge_template_deletion_confirmation"));
530 $confirmation_gui->setCancel(
$lng->txt(
"cancel"),
"listImageTemplates");
531 $confirmation_gui->setConfirm(
$lng->txt(
"delete"),
"deleteImageTemplates");
533 include_once(
"./Services/Badge/classes/class.ilBadgeImageTemplate.php");
534 foreach ($tmpl_ids as $tmpl_id) {
536 $confirmation_gui->addItem(
"id[]", $tmpl_id, $tmpl->getTitle());
539 $tpl->setContent($confirmation_gui->getHTML());
549 $tmpl_ids = $_REQUEST[
"id"];
551 include_once(
"./Services/Badge/classes/class.ilBadgeImageTemplate.php");
552 foreach ($tmpl_ids as $tmpl_id) {
560 $ilCtrl->redirect($this,
"listImageTemplates");
574 $this->tabs_gui->setTabActive(
"obj_badges");
576 include_once(
"./Services/Badge/classes/class.ilObjectBadgeTableGUI.php");
580 $ilAccess->checkAccess(
"write",
"", $this->object->getRefId())
589 include_once
"Services/Badge/classes/class.ilObjectBadgeTableGUI.php";
593 $ilAccess->checkAccess(
"write",
"", $this->object->getRefId())
596 $tbl->writeFilterToSession();
604 include_once
"Services/Badge/classes/class.ilObjectBadgeTableGUI.php";
608 $ilAccess->checkAccess(
"write",
"", $this->object->getRefId())
621 $parent_obj_id = $_REQUEST[
"pid"];
622 if (!$parent_obj_id) {
623 $ilCtrl->redirect($this,
"listObjectBadges");
628 $this->tabs_gui->clearTargets();
629 $this->tabs_gui->setBackTarget(
631 $ilCtrl->getLinkTarget($this,
"listObjectBadges")
634 $ilCtrl->saveParameter($this,
"pid");
636 include_once
"Services/Badge/classes/class.ilBadgeUserTableGUI.php";
643 include_once
"Services/Badge/classes/class.ilBadgeUserTableGUI.php";
646 $tbl->writeFilterToSession();
652 include_once
"Services/Badge/classes/class.ilBadgeUserTableGUI.php";
669 $badge_ids = $_REQUEST[
"id"];
671 !$ilAccess->checkAccess(
"write",
"", $this->object->getRefId())) {
672 $ilCtrl->redirect($this,
"listObjectBadges");
685 include_once
"Services/Badge/classes/class.ilBadge.php";
686 foreach ($badge_ids as $badge_id) {
687 $badge =
new ilBadge($badge_id);
688 $badge->setActive($a_status);
693 $ilCtrl->redirect($this,
"listObjectBadges");
715 $ilTabs->clearTargets();
716 $ilTabs->setBackTarget(
718 $ilCtrl->getLinkTarget($this,
"listObjectBadges")
721 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
723 $confirmation_gui->setFormAction(
$ilCtrl->getFormAction($this));
724 $confirmation_gui->setHeaderText(
$lng->txt(
"badge_deletion_confirmation"));
725 $confirmation_gui->setCancel(
$lng->txt(
"cancel"),
"listObjectBadges");
726 $confirmation_gui->setConfirm(
$lng->txt(
"delete"),
"deleteObjectBadges");
728 include_once
"Services/Badge/classes/class.ilBadge.php";
729 include_once
"Services/Badge/classes/class.ilBadgeAssignment.php";
730 foreach ($badge_ids as $badge_id) {
731 $badge =
new ilBadge($badge_id);
732 $parent = $badge->getParentMeta();
736 $parent[
"id"] .
") " .
738 if ((
bool) $parent[
"deleted"]) {
739 $container .=
' <span class="il_ItemAlertProperty">' .
$lng->txt(
"deleted") .
'</span>';
742 $confirmation_gui->addItem(
751 $tpl->setContent($confirmation_gui->getHTML());
761 include_once
"Services/Badge/classes/class.ilBadge.php";
762 foreach ($badge_ids as $badge_id) {
763 $badge =
new ilBadge($badge_id);
768 $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()
if(!array_key_exists('StateId', $_REQUEST)) $id
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
if(isset($_POST['submit'])) $form
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()