ILIAS  trunk Revision v11.0_alpha-1862-g4e205cb56d4
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilObjRoleTemplateGUI Class Reference

Class ilObjRoleTemplateGUI. More...

+ Inheritance diagram for ilObjRoleTemplateGUI:
+ Collaboration diagram for ilObjRoleTemplateGUI:

Public Member Functions

 __construct ($a_data, int $a_id, bool $a_call_by_reference)
 
 executeCommand ()
 
 createObject ()
 
 editObject (?ilPropertyFormGUI $form=null)
 Create new object. More...
 
 saveObject ()
 
 updateObject ()
 
 adoptPermSaveObject ()
 
 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)
 

Protected Member Functions

 getRoleTemplateForm (bool $is_role_creation_form=false)
 
 permObject ()
 
 permSaveObject ()
 
 getTabs ()
 
 addAdminLocatorItems (bool $do_not_add_object=false)
 
- 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)
 

Protected Attributes

ilRbacAdmin $rbac_admin
 
Factory $refinery
 
- 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 = ""
 

Private Attributes

const FORM_KEY_TITLE = 'title'
 
const FORM_KEY_DESCRIPTION = 'description'
 
const FORM_KEY_ILIAS_ID = 'ilias_id'
 
const FORM_KEY_PROTECT = 'protect'
 
int $rolf_ref_id
 
GlobalHttpState $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)
 
- 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]
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilObjRoleTemplateGUI::__construct (   $a_data,
int  $a_id,
bool  $a_call_by_reference 
)

Definition at line 46 of file class.ilObjRoleTemplateGUI.php.

References $DIC, ilObjectGUI\$ref_id, ILIAS\GlobalScreen\Provider\__construct(), ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), and ILIAS\Repository\refinery().

47  {
48  global $DIC;
49 
50  $this->rbac_admin = $DIC->rbac()->admin();
51 
52  $this->type = "rolt";
53  parent::__construct($a_data, $a_id, $a_call_by_reference, false);
54  $this->lng->loadLanguageModule('rbac');
55  $this->rolf_ref_id = &$this->ref_id;
56  $this->ctrl->saveParameter($this, "obj_id");
57  $this->http = $DIC->http();
58  $this->refinery = $DIC->refinery();
59  }
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

◆ addAdminLocatorItems()

ilObjRoleTemplateGUI::addAdminLocatorItems ( bool  $do_not_add_object = false)
protected

Definition at line 411 of file class.ilObjRoleTemplateGUI.php.

References ilObjectGUI\$ref_id, ilObjRole\_getTranslation(), ilObject\_lookupObjId(), ilObject\_lookupType(), ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ILIAS\Repository\locator(), ILIAS\Repository\object(), and ILIAS\Repository\refinery().

411  : void
412  {
413  parent::addAdminLocatorItems(true);
414 
415  $query = $this->http->wrapper()->query();
416 
417  if ($query->has('ref_id')) {
418  $ref_id = $query->retrieve('ref_id', $this->refinery->kindlyTo()->int());
419  $this->locator->addItem(
420  $this->lng->txt('obj_' . ilObject::_lookupType(
422  )),
423  $this->ctrl->getLinkTargetByClass("ilobjrolefoldergui", "view")
424  );
425  }
426 
427  if ($query->has('obj_id')) {
428  $this->locator->addItem(
429  ilObjRole::_getTranslation($this->object->getTitle()),
430  $this->ctrl->getLinkTarget($this, 'perm')
431  );
432  }
433  }
static _lookupObjId(int $ref_id)
static http()
Fetches the global http state from ILIAS.
static _getTranslation(string $a_role_title)
static _lookupType(int $id, bool $reference=false)
+ Here is the call graph for this function:

◆ adoptPermSaveObject()

ilObjRoleTemplateGUI::adoptPermSaveObject ( )

Definition at line 347 of file class.ilObjRoleTemplateGUI.php.

References ilObject\_lookupTitle(), ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), and ILIAS\Repository\refinery().

347  : void
348  {
349  $source = 0;
350  if ($this->http->wrapper()->post()->has('adopt')) {
351  $source = $this->http->wrapper()->post()->retrieve(
352  'adopt',
353  $this->refinery->kindlyTo()->int()
354  );
355  }
356 
357  if (!$this->rbac_system->checkAccess('write', $this->rolf_ref_id)) {
358  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('msg_no_perm_perm'), true);
359  } elseif ($this->obj_id == $source) {
360  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("msg_perm_adopted_from_itself"), true);
361  } else {
362  $this->rbac_admin->deleteRolePermission($this->obj_id, $this->rolf_ref_id);
363  $parentRoles = $this->rbac_review->getParentRoleIds($this->rolf_ref_id, true);
364  $this->rbac_admin->copyRoleTemplatePermissions(
365  $source,
366  $parentRoles[$source]["parent"],
367  $this->rolf_ref_id,
368  $this->obj_id
369  );
370  // update object data entry (to update last modification date)
371  $this->object->update();
372 
373  // send info
374  $title = ilObject::_lookupTitle($source);
375  $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_perm_adopted_from1") . " '" . $title . "'.<br/>" . $this->lng->txt("msg_perm_adopted_from2"), true);
376  }
377  $this->ctrl->redirect($this, "perm");
378  }
static http()
Fetches the global http state from ILIAS.
static _lookupTitle(int $obj_id)
+ Here is the call graph for this function:

◆ createObject()

ilObjRoleTemplateGUI::createObject ( )

Definition at line 132 of file class.ilObjRoleTemplateGUI.php.

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

132  : void
133  {
134  if (!$this->rbac_system->checkAccess('create_rolt', $this->rolf_ref_id)) {
135  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
136  }
137 
138  $this->tabs_gui->setBackTarget(
139  $this->lng->txt('cancel'),
140  $this->ctrl->getParentReturnByClass(self::class)
141  );
142 
143  $this->tpl->setContent(
144  $this->ui_renderer->render(
145  $this->ui_factory->panel()->standard(
146  $this->lng->txt('rolt_new'),
147  $this->getRoleTemplateForm(true)
148  )
149  )
150  );
151  }
getRoleTemplateForm(bool $is_role_creation_form=false)
+ Here is the call graph for this function:

◆ editObject()

ilObjRoleTemplateGUI::editObject ( ?ilPropertyFormGUI  $form = null)

Create new object.

Definition at line 156 of file class.ilObjRoleTemplateGUI.php.

References getRoleTemplateForm(), and ILIAS\Repository\lng().

156  : void
157  {
158  $this->tabs_gui->activateTab('settings');
159 
160  if (!$this->rbac_system->checkAccess("write", $this->rolf_ref_id)) {
161  $this->error->raiseError($this->lng->txt("msg_no_perm_write"), $this->error->MESSAGE);
162  }
163 
164  $this->tpl->setContent(
165  $this->ui_renderer->render(
166  $this->ui_factory->panel()->standard(
167  $this->lng->txt('rolt_edit'),
168  $this->getRoleTemplateForm()
169  )
170  )
171  );
172  }
getRoleTemplateForm(bool $is_role_creation_form=false)
+ Here is the call graph for this function:

◆ executeCommand()

ilObjRoleTemplateGUI::executeCommand ( )

Definition at line 61 of file class.ilObjRoleTemplateGUI.php.

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

61  : void
62  {
63  $this->prepareOutput();
64 
65  $next_class = $this->ctrl->getNextClass($this);
66  $cmd = $this->ctrl->getCmd();
67 
68  switch ($next_class) {
69  default:
70  if (!$cmd) {
71  $cmd = "perm";
72  }
73  $cmd .= "Object";
74  $this->$cmd();
75 
76  break;
77  }
78  }
prepareOutput(bool $show_sub_objects=true)
+ Here is the call graph for this function:

◆ getAdminTabs()

ilObjRoleTemplateGUI::getAdminTabs ( )

Definition at line 380 of file class.ilObjRoleTemplateGUI.php.

References getTabs().

380  : void
381  {
382  $this->getTabs();
383  }
+ Here is the call graph for this function:

◆ getRoleTemplateForm()

ilObjRoleTemplateGUI::getRoleTemplateForm ( bool  $is_role_creation_form = false)
protected

Definition at line 80 of file class.ilObjRoleTemplateGUI.php.

