ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilObjRoleTemplateGUI Class Reference

Class ilObjRoleTemplateGUI. More...

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

Public Member Functions

 __construct ($a_data, $a_id, $a_call_by_reference)
 Constructor. More...
 
 executeCommand ()
 execute command More...
 
 createObject (ilPropertyFormGUI $form=null)
 create new role definition template More...
 
 editObject (ilPropertyFormGUI $form=null)
 Create new object. More...
 
 updateObject ()
 update role template object More...
 
 saveObject ()
 save a new role template object More...
 
 adoptPermSaveObject ()
 adopting permission setting from other roles/role templates More...
 
 getAdminTabs ()
 admin and normal tabs are equal for roles More...
 
 cancelObject ()
 cancelObject is called when an operation is canceled, method links back @access public More...
 
- Public Member Functions inherited from ilObjectGUI
 executeCommand ()
 execute command More...
 
 withReferences ()
 determines wether objects are referenced or not (got ref ids or not) More...
 
 setCreationMode ($a_mode=true)
 if true, a creation screen is displayed the current $_GET[ref_id] don't belong to the current class! the mode is determined in ilrepositorygui More...
 
 getCreationMode ()
 get creation mode More...
 
 prepareOutput ($a_show_subobjects=true)
 prepare output More...
 
 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 @access public More...
 
 createObject ()
 create new object form More...
 
 cancelCreation ()
 cancel create action and go back to repository parent More...
 
 saveObject ()
 save object More...
 
 getDidacticTemplateVar ($a_type)
 Get didactic template setting from creation screen. More...
 
 putObjectInTree (ilObject $a_obj, $a_parent_node_id=null)
 Add object to tree at given position. More...
 
 editObject ()
 edit object More...
 
 addExternalEditFormCustom (ilPropertyFormGUI $a_form)
 
 updateObject ()
 updates object entry in object_data More...
 
 getFormAction ($a_cmd, $a_formaction="")
 get form action for command (command is method name without "Object", e.g. More...
 
 isVisible ($a_ref_id, $a_type)
 
 viewObject ()
 list childs of current object More...
 
 deleteObject ($a_error=false)
 Display deletion confirmation screen. More...
 
 cloneAllObject ()
 Clone single (not container object) Method is overwritten in ilContainerGUI. More...
 

Data Fields

const FORM_MODE_EDIT = 1
 
const FORM_MODE_CREATE = 2
 
 $type
 
 $rolf_ref_id
 
- Data Fields inherited from ilObjectGUI
const COPY_WIZARD_NEEDS_PAGE = 1
 
 $objDefinition
 
 $tpl
 
 $tree
 
 $lng
 
 $data
 
 $object
 
 $ref_id
 
 $obj_id
 
 $maxcount
 
 $formaction
 
 $return_location
 
 $target_frame
 
 $tab_target_script
 
 $actions
 
 $sub_objects
 
 $omit_locator = false
 
const CFORM_NEW = 1
 
const CFORM_IMPORT = 2
 
const CFORM_CLONE = 3
 

Protected Member Functions

 initFormRoleTemplate ($a_mode=self::FORM_MODE_CREATE)
 Init create form. More...
 
 getTabs ()
 get tabs abstract method.@abstract overwrite in derived GUI class of your object type @access public

Parameters
objectinstance of ilTabsGUI
More...
 
 addAdminLocatorItems ($a_do_not_add_object=false)
 should be overwritten to add object specific items (repository items are preloaded)
Parameters
bool$a_do_not_add_object
More...
 
- Protected Member Functions inherited from ilObjectGUI
 assignObject ()
 
 setTitleAndDescription ()
 called by prepare output More...
 
 initHeaderAction ($a_sub_type=null, $a_sub_id=null)
 Add header action menu. More...
 
 insertHeaderAction ($a_list_gui)
 Insert header action into main template. More...
 
 addHeaderAction ()
 Add header action menu. More...
 
 redrawHeaderActionObject ()
 Ajax call: redraw action header only. More...
 
 showMountWebfolderIcon ()
 
 setTabs ()
 set admin tabs @access public More...
 
 setAdminTabs ()
 set admin tabs @access public More...
 
 setLocator ()
 set Locator More...
 
 addLocatorItems ()
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 omitLocator ($a_omit=true)
 
 addAdminLocatorItems ($a_do_not_add_object=false)
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 initCreationForms ($a_new_type)
 Init creation froms. More...
 
 getCreationFormsHTML (array $a_forms)
 Get HTML for creation forms (accordion) More...
 
 initCreateForm ($a_new_type)
 Init object creation form. More...
 
 initDidacticTemplate (ilPropertyFormGUI $form)
 Show didactic template types. More...
 
 addDidacticTemplateOptions (array &$a_options)
 Add custom templates. More...
 
 afterSave (ilObject $a_new_object)
 Post (successful) object creation hook. More...
 
 initEditForm ()
 Init object edit form. More...
 
 initEditCustomForm (ilPropertyFormGUI $a_form)
 Add custom fields to update form. More...
 
 getEditFormValues ()
 Get values for edit form. More...
 
 getEditFormCustomValues (array &$a_values)
 Add values to custom edit fields. More...
 
 validateCustom (ilPropertyFormGUI $a_form)
 Validate custom values (if not possible with checkInput()) More...
 
 updateCustom (ilPropertyFormGUI $a_form)
 Insert custom update form values into object. More...
 
 afterUpdate ()
 Post (successful) object update hook. More...
 
 initImportForm ($a_new_type)
 Init object import form. More...
 
 importFileObject ($parent_id=null, $a_catch_errors=true)
 Import. More...
 
 afterImport (ilObject $a_new_object)
 Post (successful) object import hook. More...
 
 setFormAction ($a_cmd, $a_formaction)
 set specific form action for command More...
 
 getReturnLocation ($a_cmd, $a_location="")
 get return location for command (command is method name without "Object", e.g. More...
 
 setReturnLocation ($a_cmd, $a_location)
 set specific return location for command More...
 
 getTargetFrame ($a_cmd, $a_target_frame="")
 get target frame for command (command is method name without "Object", e.g. More...
 
 setTargetFrame ($a_cmd, $a_target_frame)
 set specific target frame for command More...
 
 showPossibleSubObjects ()
 show possible subobjects (pulldown menu) More...
 
 getTemplateFile ($a_cmd, $a_type="")
 get a template blockfile format: tpl. More...
 
 getTabs ()
 get tabs abstract method. More...
 
 __showButton ($a_cmd, $a_text, $a_target='')
 
 hitsperpageObject ()
 
__initTableGUI ()
 
 __setTableGUIBasicData (&$tbl, &$result_set, $a_from="")
 standard implementation for tables use 'from' variable use different initial setting of table More...
 
 redirectToRefId ($a_ref_id, $a_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 $_GET["ref_id"] value More...
 
 fillCloneTemplate ($a_tpl_varname, $a_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...
 
 setColumnSettings (ilColumnGUI $column_gui)
 May be overwritten in subclasses. More...
 
 checkPermission ($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
 Check permission and redirect on error. More...
 
 checkPermissionBool ($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
 Check permission. More...
 
 enableDragDropFileUpload ()
 Enables the file upload into this object by dropping files. More...
 
 handleAutoRating (ilObject $a_new_obj)
 Activate rating automatically if parent container setting. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from ilObjectGUI
static _gotoRepositoryRoot ($a_raise_error=false)
 Goto repository root. More...
 
static _gotoRepositoryNode ($a_ref_id, $a_cmd="frameset")
 Goto repository root. More...
 
- Protected Attributes inherited from ilObjectGUI
 $ilErr
 
 $locator
 
 $user
 
 $access
 
 $settings
 
 $rbacreview
 
 $toolbar
 
 $rbacsystem
 
 $tmp_import_dir
 
 $tabs_gui = null
 
 $ctrl
 

Detailed Description

Class ilObjRoleTemplateGUI.

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

@ilCtrl_Calls ilObjRoleTemplateGUI:

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

Constructor & Destructor Documentation

◆ __construct()

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

Constructor.

@access public

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

42 {
43 global $lng;
44
45 $lng->loadLanguageModule('rbac');
46
47 $this->type = "rolt";
48 parent::__construct($a_data, $a_id, $a_call_by_reference, false);
49 $this->rolf_ref_id =&$this->ref_id;
50 $this->ctrl->saveParameter($this, "obj_id");
51 }

References ilObjectGUI\$lng, and ilObjectGUI\$ref_id.

Member Function Documentation

◆ addAdminLocatorItems()

ilObjRoleTemplateGUI::addAdminLocatorItems (   $a_do_not_add_object = false)
protected

should be overwritten to add object specific items (repository items are preloaded)

Parameters
bool$a_do_not_add_object

Reimplemented from ilObjectGUI.

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

484 {
485 global $DIC;
486
487 $ilLocator = $DIC['ilLocator'];
488
489 if (
490 $_GET["admin_mode"] == "settings"
491 && $_GET["ref_id"] == ROLE_FOLDER_ID) { // system settings
492 parent::addAdminLocatorItems(true);
493
494 $ilLocator->addItem(
495 $this->lng->txt("obj_" . ilObject::_lookupType(ilObject::_lookupObjId($_GET["ref_id"]))),
496 $this->ctrl->getLinkTargetByClass("ilobjrolefoldergui", 'view')
497 );
498
499 if ($_GET["obj_id"] > 0) {
500 $ilLocator->addItem(
501 $this->object->getTitle(),
502 $this->ctrl->getLinkTarget($this, 'perm')
503 );
504 }
505 } else {
506 parent::addAdminLocatorItems($a_do_not_add_object);
507 }
508 }
$_GET["client_id"]
static _lookupObjId($a_id)
static _lookupType($a_id, $a_reference=false)
lookup object type
global $DIC
Definition: saml.php:7

References $_GET, $DIC, ilObject\_lookupObjId(), and ilObject\_lookupType().

+ Here is the call graph for this function:

◆ adoptPermSaveObject()

ilObjRoleTemplateGUI::adoptPermSaveObject ( )

adopting permission setting from other roles/role templates

@access public

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

409 {
410 global $rbacadmin, $rbacsystem, $rbacreview;
411
412 if (!$rbacsystem->checkAccess('write', $this->rolf_ref_id)) {
413 $this->ilias->raiseError($this->lng->txt("msg_no_perm_perm"), $this->ilias->error_obj->WARNING);
414 } elseif ($this->obj_id == $_POST["adopt"]) {
415 ilUtil::sendFailure($this->lng->txt("msg_perm_adopted_from_itself"), true);
416 } else {
417 $rbacadmin->deleteRolePermission($this->obj_id, $this->rolf_ref_id);
418 $parentRoles = $rbacreview->getParentRoleIds($this->rolf_ref_id, true);
419 $rbacadmin->copyRoleTemplatePermissions(
420 $_POST["adopt"],
421 $parentRoles[$_POST["adopt"]]["parent"],
422 $this->rolf_ref_id,
423 $this->obj_id
424 );
425 // update object data entry (to update last modification date)
426 $this->object->update();
427
428 // send info
429 $obj_data =&$this->ilias->obj_factory->getInstanceByObjId($_POST["adopt"]);
430 ilUtil::sendSuccess($this->lng->txt("msg_perm_adopted_from1") . " '" . $obj_data->getTitle() . "'.<br/>" . $this->lng->txt("msg_perm_adopted_from2"), true);
431 }
432
433 $this->ctrl->redirect($this, "perm");
434 }
$_POST["username"]
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
redirection script todo: (a better solution should control the processing via a xml file)

References $_POST, ilObjectGUI\$rbacreview, ilObjectGUI\$rbacsystem, ilUtil\sendFailure(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ cancelObject()

ilObjRoleTemplateGUI::cancelObject ( )

cancelObject is called when an operation is canceled, method links back @access public

Reimplemented from ilObjectGUI.

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

474 {
475 $this->ctrl->redirectByClass("ilobjrolefoldergui", "view");
476 }

◆ createObject()

ilObjRoleTemplateGUI::createObject ( ilPropertyFormGUI  $form = null)

create new role definition template

@access public

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

146 {
147 global $rbacsystem;
148
149 if (!$rbacsystem->checkAccess("create_rolt", $this->rolf_ref_id)) {
150 $this->ilias->raiseError($this->lng->txt("permission_denied"), $this->ilias->error_obj->MESSAGE);
151 }
152 if (!$form) {
153 $form = $this->initFormRoleTemplate(self::FORM_MODE_CREATE);
154 }
155 $this->tpl->setContent($form->getHTML());
156 return true;
157 }
initFormRoleTemplate($a_mode=self::FORM_MODE_CREATE)
Init create form.
if(isset($_POST['submit'])) $form

References $form, ilObjectGUI\$rbacsystem, and initFormRoleTemplate().

+ Here is the call graph for this function:

◆ editObject()

ilObjRoleTemplateGUI::editObject ( ilPropertyFormGUI  $form = null)

Create new object.

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

163 {
164 global $rbacsystem;
165
166 $this->tabs_gui->activateTab('settings');
167
168 if (!$rbacsystem->checkAccess("write", $this->rolf_ref_id)) {
169 $this->ilias->raiseError($this->lng->txt("msg_no_perm_write"), $this->ilias->error_obj->MESSAGE);
170 }
171
172 if (!$form) {
173 $form = $this->initFormRoleTemplate(self::FORM_MODE_EDIT);
174 }
175 $GLOBALS['tpl']->setContent($form->getHTML());
176 }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.

References $form, $GLOBALS, ilObjectGUI\$rbacsystem, and initFormRoleTemplate().

+ Here is the call graph for this function:

◆ executeCommand()

ilObjRoleTemplateGUI::executeCommand ( )

execute command

Reimplemented from ilObjectGUI.

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

54 {
55 global $rbacsystem;
56
57 $this->prepareOutput();
58
59 $next_class = $this->ctrl->getNextClass($this);
60 $cmd = $this->ctrl->getCmd();
61
62 switch ($next_class) {
63 default:
64 if (!$cmd) {
65 $cmd = "perm";
66 }
67 $cmd .= "Object";
68 $this->$cmd();
69
70 break;
71 }
72
73 return true;
74 }
prepareOutput($a_show_subobjects=true)
prepare output

References ilObjectGUI\$rbacsystem, and ilObjectGUI\prepareOutput().

+ Here is the call graph for this function:

◆ getAdminTabs()

ilObjRoleTemplateGUI::getAdminTabs ( )

admin and normal tabs are equal for roles

Reimplemented from ilObjectGUI.

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

440 {
441 $this->getTabs();
442 }
getTabs()
get tabs abstract method.@abstract overwrite in derived GUI class of your object type @access public

References getTabs().

+ Here is the call graph for this function:

◆ getTabs()

ilObjRoleTemplateGUI::getTabs ( )
protected

get tabs abstract method.@abstract overwrite in derived GUI class of your object type @access public

Parameters
objectinstance of ilTabsGUI

Reimplemented from ilObjectGUI.

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

448 {
449 global $DIC;
450
451 $rbacsystem = $DIC->rbac()->system();
452
453 if ($rbacsystem->checkAccess('write', $this->ref_id)) {
454 $this->tabs_gui->addTab(
455 'settings',
456 $this->lng->txt('settings'),
457 $this->ctrl->getLinkTarget($this, 'edit')
458 );
459 }
460 if ($rbacsystem->checkAccess('edit_permission', $this->ref_id)) {
461 $this->tabs_gui->addTab(
462 'perm',
463 $this->lng->txt('default_perm_settings'),
464 $this->ctrl->getLinkTarget($this, 'perm')
465 );
466 }
467 }

References $DIC, and ilObjectGUI\$rbacsystem.

Referenced by getAdminTabs().

+ Here is the caller graph for this function:

◆ initFormRoleTemplate()

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

Init create form.

Parameters
boolcreation mode
Returns
ilPropertyFormGUI $form

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

82 {
83 include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
85
86 if ($this->creation_mode) {
87 $this->ctrl->setParameter($this, "new_type", 'rolt');
88 }
89
90 $form->setFormAction($this->ctrl->getFormAction($this));
91
92 if ($a_mode == self::FORM_MODE_CREATE) {
93 $form->setTitle($this->lng->txt('rolt_new'));
94 $form->addCommandButton('save', $this->lng->txt('rolt_new'));
95 } else {
96 $form->setTitle($this->lng->txt('rolt_edit'));
97 $form->addCommandButton('update', $this->lng->txt('save'));
98 }
99 $form->addCommandButton('cancel', $this->lng->txt('cancel'));
100
101 $title = new ilTextInputGUI($this->lng->txt('title'), 'title');
102 if ($a_mode != self::FORM_MODE_CREATE) {
103 if ($this->object->isInternalTemplate()) {
104 $title->setDisabled(true);
105 }
106 $title->setValue($this->object->getTitle());
107 }
108 $title->setSize(40);
109 $title->setMaxLength(70);
110 $title->setRequired(true);
111 $form->addItem($title);
112
113 $desc = new ilTextAreaInputGUI($this->lng->txt('description'), 'desc');
114
115 if ($a_mode != self::FORM_MODE_CREATE) {
116 $desc->setValue($this->object->getDescription());
117 }
118 $desc->setCols(40);
119 $desc->setRows(3);
120 $form->addItem($desc);
121
122 if ($a_mode != self::FORM_MODE_CREATE) {
123 $ilias_id = new ilNonEditableValueGUI($this->lng->txt("ilias_id"), "ilias_id");
124 $ilias_id->setValue('il_' . IL_INST_ID . '_' . ilObject::_lookupType($this->object->getId()) . '_' . $this->object->getId());
125 $form->addItem($ilias_id);
126 }
127
128 $pro = new ilCheckboxInputGUI($this->lng->txt('role_protect_permissions'), 'protected');
129 $pro->setChecked($GLOBALS['rbacreview']->isProtected(
130 $this->rolf_ref_id,
131 $this->object->getId()
132 ));
133 $pro->setValue(1);
134 $form->addItem($pro);
135
136 return $form;
137 }
This class represents a checkbox property in a property form.
This class represents a non editable value in a property form.
This class represents a property form user interface.
This class represents a text area property in a property form.
This class represents a text property in a property form.

References $form, $GLOBALS, $title, and ilObject\_lookupType().

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveObject()

ilObjRoleTemplateGUI::saveObject ( )

save a new role template object

@access public

Reimplemented from ilObjectGUI.

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

218 {
219 global $rbacsystem,$rbacadmin, $rbacreview;
220
221 if (!$rbacsystem->checkAccess("create_rolt", $this->rolf_ref_id)) {
222 $this->ilias->raiseError($this->lng->txt("msg_no_perm_create_rolt"), $this->ilias->error_obj->WARNING);
223 }
224 $form = $this->initFormRoleTemplate();
225 if ($form->checkInput()) {
226 include_once("./Services/AccessControl/classes/class.ilObjRoleTemplate.php");
227 $roltObj = new ilObjRoleTemplate();
228 $roltObj->setTitle($form->getInput('title'));
229 $roltObj->setDescription($form->getInput('desc'));
230 $roltObj->create();
231 $rbacadmin->assignRoleToFolder($roltObj->getId(), $this->rolf_ref_id, 'n');
232 $rbacadmin->setProtected(
233 $this->rolf_ref_id,
234 $roltObj->getId(),
235 $form->getInput('protected') ? 'y' : 'n'
236 );
237
238 ilUtil::sendSuccess($this->lng->txt("rolt_added"), true);
239 // redirect to permission screen
240 $this->ctrl->setParameter($this, 'obj_id', $roltObj->getId());
241 $this->ctrl->redirect($this, 'perm');
242 }
243 $form->setValuesByPost();
244 $this->createObject($form);
245 }
Class ilObjRoleTemplate.
createObject()
create new object form

References $form, ilObjectGUI\$rbacreview, ilObjectGUI\$rbacsystem, ilObjectGUI\createObject(), initFormRoleTemplate(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ updateObject()

ilObjRoleTemplateGUI::updateObject ( )

update role template object

@access public

Reimplemented from ilObjectGUI.

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

184 {
185 global $rbacsystem, $rbacadmin, $rbacreview;
186
187 // check write access
188 if (!$rbacsystem->checkAccess("write", $this->rolf_ref_id)) {
189 $this->ilias->raiseError($this->lng->txt("msg_no_perm_modify_rolt"), $this->ilias->error_obj->WARNING);
190 }
191
192 $form = $this->initFormRoleTemplate(self::FORM_MODE_EDIT);
193 if ($form->checkInput()) {
194 $this->object->setTitle($form->getInput('title'));
195 $this->object->setDescription($form->getInput('desc'));
196 $rbacadmin->setProtected(
197 $this->rolf_ref_id,
198 $this->object->getId(),
199 $form->getInput('protected') ? 'y' : 'n'
200 );
201 $this->object->update();
202 ilUtil::sendSuccess($this->lng->txt("saved_successfully"), true);
203 $this->ctrl->returnToParent($this);
204 }
205
206 $form->setValuesByPost();
207 $this->editObject($form);
208 }
editObject()
edit object

References $form, ilObjectGUI\$rbacreview, ilObjectGUI\$rbacsystem, ilObjectGUI\editObject(), initFormRoleTemplate(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

Field Documentation

◆ $rolf_ref_id

ilObjRoleTemplateGUI::$rolf_ref_id

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

◆ $type

ilObjRoleTemplateGUI::$type

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

◆ FORM_MODE_CREATE

const ilObjRoleTemplateGUI::FORM_MODE_CREATE = 2

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

◆ FORM_MODE_EDIT

const ilObjRoleTemplateGUI::FORM_MODE_EDIT = 1

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


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