ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
ilObjBadgeAdministrationGUI Class Reference

ilObjBadgeAdministrationGUI: ilPermissionGUI, ilBadgeManagementGUI ilObjBadgeAdministrationGUI: ilAdministrationGUI 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 ()
 
 getSafePostCommands ()
 This method must return a list of safe POST commands. More...
 
 getUnsafeGetCommands ()
 This method must return a list of unsafe GET commands. More...
 
- Public Member Functions inherited from ilObjectGUI
 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] does belong to the parent 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...
 
 cancelObject ()
 cancel action and go back to previous page More...
 
 createObject ()
 create new object form More...
 
 editAvailabilityPeriodObject ()
 
 saveAvailabilityPeriodObject ()
 
 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)
 
 addToDeskObject ()
 
 removeFromDeskObject ()
 
- Public Member Functions inherited from ILIAS\Object\ImplementsCreationCallback
 callCreationCallback (\ilObject $object, \ilObjectDefinition $obj_definition, int $requested_crtcb)
 

Data Fields

const TABLE_ALL_OBJECTS_ACTION = 'ALL_OBJECTS'
 
- Data Fields inherited from ilObjectGUI
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
 
const SUPPORTED_IMPORT_MIME_TYPES = [MimeType::APPLICATION__ZIP, MimeType::APPLICATION__X_ZIP_COMPRESSED]
 

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 ()
 
 applyObjectFilter ()
 
 resetObjectFilter ()
 
 listObjectBadgeUsers ()
 
 applylistObjectBadgeUsers ()
 
 resetlistObjectBadgeUsers ()
 
 listObjectBadges ()
 
 getObjectBadgesFromMultiAction ()
 
 toggleObjectBadges (bool $a_status)
 
 activateObjectBadges ()
 
 deactivateObjectBadges ()
 
 confirmDeleteObjectBadges ()
 
 deleteObjectBadges ()
 
- Protected Member Functions inherited from ilObjectGUI
 getObjectService ()
 
 assignObject ()
 
 setTitleAndDescription ()
 
 createActionDispatcherGUI ()
 
 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...
 
 getCreationFormsHTML (StandardForm|ilPropertyFormGUI|array $form)
 
 getTitleForCreationFormPage ()
 
 getCreationFormTitle ()
 
 initCreateForm (string $new_type)
 
 didacticTemplatesToForm ()
 
 initDidacticTemplate (ilPropertyFormGUI $form)
 
 retrieveAdditionalDidacticTemplateOptions ()
 
 addAdoptContentLinkToToolbar ()
 
 addImportButtonToToolbar ()
 
 addAvailabilityPeriodButtonToToolbar (ilToolbarGUI $toolbar)
 
 parseDidacticTemplateVar (string $var, string $type)
 
 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...
 
 routeImportCmdObject ()
 
 importFile (string $file_to_import, string $path_to_uploaded_file_in_temp_dir)
 
 deleteUploadedImportFile (string $path_to_uploaded_file_in_temp_dir)
 
 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 ()
 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...
 
 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...
 
 getCreatableObjectTypes ()
 
 buildAddNewItemElements (array $subtypes, string $create_target_class=ilRepositoryGUI::class, ?int $redirect_target_ref_id=null,)
 
 buildGroup (string $create_target_class, array $obj_types_in_group, string $title, array $subtypes)
 

Private Attributes

ILIAS ResourceStorage Services $resource_storage
 
ilRbacSystem $rbacsystem
 
ilBadgeGUIRequest $badge_request
 
ilTabsGUI $tabs
 
Services $http
 

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)
 
- 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
 
Refinery $refinery
 
ilFavouritesManager $favourites
 
ilObjectCustomIconFactory $custom_icon_factory
 
UIFactory $ui_factory
 
UIRenderer $ui_renderer
 
Filesystem $temp_file_system
 
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 = ""
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilObjBadgeAdministrationGUI::__construct (   $a_data,
int  $a_id,
bool  $a_call_by_reference = true,
bool  $a_prepare_output = true 
)

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

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

43  {
44  global $DIC;
45 
46  $this->resource_storage = $DIC->resourceStorage();
47  $this->rbacsystem = $DIC->rbac()->system();
48  $this->ctrl = $DIC->ctrl();
49  $this->access = $DIC->access();
50  $this->lng = $DIC->language();
51  $this->toolbar = $DIC->toolbar();
52  $this->tpl = $DIC['tpl'];
53  $this->tabs = $DIC->tabs();
54  $this->type = 'bdga';
55  $this->http = $DIC->http();
56  parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
57 
58  $this->badge_request = new ilBadgeGUIRequest(
59  $DIC->http(),
60  $DIC->refinery()
61  );
62 
63  $this->lng->loadLanguageModule('badge');
64  }
static http()
Fetches the global http state from ILIAS.
global $DIC
Definition: shib_login.php:25
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ activateObjectBadges()

ilObjBadgeAdministrationGUI::activateObjectBadges ( )
protected

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

References toggleObjectBadges().

719  : void
720  {
721  $this->toggleObjectBadges(true);
722  }
+ Here is the call graph for this function:

◆ activateTypes()

ilObjBadgeAdministrationGUI::activateTypes ( )
protected

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

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