References ILIAS\UI\Implementation\Component\Input\$inputs, ilObjRole\_getTranslation(), ILIAS\Repository\ctrl(), IL_INST_ID, ILIAS\Repository\lng(), ILIAS\Repository\object(), ILIAS\Repository\refinery(), and ILIAS\UI\Implementation\Component\Input\withValue().

Referenced by createObject(), editObject(), saveObject(), and updateObject().

80  : StandardForm
81  {
82  if ($this->creation_mode) {
83  $this->ctrl->setParameter($this, 'new_type', 'rolt');
84  }
85 
86  $ff = $this->ui_factory->input()->field();
87 
88  $title_validation_constraint = $this->refinery->custom()->constraint(
89  fn(string $v): bool => preg_match('/^il_.*$/', $v) ? false : true,
90  $this->lng->txt('msg_role_reserved_prefix')
91  );
92 
93  $inputs = [
94  self::FORM_KEY_TITLE => $ff->text($this->lng->txt('title'))
95  ->withMaxLength(70)
96  ->withRequired(true)
97  ->withAdditionalTransformation($title_validation_constraint)
98  ->withValue(
99  $is_role_creation_form ? ''
100  : ilObjRole::_getTranslation($this->object->getTitle())
101  )->withDisabled($is_role_creation_form ? false : $this->object->isInternalTemplate()),
102  self::FORM_KEY_DESCRIPTION => $ff->textarea($this->lng->txt('description'))
103  ->withMaxLimit(4000)
104  ->withValue($is_role_creation_form ? '' : $this->object->getDescription())
105  ];
106 
107  if (!$is_role_creation_form) {
108  $inputs[self::FORM_KEY_ILIAS_ID] = $ff->text($this->lng->txt('ilias_id'))
109  ->withDisabled(true)
110  ->withValue('il_' . IL_INST_ID . '_'
111  . $this->object->getType() . '_' . $this->object->getId());
112  }
113 
114  $inputs[self::FORM_KEY_PROTECT] = $ff->checkbox($this->lng->txt('role_protect_permissions'))
115  ->withValue(
116  $is_role_creation_form
117  ? false
118  : $this->rbac_review->isProtected($this->rolf_ref_id, $this->object->getId())
119  );
120 
121  return $this->ui_factory->input()->container()->form()->standard(
122  $this->ctrl->getFormActionByClass(
123  self::class,
124  $is_role_creation_form ? 'save' : 'update'
125  ),
126  $inputs
127  )->withSubmitLabel(
128  $is_role_creation_form ? $this->lng->txt('rolt_new') : $this->lng->txt('save')
129  );
130  }
const IL_INST_ID
Definition: constants.php:40
static _getTranslation(string $a_role_title)
withValue($value)
Get an input like this with another value displayed on the client side.
Definition: Group.php:61
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTabs()

ilObjRoleTemplateGUI::getTabs ( )
protected

Definition at line 388 of file class.ilObjRoleTemplateGUI.php.

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

Referenced by getAdminTabs().

388  : void
389  {
390  $this->tabs_gui->setBackTarget($this->lng->txt('btn_back'), (string) $this->ctrl->getParentReturn($this));
391 
392  if ($this->rbac_system->checkAccess('write', $this->ref_id)) {
393  $this->tabs_gui->addTab(
394  'settings',
395  $this->lng->txt('settings'),
396  $this->ctrl->getLinkTarget($this, 'edit')
397  );
398  }
399  if ($this->rbac_system->checkAccess('edit_permission', $this->ref_id)) {
400  $this->tabs_gui->addTab(
401  'perm',
402  $this->lng->txt('default_perm_settings'),
403  $this->ctrl->getLinkTarget($this, 'perm')
404  );
405  }
406  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ permObject()

ilObjRoleTemplateGUI::permObject ( )
protected

Definition at line 249 of file class.ilObjRoleTemplateGUI.php.

References ILIAS\Repository\ctrl(), ilAccordionGUI\FORCE_ALL_OPEN, and ILIAS\Repository\lng().

249  : void
250  {
251  if (!$this->rbac_system->checkAccess('edit_permission', $this->ref_id)) {
252  $this->error->raiseError($this->lng->txt('msg_no_perm_perm'), $this->error->MESSAGE);
253  return;
254  }
255  $this->tabs_gui->activateTab('perm');
256 
257  $this->tpl->addBlockFile(
258  'ADM_CONTENT',
259  'adm_content',
260  'tpl.rbac_template_permissions.html',
261  'components/ILIAS/AccessControl'
262  );
263 
264  $this->tpl->setVariable('PERM_ACTION', $this->ctrl->getFormAction($this));
265 
266  $acc = new ilAccordionGUI();
267  $acc->setBehaviour(ilAccordionGUI::FORCE_ALL_OPEN);
268  $acc->setId('template_perm_' . $this->ref_id);
269 
270  $subs = ilObjRole::getSubObjects('root', false);
271 
272  foreach ($subs as $subtype => $def) {
274  $this,
275  'perm',
276  $this->ref_id,
277  $this->obj_id,
278  $subtype,
279  false
280  );
281  $tbl->setShowChangeExistingObjects(false);
282  $tbl->parse();
283 
284  $acc->addItem($def['translation'], $tbl->getHTML());
285  }
286 
287  $this->tpl->setVariable('ACCORDION', $acc->getHTML());
288 
289  // Add options table
291  $this,
292  'perm',
293  $this->ref_id,
294  $this->obj_id,
295  false
296  );
297  $options->setShowOptions(false);
298  $options->addMultiCommand(
299  'permSave',
300  $this->lng->txt('save')
301  );
302 
303  $options->parse();
304  $this->tpl->setVariable('OPTIONS_TABLE', $options->getHTML());
305  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ permSaveObject()

ilObjRoleTemplateGUI::permSaveObject ( )
protected
Todo:
fix custom transformation

Definition at line 310 of file class.ilObjRoleTemplateGUI.php.

References ilObjectGUI\$ref_id, $rolf_ref_id, ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ILIAS\Repository\object(), and ILIAS\Repository\refinery().

310  : void
311  {
312  if (!$this->rbac_system->checkAccess('write', $this->rolf_ref_id)) {
313  $this->error->raiseError($this->lng->txt('msg_no_perm_perm'), $this->error->MESSAGE);
314  return;
315  }
316 
317  $template_permissions = [];
318  if ($this->http->wrapper()->post()->has('template_perm')) {
319  $custom_transformer = $this->refinery->custom()->transformation(
320  function ($array) {
321  return $array;
322  }
323  );
324  $template_permissions = $this->http->wrapper()->post()->retrieve(
325  'template_perm',
326  $custom_transformer
327  );
328  }
329 
330  $subs = ilObjRole::getSubObjects('root', false);
331  foreach (array_keys($subs) as $subtype) {
332  // Delete per object type
333  $this->rbac_admin->deleteRolePermission($this->object->getId(), $this->ref_id, $subtype);
334  }
335 
336  foreach ($template_permissions as $key => $ops_array) {
337  $this->rbac_admin->setRolePermission($this->object->getId(), $key, $ops_array, $this->rolf_ref_id);
338  }
339 
340  // update object data entry (to update last modification date)
341  $this->object->update();
342 
343  $this->tpl->setOnScreenMessage('success', $this->lng->txt("saved_successfully"), true);
344  $this->ctrl->redirect($this, "perm");
345  }
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:

◆ saveObject()

ilObjRoleTemplateGUI::saveObject ( )

Definition at line 174 of file class.ilObjRoleTemplateGUI.php.

References ilObjectGUI\$data, $rolf_ref_id, ILIAS\Repository\ctrl(), getRoleTemplateForm(), ILIAS\Repository\lng(), and null.

