ILIAS  trunk Revision v11.0_alpha-1866-gfa368f7776e
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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 ()
 
- 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:22
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ activateObjectBadges()

ilObjBadgeAdministrationGUI::activateObjectBadges ( )
protected

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

References toggleObjectBadges().

Referenced by executeCommand().

709  : void
710  {
711  $this->toggleObjectBadges(true);
712  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ activateTypes()

ilObjBadgeAdministrationGUI::activateTypes ( )
protected

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

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

Referenced by executeCommand().

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

◆ addImageTemplate()

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

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

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

Referenced by saveImageTemplate().

354  : void {
355  $tpl = $this->tpl;
356 
357  $this->checkPermission('write');
358 
359  $this->assertActive();
360  $this->tabs_gui->setTabActive('imgtmpl');
361 
362  if (!$a_form) {
363  $a_form = $this->initImageTemplateForm('create');
364  }
365 
366  $tpl->setContent($a_form->getHTML());
367  }
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 642 of file class.ilObjBadgeAdministrationGUI.php.

References listObjectBadges().

642  : void
643  {
644  $this->listObjectBadges();
645  }
+ Here is the call graph for this function:

◆ applyObjectFilter()

ilObjBadgeAdministrationGUI::applyObjectFilter ( )
protected

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

References listObjectBadges().

606  : void
607  {
608  $this->listObjectBadges();
609  }
+ Here is the call graph for this function:

◆ assertActive()

ilObjBadgeAdministrationGUI::assertActive ( )
protected

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

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

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

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

◆ confirmDeleteImageTemplates()

ilObjBadgeAdministrationGUI::confirmDeleteImageTemplates ( )
protected

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

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

Referenced by executeCommand().

536  : void
537  {
538  $ilCtrl = $this->ctrl;
539  $lng = $this->lng;
540  $tpl = $this->tpl;
541  $ilTabs = $this->tabs;
542 
543  $this->checkPermission('write');
544 
545  $tmpl_ids = $this->badge_request->getBadgeAssignableUsers();
546  if ($tmpl_ids === ['ALL_OBJECTS']) {
547  $tmpl_ids = [];
548  foreach (ilBadgeImageTemplate::getInstances() as $template) {
549  $tmpl_ids[] = $template->getId();
550  }
551  }
552 
553  if (!$tmpl_ids) {
554  $ilCtrl->redirect($this, 'listImageTemplates');
555  }
556 
557  $ilTabs->clearTargets();
558  $ilTabs->setBackTarget(
559  $lng->txt('back'),
560  $ilCtrl->getLinkTarget($this, 'listImageTemplates')
561  );
562 
563  $confirmation_gui = new ilConfirmationGUI();
564  $confirmation_gui->setFormAction($ilCtrl->getFormAction($this));
565  $confirmation_gui->setHeaderText($lng->txt('badge_template_deletion_confirmation'));
566  $confirmation_gui->setCancel($lng->txt('cancel'), 'listImageTemplates');
567  $confirmation_gui->setConfirm($lng->txt('delete'), 'deleteImageTemplates');
568 
569  foreach ($tmpl_ids as $tmpl_id) {
570  $tmpl = new ilBadgeImageTemplate($tmpl_id);
571  $confirmation_gui->addItem('id[]', $tmpl_id, $tmpl->getTitle());
572  }
573 
574  $tpl->setContent($confirmation_gui->getHTML());
575  }
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:
+ Here is the caller graph for this function:

◆ confirmDeleteObjectBadges()

ilObjBadgeAdministrationGUI::confirmDeleteObjectBadges ( )
protected

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

Referenced by executeCommand().

719  : void
720  {
721  $ilCtrl = $this->ctrl;
722  $lng = $this->lng;
723  $tpl = $this->tpl;
724  $ilTabs = $this->tabs;
725 
726  $badge_ids = $this->badge_request->getMultiActionBadgeIdsFromUrl();
727 
728  $ilTabs->clearTargets();
729  $ilTabs->setBackTarget(
730  $lng->txt('back'),
731  $ilCtrl->getLinkTarget($this, 'listObjectBadges')
732  );
733 
734  $confirmation_gui = new ilConfirmationGUI();
735  $confirmation_gui->setFormAction($ilCtrl->getFormAction($this));
736  $confirmation_gui->setHeaderText($lng->txt('badge_deletion_confirmation'));
737  $confirmation_gui->setCancel($lng->txt('cancel'), 'listObjectBadges');
738  $confirmation_gui->setConfirm($lng->txt('delete'), 'deleteObjectBadges');
739 
740  if ($badge_ids === ['ALL_OBJECTS']) {
741  $badge_ids = [];
742  $filter = [
743  'type' => '',
744  'title' => '',
745  'object' => ''
746  ];
747  foreach (ilBadge::getObjectInstances($filter) as $badge_item) {
748  $badge_ids[] = $badge_item['id'];
749  }
750  }
751  foreach ($badge_ids as $badge_id) {
752  $badge = new ilBadge($badge_id);
753  $parent = $badge->getParentMeta();
754 
755  $container = '(' . $parent['type'] . '/' .
756  $parent['id'] . ') ' .
757  $parent['title'];
758  if ($parent['deleted']) {
759  $container .= ' <span class="il_ItemAlertProperty">' . $lng->txt('deleted') . '</span>';
760  }
761 
762  $confirmation_gui->addItem(
763  'id[]',
764  $badge_id,
765  $container . ' - ' .
766  $badge->getTitle() .
767  ' (' . count(ilBadgeAssignment::getInstancesByBadgeId($badge_id)) . ')'
768  );
769  }
770 
771  $tpl->setContent($confirmation_gui->getHTML());
772  }
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:36
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:
+ Here is the caller graph for this function:

◆ deactivateObjectBadges()

ilObjBadgeAdministrationGUI::deactivateObjectBadges ( )
protected

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

References toggleObjectBadges().

Referenced by executeCommand().

714  : void
715  {
716  $this->toggleObjectBadges(false);
717  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deactivateTypes()

ilObjBadgeAdministrationGUI::deactivateTypes ( )
protected

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

Referenced by executeCommand().

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

◆ deleteImageTemplates()

ilObjBadgeAdministrationGUI::deleteImageTemplates ( )
protected

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

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

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

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

774  : void
775  {
776  $ilCtrl = $this->ctrl;
777  $lng = $this->lng;
778 
779  $badge_ids = $this->badge_request->getMultiActionBadgeIdsFromPost();
780 
781  foreach ($badge_ids as $badge_id) {
782  $badge = new ilBadge($badge_id);
783  $badge->delete();
784  }
785 
786  $this->tpl->setOnScreenMessage('success', $lng->txt('settings_saved'), true);
787  $ilCtrl->redirect($this, 'listObjectBadges');
788  }
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 446 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 executeCommand(), and updateImageTemplate().

448  : void {
449  $ilCtrl = $this->ctrl;
450  $tpl = $this->tpl;
451 
452  $this->checkPermission('write');
453 
454  $this->assertActive();
455  $this->tabs_gui->setTabActive('imgtmpl');
456 
457  $tmpl_ids = $this->badge_request->getMultiActionBadgeIdsFromUrl();
458  if (count($tmpl_ids) !== 1) {
459  $this->ctrl->redirect($this, 'listImageTemplates');
460  }
461 
462  $template_id = (int) array_pop($tmpl_ids);
463  $ilCtrl->setParameter($this, 'tid', $template_id);
464 
465  $tmpl = new ilBadgeImageTemplate($template_id);
466 
467  if (!$a_form) {
468  $a_form = $this->initImageTemplateForm('edit');
469  $this->setImageTemplateFormValues($a_form, $tmpl);
470  }
471 
472  $tpl->setContent($a_form->getHTML());
473  }
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 198 of file class.ilObjBadgeAdministrationGUI.php.

References initFormSettings().

Referenced by saveSettings().

198  : void
199  {
200  $this->tabs_gui->setTabActive('settings');
201 
202  if (!$a_form) {
203  $a_form = $this->initFormSettings();
204  }
205 
206  $this->tpl->setContent($a_form->getHTML());
207  }
+ 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 activateObjectBadges(), activateTypes(), assertActive(), confirmDeleteImageTemplates(), confirmDeleteObjectBadges(), ILIAS\Repository\ctrl(), deactivateObjectBadges(), deactivateTypes(), editImageTemplate(), ILIAS\FileDelivery\http(), listObjectBadgeUsers(), 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  $table_action = $this->http->wrapper()->query()->retrieve(
97  'tid_table_action',
98  $this->refinery->byTrying([
99  $this->refinery->kindlyTo()->string(),
100  $this->refinery->always('')
101  ])
102  );
103 
104  $render_default = true;
105  if ($table_action === 'badge_type_activate') {
106  $this->activateTypes();
107  } elseif ($table_action === 'badge_type_deactivate') {
108  $this->deactivateTypes();
109  } elseif ($table_action === 'badge_image_template_editImageTemplate') {
110  $this->editImageTemplate();
111  $render_default = false;
112  } elseif ($table_action === 'obj_badge_user') {
113  $this->editImageTemplate();
114  $render_default = false;
115  } elseif ($table_action === 'obj_badge_activate') {
116  $this->activateObjectBadges();
117  $render_default = false;
118  } elseif ($table_action === 'obj_badge_deactivate') {
119  $this->deactivateObjectBadges();
120  $render_default = false;
121  } elseif ($table_action === 'obj_badge_show_users') {
122  $this->listObjectBadgeUsers();
123  $render_default = false;
124  } elseif ($table_action === 'badge_image_template_delete') {
126  $render_default = false;
127  } elseif ($table_action === 'obj_badge_delete') {
128  $this->confirmDeleteObjectBadges();
129  $render_default = false;
130  }
131 
132  if ($render_default) {
133  $this->$cmd();
134  break;
135  }
136  }
137  }
ilBadgeManagementGUI: ilPropertyFormGUI
prepareOutput(bool $show_sub_objects=true)
static http()
Fetches the global http state from ILIAS.
editImageTemplate(?ilPropertyFormGUI $a_form=null)
+ Here is the call graph for this function:

◆ getAdminTabs()

ilObjBadgeAdministrationGUI::getAdminTabs ( )

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

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

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

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

Referenced by toggleObjectBadges().

665  : array
666  {
667  $ilAccess = $this->access;
668  $ilCtrl = $this->ctrl;
669 
670  $badge_ids = $this->badge_request->getMultiActionBadgeIdsFromUrl();
671  if (!$badge_ids ||
672  !$ilAccess->checkAccess('write', '', $this->object->getRefId())) {
673  $ilCtrl->redirect($this, 'listObjectBadges');
674  }
675 
676  return $badge_ids;
677  }
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:

◆ initFormSettings()

ilObjBadgeAdministrationGUI::initFormSettings ( )
protected

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

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

Referenced by editSettings(), and saveSettings().

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

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

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

331  : void
332  {
333  $lng = $this->lng;
334  $ilToolbar = $this->toolbar;
335  $ilCtrl = $this->ctrl;
336 
337  $this->assertActive();
338  $this->tabs_gui->setTabActive('imgtmpl');
339 
340  if ($this->checkPermissionBool('write')) {
341  $ilToolbar->addButton(
342  $lng->txt('badge_add_template'),
343  $ilCtrl->getLinkTarget($this, 'addImageTemplate')
344  );
345  }
346 
347  $template_table = new ilBadgeImageTemplateTableGUI($this->access->checkAccess("write", "", $this->object->getRefId()));
348  $template_table->renderTable();
349  }
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 652 of file class.ilObjBadgeAdministrationGUI.php.

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

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

652  : void
653  {
654  $this->assertActive();
655  $this->tabs_gui->setTabActive('obj_badges');
656 
657  $tbl = new ilObjectBadgeTableGUI($this, $this->access->checkAccess("write", "", $this->object->getRefId()));
658  $tbl->renderTable();
659  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ listObjectBadgeUsers()

ilObjBadgeAdministrationGUI::listObjectBadgeUsers ( )
protected

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

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

Referenced by executeCommand().

616  : void
617  {
618  $parent_obj_id = $this->badge_request->getParentId();
619  if (!$parent_obj_id && $this->badge_request->getBadgeIdFromUrl()) {
620  // In this case, we want't to list the users that have been awarded a specific badge
621  $badge = new ilBadge($this->badge_request->getBadgeIdFromUrl());
622  $parent_obj_id = $badge->getParentId();
623  }
624  if (!$parent_obj_id) {
625  $this->ctrl->redirect($this, 'listObjectBadges');
626  }
627 
628  $this->assertActive();
629 
630  $this->tabs_gui->clearTargets();
631  $this->tabs_gui->setBackTarget(
632  $this->lng->txt('back'),
633  $this->ctrl->getLinkTarget($this, 'listObjectBadges')
634  );
635 
636  $this->ctrl->saveParameter($this, 'pid');
637 
638  $tbl = new ilBadgeUserTableGUI(null, null, $parent_obj_id, $this->badge_request->getBadgeId());
639  $tbl->renderTable();
640  }
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:

◆ listTypes()

ilObjBadgeAdministrationGUI::listTypes ( )
protected

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

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

256  : void
257  {
258  $ilAccess = $this->access;
259 
260  $this->assertActive();
261  $this->tabs_gui->setTabActive('types');
262 
263  $tpl = new ilBadgeTypesTableGUI($this->access->checkAccess("write", "", $this->object->getRefId()));
264  $tpl->renderTable();
265  }
ilGlobalTemplateInterface $tpl
ilAccessHandler $access
+ Here is the call graph for this function:

◆ resetlistObjectBadgeUsers()

ilObjBadgeAdministrationGUI::resetlistObjectBadgeUsers ( )
protected

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

References listObjectBadges().

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

◆ resetObjectFilter()

ilObjBadgeAdministrationGUI::resetObjectFilter ( )
protected

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

References listObjectBadges().

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

◆ saveImageTemplate()

ilObjBadgeAdministrationGUI::saveImageTemplate ( )
protected

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

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

422  : void
423  {
424  $ilCtrl = $this->ctrl;
425  $lng = $this->lng;
426 
427  $this->checkPermission('write');
428 
429  $form = $this->initImageTemplateForm('create');
430  if ($form->checkInput()) {
431  $tmpl = new ilBadgeImageTemplate();
432  $tmpl->setTitle($form->getInput('title'));
433  $tmpl->setTypes($form->getInput('type'));
434  $tmpl->create();
435 
436  $tmpl->processImageUpload($tmpl);
437 
438  $this->tpl->setOnScreenMessage('success', $lng->txt('settings_saved'), true);
439  $ilCtrl->redirect($this, 'listImageTemplates');
440  }
441 
442  $form->setValuesByPost();
443  $this->addImageTemplate($form);
444  }
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 209 of file class.ilObjBadgeAdministrationGUI.php.

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

209  : void
210  {
211  $ilCtrl = $this->ctrl;
212 
213  $this->checkPermission('write');
214 
215  $form = $this->initFormSettings();
216  if ($form->checkInput()) {
218  $handler->setActive((bool) $form->getInput('act'));
219 
220  $this->tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'), true);
221  $ilCtrl->redirect($this, 'editSettings');
222  }
223 
224  $form->setValuesByPost();
225  $this->editSettings($form);
226  }
editSettings(?ilPropertyFormGUI $a_form=null)
$handler
Definition: oai.php:30
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 475 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().

478  : void {
479  $a_form->getItemByPostVar('title')->setValue($a_tmpl->getTitle());
480  if ($a_tmpl->getImageRid() !== null) {
481  $img = $a_tmpl->getImageFromResourceId();
482  $a_form->getItemByPostVar('img')->setImage($img);
483  $a_form->getItemByPostVar('img')->setValue($a_tmpl->getImageRid());
484  } else {
485  $a_form->getItemByPostVar('img')->setImage($a_tmpl->getImagePath());
486  $a_form->getItemByPostVar('img')->setValue($a_tmpl->getImage());
487  }
488 
489  if ($a_tmpl->getTypes()) {
490  $a_form->getItemByPostVar('tmode')->setValue('spec');
491  $a_form->getItemByPostVar('type')->setValue($a_tmpl->getTypes());
492  } else {
493  $a_form->getItemByPostVar('tmode')->setValue('all');
494  }
495  }
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 679 of file class.ilObjBadgeAdministrationGUI.php.

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

Referenced by activateObjectBadges(), and deactivateObjectBadges().

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

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

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

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