ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
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)
 

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
 

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]
 
- 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()

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

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

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

42  {
43  global $DIC;
44 
45  $this->type = "rolt";
46  parent::__construct($a_data, $a_id, $a_call_by_reference, false);
47  $this->lng->loadLanguageModule('rbac');
48  $this->rolf_ref_id = &$this->ref_id;
49  $this->ctrl->saveParameter($this, "obj_id");
50  }
global $DIC
Definition: shib_login.php:26
__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 402 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().

402  : void
403  {
404  parent::addAdminLocatorItems(true);
405 
406  $query = $this->http->wrapper()->query();
407 
408  if ($query->has('ref_id')) {
409  $ref_id = $query->retrieve('ref_id', $this->refinery->kindlyTo()->int());
410  $this->locator->addItem(
411  $this->lng->txt('obj_' . ilObject::_lookupType(
413  )),
414  $this->ctrl->getLinkTargetByClass("ilobjrolefoldergui", "view")
415  );
416  }
417 
418  if ($query->has('obj_id')) {
419  $this->locator->addItem(
420  ilObjRole::_getTranslation($this->object->getTitle()),
421  $this->ctrl->getLinkTarget($this, 'perm')
422  );
423  }
424  }
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 338 of file class.ilObjRoleTemplateGUI.php.

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

338  : void
339  {
340  $source = 0;
341  if ($this->http->wrapper()->post()->has('adopt')) {
342  $source = $this->http->wrapper()->post()->retrieve(
343  'adopt',
344  $this->refinery->kindlyTo()->int()
345  );
346  }
347 
348  if (!$this->rbac_system->checkAccess('write', $this->rolf_ref_id)) {
349  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('msg_no_perm_perm'), true);
350  } elseif ($this->obj_id == $source) {
351  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("msg_perm_adopted_from_itself"), true);
352  } else {
353  $this->rbac_admin->deleteRolePermission($this->obj_id, $this->rolf_ref_id);
354  $parentRoles = $this->rbac_review->getParentRoleIds($this->rolf_ref_id, true);
355  $this->rbac_admin->copyRoleTemplatePermissions(
356  $source,
357  $parentRoles[$source]["parent"],
358  $this->rolf_ref_id,
359  $this->obj_id
360  );
361  // update object data entry (to update last modification date)
362  $this->object->update();
363 
364  // send info
365  $title = ilObject::_lookupTitle($source);
366  $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_perm_adopted_from1") . " '" . $title . "'.<br/>" . $this->lng->txt("msg_perm_adopted_from2"), true);
367  }
368  $this->ctrl->redirect($this, "perm");
369  }
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 123 of file class.ilObjRoleTemplateGUI.php.

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

123  : void
124  {
125  if (!$this->rbac_system->checkAccess('create_rolt', $this->rolf_ref_id)) {
126  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
127  }
128 
129  $this->tabs_gui->setBackTarget(
130  $this->lng->txt('cancel'),
131  $this->ctrl->getParentReturnByClass(self::class)
132  );
133 
134  $this->tpl->setContent(
135  $this->ui_renderer->render(
136  $this->ui_factory->panel()->standard(
137  $this->lng->txt('rolt_new'),
138  $this->getRoleTemplateForm(true)
139  )
140  )
141  );
142  }
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 147 of file class.ilObjRoleTemplateGUI.php.

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

147  : void
148  {
149  $this->tabs_gui->activateTab('settings');
150 
151  if (!$this->rbac_system->checkAccess("write", $this->rolf_ref_id)) {
152  $this->error->raiseError($this->lng->txt("msg_no_perm_write"), $this->error->MESSAGE);
153  }
154 
155  $this->tpl->setContent(
156  $this->ui_renderer->render(
157  $this->ui_factory->panel()->standard(
158  $this->lng->txt('rolt_edit'),
159  $this->getRoleTemplateForm()
160  )
161  )
162  );
163  }
getRoleTemplateForm(bool $is_role_creation_form=false)
+ Here is the call graph for this function:

◆ executeCommand()

ilObjRoleTemplateGUI::executeCommand ( )

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

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

52  : void
53  {
54  $this->prepareOutput();
55 
56  $next_class = $this->ctrl->getNextClass($this);
57  $cmd = $this->ctrl->getCmd();
58 
59  switch ($next_class) {
60  default:
61  if (!$cmd) {
62  $cmd = "perm";
63  }
64  $cmd .= "Object";
65  $this->$cmd();
66 
67  break;
68  }
69  }
prepareOutput(bool $show_sub_objects=true)
+ Here is the call graph for this function:

◆ getAdminTabs()

ilObjRoleTemplateGUI::getAdminTabs ( )

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

References getTabs().

371  : void
372  {
373  $this->getTabs();
374  }
+ Here is the call graph for this function:

◆ getRoleTemplateForm()

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

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

71  : StandardForm
72  {
73  if ($this->creation_mode) {
74  $this->ctrl->setParameter($this, 'new_type', 'rolt');
75  }
76 
77  $ff = $this->ui_factory->input()->field();
78 
79  $title_validation_constraint = $this->refinery->custom()->constraint(
80  fn(string $v): bool => preg_match('/^il_.*$/', $v) ? false : true,
81  $this->lng->txt('msg_role_reserved_prefix')
82  );
83 
84  $inputs = [
85  self::FORM_KEY_TITLE => $ff->text($this->lng->txt('title'))
86  ->withMaxLength(70)
87  ->withRequired(true)
88  ->withAdditionalTransformation($title_validation_constraint)
89  ->withValue(
90  $is_role_creation_form ? ''
91  : ilObjRole::_getTranslation($this->object->getTitle())
92  )->withDisabled($is_role_creation_form ? false : $this->object->isInternalTemplate()),
93  self::FORM_KEY_DESCRIPTION => $ff->textarea($this->lng->txt('description'))
94  ->withMaxLimit(4000)
95  ->withValue($is_role_creation_form ? '' : $this->object->getDescription())
96  ];
97 
98  if (!$is_role_creation_form) {
99  $inputs[self::FORM_KEY_ILIAS_ID] = $ff->text($this->lng->txt('ilias_id'))
100  ->withDisabled(true)
101  ->withValue('il_' . IL_INST_ID . '_'
102  . $this->object->getType() . '_' . $this->object->getId());
103  }
104 
105  $inputs[self::FORM_KEY_PROTECT] = $ff->checkbox($this->lng->txt('role_protect_permissions'))
106  ->withValue(
107  $is_role_creation_form
108  ? false
109  : $this->rbac_review->isProtected($this->rolf_ref_id, $this->object->getId())
110  );
111 
112  return $this->ui_factory->input()->container()->form()->standard(
113  $this->ctrl->getFormActionByClass(
114  self::class,
115  $is_role_creation_form ? 'save' : 'update'
116  ),
117  $inputs
118  )->withSubmitLabel(
119  $is_role_creation_form ? $this->lng->txt('rolt_new') : $this->lng->txt('save')
120  );
121  }
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 379 of file class.ilObjRoleTemplateGUI.php.

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

Referenced by getAdminTabs().

379  : void
380  {
381  $this->tabs_gui->setBackTarget($this->lng->txt('btn_back'), (string) $this->ctrl->getParentReturn($this));
382 
383  if ($this->rbac_system->checkAccess('write', $this->ref_id)) {
384  $this->tabs_gui->addTab(
385  'settings',
386  $this->lng->txt('settings'),
387  $this->ctrl->getLinkTarget($this, 'edit')
388  );
389  }
390  if ($this->rbac_system->checkAccess('edit_permission', $this->ref_id)) {
391  $this->tabs_gui->addTab(
392  'perm',
393  $this->lng->txt('default_perm_settings'),
394  $this->ctrl->getLinkTarget($this, 'perm')
395  );
396  }
397  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ permObject()

ilObjRoleTemplateGUI::permObject ( )
protected

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

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

240  : void
241  {
242  if (!$this->rbac_system->checkAccess('edit_permission', $this->ref_id)) {
243  $this->error->raiseError($this->lng->txt('msg_no_perm_perm'), $this->error->MESSAGE);
244  return;
245  }
246  $this->tabs_gui->activateTab('perm');
247 
248  $this->tpl->addBlockFile(
249  'ADM_CONTENT',
250  'adm_content',
251  'tpl.rbac_template_permissions.html',
252  'components/ILIAS/AccessControl'
253  );
254 
255  $this->tpl->setVariable('PERM_ACTION', $this->ctrl->getFormAction($this));
256 
257  $acc = new ilAccordionGUI();
258  $acc->setBehaviour(ilAccordionGUI::FORCE_ALL_OPEN);
259  $acc->setId('template_perm_' . $this->ref_id);
260 
261  $subs = ilObjRole::getSubObjects('root', false);
262 
263  foreach ($subs as $subtype => $def) {
265  $this,
266  'perm',
267  $this->ref_id,
268  $this->obj_id,
269  $subtype,
270  false
271  );
272  $tbl->setShowChangeExistingObjects(false);
273  $tbl->parse();
274 
275  $acc->addItem($def['translation'], $tbl->getHTML());
276  }
277 
278  $this->tpl->setVariable('ACCORDION', $acc->getHTML());
279 
280  // Add options table
282  $this,
283  'perm',
284  $this->ref_id,
285  $this->obj_id,
286  false
287  );
288  $options->setShowOptions(false);
289  $options->addMultiCommand(
290  'permSave',
291  $this->lng->txt('save')
292  );
293 
294  $options->parse();
295  $this->tpl->setVariable('OPTIONS_TABLE', $options->getHTML());
296  }
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 301 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().

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

◆ saveObject()

ilObjRoleTemplateGUI::saveObject ( )

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

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

165  : void
166  {
167  if (!$this->rbac_system->checkAccess("create_rolt", $this->rolf_ref_id)) {
168  $this->ilias->raiseError($this->lng->txt("msg_no_perm_create_rolt"), $this->ilias->error_obj->WARNING);
169  }
170 
171  $form = $this->getRoleTemplateForm(true)->withRequest($this->request);
172  $data = $form->getData();
173  if ($data === null) {
174  $this->tabs_gui->setBackTarget(
175  $this->lng->txt('cancel'),
176  $this->ctrl->getParentReturnByClass(self::class)
177  );
178 
179  $this->tpl->setContent(
180  $this->ui_renderer->render(
181  $this->ui_factory->panel()->standard(
182  $this->lng->txt('rolt_new'),
183  $form
184  )
185  )
186  );
187  return;
188  }
189 
190  $role_template = new ilObjRoleTemplate();
191  $role_template->setTitle($data[self::FORM_KEY_TITLE]);
192  $role_template->setDescription($data[self::FORM_KEY_DESCRIPTION]);
193  $role_template->create();
194  $this->rbac_admin->assignRoleToFolder($role_template->getId(), $this->rolf_ref_id, 'n');
195  $this->rbac_admin->setProtected(
196  $this->rolf_ref_id,
197  $role_template->getId(),
198  $data[self::FORM_KEY_PROTECT] ? 'y' : 'n'
199  );
200  $this->tpl->setOnScreenMessage('success', $this->lng->txt("rolt_added"), true);
201  $this->ctrl->setParameter($this, 'obj_id', $role_template->getId());
202  $this->ctrl->redirect($this, 'perm');
203  }
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 205 of file class.ilObjRoleTemplateGUI.php.

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

205  : void
206  {
207  if (!$this->rbac_system->checkAccess('write', $this->rolf_ref_id)) {
208  $this->error->raiseError($this->lng->txt('msg_no_perm_modify_rolt'), $this->error->WARNING);
209  }
210 
211  $form = $this->getRoleTemplateForm()->withRequest($this->request);
212  $data = $form->getData();
213  if ($data === null) {
214  $this->tpl->setContent(
215  $this->ui_renderer->render(
216  $this->ui_factory->panel()->standard(
217  $this->lng->txt('rolt_edit'),
218  $form
219  )
220  )
221  );
222  return;
223  }
224 
225  if (!$this->object->isInternalTemplate()) {
226  $this->object->setTitle($data[self::FORM_KEY_TITLE]);
227  }
228 
229  $this->object->setDescription($data[self::FORM_KEY_DESCRIPTION]);
230  $this->object->update();
231  $this->rbac_admin->setProtected(
232  $this->rolf_ref_id,
233  $this->object->getId(),
234  $data[self::FORM_KEY_PROTECT] ? 'y' : 'n'
235  );
236  $this->tpl->setOnScreenMessage('success', $this->lng->txt("saved_successfully"), true);
237  $this->ctrl->returnToParent($this);
238  }
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

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