174  : void
175  {
176  if (!$this->rbac_system->checkAccess("create_rolt", $this->rolf_ref_id)) {
177  $this->ilias->raiseError($this->lng->txt("msg_no_perm_create_rolt"), $this->ilias->error_obj->WARNING);
178  }
179 
180  $form = $this->getRoleTemplateForm(true)->withRequest($this->request);
181  $data = $form->getData();
182  if ($data === null) {
183  $this->tabs_gui->setBackTarget(
184  $this->lng->txt('cancel'),
185  $this->ctrl->getParentReturnByClass(self::class)
186  );
187 
188  $this->tpl->setContent(
189  $this->ui_renderer->render(
190  $this->ui_factory->panel()->standard(
191  $this->lng->txt('rolt_new'),
192  $form
193  )
194  )
195  );
196  return;
197  }
198 
199  $role_template = new ilObjRoleTemplate();
200  $role_template->setTitle($data[self::FORM_KEY_TITLE]);
201  $role_template->setDescription($data[self::FORM_KEY_DESCRIPTION]);
202  $role_template->create();
203  $this->rbac_admin->assignRoleToFolder($role_template->getId(), $this->rolf_ref_id, 'n');
204  $this->rbac_admin->setProtected(
205  $this->rolf_ref_id,
206  $role_template->getId(),
207  $data[self::FORM_KEY_PROTECT] ? 'y' : 'n'
208  );
209  $this->tpl->setOnScreenMessage('success', $this->lng->txt("rolt_added"), true);
210  $this->ctrl->setParameter($this, 'obj_id', $role_template->getId());
211  $this->ctrl->redirect($this, 'perm');
212  }
Class ilObjRoleTemplate.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
Class ilObjForumAdministration.
getRoleTemplateForm(bool $is_role_creation_form=false)
+ Here is the call graph for this function:

◆ updateObject()

ilObjRoleTemplateGUI::updateObject ( )

Definition at line 214 of file class.ilObjRoleTemplateGUI.php.

References ilObjectGUI\$data, ILIAS\Repository\ctrl(), getRoleTemplateForm(), ILIAS\Repository\lng(), null, and ILIAS\Repository\object().

214  : void
215  {
216  if (!$this->rbac_system->checkAccess('write', $this->rolf_ref_id)) {
217  $this->error->raiseError($this->lng->txt('msg_no_perm_modify_rolt'), $this->error->WARNING);
218  }
219 
220  $form = $this->getRoleTemplateForm()->withRequest($this->request);
221  $data = $form->getData();
222  if ($data === null) {
223  $this->tpl->setContent(
224  $this->ui_renderer->render(
225  $this->ui_factory->panel()->standard(
226  $this->lng->txt('rolt_edit'),
227  $form
228  )
229  )
230  );
231  return;
232  }
233 
234  if (!$this->object->isInternalTemplate()) {
235  $this->object->setTitle($data[self::FORM_KEY_TITLE]);
236  }
237 
238  $this->object->setDescription($data[self::FORM_KEY_DESCRIPTION]);
239  $this->object->update();
240  $this->rbac_admin->setProtected(
241  $this->rolf_ref_id,
242  $this->object->getId(),
243  $data[self::FORM_KEY_PROTECT] ? 'y' : 'n'
244  );
245  $this->tpl->setOnScreenMessage('success', $this->lng->txt("saved_successfully"), true);
246  $this->ctrl->returnToParent($this);
247  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
getRoleTemplateForm(bool $is_role_creation_form=false)
+ Here is the call graph for this function:

Field Documentation

◆ $http

GlobalHttpState ilObjRoleTemplateGUI::$http
private

Definition at line 43 of file class.ilObjRoleTemplateGUI.php.

◆ $rbac_admin

ilRbacAdmin ilObjRoleTemplateGUI::$rbac_admin
protected

Definition at line 41 of file class.ilObjRoleTemplateGUI.php.

◆ $refinery

Factory ilObjRoleTemplateGUI::$refinery
protected

Definition at line 44 of file class.ilObjRoleTemplateGUI.php.

◆ $rolf_ref_id

int ilObjRoleTemplateGUI::$rolf_ref_id
private

Definition at line 39 of file class.ilObjRoleTemplateGUI.php.

Referenced by permSaveObject(), and saveObject().

◆ FORM_KEY_DESCRIPTION

const ilObjRoleTemplateGUI::FORM_KEY_DESCRIPTION = 'description'
private

Definition at line 35 of file class.ilObjRoleTemplateGUI.php.

◆ FORM_KEY_ILIAS_ID

const ilObjRoleTemplateGUI::FORM_KEY_ILIAS_ID = 'ilias_id'
private

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

◆ FORM_KEY_PROTECT

const ilObjRoleTemplateGUI::FORM_KEY_PROTECT = 'protect'
private

Definition at line 37 of file class.ilObjRoleTemplateGUI.php.

◆ FORM_KEY_TITLE

const ilObjRoleTemplateGUI::FORM_KEY_TITLE = 'title'
private

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


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