274  : void
275  {
276  $lng = $this->lng;
277  $this->assertActive();
278 
279  $tmpl_ids = $this->badge_request->getMultiActionBadgeIdsFromUrl();
280  if ($this->checkPermissionBool('write') && count($tmpl_ids) > 0) {
282  $change_state = [];
283  foreach ($handler->getInactiveTypes() as $type) {
284  if (!in_array($type, $tmpl_ids)) {
285  $change_state[] = $type;
286  }
287  }
288 
289  if (current($tmpl_ids) === self::TABLE_ALL_OBJECTS_ACTION) {
290  $handler->setInactiveTypes([]);
291  } else {
292  $handler->setInactiveTypes($change_state);
293  }
294 
295  $this->tpl->setOnScreenMessage('success', $lng->txt('settings_saved'), true);
296  }
297  $this->ctrl->redirect($this, 'listTypes');
298  }
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...
ilLanguage $lng
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
$handler
Definition: oai.php:14
+ Here is the call graph for this function:

◆ addImageTemplate()

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

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

References ilObjectGUI\$tpl, assertActive(), ilObjectGUI\checkPermission(), initImageTemplateForm(), and ilGlobalTemplateInterface\setContent().

Referenced by saveImageTemplate().

362  : void {
363  $tpl = $this->tpl;
364 
365  $this->checkPermission('write');
366 
367  $this->assertActive();
368  $this->tabs_gui->setTabActive('imgtmpl');
369 
370  if (!$a_form) {
371  $a_form = $this->initImageTemplateForm('create');
372  }
373 
374  $tpl->setContent($a_form->getHTML());
375  }
ilGlobalTemplateInterface $tpl
setContent(string $a_html)
Sets content for standard template.
checkPermission(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ applylistObjectBadgeUsers()

ilObjBadgeAdministrationGUI::applylistObjectBadgeUsers ( )
protected

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

References listObjectBadges().

651  : void
652  {
653  $this->listObjectBadges();
654  }
+ Here is the call graph for this function:

◆ applyObjectFilter()

ilObjBadgeAdministrationGUI::applyObjectFilter ( )
protected

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

References listObjectBadges().

614  : void
615  {
616  $this->listObjectBadges();
617  }
+ Here is the call graph for this function:

◆ assertActive()

ilObjBadgeAdministrationGUI::assertActive ( )
protected

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

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

Referenced by activateTypes(), addImageTemplate(), deactivateTypes(), editImageTemplate(), executeCommand(), listImageTemplates(), listObjectBadges(), listObjectBadgeUsers(), and listTypes().

192  : void
193  {
194  if (!ilBadgeHandler::getInstance()->isActive()) {
195  $this->ctrl->redirect($this, 'editSettings');
196  }
197  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ confirmDeleteImageTemplates()

ilObjBadgeAdministrationGUI::confirmDeleteImageTemplates ( )
protected

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

References ilObjectGUI\$ctrl, ilObjectGUI\$lng, $tabs, ilObjectGUI\$tpl, ilObjectGUI\checkPermission(), ilBadgeImageTemplate\getInstances(), ilGlobalTemplateInterface\setContent(), and ilLanguage\txt().

544  : void
545  {
546  $ilCtrl = $this->ctrl;
547  $lng = $this->lng;
548  $tpl = $this->tpl;
549  $ilTabs = $this->tabs;
550 
551  $this->checkPermission('write');
552 
553  $tmpl_ids = $this->badge_request->getBadgeAssignableUsers();
554  if ($tmpl_ids === ['ALL_OBJECTS']) {
555  $tmpl_ids = [];
556  foreach (ilBadgeImageTemplate::getInstances() as $template) {
557  $tmpl_ids[] = $template->getId();
558  }
559  }
560 
561  if (!$tmpl_ids) {
562  $ilCtrl->redirect($this, 'listImageTemplates');
563  }
564 
565  $ilTabs->clearTargets();
566  $ilTabs->setBackTarget(
567  $lng->txt('back'),
568  $ilCtrl->getLinkTarget($this, 'listImageTemplates')
569  );
570 
571  $confirmation_gui = new ilConfirmationGUI();
572  $confirmation_gui->setFormAction($ilCtrl->getFormAction($this));
573  $confirmation_gui->setHeaderText($lng->txt('badge_template_deletion_confirmation'));
574  $confirmation_gui->setCancel($lng->txt('cancel'), 'listImageTemplates');
575  $confirmation_gui->setConfirm($lng->txt('delete'), 'deleteImageTemplates');
576 
577  foreach ($tmpl_ids as $tmpl_id) {
578  $tmpl = new ilBadgeImageTemplate($tmpl_id);
579  $confirmation_gui->addItem('id[]', $tmpl_id, $tmpl->getTitle());
580  }
581 
582  $tpl->setContent($confirmation_gui->getHTML());
583  }
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...
ilLanguage $lng
ilGlobalTemplateInterface $tpl
setContent(string $a_html)
Sets content for standard template.
checkPermission(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
+ Here is the call graph for this function:

◆ confirmDeleteObjectBadges()

ilObjBadgeAdministrationGUI::confirmDeleteObjectBadges ( )
protected

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

References $container, ilObjectGUI\$ctrl, ilObjectGUI\$lng, $tabs, ilObjectGUI\$tpl, ilTabsGUI\clearTargets(), ilBadgeAssignment\getInstancesByBadgeId(), ilBadge\getObjectInstances(), ilGlobalTemplateInterface\setContent(), and ilLanguage\txt().

729  : void
730  {
731  $ilCtrl = $this->ctrl;
732  $lng = $this->lng;
733  $tpl = $this->tpl;
734  $ilTabs = $this->tabs;
735 
736  $badge_ids = $this->badge_request->getMultiActionBadgeIdsFromUrl();
737 
738  $ilTabs->clearTargets();
739  $ilTabs->setBackTarget(
740  $lng->txt('back'),
741  $ilCtrl->getLinkTarget($this, 'listObjectBadges')
742  );
743 
744  $confirmation_gui = new ilConfirmationGUI();
745  $confirmation_gui->setFormAction($ilCtrl->getFormAction($this));
746  $confirmation_gui->setHeaderText($lng->txt('badge_deletion_confirmation'));
747  $confirmation_gui->setCancel($lng->txt('cancel'), 'listObjectBadges');
748  $confirmation_gui->setConfirm($lng->txt('delete'), 'deleteObjectBadges');
749 
750  if ($badge_ids === ['ALL_OBJECTS']) {
751  $badge_ids = [];
752  $filter = [
753  'type' => '',
754  'title' => '',
755  'object' => ''
756  ];
757  foreach (ilBadge::getObjectInstances($filter) as $badge_item) {
758  $badge_ids[] = $badge_item['id'];
759  }
760  }
761  foreach ($badge_ids as $badge_id) {
762  $badge = new ilBadge($badge_id);
763  $parent = $badge->getParentMeta();
764 
765  $container = '(' . $parent['type'] . '/' .
766  $parent['id'] . ') ' .
767  $parent['title'];
768  if ($parent['deleted']) {
769  $container .= ' <span class="il_ItemAlertProperty">' . $lng->txt('deleted') . '</span>';
770  }
771 
772  $confirmation_gui->addItem(
773  'id[]',
774  $badge_id,
775  $container . ' - ' .
776  $badge->getTitle() .
777  ' (' . count(ilBadgeAssignment::getInstancesByBadgeId($badge_id)) . ')'
778  );
779  }
780 
781  $tpl->setContent($confirmation_gui->getHTML());
782  }
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...
$container
Definition: wac.php:13
ilLanguage $lng
ilGlobalTemplateInterface $tpl
setContent(string $a_html)
Sets content for standard template.
static getInstancesByBadgeId(int $a_badge_id)
clearTargets()
clear all targets
static getObjectInstances(?array $filter=null)
+ Here is the call graph for this function:

◆ deactivateObjectBadges()

ilObjBadgeAdministrationGUI::deactivateObjectBadges ( )
protected

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

References toggleObjectBadges().

724  : void
725  {
726  $this->toggleObjectBadges(false);
727  }
+ Here is the call graph for this function:

◆ deactivateTypes()

ilObjBadgeAdministrationGUI::deactivateTypes ( )
protected

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

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

300  : void
301  {
302  $lng = $this->lng;
303  $this->assertActive();
304 
305  $tmpl_ids = $this->badge_request->getMultiActionBadgeIdsFromUrl();
306  if ($this->checkPermissionBool('write') && count($tmpl_ids) > 0) {
308  $change_state = [];
309  foreach ($handler->getInactiveTypes() as $type) {
310  if (!in_array($type, $tmpl_ids)) {
311  $change_state[] = $type;
312  }
313  }
314 
315  $res = [];
316  if (current($tmpl_ids) === self::TABLE_ALL_OBJECTS_ACTION) {
317  $types = $handler->getAvailableTypes(false);
318  foreach ($types as $id => $type) {
319  $res[] = $id;
320  }
321  $handler->setInactiveTypes($res);
322  } else {
323  $handler->setInactiveTypes($change_state);
324  }
325  $inactive = array_merge($handler->getInactiveTypes(), $tmpl_ids);
326  $handler->setInactiveTypes($inactive);
327 
328  $this->tpl->setOnScreenMessage('success', $lng->txt('settings_saved'), true);
329  }
330  $this->ctrl->redirect($this, 'listTypes');
331  }
$res
Definition: ltiservices.php:69
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...
ilLanguage $lng
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
$handler
Definition: oai.php:14
+ Here is the call graph for this function:

◆ deleteImageTemplates()

ilObjBadgeAdministrationGUI::deleteImageTemplates ( )
protected

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

References ilObjectGUI\$lng, ilObjectGUI\checkPermissionBool(), ILIAS\Repository\ctrl(), ilBadgeImageTemplate\getInstances(), and ilLanguage\txt().

585  : void
586  {
587  $lng = $this->lng;
588  $tmpl_ids = $this->badge_request->getIds();
589 
590  if ($this->checkPermissionBool('write') && count($tmpl_ids) > 0) {
591  if (current($tmpl_ids) === self::TABLE_ALL_OBJECTS_ACTION) {
592  $tmpl_ids = [];
593  foreach (ilBadgeImageTemplate::getInstances() as $template) {
594  $tmpl_ids[] = $template->getId();
595  }
596  }
597  foreach ($tmpl_ids as $tmpl_id) {
598  $tmpl = new ilBadgeImageTemplate((int) $tmpl_id);
599  $tmpl->delete();
600  }
601  $this->tpl->setOnScreenMessage('success', $lng->txt('badge_deletion'), true);
602  } else {
603  $this->tpl->setOnScreenMessage('failure', $lng->txt('badge_select_one'), true);
604  }
605 
606  $this->ctrl->redirect($this, 'listImageTemplates');
607  }
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...
ilLanguage $lng
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
+ Here is the call graph for this function:

◆ deleteObjectBadges()

ilObjBadgeAdministrationGUI::deleteObjectBadges ( )
protected

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

References ilObjectGUI\$ctrl, ilObjectGUI\$lng, and ilLanguage\txt().

784  : void
785  {
786  $ilCtrl = $this->ctrl;
787  $lng = $this->lng;
788 
789  $badge_ids = $this->badge_request->getMultiActionBadgeIdsFromPost();
790 
791  foreach ($badge_ids as $badge_id) {
792  $badge = new ilBadge($badge_id);
793  $badge->delete();
794  }
795 
796  $this->tpl->setOnScreenMessage('success', $lng->txt('settings_saved'), true);
797  $ilCtrl->redirect($this, 'listObjectBadges');
798  }
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...
ilLanguage $lng
+ Here is the call graph for this function:

◆ editImageTemplate()

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

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

References ilObjectGUI\$ctrl, ilObjectGUI\$tpl, assertActive(), ilObjectGUI\checkPermission(), ILIAS\Repository\ctrl(), initImageTemplateForm(), ILIAS\Repository\int(), ilGlobalTemplateInterface\setContent(), and setImageTemplateFormValues().

Referenced by updateImageTemplate().

456  : void {
457  $ilCtrl = $this->ctrl;
458  $tpl = $this->tpl;
459 
460  $this->checkPermission('write');
461 
462  $this->assertActive();
463  $this->tabs_gui->setTabActive('imgtmpl');
464 
465  $tmpl_ids = $this->badge_request->getMultiActionBadgeIdsFromUrl();
466  if (count($tmpl_ids) !== 1) {
467  $this->ctrl->redirect($this, 'listImageTemplates');
468  }
469 
470  $template_id = (int) array_pop($tmpl_ids);
471  $ilCtrl->setParameter($this, 'tid', $template_id);
472 
473  $tmpl = new ilBadgeImageTemplate($template_id);
474 
475  if (!$a_form) {
476  $a_form = $this->initImageTemplateForm('edit');
477  $this->setImageTemplateFormValues($a_form, $tmpl);
478  }
479 
480  $tpl->setContent($a_form->getHTML());
481  }
setImageTemplateFormValues(ilPropertyFormGUI $a_form, ilBadgeImageTemplate $a_tmpl)
ilGlobalTemplateInterface $tpl
setContent(string $a_html)
Sets content for standard template.
checkPermission(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ editSettings()

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

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

References initFormSettings().

Referenced by saveSettings().

204  : void
205  {
206  $this->tabs_gui->setTabActive('settings');
207 
208  if (!$a_form) {
209  $a_form = $this->initFormSettings();
210  }
211 
212  $this->tpl->setContent($a_form->getHTML());
213  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilObjBadgeAdministrationGUI::executeCommand ( )

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

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

66  : void
67  {
68  $next_class = $this->ctrl->getNextClass($this) ?? '';
69  $cmd = $this->ctrl->getCmd() ?? '';
70 
71  $this->prepareOutput();
72 
73  switch (strtolower($next_class)) {
74  case strtolower(ilPermissionGUI::class):
75  $this->tabs_gui->setTabActive('perm_settings');
76  $perm_gui = new ilPermissionGUI($this);
77  $this->ctrl->forwardCommand($perm_gui);
78  break;
79 
80  case strtolower(ilBadgeManagementGUI::class):
81  $this->assertActive();
82  $this->tabs_gui->setTabActive('activity');
83  $gui = new ilBadgeManagementGUI($this->ref_id, $this->obj_id, $this->type);
84  $this->ctrl->forwardCommand($gui);
85  break;
86 
87  default:
88  if (!$cmd || $cmd === 'view') {
89  $cmd = 'editSettings';
90  }
91 
92  if ($this->badge_request->getBadgeIdFromUrl()) {
93  $this->ctrl->setParameter($this, 'tid', $this->badge_request->getBadgeIdFromUrl());
94  }
95 
96  $get = fn(string $key) => $this->http->wrapper()->query()->retrieve(
97  $key,
98  $this->refinery->byTrying([
99  $this->refinery->kindlyTo()->string(),
100  $this->refinery->always('')
101  ])
102  );
103 
104  $table_action = $get('tid_table_action');
105  $return_cmd = $get('returnCmd') ?: 'view';
106 
107  $render_default = true;
108  $actions = [
109  'badge_type_activate' => ['activateTypes', true],
110  'badge_type_deactivate' => ['deactivateTypes', true],
111  'badge_image_template_editImageTemplate' => 'editImageTemplate',
112  'obj_badge_user' => 'editImageTemplate',
113  'obj_badge_activate' => 'activateObjectBadges',
114  'obj_badge_deactivate' => 'deactivateObjectBadges',
115  'obj_badge_show_users' => 'listObjectBadgeUsers',
116  'badge_image_template_delete' => 'confirmDeleteImageTemplates',
117  'obj_badge_delete' => 'confirmDeleteObjectBadges',
118  ];
119 
120  $entry = $actions[$table_action] ?? null;
121  if ($cmd !== 'action' || !$entry) {
122  $this->$cmd();
123  return;
124  }
125 
126  $entry = is_array($entry) ? $entry : [$entry, false];
127  $this->{$entry[0]}();
128  if ($entry[1] && in_array($return_cmd, ['listObjectBadges', 'listObjectBadgeUsers', 'listImageTemplates', 'listTypes'], true)) {
129  $this->$return_cmd();
130  }
131  break;
132  }
133  }
ilBadgeManagementGUI: ilPropertyFormGUI
prepareOutput(bool $show_sub_objects=true)
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:

◆ getAdminTabs()

ilObjBadgeAdministrationGUI::getAdminTabs ( )

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

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

135  : void
136  {
138 
139  if ($rbacsystem->checkAccess('visible,read', $this->object->getRefId())) {
140  $this->tabs_gui->addTab(
141  'settings',
142  $this->lng->txt('settings'),
143  $this->ctrl->getLinkTarget($this, 'editSettings')
144  );
145 
146  if (ilBadgeHandler::getInstance()->isActive()) {
147  $this->tabs_gui->addTab(
148  'types',
149  $this->lng->txt('badge_types'),
150  $this->ctrl->getLinkTarget($this, 'listTypes')
151  );
152 
153  $this->tabs_gui->addTab(
154  'imgtmpl',
155  $this->lng->txt('badge_image_templates'),
156  $this->ctrl->getLinkTarget($this, 'listImageTemplates')
157  );
158 
159  $this->tabs_gui->addTab(
160  'activity',
161  $this->lng->txt('badge_activity_badges'),
162  $this->ctrl->getLinkTargetByClass('ilbadgemanagementgui', '')
163  );
164 
165  $this->tabs_gui->addTab(
166  'obj_badges',
167  $this->lng->txt('badge_object_badges'),
168  $this->ctrl->getLinkTarget($this, 'listObjectBadges')
169  );
170  }
171  }
172 
173  if ($rbacsystem->checkAccess('edit_permission', $this->object->getRefId())) {
174  $this->tabs_gui->addTab(
175  'perm_settings',
176  $this->lng->txt('perm_settings'),
177  $this->ctrl->getLinkTargetByClass('ilpermissiongui', 'perm')
178  );
179  }
180  }
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 ...
+ Here is the call graph for this function:

◆ getObjectBadgesFromMultiAction()

ilObjBadgeAdministrationGUI::getObjectBadgesFromMultiAction ( )
protected

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

References ilObjectGUI\$access, ilObjectGUI\$ctrl, and ilCtrl\redirect().

Referenced by toggleObjectBadges().

675  : array
676  {
677  $ilAccess = $this->access;
678  $ilCtrl = $this->ctrl;
679 
680  $badge_ids = $this->badge_request->getMultiActionBadgeIdsFromUrl();
681  if (!$badge_ids ||
682  !$ilAccess->checkAccess('write', '', $this->object->getRefId())) {
683  $ilCtrl->redirect($this, 'listObjectBadges');
684  }
685 
686  return $badge_ids;
687  }
redirect(object $a_gui_obj, string $a_cmd=null, string $a_anchor=null, bool $is_async=false)
ilAccessHandler $access
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSafePostCommands()

ilObjBadgeAdministrationGUI::getSafePostCommands ( )

This method must return a list of safe POST commands.

Safe post commands returned by this method will no longer be CSRF protected and will NOT be appended by an ilCtrlToken.

Returns
string[]

Implements ilCtrlSecurityInterface.

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

182  : array
183  {
184  return [];
185  }

◆ getUnsafeGetCommands()

ilObjBadgeAdministrationGUI::getUnsafeGetCommands ( )

This method must return a list of unsafe GET commands.

Unsafe get commands returned by this method will now be CSRF protected, which means an ilCtrlToken is appended each time a link-target is generated to the class implementing this interface with a command from that list.

Tokens will be validated in

See also
ilCtrlInterface::getCmd(), whereas the fallback command will be used if the CSRF validation fails.
Returns
string[]

Implements ilCtrlSecurityInterface.

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

187  : array
188  {
189  return ['action'];
190  }

◆ initFormSettings()

ilObjBadgeAdministrationGUI::initFormSettings ( )
protected

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

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

Referenced by editSettings(), and saveSettings().

235  {
236  $ilAccess = $this->access;
237 
238  $form = new ilPropertyFormGUI();
239  $form->setFormAction($this->ctrl->getFormAction($this));
240  $form->setTitle($this->lng->txt('badge_settings'));
241 
242  if ($ilAccess->checkAccess('write', '', $this->object->getRefId())) {
243  $form->addCommandButton('saveSettings', $this->lng->txt('save'));
244  $form->addCommandButton('editSettings', $this->lng->txt('cancel'));
245  }
246 
247  $act = new ilCheckboxInputGUI($this->lng->txt('badge_service_activate'), 'act');
248  $act->setInfo($this->lng->txt('badge_service_activate_info'));
249  $form->addItem($act);
250 
252  $act->setChecked($handler->isActive());
253 
254  return $form;
255  }
$handler
Definition: oai.php:14
ilAccessHandler $access
+ 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 377 of file class.ilObjBadgeAdministrationGUI.php.

References ilObjectGUI\$ctrl, ilObjectGUI\$id, ilObjectGUI\$lng, ilObjectGUI\$type, ilBadgeHandler\getInstance(), ilFormPropertyGUI\setRequired(), ilFileInputGUI\setSuffixes(), and ilLanguage\txt().

Referenced by addImageTemplate(), editImageTemplate(), saveImageTemplate(), and updateImageTemplate().

380  $lng = $this->lng;
381  $ilCtrl = $this->ctrl;
382 
383  $form = new ilPropertyFormGUI();
384  $form->setFormAction($ilCtrl->getFormAction($this, 'saveBadge'));
385  $form->setTitle($lng->txt('badge_image_template_form'));
386 
387  $title = new ilTextInputGUI($lng->txt('title'), 'title');
388  $title->setMaxLength(255);
389  $title->setRequired(true);
390  $form->addItem($title);
391 
392  $img = new ilImageFileInputGUI($lng->txt('image'), 'img');
393  $img->setSuffixes(['png', 'svg']);
394  if ($a_mode === 'create') {
395  $img->setRequired(true);
396  }
397  $img->setUseCache(false);
398  $img->setAllowDeletion(false);
399  $form->addItem($img);
400 
401  $types_mode = new ilRadioGroupInputGUI($lng->txt('badge_template_types'), 'tmode');
402  $types_mode->setRequired(true);
403  $types_mode->setValue('all');
404  $form->addItem($types_mode);
405 
406  $type_all = new ilRadioOption($lng->txt('badge_template_types_all'), 'all');
407  $types_mode->addOption($type_all);
408 
409  $type_spec = new ilRadioOption($lng->txt('badge_template_types_specific'), 'spec');
410  $types_mode->addOption($type_spec);
411 
412  $types = new ilCheckboxGroupInputGUI($lng->txt('badge_types'), 'type');
413  $types->setRequired(true);
414  $type_spec->addSubItem($types);
415 
416  foreach (ilBadgeHandler::getInstance()->getAvailableTypes(false) as $id => $type) {
417  $types->addOption(new ilCheckboxOption($type->getCaption(), $id));
418  }
419 
420  if ($a_mode === 'create') {
421  $form->addCommandButton('saveImageTemplate', $lng->txt('save'));
422  } else {
423  $form->addCommandButton('updateImageTemplate', $lng->txt('save'));
424  }
425  $form->addCommandButton('listImageTemplates', $lng->txt('cancel'));
426 
427  return $form;
428  }
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...
setSuffixes(array $a_suffixes)
ilLanguage $lng
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...
setRequired(bool $a_required)
This class represents an image file property in a property form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ listImageTemplates()

ilObjBadgeAdministrationGUI::listImageTemplates ( )
protected

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

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

338  : void
339  {
340  $lng = $this->lng;
341  $ilToolbar = $this->toolbar;
342  $ilCtrl = $this->ctrl;
343 
344  $this->assertActive();
345  $this->tabs_gui->setTabActive('imgtmpl');
346 
347  if ($this->checkPermissionBool('write')) {
348  $ilToolbar->addButton(
349  $lng->txt('badge_add_template'),
350  $ilCtrl->getLinkTarget($this, 'addImageTemplate')
351  );
352  }
353 
354  $template_table = new ilBadgeImageTemplateTableGUI($this->access->checkAccess("write", "", $this->object->getRefId()));
355  $this->ctrl->setParameter($this, 'returnCmd', __FUNCTION__);
356  $template_table->renderTable(ILIAS_HTTP_PATH . '/' . $this->ctrl->getLinkTarget($this, 'action'));
357  }
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...
ilLanguage $lng
ilToolbarGUI $toolbar
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
+ Here is the call graph for this function:

◆ listObjectBadges()

ilObjBadgeAdministrationGUI::listObjectBadges ( )
protected

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

References ILIAS\Repository\access(), assertActive(), and ILIAS\Repository\ctrl().

Referenced by applylistObjectBadgeUsers(), applyObjectFilter(), resetlistObjectBadgeUsers(), and resetObjectFilter().

661  : void
662  {
663  $this->assertActive();
664  $this->tabs_gui->setTabActive('obj_badges');
665 
666  $tbl = new ilObjectBadgeTableGUI($this, $this->access->checkAccess("write", "", $this->object->getRefId()));
667  $this->ctrl->setParameter($this, 'returnCmd', __FUNCTION__);
668  $tbl->renderTable(ILIAS_HTTP_PATH . '/' . $this->ctrl->getLinkTarget($this, 'action'));
669  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ listObjectBadgeUsers()

ilObjBadgeAdministrationGUI::listObjectBadgeUsers ( )
protected

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

References assertActive(), ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

624  : void
625  {
626  $parent_obj_id = $this->badge_request->getParentId();
627  if (!$parent_obj_id && $this->badge_request->getBadgeIdFromUrl()) {
628  // In this case, we want't to list the users that have been awarded a specific badge
629  $badge = new ilBadge($this->badge_request->getBadgeIdFromUrl());
630  $parent_obj_id = $badge->getParentId();
631  }
632  if (!$parent_obj_id) {
633  $this->ctrl->redirect($this, 'listObjectBadges');
634  }
635 
636  $this->assertActive();
637 
638  $this->tabs_gui->clearTargets();
639  $this->tabs_gui->setBackTarget(
640  $this->lng->txt('back'),
641  $this->ctrl->getLinkTarget($this, 'listObjectBadges')
642  );
643 
644  $this->ctrl->saveParameter($this, 'pid');
645 
646  $tbl = new ilBadgeUserTableGUI(null, null, $parent_obj_id, $this->badge_request->getBadgeId());
647  $this->ctrl->setParameter($this, 'returnCmd', __FUNCTION__);
648  $tbl->renderTable(ILIAS_HTTP_PATH . '/' . $this->ctrl->getLinkTarget($this, 'action'));
649  }
+ Here is the call graph for this function:

◆ listTypes()

ilObjBadgeAdministrationGUI::listTypes ( )
protected

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

References ilObjectGUI\$access, ilObjectGUI\$tpl, ILIAS\Repository\access(), assertActive(), and ILIAS\Repository\ctrl().

262  : void
263  {
264  $ilAccess = $this->access;
265 
266  $this->assertActive();
267  $this->tabs_gui->setTabActive('types');
268 
269  $tpl = new ilBadgeTypesTableGUI($this->access->checkAccess("write", "", $this->object->getRefId()));
270  $this->ctrl->setParameter($this, 'returnCmd', __FUNCTION__);
271  $tpl->renderTable(ILIAS_HTTP_PATH . '/' . $this->ctrl->getLinkTarget($this, 'action'));
272  }
ilGlobalTemplateInterface $tpl
ilAccessHandler $access
+ Here is the call graph for this function:

◆ resetlistObjectBadgeUsers()

ilObjBadgeAdministrationGUI::resetlistObjectBadgeUsers ( )
protected

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

References listObjectBadges().

656  : void
657  {
658  $this->listObjectBadges();
659  }
+ Here is the call graph for this function:

◆ resetObjectFilter()

ilObjBadgeAdministrationGUI::resetObjectFilter ( )
protected

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

References listObjectBadges().

619  : void
620  {
621  $this->listObjectBadges();
622  }
+ Here is the call graph for this function:

◆ saveImageTemplate()

ilObjBadgeAdministrationGUI::saveImageTemplate ( )
protected

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

References ilObjectGUI\$ctrl, ilObjectGUI\$lng, addImageTemplate(), ilObjectGUI\checkPermission(), initImageTemplateForm(), and ilLanguage\txt().

430  : void
431  {
432  $ilCtrl = $this->ctrl;
433  $lng = $this->lng;
434 
435  $this->checkPermission('write');
436 
437  $form = $this->initImageTemplateForm('create');
438  if ($form->checkInput()) {
439  $tmpl = new ilBadgeImageTemplate();
440  $tmpl->setTitle($form->getInput('title'));
441  $tmpl->setTypes($form->getInput('type'));
442  $tmpl->create();
443 
444  $tmpl->processImageUpload($tmpl);
445 
446  $this->tpl->setOnScreenMessage('success', $lng->txt('settings_saved'), true);
447  $ilCtrl->redirect($this, 'listImageTemplates');
448  }
449 
450  $form->setValuesByPost();
451  $this->addImageTemplate($form);
452  }
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...
ilLanguage $lng
addImageTemplate(ilPropertyFormGUI $a_form=null)
checkPermission(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
+ Here is the call graph for this function:

◆ saveSettings()

ilObjBadgeAdministrationGUI::saveSettings ( )
protected

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

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

215  : void
216  {
217  $ilCtrl = $this->ctrl;
218 
219  $this->checkPermission('write');
220 
221  $form = $this->initFormSettings();
222  if ($form->checkInput()) {
224  $handler->setActive((bool) $form->getInput('act'));
225 
226  $this->tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'), true);
227  $ilCtrl->redirect($this, 'editSettings');
228  }
229 
230  $form->setValuesByPost();
231  $this->editSettings($form);
232  }
editSettings(ilPropertyFormGUI $a_form=null)
$handler
Definition: oai.php:14
checkPermission(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
+ Here is the call graph for this function:

◆ setImageTemplateFormValues()

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

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

References ilBadgeImageTemplate\getImage(), ilBadgeImageTemplate\getImageFromResourceId(), ilBadgeImageTemplate\getImagePath(), ilBadgeImageTemplate\getImageRid(), ilPropertyFormGUI\getItemByPostVar(), ilBadgeImageTemplate\getTitle(), and ilBadgeImageTemplate\getTypes().

Referenced by editImageTemplate(), and updateImageTemplate().

486  : void {
487  $a_form->getItemByPostVar('title')->setValue($a_tmpl->getTitle());
488  if ($a_tmpl->getImageRid() !== null) {
489  $img = $a_tmpl->getImageFromResourceId();
490  $a_form->getItemByPostVar('img')->setImage($img);
491  $a_form->getItemByPostVar('img')->setValue($a_tmpl->getImageRid());
492  } else {
493  $a_form->getItemByPostVar('img')->setImage($a_tmpl->getImagePath());
494  $a_form->getItemByPostVar('img')->setValue($a_tmpl->getImage());
495  }
496 
497  if ($a_tmpl->getTypes()) {
498  $a_form->getItemByPostVar('tmode')->setValue('spec');
499  $a_form->getItemByPostVar('type')->setValue($a_tmpl->getTypes());
500  } else {
501  $a_form->getItemByPostVar('tmode')->setValue('all');
502  }
503  }
getItemByPostVar(string $a_post_var)
getImageFromResourceId(int $size=ilBadgeImage::IMAGE_SIZE_XS)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ toggleObjectBadges()

ilObjBadgeAdministrationGUI::toggleObjectBadges ( bool  $a_status)
protected

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

References ilObjectGUI\$ctrl, ilObjectGUI\$lng, getObjectBadgesFromMultiAction(), ilBadge\getObjectInstances(), and ilLanguage\txt().

Referenced by activateObjectBadges(), and deactivateObjectBadges().

689  : void
690  {
691  $ilCtrl = $this->ctrl;
692  $lng = $this->lng;
693 
694  $badge_ids = $this->getObjectBadgesFromMultiAction();
695  if (current($badge_ids) === self::TABLE_ALL_OBJECTS_ACTION) {
696  $filter = ['type' => '' , 'title' => '', 'object' => ''];
697  $badge_ids = [];
698  foreach (ilBadge::getObjectInstances($filter) as $badge_item) {
699  $badge_ids[] = $badge_item['id'];
700  }
701  foreach ($badge_ids as $badge_id) {
702  $badge = new ilBadge($badge_id);
703  $badge->setActive($a_status);
704  $badge->update();
705  }
706  } else {
707  foreach ($badge_ids as $badge_id) {
708  $badge = new ilBadge($badge_id);
709  $badge->setActive($a_status);
710  $badge->update();
711  }
712  }
713 
714 
715  $this->tpl->setOnScreenMessage('success', $lng->txt('settings_saved'), true);
716  $ilCtrl->redirect($this, 'listObjectBadges');
717  }
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...
ilLanguage $lng
static getObjectInstances(?array $filter=null)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateImageTemplate()

ilObjBadgeAdministrationGUI::updateImageTemplate ( )
protected

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

References ilObjectGUI\$ctrl, ilObjectGUI\$lng, ilObjectGUI\checkPermission(), editImageTemplate(), initImageTemplateForm(), setImageTemplateFormValues(), and ilLanguage\txt().

505  : void
506  {
507  $ilCtrl = $this->ctrl;
508  $lng = $this->lng;
509 
510  $this->checkPermission('write');
511 
512  $tmpl_id = $this->badge_request->getTemplateId();
513  if (!$tmpl_id) {
514  $ilCtrl->redirect($this, 'listImageTemplates');
515  }
516 
517  $ilCtrl->setParameter($this, 'tid', $tmpl_id);
518 
519  $tmpl = new ilBadgeImageTemplate($tmpl_id);
520 
521  $form = $this->initImageTemplateForm('update');
522  if ($form->checkInput()) {
523  $tmpl->setTitle($form->getInput('title'));
524 
525  if ($form->getInput('tmode') !== 'all') {
526  $tmpl->setTypes($form->getInput('type'));
527  } else {
528  $tmpl->setTypes(null);
529  }
530 
531  $tmpl->update();
532 
533  $tmpl->processImageUpload($tmpl);
534 
535  $this->tpl->setOnScreenMessage('success', $lng->txt('settings_saved'), true);
536  $ilCtrl->redirect($this, 'listImageTemplates');
537  }
538 
539  $this->setImageTemplateFormValues($form, $tmpl);
540  $form->setValuesByPost();
541  $this->editImageTemplate($form);
542  }
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...
setImageTemplateFormValues(ilPropertyFormGUI $a_form, ilBadgeImageTemplate $a_tmpl)
ilLanguage $lng
editImageTemplate(ilPropertyFormGUI $a_form=null)
checkPermission(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
+ Here is the call graph for this function:

Field Documentation

◆ $badge_request

ilBadgeGUIRequest ilObjBadgeAdministrationGUI::$badge_request
private

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

◆ $http

Services ilObjBadgeAdministrationGUI::$http
private

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

◆ $rbacsystem

ilRbacSystem ilObjBadgeAdministrationGUI::$rbacsystem
private

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

Referenced by getAdminTabs().

◆ $resource_storage

ILIAS ResourceStorage Services ilObjBadgeAdministrationGUI::$resource_storage
private

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

◆ $tabs

ilTabsGUI ilObjBadgeAdministrationGUI::$tabs
private

◆ TABLE_ALL_OBJECTS_ACTION

const ilObjBadgeAdministrationGUI::TABLE_ALL_OBJECTS_ACTION = 'ALL_OBJECTS'

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


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