ILIAS  trunk Revision v11.0_alpha-2662-g519ff7d528f
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
 

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
 
GlobalHttpState $http
 
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
 
CustomIconFactory $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 37 of file class.ilObjBadgeAdministrationGUI.php.

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

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

Member Function Documentation

◆ activateObjectBadges()

ilObjBadgeAdministrationGUI::activateObjectBadges ( )
protected

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

References toggleObjectBadges().

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

◆ activateTypes()

ilObjBadgeAdministrationGUI::activateTypes ( )
protected

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

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

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

◆ addImageTemplate()

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

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

References ilObjectGUI\$tpl, assertActive(), ilObjectGUI\checkPermission(), initImageTemplateForm(), and ILIAS\UICore\GlobalTemplate\setContent().

Referenced by saveImageTemplate().

360  : void {
361  $tpl = $this->tpl;
362 
363  $this->checkPermission('write');
364 
365  $this->assertActive();
366  $this->tabs_gui->setTabActive('imgtmpl');
367 
368  if (!$a_form) {
369  $a_form = $this->initImageTemplateForm('create');
370  }
371 
372  $tpl->setContent($a_form->getHTML());
373  }
setContent(string $a_html)
Sets content for standard template.
ilGlobalTemplateInterface $tpl
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 649 of file class.ilObjBadgeAdministrationGUI.php.

References listObjectBadges().

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

◆ applyObjectFilter()

ilObjBadgeAdministrationGUI::applyObjectFilter ( )
protected

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

References listObjectBadges().

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

◆ assertActive()

ilObjBadgeAdministrationGUI::assertActive ( )
protected

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

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

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

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

◆ confirmDeleteImageTemplates()

ilObjBadgeAdministrationGUI::confirmDeleteImageTemplates ( )
protected

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

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

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

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

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

References toggleObjectBadges().

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

◆ deactivateTypes()

ilObjBadgeAdministrationGUI::deactivateTypes ( )
protected

Definition at line 298 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().

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

◆ deleteImageTemplates()

ilObjBadgeAdministrationGUI::deleteImageTemplates ( )
protected

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

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

583  : void
584  {
585  $lng = $this->lng;
586  $tmpl_ids = $this->badge_request->getIds();
587 
588  if ($this->checkPermissionBool('write') && count($tmpl_ids) > 0) {
589  if (current($tmpl_ids) === self::TABLE_ALL_OBJECTS_ACTION) {
590  $tmpl_ids = [];
591  foreach (ilBadgeImageTemplate::getInstances() as $template) {
592  $tmpl_ids[] = $template->getId();
593  }
594  }
595  foreach ($tmpl_ids as $tmpl_id) {
596  $tmpl = new ilBadgeImageTemplate((int) $tmpl_id);
597  $tmpl->delete();
598  }
599  $this->tpl->setOnScreenMessage('success', $lng->txt('badge_deletion'), true);
600  } else {
601  $this->tpl->setOnScreenMessage('failure', $lng->txt('badge_select_one'), true);
602  }
603 
604  $this->ctrl->redirect($this, 'listImageTemplates');
605  }
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 782 of file class.ilObjBadgeAdministrationGUI.php.

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

782  : void
783  {
784  $ilCtrl = $this->ctrl;
785  $lng = $this->lng;
786 
787  $badge_ids = $this->badge_request->getMultiActionBadgeIdsFromPost();
788 
789  foreach ($badge_ids as $badge_id) {
790  $badge = new ilBadge($badge_id);
791  $badge->delete();
792  }
793 
794  $this->tpl->setOnScreenMessage('success', $lng->txt('settings_saved'), true);
795  $ilCtrl->redirect($this, 'listObjectBadges');
796  }
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 452 of file class.ilObjBadgeAdministrationGUI.php.

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

Referenced by updateImageTemplate().

