ILIAS  release_8 Revision v8.24
ilObjBadgeAdministrationGUI Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilObjBadgeAdministrationGUI:
+ Collaboration diagram for ilObjBadgeAdministrationGUI:

Public Member Functions

 __construct ( $a_data, int $a_id, bool $a_call_by_reference=true, bool $a_prepare_output=true)
 
 executeCommand ()
 
 getAdminTabs ()
 administration tabs show only permissions and trash folder More...
 
- Public Member Functions inherited from ilObjectGUI
 __construct ($data, int $id=0, bool $call_by_reference=true, bool $prepare_output=true)
 
 getRefId ()
 
 setAdminMode (string $mode)
 
 getAdminMode ()
 
 getObject ()
 
 executeCommand ()
 
 withReferences ()
 determines whether objects are referenced or not (got ref ids or not) More...
 
 setCreationMode (bool $mode=true)
 if true, a creation screen is displayed the current [ref_id] don't belong to the current class! The mode is determined in ilRepositoryGUI More...
 
 getCreationMode ()
 
 prepareOutput (bool $show_sub_objects=true)
 
 getAdminTabs ()
 administration tabs show only permissions and trash folder More...
 
 getHTML ()
 
 confirmedDeleteObject ()
 confirmed deletion of object -> objects are moved to trash or deleted immediately, if trash is disabled More...
 
 cancelDeleteObject ()
 cancel deletion of object More...
 
 cancelObject ()
 cancel action and go back to previous page More...
 
 createObject ()
 create new object form More...
 
 cancelCreation ()
 cancel create action and go back to repository parent More...
 
 saveObject ()
 
 getDidacticTemplateVar (string $type)
 Get didactic template setting from creation screen. More...
 
 putObjectInTree (ilObject $obj, int $parent_node_id=null)
 Add object to tree at given position. More...
 
 editObject ()
 
 addExternalEditFormCustom (ilPropertyFormGUI $form)
 
 updateObject ()
 updates object entry in object_data More...
 
 getFormAction (string $cmd, string $default_form_action="")
 Get form action for command (command is method name without "Object", e.g. More...
 
 isVisible (int $ref_id, string $type)
 
 viewObject ()
 viewObject container presentation for "administration -> repository, trash, permissions" More...
 
 deleteObject (bool $error=false)
 Display deletion confirmation screen. More...
 
 setColumnSettings (ilColumnGUI $column_gui)
 
 redirectAfterCreation ()
 Redirect after creation, see https://docu.ilias.de/goto_docu_wiki_wpage_5035_1357.html Should be overwritten and redirect to settings screen. More...
 
 addToDeskObject ()
 
 removeFromDeskObject ()
 
- Public Member Functions inherited from ILIAS\Object\ImplementsCreationCallback
 callCreationCallback (\ilObject $object, \ilObjectDefinition $obj_definition, int $requested_crtcb)
 

Protected Member Functions

 assertActive ()
 
 editSettings (ilPropertyFormGUI $a_form=null)
 
 saveSettings ()
 
 initFormSettings ()
 
 listTypes ()
 
 activateTypes ()
 
 deactivateTypes ()
 
 listImageTemplates ()
 
 addImageTemplate (ilPropertyFormGUI $a_form=null)
 
 initImageTemplateForm (string $a_mode)
 
 saveImageTemplate ()
 
 editImageTemplate (ilPropertyFormGUI $a_form=null)
 
 setImageTemplateFormValues (ilPropertyFormGUI $a_form, ilBadgeImageTemplate $a_tmpl)
 
 updateImageTemplate ()
 
 confirmDeleteImageTemplates ()
 
 deleteImageTemplates ()
 
 listObjectBadges ()
 
 applyObjectFilter ()
 
 resetObjectFilter ()
 
 listObjectBadgeUsers ()
 
 applylistObjectBadgeUsers ()
 
 resetlistObjectBadgeUsers ()
 
 getObjectBadgesFromMultiAction ()
 
 toggleObjectBadges (bool $a_status)
 
 activateObjectBadges ()
 
 deactivateObjectBadges ()
 
 confirmDeleteObjectBadges ()
 
 deleteObjectBadges ()
 
- Protected Member Functions inherited from ilObjectGUI
 getObjectService ()
 
 assignObject ()
 
 setTitleAndDescription ()
 
 initHeaderAction (?string $sub_type=null, ?int $sub_id=null)
 Add header action menu. More...
 
 insertHeaderAction (?ilObjectListGUI $list_gui=null)
 Insert header action into main template. More...
 
 addHeaderAction ()
 Add header action menu. More...
 
 redrawHeaderActionObject ()
 Ajax call: redraw action header only. More...
 
 setTabs ()
 set admin tabs More...
 
 setAdminTabs ()
 set admin tabs More...
 
 setLocator ()
 
 addLocatorItems ()
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 omitLocator (bool $omit=true)
 
 addAdminLocatorItems (bool $do_not_add_object=false)
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 initCreationForms (string $new_type)
 Init creation forms. More...
 
 getCreationFormsHTML (array $forms)
 Get HTML for creation forms (accordion) More...
 
 initCreateForm (string $new_type)
 
 initDidacticTemplate (ilPropertyFormGUI $form)
 
 addDidacticTemplateOptions (array &$a_options)
 Add custom templates. More...
 
 afterSave (ilObject $new_object)
 Post (successful) object creation hook. More...
 
 initEditForm ()
 
 initEditCustomForm (ilPropertyFormGUI $a_form)
 Add custom fields to update form. More...
 
 getEditFormValues ()
 
 getEditFormCustomValues (array &$a_values)
 Add values to custom edit fields. More...
 
 validateCustom (ilPropertyFormGUI $form)
 Validate custom values (if not possible with checkInput()) More...
 
 updateCustom (ilPropertyFormGUI $form)
 Insert custom update form values into object. More...
 
 afterUpdate ()
 Post (successful) object update hook. More...
 
 initImportForm (string $new_type)
 
 importFileObject (int $parent_id=null)
 
 afterImport (ilObject $new_object)
 Post (successful) object import hook. More...
 
 setFormAction (string $cmd, string $form_action)
 
 getReturnLocation (string $cmd, string $default_location="")
 Get return location for command (command is method name without "Object", e.g. More...
 
 setReturnLocation (string $cmd, string $location)
 set specific return location for command More...
 
 getTargetFrame (string $cmd, string $default_target_frame="")
 get target frame for command (command is method name without "Object", e.g. More...
 
 setTargetFrame (string $cmd, string $target_frame)
 Set specific target frame for command. More...
 
 showPossibleSubObjects ()
 show possible sub objects (pull down menu) More...
 
 getTabs ()
 @abstract overwrite in derived GUI class of your object type More...
 
 redirectToRefId (int $ref_id, string $cmd="")
 redirects to (repository) view per ref id usually to a container and usually used at the end of a save/import method where the object gui type (of the new object) doesn't match with the type of the current ["ref_id"] value of the request More...
 
 fillCloneTemplate (?string $tpl_name, string $type)
 Fill object clone template This method can be called from any object GUI class that wants to offer object cloning. More...
 
 getCenterColumnHTML ()
 Get center column. More...
 
 getRightColumnHTML ()
 Display right column. More...
 
 checkPermission (string $perm, string $cmd="", string $type="", ?int $ref_id=null)
 
 checkPermissionBool (string $perm, string $cmd="", string $type="", ?int $ref_id=null)
 
 enableDragDropFileUpload ()
 Enables the file upload into this object by dropping files. More...
 
 showCustomIconsEditing ( $input_colspan=1, ilPropertyFormGUI $form=null, $as_section=true)
 show edit section of custom icons for container More...
 

Protected Attributes

ilRbacSystem $rbacsystem
 
ilBadgeGUIRequest $badge_request
 
ilTabsGUI $tabs
 
- Protected Attributes inherited from ilObjectGUI
ILIAS Notes Service $notes_service
 
ServerRequestInterface $request
 
ilLocatorGUI $locator
 
ilObjUser $user
 
ilAccessHandler $access
 
ilSetting $settings
 
ilToolbarGUI $toolbar
 
ilRbacAdmin $rbac_admin
 
ilRbacSystem $rbac_system
 
ilRbacReview $rbac_review
 
ilObjectService $object_service
 
ilObjectDefinition $obj_definition
 
ilGlobalTemplateInterface $tpl
 
ilTree $tree
 
ilCtrl $ctrl
 
ilErrorHandling $error
 
ilLanguage $lng
 
ilTabsGUI $tabs_gui
 
ILIAS $ilias
 
ArrayBasedRequestWrapper $post_wrapper
 
RequestWrapper $request_wrapper
 
Factory $refinery
 
ilFavouritesManager $favourites
 
ilObjectCustomIconFactory $custom_icon_factory
 
ilObject $object = null
 
bool $creation_mode = false
 
 $data
 
int $id
 
bool $call_by_reference = false
 
bool $prepare_output
 
int $ref_id
 
int $obj_id
 
int $maxcount
 
array $form_action = []
 
array $return_location = []
 
array $target_frame = []
 
string $tmp_import_dir
 
string $sub_objects = ""
 
bool $omit_locator = false
 
string $type = ""
 
string $admin_mode = self::ADMIN_MODE_NONE
 
int $requested_ref_id = 0
 
int $requested_crtptrefid = 0
 
int $requested_crtcb = 0
 
string $requested_new_type = ""
 
string $link_params
 
string $html = ""
 

Additional Inherited Members

- Static Public Member Functions inherited from ilObjectGUI
static _gotoRepositoryRoot (bool $raise_error=false)
 Goto repository root. More...
 
static _gotoRepositoryNode (int $ref_id, string $cmd="")
 
static _gotoSharedWorkspaceNode (int $wsp_id)
 
- Data Fields inherited from ilObjectGUI
const ALLOWED_TAGS_IN_TITLE_AND_DESCRIPTION
 
const ADMIN_MODE_NONE = ""
 
const ADMIN_MODE_SETTINGS = "settings"
 
const ADMIN_MODE_REPOSITORY = "repository"
 
const UPLOAD_TYPE_LOCAL = 1
 
const UPLOAD_TYPE_UPLOAD_DIRECTORY = 2
 
const CFORM_NEW = 1
 
const CFORM_IMPORT = 2
 
const CFORM_CLONE = 3
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Badge Administration Settings.

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om @ilCtrl_Calls ilObjBadgeAdministrationGUI: ilPermissionGUI, ilBadgeManagementGUI @ilCtrl_IsCalledBy ilObjBadgeAdministrationGUI: ilAdministrationGUI

Definition at line 26 of file class.ilObjBadgeAdministrationGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilObjBadgeAdministrationGUI::__construct (   $data,
int  $id,
bool  $call_by_reference = true,
bool  $prepare_output = true 
)
Parameters
mixed$data
int$id
bool$call_by_reference
bool$prepare_output
Exceptions
ilCtrlException

Reimplemented from ilObjectGUI.

Definition at line 32 of file class.ilObjBadgeAdministrationGUI.php.

37 {
38 global $DIC;
39
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();
47 $this->type = "bdga";
48 parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
49
50 $this->badge_request = new ilBadgeGUIRequest(
51 $DIC->http(),
52 $DIC->refinery()
53 );
54
55 $this->lng->loadLanguageModule("badge");
56 }
global $DIC
Definition: feed.php:28
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), ILIAS\Repository\access(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ILIAS\Repository\tabs(), and ILIAS\Repository\toolbar().

+ Here is the call graph for this function:

Member Function Documentation

◆ activateObjectBadges()

ilObjBadgeAdministrationGUI::activateObjectBadges ( )
protected

Definition at line 647 of file class.ilObjBadgeAdministrationGUI.php.

647 : void
648 {
649 $this->toggleObjectBadges(true);
650 }

◆ activateTypes()

ilObjBadgeAdministrationGUI::activateTypes ( )
protected

Definition at line 222 of file class.ilObjBadgeAdministrationGUI.php.

222 : void
223 {
225
226 $this->assertActive();
227
228 $ids = $this->badge_request->getIds();
229 if ($this->checkPermissionBool("write") && count($ids) > 0) {
230 $handler = ilBadgeHandler::getInstance();
231 $inactive = [];
232 foreach ($handler->getInactiveTypes() as $type) {
233 if (!in_array($type, $ids)) {
234 $inactive[] = $type;
235 }
236 }
237 $handler->setInactiveTypes($inactive);
238
239 $this->tpl->setOnScreenMessage('success', $lng->txt("settings_saved"), true);
240 }
241 $this->ctrl->redirect($this, "listTypes");
242 }
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...
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
ilLanguage $lng

References ilObjectGUI\$lng, ilObjectGUI\$type, assertActive(), ilObjectGUI\checkPermissionBool(), ILIAS\Repository\ctrl(), ilBadgeHandler\getInstance(), and ilLanguage\txt().

+ Here is the call graph for this function:

◆ addImageTemplate()

ilObjBadgeAdministrationGUI::addImageTemplate ( ilPropertyFormGUI  $a_form = null)
protected

Definition at line 291 of file class.ilObjBadgeAdministrationGUI.php.

293 : void {
295
296 $this->checkPermission("write");
297
298 $this->assertActive();
299 $this->tabs_gui->setTabActive("imgtmpl");
300
301 if (!$a_form) {
302 $a_form = $this->initImageTemplateForm("create");
303 }
304
305 $tpl->setContent($a_form->getHTML());
306 }
ilGlobalTemplateInterface $tpl
checkPermission(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
setContent(string $a_html)
Sets content for standard template.

◆ applylistObjectBadgeUsers()

ilObjBadgeAdministrationGUI::applylistObjectBadgeUsers ( )
protected

Definition at line 595 of file class.ilObjBadgeAdministrationGUI.php.

595 : void
596 {
597 $tbl = new ilBadgeUserTableGUI($this, "listObjectBadgeUsers", 0, null, 0, $this->badge_request->getBadgeId());
598 $tbl->resetOffset();
599 $tbl->writeFilterToSession();
600 $this->listObjectBadgeUsers();
601 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ applyObjectFilter()

ilObjBadgeAdministrationGUI::applyObjectFilter ( )
protected

Definition at line 542 of file class.ilObjBadgeAdministrationGUI.php.

542 : void
543 {
544 $ilAccess = $this->access;
545
546 $tbl = new ilObjectBadgeTableGUI(
547 $this,
548 "listObjectBadges",
549 $ilAccess->checkAccess("write", "", $this->object->getRefId())
550 );
551 $tbl->resetOffset();
552 $tbl->writeFilterToSession();
553 $this->listObjectBadges();
554 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilAccessHandler $access

◆ assertActive()

ilObjBadgeAdministrationGUI::assertActive ( )
protected

Definition at line 136 of file class.ilObjBadgeAdministrationGUI.php.

136 : void
137 {
138 if (!ilBadgeHandler::getInstance()->isActive()) {
139 $this->ctrl->redirect($this, "editSettings");
140 }
141 }

References ILIAS\Repository\ctrl(), and ilBadgeHandler\getInstance().

Referenced by activateTypes(), deactivateTypes(), executeCommand(), listImageTemplates(), and listTypes().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ confirmDeleteImageTemplates()

ilObjBadgeAdministrationGUI::confirmDeleteImageTemplates ( )
protected

Definition at line 467 of file class.ilObjBadgeAdministrationGUI.php.

467 : void
468 {
469 $ilCtrl = $this->ctrl;
472 $ilTabs = $this->tabs;
473
474 $this->checkPermission("write");
475
476 $tmpl_ids = $this->badge_request->getIds();
477 if (!$tmpl_ids) {
478 $ilCtrl->redirect($this, "listImageTemplates");
479 }
480
481 $ilTabs->clearTargets();
482 $ilTabs->setBackTarget(
483 $lng->txt("back"),
484 $ilCtrl->getLinkTarget($this, "listImageTemplates")
485 );
486
487 $confirmation_gui = new ilConfirmationGUI();
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");
492
493 foreach ($tmpl_ids as $tmpl_id) {
494 $tmpl = new ilBadgeImageTemplate($tmpl_id);
495 $confirmation_gui->addItem("id[]", $tmpl_id, $tmpl->getTitle());
496 }
497
498 $tpl->setContent($confirmation_gui->getHTML());
499 }
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...

References $lng, and $tpl.

◆ confirmDeleteObjectBadges()

ilObjBadgeAdministrationGUI::confirmDeleteObjectBadges ( )
protected

Definition at line 657 of file class.ilObjBadgeAdministrationGUI.php.

657 : void
658 {
659 $ilCtrl = $this->ctrl;
662 $ilTabs = $this->tabs;
663
664 $badge_ids = $this->getObjectBadgesFromMultiAction();
665
666 $ilTabs->clearTargets();
667 $ilTabs->setBackTarget(
668 $lng->txt("back"),
669 $ilCtrl->getLinkTarget($this, "listObjectBadges")
670 );
671
672 $confirmation_gui = new ilConfirmationGUI();
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");
677
678 foreach ($badge_ids as $badge_id) {
679 $badge = new ilBadge($badge_id);
680 $parent = $badge->getParentMeta();
681
682 // :TODO: container presentation
683 $container = "(" . $parent["type"] . "/" .
684 $parent["id"] . ") " .
685 $parent["title"];
686 if ($parent["deleted"]) {
687 $container .= ' <span class="il_ItemAlertProperty">' . $lng->txt("deleted") . '</span>';
688 }
689
690 $confirmation_gui->addItem(
691 "id[]",
692 $badge_id,
693 $container . " - " .
694 $badge->getTitle() .
695 " (" . count(ilBadgeAssignment::getInstancesByBadgeId($badge_id)) . ")"
696 );
697 }
698
699 $tpl->setContent($confirmation_gui->getHTML());
700 }
static getInstancesByBadgeId(int $a_badge_id)
$container
@noRector
Definition: wac.php:14

References $container, $lng, $tpl, and ilBadgeAssignment\getInstancesByBadgeId().

+ Here is the call graph for this function:

◆ deactivateObjectBadges()

ilObjBadgeAdministrationGUI::deactivateObjectBadges ( )
protected

Definition at line 652 of file class.ilObjBadgeAdministrationGUI.php.

652 : void
653 {
654 $this->toggleObjectBadges(false);
655 }

◆ deactivateTypes()

ilObjBadgeAdministrationGUI::deactivateTypes ( )
protected

Definition at line 244 of file class.ilObjBadgeAdministrationGUI.php.

244 : void
245 {
247
248 $this->assertActive();
249
250 $ids = $this->badge_request->getIds();
251 if ($this->checkPermissionBool("write") && count($ids) > 0) {
252 $handler = ilBadgeHandler::getInstance();
253 $inactive = array_merge($handler->getInactiveTypes(), $ids);
254 $handler->setInactiveTypes($inactive);
255
256 $this->tpl->setOnScreenMessage('success', $lng->txt("settings_saved"), true);
257 }
258 $this->ctrl->redirect($this, "listTypes");
259 }

References ilObjectGUI\$lng, assertActive(), ilObjectGUI\checkPermissionBool(), ILIAS\Repository\ctrl(), ilBadgeHandler\getInstance(), and ilLanguage\txt().

+ Here is the call graph for this function:

◆ deleteImageTemplates()

ilObjBadgeAdministrationGUI::deleteImageTemplates ( )
protected

Definition at line 501 of file class.ilObjBadgeAdministrationGUI.php.

501 : void
502 {
503 $ilCtrl = $this->ctrl;
505
506 $this->checkPermission("write");
507
508 $tmpl_ids = $this->badge_request->getIds();
509 if ($tmpl_ids) {
510 foreach ($tmpl_ids as $tmpl_id) {
511 $tmpl = new ilBadgeImageTemplate($tmpl_id);
512 $tmpl->delete();
513 }
514
515 $this->tpl->setOnScreenMessage('success', $lng->txt("settings_saved"), true);
516 }
517
518 $ilCtrl->redirect($this, "listImageTemplates");
519 }

References $lng.

◆ deleteObjectBadges()

ilObjBadgeAdministrationGUI::deleteObjectBadges ( )
protected

Definition at line 702 of file class.ilObjBadgeAdministrationGUI.php.

702 : void
703 {
704 $ilCtrl = $this->ctrl;
706
707 $badge_ids = $this->getObjectBadgesFromMultiAction();
708
709 foreach ($badge_ids as $badge_id) {
710 $badge = new ilBadge($badge_id);
711 $badge->delete();
712 }
713
714 $this->tpl->setOnScreenMessage('success', $lng->txt("settings_saved"), true);
715 $ilCtrl->redirect($this, "listObjectBadges");
716 }

References $lng.

◆ editImageTemplate()

ilObjBadgeAdministrationGUI::editImageTemplate ( ilPropertyFormGUI  $a_form = null)
protected

Definition at line 384 of file class.ilObjBadgeAdministrationGUI.php.

386 : void {
387 $ilCtrl = $this->ctrl;
389
390 $this->checkPermission("write");
391
392 $this->assertActive();
393 $this->tabs_gui->setTabActive("imgtmpl");
394
395 $tmpl_id = $this->badge_request->getTemplateId();
396 if (!$tmpl_id) {
397 $ilCtrl->redirect($this, "listImageTemplates");
398 }
399
400 $ilCtrl->setParameter($this, "tid", $tmpl_id);
401
402 $tmpl = new ilBadgeImageTemplate($tmpl_id);
403
404 if (!$a_form) {
405 $a_form = $this->initImageTemplateForm("edit");
406 $this->setImageTemplateFormValues($a_form, $tmpl);
407 }
408
409 $tpl->setContent($a_form->getHTML());
410 }
setImageTemplateFormValues(ilPropertyFormGUI $a_form, ilBadgeImageTemplate $a_tmpl)

◆ editSettings()

ilObjBadgeAdministrationGUI::editSettings ( ilPropertyFormGUI  $a_form = null)
protected

Definition at line 148 of file class.ilObjBadgeAdministrationGUI.php.

148 : void
149 {
150 $this->tabs_gui->setTabActive("settings");
151
152 if (!$a_form) {
153 $a_form = $this->initFormSettings();
154 }
155
156 $this->tpl->setContent($a_form->getHTML());
157 }

References initFormSettings().

Referenced by saveSettings().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilObjBadgeAdministrationGUI::executeCommand ( )

Reimplemented from ilObjectGUI.

Definition at line 58 of file class.ilObjBadgeAdministrationGUI.php.

58 : void
59 {
60 $next_class = $this->ctrl->getNextClass($this);
61 $cmd = $this->ctrl->getCmd();
62
63 $this->prepareOutput();
64
65 switch ($next_class) {
66 case 'ilpermissiongui':
67 $this->tabs_gui->setTabActive('perm_settings');
68 $perm_gui = new ilPermissionGUI($this);
69 $this->ctrl->forwardCommand($perm_gui);
70 break;
71
72 case 'ilbadgemanagementgui':
73 $this->assertActive();
74 $this->tabs_gui->setTabActive('activity');
75 $gui = new ilBadgeManagementGUI($this->ref_id, $this->obj_id, $this->type);
76 $this->ctrl->forwardCommand($gui);
77 break;
78
79 default:
80 if (!$cmd || $cmd === 'view') {
81 $cmd = "editSettings";
82 }
83
84 $this->$cmd();
85 break;
86 }
87 }
Class ilBadgeManagementGUI.
prepareOutput(bool $show_sub_objects=true)
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.

References assertActive(), ILIAS\Repository\ctrl(), and ilObjectGUI\prepareOutput().

+ Here is the call graph for this function:

◆ getAdminTabs()

ilObjBadgeAdministrationGUI::getAdminTabs ( )

administration tabs show only permissions and trash folder

Reimplemented from ilObjectGUI.

Definition at line 89 of file class.ilObjBadgeAdministrationGUI.php.

89 : void
90 {
92
93 if ($rbacsystem->checkAccess("visible,read", $this->object->getRefId())) {
94 $this->tabs_gui->addTab(
95 "settings",
96 $this->lng->txt("settings"),
97 $this->ctrl->getLinkTarget($this, "editSettings")
98 );
99
100 if (ilBadgeHandler::getInstance()->isActive()) {
101 $this->tabs_gui->addTab(
102 "types",
103 $this->lng->txt("badge_types"),
104 $this->ctrl->getLinkTarget($this, "listTypes")
105 );
106
107 $this->tabs_gui->addTab(
108 "imgtmpl",
109 $this->lng->txt("badge_image_templates"),
110 $this->ctrl->getLinkTarget($this, "listImageTemplates")
111 );
112
113 $this->tabs_gui->addTab(
114 "activity",
115 $this->lng->txt("badge_activity_badges"),
116 $this->ctrl->getLinkTargetByClass("ilbadgemanagementgui", "")
117 );
118
119 $this->tabs_gui->addTab(
120 "obj_badges",
121 $this->lng->txt("badge_object_badges"),
122 $this->ctrl->getLinkTarget($this, "listObjectBadges")
123 );
124 }
125 }
126
127 if ($rbacsystem->checkAccess('edit_permission', $this->object->getRefId())) {
128 $this->tabs_gui->addTab(
129 "perm_settings",
130 $this->lng->txt("perm_settings"),
131 $this->ctrl->getLinkTargetByClass('ilpermissiongui', "perm")
132 );
133 }
134 }
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 ...

References $rbacsystem, ilRbacSystem\checkAccess(), ilBadgeHandler\getInstance(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ getObjectBadgesFromMultiAction()

ilObjBadgeAdministrationGUI::getObjectBadgesFromMultiAction ( )
protected

Definition at line 616 of file class.ilObjBadgeAdministrationGUI.php.

616 : array
617 {
618 $ilAccess = $this->access;
619 $ilCtrl = $this->ctrl;
620
621 $badge_ids = $this->badge_request->getIds();
622 if (!$badge_ids ||
623 !$ilAccess->checkAccess("write", "", $this->object->getRefId())) {
624 $ilCtrl->redirect($this, "listObjectBadges");
625 }
626
627 return $badge_ids;
628 }
redirect(object $a_gui_obj, string $a_cmd=null, string $a_anchor=null, bool $is_async=false)
@inheritDoc

◆ initFormSettings()

ilObjBadgeAdministrationGUI::initFormSettings ( )
protected

Definition at line 178 of file class.ilObjBadgeAdministrationGUI.php.

179 {
180 $ilAccess = $this->access;
181
182 $form = new ilPropertyFormGUI();
183 $form->setFormAction($this->ctrl->getFormAction($this));
184 $form->setTitle($this->lng->txt("badge_settings"));
185
186 if ($ilAccess->checkAccess("write", "", $this->object->getRefId())) {
187 $form->addCommandButton("saveSettings", $this->lng->txt("save"));
188 $form->addCommandButton("editSettings", $this->lng->txt("cancel"));
189 }
190
191 $act = new ilCheckboxInputGUI($this->lng->txt("badge_service_activate"), "act");
192 $act->setInfo($this->lng->txt("badge_service_activate_info"));
193 $form->addItem($act);
194
195
196 $handler = ilBadgeHandler::getInstance();
197 $act->setChecked($handler->isActive());
198
199 return $form;
200 }
This class represents a checkbox property in a property form.
This class represents a property form user interface.

References ilObjectGUI\$access, ILIAS\Repository\ctrl(), ilBadgeHandler\getInstance(), and ILIAS\Repository\lng().

Referenced by editSettings(), and saveSettings().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initImageTemplateForm()

ilObjBadgeAdministrationGUI::initImageTemplateForm ( string  $a_mode)
protected

Definition at line 308 of file class.ilObjBadgeAdministrationGUI.php.

312 $ilCtrl = $this->ctrl;
313
314 $form = new ilPropertyFormGUI();
315 $form->setFormAction($ilCtrl->getFormAction($this, "saveBadge"));
316 $form->setTitle($lng->txt("badge_image_template_form"));
317
318 $title = new ilTextInputGUI($lng->txt("title"), "title");
319 $title->setRequired(true);
320 $form->addItem($title);
321
322 $img = new ilImageFileInputGUI($lng->txt("image"), "img");
323 $img->setSuffixes(array("png", "svg"));
324 if ($a_mode === "create") {
325 $img->setRequired(true);
326 }
327 $img->setUseCache(false);
328 $img->setAllowDeletion(false);
329 $form->addItem($img);
330
331 $types_mode = new ilRadioGroupInputGUI($lng->txt("badge_template_types"), "tmode");
332 $types_mode->setRequired(true);
333 $types_mode->setValue("all");
334 $form->addItem($types_mode);
335
336 $type_all = new ilRadioOption($lng->txt("badge_template_types_all"), "all");
337 $types_mode->addOption($type_all);
338
339 $type_spec = new ilRadioOption($lng->txt("badge_template_types_specific"), "spec");
340 $types_mode->addOption($type_spec);
341
342 $types = new ilCheckboxGroupInputGUI($lng->txt("badge_types"), "type");
343 $types->setRequired(true);
344 $type_spec->addSubItem($types);
345
346 foreach (ilBadgeHandler::getInstance()->getAvailableTypes(false) as $id => $type) {
347 $types->addOption(new ilCheckboxOption($type->getCaption(), $id));
348 }
349
350 if ($a_mode === "create") {
351 $form->addCommandButton("saveImageTemplate", $lng->txt("save"));
352 } else {
353 $form->addCommandButton("updateImageTemplate", $lng->txt("save"));
354 }
355 $form->addCommandButton("listImageTemplates", $lng->txt("cancel"));
356
357 return $form;
358 }
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 class represents a property in a property form.
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.
$img
Definition: imgupload.php:83

◆ listImageTemplates()

ilObjBadgeAdministrationGUI::listImageTemplates ( )
protected

Definition at line 266 of file class.ilObjBadgeAdministrationGUI.php.

266 : void
267 {
268 $ilAccess = $this->access;
270 $ilToolbar = $this->toolbar;
271 $ilCtrl = $this->ctrl;
272
273 $this->assertActive();
274 $this->tabs_gui->setTabActive("imgtmpl");
275
276 if ($this->checkPermissionBool("write")) {
277 $ilToolbar->addButton(
278 $lng->txt("badge_add_template"),
279 $ilCtrl->getLinkTarget($this, "addImageTemplate")
280 );
281 }
282
284 $this,
285 "listImageTemplates",
286 $ilAccess->checkAccess("write", "", $this->object->getRefId())
287 );
288 $this->tpl->setContent($tbl->getHTML());
289 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilToolbarGUI $toolbar

References ilObjectGUI\$access, ilObjectGUI\$ctrl, ilObjectGUI\$lng, ilObjectGUI\$toolbar, assertActive(), ilObjectGUI\checkPermissionBool(), and ilLanguage\txt().

+ Here is the call graph for this function:

◆ listObjectBadges()

ilObjBadgeAdministrationGUI::listObjectBadges ( )
protected

Definition at line 526 of file class.ilObjBadgeAdministrationGUI.php.

526 : void
527 {
528 $ilAccess = $this->access;
530
531 $this->assertActive();
532 $this->tabs_gui->setTabActive("obj_badges");
533
534 $tbl = new ilObjectBadgeTableGUI(
535 $this,
536 "listObjectBadges",
537 $ilAccess->checkAccess("write", "", $this->object->getRefId())
538 );
539 $tpl->setContent($tbl->getHTML());
540 }

References $tpl.

◆ listObjectBadgeUsers()

ilObjBadgeAdministrationGUI::listObjectBadgeUsers ( )
protected

Definition at line 570 of file class.ilObjBadgeAdministrationGUI.php.

570 : void
571 {
572 $ilCtrl = $this->ctrl;
575
576 $parent_obj_id = $this->badge_request->getParentId();
577 if (!$parent_obj_id) {
578 $ilCtrl->redirect($this, "listObjectBadges");
579 }
580
581 $this->assertActive();
582
583 $this->tabs_gui->clearTargets();
584 $this->tabs_gui->setBackTarget(
585 $lng->txt("back"),
586 $ilCtrl->getLinkTarget($this, "listObjectBadges")
587 );
588
589 $ilCtrl->saveParameter($this, "pid");
590
591 $tbl = new ilBadgeUserTableGUI($this, "listObjectBadgeUsers", 0, null, $parent_obj_id, $this->badge_request->getBadgeId());
592 $tpl->setContent($tbl->getHTML());
593 }

References $lng, and $tpl.

◆ listTypes()

ilObjBadgeAdministrationGUI::listTypes ( )
protected

Definition at line 207 of file class.ilObjBadgeAdministrationGUI.php.

207 : void
208 {
209 $ilAccess = $this->access;
210
211 $this->assertActive();
212 $this->tabs_gui->setTabActive("types");
213
214 $tbl = new ilBadgeTypesTableGUI(
215 $this,
216 "listTypes",
217 $ilAccess->checkAccess("write", "", $this->object->getRefId())
218 );
219 $this->tpl->setContent($tbl->getHTML());
220 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References ilObjectGUI\$access, and assertActive().

+ Here is the call graph for this function:

◆ resetlistObjectBadgeUsers()

ilObjBadgeAdministrationGUI::resetlistObjectBadgeUsers ( )
protected

Definition at line 603 of file class.ilObjBadgeAdministrationGUI.php.

603 : void
604 {
605 $tbl = new ilBadgeUserTableGUI($this, "listObjectBadgeUsers", 0, null, 0, $this->badge_request->getBadgeId());
606 $tbl->resetOffset();
607 $tbl->resetFilter();
608 $this->listObjectBadgeUsers();
609 }

◆ resetObjectFilter()

ilObjBadgeAdministrationGUI::resetObjectFilter ( )
protected

Definition at line 556 of file class.ilObjBadgeAdministrationGUI.php.

556 : void
557 {
558 $ilAccess = $this->access;
559
560 $tbl = new ilObjectBadgeTableGUI(
561 $this,
562 "listObjectBadges",
563 $ilAccess->checkAccess("write", "", $this->object->getRefId())
564 );
565 $tbl->resetOffset();
566 $tbl->resetFilter();
567 $this->listObjectBadges();
568 }

◆ saveImageTemplate()

ilObjBadgeAdministrationGUI::saveImageTemplate ( )
protected

Definition at line 360 of file class.ilObjBadgeAdministrationGUI.php.

360 : void
361 {
362 $ilCtrl = $this->ctrl;
364
365 $this->checkPermission("write");
366
367 $form = $this->initImageTemplateForm("create");
368 if ($form->checkInput()) {
369 $tmpl = new ilBadgeImageTemplate();
370 $tmpl->setTitle($form->getInput("title"));
371 $tmpl->setTypes($form->getInput("type"));
372 $tmpl->create();
373
374 $tmpl->uploadImage($_FILES["img"]);
375
376 $this->tpl->setOnScreenMessage('success', $lng->txt("settings_saved"), true);
377 $ilCtrl->redirect($this, "listImageTemplates");
378 }
379
380 $form->setValuesByPost();
381 $this->addImageTemplate($form);
382 }
addImageTemplate(ilPropertyFormGUI $a_form=null)

References $lng.

◆ saveSettings()

ilObjBadgeAdministrationGUI::saveSettings ( )
protected

Definition at line 159 of file class.ilObjBadgeAdministrationGUI.php.

159 : void
160 {
161 $ilCtrl = $this->ctrl;
162
163 $this->checkPermission("write");
164
165 $form = $this->initFormSettings();
166 if ($form->checkInput()) {
167 $handler = ilBadgeHandler::getInstance();
168 $handler->setActive((bool) $form->getInput("act"));
169
170 $this->tpl->setOnScreenMessage('success', $this->lng->txt("settings_saved"), true);
171 $ilCtrl->redirect($this, "editSettings");
172 }
173
174 $form->setValuesByPost();
175 $this->editSettings($form);
176 }
editSettings(ilPropertyFormGUI $a_form=null)

References ilObjectGUI\$ctrl, ilObjectGUI\checkPermission(), editSettings(), ilBadgeHandler\getInstance(), initFormSettings(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ setImageTemplateFormValues()

ilObjBadgeAdministrationGUI::setImageTemplateFormValues ( ilPropertyFormGUI  $a_form,
ilBadgeImageTemplate  $a_tmpl 
)
protected

Definition at line 412 of file class.ilObjBadgeAdministrationGUI.php.

415 : void {
416 $a_form->getItemByPostVar("title")->setValue($a_tmpl->getTitle());
417 $a_form->getItemByPostVar("img")->setImage($a_tmpl->getImagePath());
418 $a_form->getItemByPostVar("img")->setValue($a_tmpl->getImage());
419
420 if ($a_tmpl->getTypes()) {
421 $a_form->getItemByPostVar("tmode")->setValue("spec");
422 $a_form->getItemByPostVar("type")->setValue($a_tmpl->getTypes());
423 } else {
424 $a_form->getItemByPostVar("tmode")->setValue("all");
425 }
426 }
getItemByPostVar(string $a_post_var)

References ilPropertyFormGUI\getItemByPostVar(), and ilBadgeImageTemplate\getTypes().

+ Here is the call graph for this function:

◆ toggleObjectBadges()

ilObjBadgeAdministrationGUI::toggleObjectBadges ( bool  $a_status)
protected

Definition at line 630 of file class.ilObjBadgeAdministrationGUI.php.

630 : void
631 {
632 $ilCtrl = $this->ctrl;
634
635 $badge_ids = $this->getObjectBadgesFromMultiAction();
636
637 foreach ($badge_ids as $badge_id) {
638 $badge = new ilBadge($badge_id);
639 $badge->setActive($a_status);
640 $badge->update();
641 }
642
643 $this->tpl->setOnScreenMessage('success', $lng->txt("settings_saved"), true);
644 $ilCtrl->redirect($this, "listObjectBadges");
645 }

References $lng.

◆ updateImageTemplate()

ilObjBadgeAdministrationGUI::updateImageTemplate ( )
protected

Definition at line 428 of file class.ilObjBadgeAdministrationGUI.php.

428 : void
429 {
430 $ilCtrl = $this->ctrl;
432
433 $this->checkPermission("write");
434
435 $tmpl_id = $this->badge_request->getTemplateId();
436 if (!$tmpl_id) {
437 $ilCtrl->redirect($this, "listImageTemplates");
438 }
439
440 $ilCtrl->setParameter($this, "tid", $tmpl_id);
441
442 $tmpl = new ilBadgeImageTemplate($tmpl_id);
443
444 $form = $this->initImageTemplateForm("update");
445 if ($form->checkInput()) {
446 $tmpl->setTitle($form->getInput("title"));
447
448 if ($form->getInput("tmode") !== "all") {
449 $tmpl->setTypes($form->getInput("type"));
450 } else {
451 $tmpl->setTypes(null);
452 }
453
454 $tmpl->update();
455
456 $tmpl->uploadImage($_FILES["img"]);
457
458 $this->tpl->setOnScreenMessage('success', $lng->txt("settings_saved"), true);
459 $ilCtrl->redirect($this, "listImageTemplates");
460 }
461
462 $this->setImageTemplateFormValues($form, $tmpl);
463 $form->setValuesByPost();
464 $this->editImageTemplate($form);
465 }
editImageTemplate(ilPropertyFormGUI $a_form=null)

References $lng.

Field Documentation

◆ $badge_request

ilBadgeGUIRequest ilObjBadgeAdministrationGUI::$badge_request
protected

Definition at line 29 of file class.ilObjBadgeAdministrationGUI.php.

◆ $rbacsystem

ilRbacSystem ilObjBadgeAdministrationGUI::$rbacsystem
protected

Definition at line 28 of file class.ilObjBadgeAdministrationGUI.php.

Referenced by getAdminTabs().

◆ $tabs

ilTabsGUI ilObjBadgeAdministrationGUI::$tabs
protected

Definition at line 30 of file class.ilObjBadgeAdministrationGUI.php.


The documentation for this class was generated from the following file: