ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables 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 (ilPropertyFormGUI $form=null)
 
 editObject (ilPropertyFormGUI $form=null)
 Create new object. More...
 
 updateObject ()
 
 saveObject ()
 
 adoptPermSaveObject ()
 
 getAdminTabs ()
 
 cancelObject ()
 
- Public Member Functions inherited from ilObjectGUI
 __construct ($data, int $id=0, bool $call_by_reference=true, bool $prepare_output=true)
 
 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] don't belong to the current 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...
 
 cancelDeleteObject ()
 cancel deletion of object More...
 
 cancelObject ()
 cancel action and go back to previous page More...
 
 createObject ()
 create new object form More...
 
 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)
 
 redirectAfterCreation ()
 Redirect after creation, see https://docu.ilias.de/goto_docu_wiki_wpage_5035_1357.html Should be overwritten and redirect to settings screen. More...
 
 addToDeskObject ()
 
 removeFromDeskObject ()
 
- Public Member Functions inherited from ILIAS\Object\ImplementsCreationCallback
 callCreationCallback (\ilObject $object, \ilObjectDefinition $obj_definition, int $requested_crtcb)
 

Protected Member Functions

 initFormRoleTemplate (int $a_mode=self::FORM_MODE_CREATE)
 
 permObject ()
 
 permSaveObject ()
 
 getTabs ()
 
 addAdminLocatorItems (bool $do_not_add_object=false)
 
- Protected Member Functions inherited from ilObjectGUI
 getObjectService ()
 
 assignObject ()
 
 setTitleAndDescription ()
 
 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...
 
 initCreationForms (string $new_type)
 Init creation forms. More...
 
 getCreationFormsHTML (array $forms)
 Get HTML for creation forms (accordion) More...
 
 initCreateForm (string $new_type)
 
 initDidacticTemplate (ilPropertyFormGUI $form)
 
 addDidacticTemplateOptions (array &$a_options)
 Add custom templates. More...
 
 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...
 
 initImportForm (string $new_type)
 
 importFileObject (int $parent_id=null)
 
 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...
 
 fillCloneTemplate (?string $tpl_name, string $type)
 Fill object clone template This method can be called from any object GUI class that wants to offer object cloning. 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...
 
 showCustomIconsEditing ( $input_colspan=1, ilPropertyFormGUI $form=null, $as_section=true)
 show edit section of custom icons for container More...
 

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
 
Factory $refinery
 
ilFavouritesManager $favourites
 
ilObjectCustomIconFactory $custom_icon_factory
 
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_MODE_EDIT = 1
 
const FORM_MODE_CREATE = 2
 
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 ALLOWED_TAGS_IN_TITLE_AND_DESCRIPTION
 
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
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

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

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

44  {
45  global $DIC;
46 
47  $this->rbac_admin = $DIC->rbac()->admin();
48 
49  $this->type = "rolt";
50  parent::__construct($a_data, $a_id, $a_call_by_reference, false);
51  $this->lng->loadLanguageModule('rbac');
52  $this->rolf_ref_id = &$this->ref_id;
53  $this->ctrl->saveParameter($this, "obj_id");
54  $this->http = $DIC->http();
55  $this->refinery = $DIC->refinery();
56  }
global $DIC
Definition: feed.php:28
static http()
Fetches the global http state from ILIAS.
__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 385 of file class.ilObjRoleTemplateGUI.php.

References $query, 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().

385  : void
386  {
387  parent::addAdminLocatorItems(true);
388 
389  $query = $this->http->wrapper()->query();
390 
391  if ($query->has('ref_id')) {
392  $ref_id = $query->retrieve('ref_id', $this->refinery->kindlyTo()->int());
393  $this->locator->addItem(
394  $this->lng->txt('obj_' . ilObject::_lookupType(
396  )),
397  $this->ctrl->getLinkTargetByClass("ilobjrolefoldergui", "view")
398  );
399  }
400 
401  if ($query->has('obj_id')) {
402  $this->locator->addItem(
403  ilObjRole::_getTranslation($this->object->getTitle()),
404  $this->ctrl->getLinkTarget($this, 'perm')
405  );
406  }
407  }
static _lookupObjId(int $ref_id)
static http()
Fetches the global http state from ILIAS.
static _getTranslation(string $a_role_title)
$query
static _lookupType(int $id, bool $reference=false)
+ Here is the call graph for this function:

◆ adoptPermSaveObject()

ilObjRoleTemplateGUI::adoptPermSaveObject ( )

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

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

316  : void
317  {
318  $source = 0;
319  if ($this->http->wrapper()->post()->has('adopt')) {
320  $source = $this->http->wrapper()->post()->retrieve(
321  'adopt',
322  $this->refinery->kindlyTo()->int()
323  );
324  }
325 
326  if (!$this->rbac_system->checkAccess('write', $this->rolf_ref_id)) {
327  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('msg_no_perm_perm'), true);
328  } elseif ($this->obj_id == $source) {
329  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("msg_perm_adopted_from_itself"), true);
330  } else {
331  $this->rbac_admin->deleteRolePermission($this->obj_id, $this->rolf_ref_id);
332  $parentRoles = $this->rbac_review->getParentRoleIds($this->rolf_ref_id, true);
333  $this->rbac_admin->copyRoleTemplatePermissions(
334  $source,
335  $parentRoles[$source]["parent"],
336  $this->rolf_ref_id,
337  $this->obj_id
338  );
339  // update object data entry (to update last modification date)
340  $this->object->update();
341 
342  // send info
343  $title = ilObject::_lookupTitle($source);
344  $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_perm_adopted_from1") . " '" . $title . "'.<br/>" . $this->lng->txt("msg_perm_adopted_from2"), true);
345  }
346  $this->ctrl->redirect($this, "perm");
347  }
static http()
Fetches the global http state from ILIAS.
static _lookupTitle(int $obj_id)
$source
Definition: metadata.php:93
+ Here is the call graph for this function:

◆ cancelObject()

ilObjRoleTemplateGUI::cancelObject ( )

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

References ILIAS\Repository\ctrl().

377  : void
378  {
379  $this->ctrl->redirectByClass("ilobjrolefoldergui", "view");
380  }
+ Here is the call graph for this function:

◆ createObject()

ilObjRoleTemplateGUI::createObject ( ilPropertyFormGUI  $form = null)

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

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

134  : void
135  {
136  if (!$this->rbac_system->checkAccess("create_rolt", $this->rolf_ref_id)) {
137  $this->error->raiseError($this->lng->txt("permission_denied"), $this->error->MESSAGE);
138  }
139  if ($form === null) {
140  $form = $this->initFormRoleTemplate(self::FORM_MODE_CREATE);
141  }
142  $this->tpl->setContent($form->getHTML());
143  }
initFormRoleTemplate(int $a_mode=self::FORM_MODE_CREATE)
+ Here is the call graph for this function:

◆ editObject()

ilObjRoleTemplateGUI::editObject ( ilPropertyFormGUI  $form = null)

Create new object.

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

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

148  : void
149  {
150  $this->tabs_gui->activateTab('settings');
151 
152  if (!$this->rbac_system->checkAccess("write", $this->rolf_ref_id)) {
153  $this->error->raiseError($this->lng->txt("msg_no_perm_write"), $this->error->MESSAGE);
154  }
155 
156  if ($form === null) {
157  $form = $this->initFormRoleTemplate(self::FORM_MODE_EDIT);
158  }
159  $this->tpl->setContent($form->getHTML());
160  }
initFormRoleTemplate(int $a_mode=self::FORM_MODE_CREATE)
+ Here is the call graph for this function:

◆ executeCommand()

ilObjRoleTemplateGUI::executeCommand ( )

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

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

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

◆ getAdminTabs()

ilObjRoleTemplateGUI::getAdminTabs ( )

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

References getTabs().

349  : void
350  {
351  $this->getTabs();
352  }
+ Here is the call graph for this function:

◆ getTabs()

ilObjRoleTemplateGUI::getTabs ( )
protected

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

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

Referenced by getAdminTabs().

357  : void
358  {
359  $this->tabs_gui->setBackTarget($this->lng->txt('btn_back'), (string) $this->ctrl->getParentReturn($this));
360 
361  if ($this->rbac_system->checkAccess('write', $this->ref_id)) {
362  $this->tabs_gui->addTab(
363  'settings',
364  $this->lng->txt('settings'),
365  $this->ctrl->getLinkTarget($this, 'edit')
366  );
367  }
368  if ($this->rbac_system->checkAccess('edit_permission', $this->ref_id)) {
369  $this->tabs_gui->addTab(
370  'perm',
371  $this->lng->txt('default_perm_settings'),
372  $this->ctrl->getLinkTarget($this, 'perm')
373  );
374  }
375  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initFormRoleTemplate()

ilObjRoleTemplateGUI::initFormRoleTemplate ( int  $a_mode = self::FORM_MODE_CREATE)
protected

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

References $GLOBALS, ilObjRole\_getTranslation(), ilObject\_lookupType(), ILIAS\Repository\ctrl(), IL_INST_ID, ILIAS\Repository\lng(), ILIAS\Repository\object(), ilCheckboxInputGUI\setChecked(), ilTextAreaInputGUI\setValue(), and ilNonEditableValueGUI\setValue().

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

78  {
79  $form = new ilPropertyFormGUI();
80 
81  if ($this->creation_mode) {
82  $this->ctrl->setParameter($this, "new_type", 'rolt');
83  }
84 
85  $form->setFormAction($this->ctrl->getFormAction($this));
86 
87  if ($a_mode == self::FORM_MODE_CREATE) {
88  $form->setTitle($this->lng->txt('rolt_new'));
89  $form->addCommandButton('save', $this->lng->txt('rolt_new'));
90  } else {
91  $form->setTitle($this->lng->txt('rolt_edit'));
92  $form->addCommandButton('update', $this->lng->txt('save'));
93  }
94  $form->addCommandButton('cancel', $this->lng->txt('cancel'));
95 
96  $title = new ilTextInputGUI($this->lng->txt('title'), 'title');
97  if ($a_mode != self::FORM_MODE_CREATE) {
98  if ($this->object->isInternalTemplate()) {
99  $title->setDisabled(true);
100  }
101  $title->setValue(ilObjRole::_getTranslation($this->object->getTitle()));
102  }
103  $title->setSize(40);
104  $title->setMaxLength(70);
105  $title->setRequired(true);
106  $form->addItem($title);
107 
108  $desc = new ilTextAreaInputGUI($this->lng->txt('description'), 'desc');
109 
110  if ($a_mode != self::FORM_MODE_CREATE) {
111  $desc->setValue($this->object->getDescription());
112  }
113  $desc->setCols(40);
114  $desc->setRows(3);
115  $form->addItem($desc);
116 
117  if ($a_mode != self::FORM_MODE_CREATE) {
118  $ilias_id = new ilNonEditableValueGUI($this->lng->txt("ilias_id"), "ilias_id");
119  $ilias_id->setValue('il_' . IL_INST_ID . '_' . ilObject::_lookupType($this->object->getId()) . '_' . $this->object->getId());
120  $form->addItem($ilias_id);
121  }
122 
123  $pro = new ilCheckboxInputGUI($this->lng->txt('role_protect_permissions'), 'protected');
124  $pro->setChecked($GLOBALS['DIC']['rbacreview']->isProtected(
125  $this->rolf_ref_id,
126  $this->object->getId()
127  ));
128  $pro->setValue((string) 1);
129  $form->addItem($pro);
130 
131  return $form;
132  }
const IL_INST_ID
Definition: constants.php:40
This class represents a checkbox property in a property form.
static _getTranslation(string $a_role_title)
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a text area property in a property form.
static _lookupType(int $id, bool $reference=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ permObject()

ilObjRoleTemplateGUI::permObject ( )
protected

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

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

216  : void
217  {
218  if (!$this->rbac_system->checkAccess('edit_permission', $this->ref_id)) {
219  $this->error->raiseError($this->lng->txt('msg_no_perm_perm'), $this->error->MESSAGE);
220  return;
221  }
222  $this->tabs_gui->activateTab('perm');
223 
224  $this->tpl->addBlockFile(
225  'ADM_CONTENT',
226  'adm_content',
227  'tpl.rbac_template_permissions.html',
228  'Services/AccessControl'
229  );
230 
231  $this->tpl->setVariable('PERM_ACTION', $this->ctrl->getFormAction($this));
232 
233  $acc = new ilAccordionGUI();
234  $acc->setBehaviour(ilAccordionGUI::FORCE_ALL_OPEN);
235  $acc->setId('template_perm_' . $this->ref_id);
236 
237  $subs = ilObjRole::getSubObjects('root', false);
238 
239  foreach ($subs as $subtype => $def) {
241  $this,
242  'perm',
243  $this->ref_id,
244  $this->obj_id,
245  $subtype,
246  false
247  );
248  $tbl->setShowChangeExistingObjects(false);
249  $tbl->parse();
250 
251  $acc->addItem($def['translation'], $tbl->getHTML());
252  }
253 
254  $this->tpl->setVariable('ACCORDION', $acc->getHTML());
255 
256  // Add options table
258  $this,
259  'perm',
260  $this->ref_id,
261  $this->obj_id,
262  false
263  );
264  $options->setShowOptions(false);
265  $options->addMultiCommand(
266  'permSave',
267  $this->lng->txt('save')
268  );
269 
270  $options->parse();
271  $this->tpl->setVariable('OPTIONS_TABLE', $options->getHTML());
272  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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 277 of file class.ilObjRoleTemplateGUI.php.

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

277  : void
278  {
279  if (!$this->rbac_system->checkAccess('write', $this->rolf_ref_id)) {
280  $this->error->raiseError($this->lng->txt('msg_no_perm_perm'), $this->error->MESSAGE);
281  return;
282  }
283 
284  $template_permissions = [];
285  if ($this->http->wrapper()->post()->has('template_perm')) {
286  $custom_transformer = $this->refinery->custom()->transformation(
287  function ($array) {
288  return $array;
289  }
290  );
291  $template_permissions = $this->http->wrapper()->post()->retrieve(
292  'template_perm',
293  $custom_transformer
294  );
295  }
296  // delete all existing template entries
297  //$rbacadmin->deleteRolePermission($this->object->getId(), $this->ref_id);
298  $subs = ilObjRole::getSubObjects('root', false);
299 
300  foreach (array_keys($subs) as $subtype) {
301  // Delete per object type
302  $this->rbac_admin->deleteRolePermission($this->object->getId(), $this->ref_id, $subtype);
303  }
304 
305  foreach ($template_permissions as $key => $ops_array) {
306  $this->rbac_admin->setRolePermission($this->object->getId(), $key, $ops_array, $this->rolf_ref_id);
307  }
308 
309  // update object data entry (to update last modification date)
310  $this->object->update();
311 
312  $this->tpl->setOnScreenMessage('success', $this->lng->txt("saved_successfully"), true);
313  $this->ctrl->redirect($this, "perm");
314  }
static http()
Fetches the global http state from ILIAS.
string $key
Consumer key/client ID value.
Definition: System.php:193
+ Here is the call graph for this function:

◆ saveObject()

ilObjRoleTemplateGUI::saveObject ( )

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

References $rolf_ref_id, ilObjectGUI\createObject(), ILIAS\Repository\ctrl(), initFormRoleTemplate(), and ILIAS\Repository\lng().

189  : void
190  {
191  if (!$this->rbac_system->checkAccess("create_rolt", $this->rolf_ref_id)) {
192  $this->ilias->raiseError($this->lng->txt("msg_no_perm_create_rolt"), $this->ilias->error_obj->WARNING);
193  }
194  $form = $this->initFormRoleTemplate();
195  if ($form->checkInput()) {
196  $roltObj = new ilObjRoleTemplate();
197  $roltObj->setTitle($form->getInput('title'));
198  $roltObj->setDescription($form->getInput('desc'));
199  $roltObj->create();
200  $this->rbac_admin->assignRoleToFolder($roltObj->getId(), $this->rolf_ref_id, 'n');
201  $this->rbac_admin->setProtected(
202  $this->rolf_ref_id,
203  $roltObj->getId(),
204  $form->getInput('protected') ? 'y' : 'n'
205  );
206 
207  $this->tpl->setOnScreenMessage('success', $this->lng->txt("rolt_added"), true);
208  // redirect to permission screen
209  $this->ctrl->setParameter($this, 'obj_id', $roltObj->getId());
210  $this->ctrl->redirect($this, 'perm');
211  }
212  $form->setValuesByPost();
213  $this->createObject($form);
214  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
createObject()
create new object form
initFormRoleTemplate(int $a_mode=self::FORM_MODE_CREATE)
header include for all ilias files.
+ Here is the call graph for this function:

◆ updateObject()

ilObjRoleTemplateGUI::updateObject ( )

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

References ILIAS\Repository\ctrl(), ilObjectGUI\editObject(), initFormRoleTemplate(), ILIAS\Repository\lng(), and ILIAS\Repository\object().

162  : void
163  {
164  // check write access
165  if (!$this->rbac_system->checkAccess("write", $this->rolf_ref_id)) {
166  $this->error->raiseError($this->lng->txt("msg_no_perm_modify_rolt"), $this->error->WARNING);
167  }
168 
169  $form = $this->initFormRoleTemplate(self::FORM_MODE_EDIT);
170  if ($form->checkInput()) {
171  if (!$this->object->isInternalTemplate()) {
172  $this->object->setTitle($form->getInput('title'));
173  }
174  $this->object->setDescription($form->getInput('desc'));
175  $this->rbac_admin->setProtected(
176  $this->rolf_ref_id,
177  $this->object->getId(),
178  $form->getInput('protected') ? 'y' : 'n'
179  );
180  $this->object->update();
181  $this->tpl->setOnScreenMessage('success', $this->lng->txt("saved_successfully"), true);
182  $this->ctrl->returnToParent($this);
183  }
184 
185  $form->setValuesByPost();
186  $this->editObject($form);
187  }
initFormRoleTemplate(int $a_mode=self::FORM_MODE_CREATE)
+ Here is the call graph for this function:

Field Documentation

◆ $http

GlobalHttpState ilObjRoleTemplateGUI::$http
private

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

◆ $rbac_admin

ilRbacAdmin ilObjRoleTemplateGUI::$rbac_admin
protected

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

◆ $refinery

Factory ilObjRoleTemplateGUI::$refinery
protected

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

◆ $rolf_ref_id

int ilObjRoleTemplateGUI::$rolf_ref_id
private

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

Referenced by permSaveObject(), and saveObject().

◆ FORM_MODE_CREATE

const ilObjRoleTemplateGUI::FORM_MODE_CREATE = 2
private

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

◆ FORM_MODE_EDIT

const ilObjRoleTemplateGUI::FORM_MODE_EDIT = 1
private

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


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