454  : void {
455  $ilCtrl = $this->ctrl;
456  $tpl = $this->tpl;
457 
458  $this->checkPermission('write');
459 
460  $this->assertActive();
461  $this->tabs_gui->setTabActive('imgtmpl');
462 
463  $tmpl_ids = $this->badge_request->getMultiActionBadgeIdsFromUrl();
464  if (count($tmpl_ids) !== 1) {
465  $this->ctrl->redirect($this, 'listImageTemplates');
466  }
467 
468  $template_id = (int) array_pop($tmpl_ids);
469  $ilCtrl->setParameter($this, 'tid', $template_id);
470 
471  $tmpl = new ilBadgeImageTemplate($template_id);
472 
473  if (!$a_form) {
474  $a_form = $this->initImageTemplateForm('edit');
475  $this->setImageTemplateFormValues($a_form, $tmpl);
476  }
477 
478  $tpl->setContent($a_form->getHTML());
479  }
setContent(string $a_html)
Sets content for standard template.
setImageTemplateFormValues(ilPropertyFormGUI $a_form, ilBadgeImageTemplate $a_tmpl)
ilGlobalTemplateInterface $tpl
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 202 of file class.ilObjBadgeAdministrationGUI.php.

References initFormSettings().

Referenced by saveSettings().

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

◆ executeCommand()

ilObjBadgeAdministrationGUI::executeCommand ( )

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

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

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

◆ getAdminTabs()

ilObjBadgeAdministrationGUI::getAdminTabs ( )

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

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

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

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

Referenced by toggleObjectBadges().

673  : array
674  {
675  $ilAccess = $this->access;
676  $ilCtrl = $this->ctrl;
677 
678  $badge_ids = $this->badge_request->getMultiActionBadgeIdsFromUrl();
679  if (!$badge_ids ||
680  !$ilAccess->checkAccess('write', '', $this->object->getRefId())) {
681  $ilCtrl->redirect($this, 'listObjectBadges');
682  }
683 
684  return $badge_ids;
685  }
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 180 of file class.ilObjBadgeAdministrationGUI.php.

180  : array
181  {
182  return [];
183  }

◆ 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 185 of file class.ilObjBadgeAdministrationGUI.php.

185  : array
186  {
187  return ['action'];
188  }

◆ initFormSettings()

ilObjBadgeAdministrationGUI::initFormSettings ( )
protected

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

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

Referenced by editSettings(), and saveSettings().

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

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

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

336  : void
337  {
338  $lng = $this->lng;
339  $ilToolbar = $this->toolbar;
340  $ilCtrl = $this->ctrl;
341 
342  $this->assertActive();
343  $this->tabs_gui->setTabActive('imgtmpl');
344 
345  if ($this->checkPermissionBool('write')) {
346  $ilToolbar->addButton(
347  $lng->txt('badge_add_template'),
348  $ilCtrl->getLinkTarget($this, 'addImageTemplate')
349  );
350  }
351 
352  $template_table = new ilBadgeImageTemplateTableGUI($this->access->checkAccess("write", "", $this->object->getRefId()));
353  $this->ctrl->setParameter($this, 'returnCmd', __FUNCTION__);
354  $template_table->renderTable(ILIAS_HTTP_PATH . '/' . $this->ctrl->getLinkTarget($this, 'action'));
355  }
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 659 of file class.ilObjBadgeAdministrationGUI.php.

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

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

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

◆ listObjectBadgeUsers()

ilObjBadgeAdministrationGUI::listObjectBadgeUsers ( )
protected

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

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

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

◆ listTypes()

ilObjBadgeAdministrationGUI::listTypes ( )
protected

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

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

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

◆ resetlistObjectBadgeUsers()

ilObjBadgeAdministrationGUI::resetlistObjectBadgeUsers ( )
protected

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

References listObjectBadges().

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

◆ resetObjectFilter()

ilObjBadgeAdministrationGUI::resetObjectFilter ( )
protected

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

References listObjectBadges().

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

◆ saveImageTemplate()

ilObjBadgeAdministrationGUI::saveImageTemplate ( )
protected

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

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

428  : void
429  {
430  $ilCtrl = $this->ctrl;
431  $lng = $this->lng;
432 
433  $this->checkPermission('write');
434 
435  $form = $this->initImageTemplateForm('create');
436  if ($form->checkInput()) {
437  $tmpl = new ilBadgeImageTemplate();
438  $tmpl->setTitle($form->getInput('title'));
439  $tmpl->setTypes($form->getInput('type'));
440  $tmpl->create();
441 
442  $tmpl->processImageUpload($tmpl);
443 
444  $this->tpl->setOnScreenMessage('success', $lng->txt('settings_saved'), true);
445  $ilCtrl->redirect($this, 'listImageTemplates');
446  }
447 
448  $form->setValuesByPost();
449  $this->addImageTemplate($form);
450  }
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...
addImageTemplate(?ilPropertyFormGUI $a_form=null)
ilLanguage $lng
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 213 of file class.ilObjBadgeAdministrationGUI.php.

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

213  : void
214  {
215  $ilCtrl = $this->ctrl;
216 
217  $this->checkPermission('write');
218 
219  $form = $this->initFormSettings();
220  if ($form->checkInput()) {
222  $handler->setActive((bool) $form->getInput('act'));
223 
224  $this->tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'), true);
225  $ilCtrl->redirect($this, 'editSettings');
226  }
227 
228  $form->setValuesByPost();
229  $this->editSettings($form);
230  }
editSettings(?ilPropertyFormGUI $a_form=null)
$handler
Definition: oai.php:29
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 481 of file class.ilObjBadgeAdministrationGUI.php.

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

Referenced by editImageTemplate(), and updateImageTemplate().

484  : void {
485  $a_form->getItemByPostVar('title')->setValue($a_tmpl->getTitle());
486  if ($a_tmpl->getImageRid() !== null) {
487  $img = $a_tmpl->getImageFromResourceId();
488  $a_form->getItemByPostVar('img')->setImage($img);
489  $a_form->getItemByPostVar('img')->setValue($a_tmpl->getImageRid());
490  } else {
491  $a_form->getItemByPostVar('img')->setImage($a_tmpl->getImagePath());
492  $a_form->getItemByPostVar('img')->setValue($a_tmpl->getImage());
493  }
494 
495  if ($a_tmpl->getTypes()) {
496  $a_form->getItemByPostVar('tmode')->setValue('spec');
497  $a_form->getItemByPostVar('type')->setValue($a_tmpl->getTypes());
498  } else {
499  $a_form->getItemByPostVar('tmode')->setValue('all');
500  }
501  }
getItemByPostVar(string $a_post_var)
getImageFromResourceId(int $size=ilBadgeImage::IMAGE_SIZE_XS)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ 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 687 of file class.ilObjBadgeAdministrationGUI.php.

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

Referenced by activateObjectBadges(), and deactivateObjectBadges().

687  : void
688  {
689  $ilCtrl = $this->ctrl;
690  $lng = $this->lng;
691 
692  $badge_ids = $this->getObjectBadgesFromMultiAction();
693  if (current($badge_ids) === self::TABLE_ALL_OBJECTS_ACTION) {
694  $filter = ['type' => '' , 'title' => '', 'object' => ''];
695  $badge_ids = [];
696  foreach (ilBadge::getObjectInstances($filter) as $badge_item) {
697  $badge_ids[] = $badge_item['id'];
698  }
699  foreach ($badge_ids as $badge_id) {
700  $badge = new ilBadge($badge_id);
701  $badge->setActive($a_status);
702  $badge->update();
703  }
704  } else {
705  foreach ($badge_ids as $badge_id) {
706  $badge = new ilBadge($badge_id);
707  $badge->setActive($a_status);
708  $badge->update();
709  }
710  }
711 
712 
713  $this->tpl->setOnScreenMessage('success', $lng->txt('settings_saved'), true);
714  $ilCtrl->redirect($this, 'listObjectBadges');
715  }
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 503 of file class.ilObjBadgeAdministrationGUI.php.

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

503  : void
504  {
505  $ilCtrl = $this->ctrl;
506  $lng = $this->lng;
507 
508  $this->checkPermission('write');
509 
510  $tmpl_id = $this->badge_request->getTemplateId();
511  if (!$tmpl_id) {
512  $ilCtrl->redirect($this, 'listImageTemplates');
513  }
514 
515  $ilCtrl->setParameter($this, 'tid', $tmpl_id);
516 
517  $tmpl = new ilBadgeImageTemplate($tmpl_id);
518 
519  $form = $this->initImageTemplateForm('update');
520  if ($form->checkInput()) {
521  $tmpl->setTitle($form->getInput('title'));
522 
523  if ($form->getInput('tmode') !== 'all') {
524  $tmpl->setTypes($form->getInput('type'));
525  } else {
526  $tmpl->setTypes(null);
527  }
528 
529  $tmpl->update();
530 
531  $tmpl->processImageUpload($tmpl);
532 
533  $this->tpl->setOnScreenMessage('success', $lng->txt('settings_saved'), true);
534  $ilCtrl->redirect($this, 'listImageTemplates');
535  }
536 
537  $this->setImageTemplateFormValues($form, $tmpl);
538  $form->setValuesByPost();
539  $this->editImageTemplate($form);
540  }
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)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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.

◆ $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: