ILIAS  trunk Revision v11.0_alpha-1713-gd8962da2f67
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilContainerReferenceGUI Class Reference
+ Inheritance diagram for ilContainerReferenceGUI:
+ Collaboration diagram for ilContainerReferenceGUI:

Public Member Functions

 executeCommand ()
 
 redirectObject ()
 
 createObject ()
 
 saveObject ()
 
 editReferenceObject ()
 
 editObject (?ilPropertyFormGUI $form=null)
 
 updateObject ()
 
 getTargetType ()
 
 getReferenceType ()
 
 getId ()
 
- Public Member Functions inherited from ilObjectGUI
 getRefId ()
 
 setAdminMode (string $mode)
 
 getAdminMode ()
 
 getObject ()
 
 executeCommand ()
 
 withReferences ()
 determines whether objects are referenced or not (got ref ids or not) More...
 
 setCreationMode (bool $mode=true)
 If true, a creation screen is displayed the current [ref_id] does belong to the parent class The mode is determined in ilRepositoryGUI. More...
 
 getCreationMode ()
 
 prepareOutput (bool $show_sub_objects=true)
 
 getAdminTabs ()
 administration tabs show only permissions and trash folder More...
 
 getHTML ()
 
 confirmedDeleteObject ()
 confirmed deletion of object -> objects are moved to trash or deleted immediately, if trash is disabled More...
 
 cancelObject ()
 cancel action and go back to previous page More...
 
 createObject ()
 create new object form More...
 
 editAvailabilityPeriodObject ()
 
 saveAvailabilityPeriodObject ()
 
 cancelCreation ()
 cancel create action and go back to repository parent More...
 
 saveObject ()
 
 getDidacticTemplateVar (string $type)
 Get didactic template setting from creation screen. More...
 
 putObjectInTree (ilObject $obj, ?int $parent_node_id=null)
 Add object to tree at given position. More...
 
 editObject ()
 
 addExternalEditFormCustom (ilPropertyFormGUI $form)
 
 updateObject ()
 updates object entry in object_data More...
 
 getFormAction (string $cmd, string $default_form_action="")
 Get form action for command (command is method name without "Object", e.g. More...
 
 isVisible (int $ref_id, string $type)
 
 viewObject ()
 viewObject container presentation for "administration -> repository, trash, permissions" More...
 
 deleteObject (bool $error=false)
 Display deletion confirmation screen. More...
 
 setColumnSettings (ilColumnGUI $column_gui)
 
 addToDeskObject ()
 
 removeFromDeskObject ()
 
- Public Member Functions inherited from ILIAS\Object\ImplementsCreationCallback
 callCreationCallback (\ilObject $object, \ilObjectDefinition $obj_definition, int $requested_crtcb)
 

Data Fields

const MAX_SELECTION_ENTRIES = 50
 
const MODE_CREATE = 1
 
const MODE_EDIT = 2
 
- Data Fields inherited from ilObjectGUI
const ADMIN_MODE_NONE = ""
 
const ADMIN_MODE_SETTINGS = "settings"
 
const ADMIN_MODE_REPOSITORY = "repository"
 
const UPLOAD_TYPE_LOCAL = 1
 
const UPLOAD_TYPE_UPLOAD_DIRECTORY = 2
 
const CFORM_NEW = 1
 
const CFORM_IMPORT = 2
 
const CFORM_CLONE = 3
 
const SUPPORTED_IMPORT_MIME_TYPES = [MimeType::APPLICATION__ZIP, MimeType::APPLICATION__X_ZIP_COMPRESSED]
 

Protected Member Functions

 addLocatorItems ()
 
 initCreateForm (string $new_type)
 
 afterSave (ilObject $new_object)
 
 firstEditObject ()
 
 initForm (int $a_mode=self::MODE_EDIT)
 
 loadPropertiesFromSettingsForm (ilPropertyFormGUI $form)
 
 getTabs ()
 
- 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

ilTabsGUI $tabs
 
ilErrorHandling $error
 
array $existing_objects = []
 
string $target_type
 
string $reference_type
 
ilPropertyFormGUI $form
 
StandardGUIRequest $cont_request
 
- 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 = ""
 

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)
 

Detailed Description

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

Definition at line 26 of file class.ilContainerReferenceGUI.php.

Member Function Documentation

◆ addLocatorItems()

ilContainerReferenceGUI::addLocatorItems ( )
protected

Definition at line 100 of file class.ilContainerReferenceGUI.php.

References ilObjectGUI\$locator, ILIAS\Repository\ctrl(), and ILIAS\Repository\object().

100  : void
101  {
102  $ilLocator = $this->locator;
103 
104  if ($this->object instanceof ilObject) {
105  $ilLocator->addItem($this->object->getPresentationTitle(), $this->ctrl->getLinkTarget($this));
106  }
107  }
ilLocatorGUI $locator
+ Here is the call graph for this function:

◆ afterSave()

ilContainerReferenceGUI::afterSave ( ilObject  $new_object)
protected

Definition at line 196 of file class.ilContainerReferenceGUI.php.

References ilObject\_lookupObjId(), ilObject\_lookupTitle(), ILIAS\Repository\ctrl(), ILIAS\Repository\form(), ilObject\getRefId(), ILIAS\Repository\lng(), ilObject\setTitle(), ilContainerReference\TITLE_TYPE_CUSTOM, ilContainerReference\TITLE_TYPE_REUSE, and ilObject\update().

Referenced by saveObject().

196  : void
197  {
198  $target_obj_id = ilObject::_lookupObjId((int) $this->form->getInput('target_id'));
199  $new_object->setTargetId($target_obj_id);
200  $new_object->setTitleType((int) $this->form->getInput('title_type'));
201 
202  if ((int) $this->form->getInput('title_type') === ilContainerReference::TITLE_TYPE_CUSTOM) {
203  $new_object->setTitle($this->form->getInput('title'));
204  } elseif ((int) $this->form->getInput('title_type') === ilContainerReference::TITLE_TYPE_REUSE) {
205  $new_object->setTitle(ilObject::_lookupTitle($new_object->getTargetId()));
206  }
207 
208  $new_object->update();
209 
210  $this->tpl->setOnScreenMessage('success', $this->lng->txt("object_added"), true);
211  $this->ctrl->setParameter($this, 'ref_id', $new_object->getRefId());
212  $this->ctrl->setParameter($this, 'creation_mode', 0);
213  $this->ctrl->redirect($this, 'firstEdit');
214  }
setTitle(string $title)
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
form( $class_path, string $cmd, string $submit_caption="")
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createObject()

ilContainerReferenceGUI::createObject ( )

Definition at line 117 of file class.ilContainerReferenceGUI.php.

References ilObjectGUI\$access, $error, $ilErr, ILIAS\Repository\ctrl(), ilPropertyFormGUI\getHTML(), initForm(), and ILIAS\Repository\lng().

Referenced by ilObjStudyProgrammeReferenceGUI\saveObject(), and saveObject().

117  : void
118  {
119  $ilAccess = $this->access;
121 
122  $new_type = $this->cont_request->getNewType();
123  if (!$ilAccess->checkAccess(
124  "create_" . $this->getReferenceType(),
125  '',
126  $this->cont_request->getRefId(),
127  $new_type
128  )) {
129  $ilErr->raiseError($this->lng->txt("permission_denied"), $ilErr->MESSAGE);
130  }
131  $this->ctrl->saveParameter($this, "crtptrefid");
132  $this->ctrl->saveParameter($this, "crtcb");
133  $form = $this->initForm(self::MODE_CREATE);
134  $this->tpl->setContent($form->getHTML());
135  }
initForm(int $a_mode=self::MODE_EDIT)
$ilErr
Definition: raiseError.php:33
ilAccessHandler $access
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ editObject()

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

Definition at line 226 of file class.ilContainerReferenceGUI.php.

References $DIC, $tabs, ilPropertyFormGUI\getHTML(), initForm(), and ilTabsGUI\setTabActive().

226  : void
227  {
228  global $DIC;
229 
230  $main_tpl = $DIC->ui()->mainTemplate();
231 
232  $ilTabs = $this->tabs;
233 
234  $ilTabs->setTabActive('settings');
235 
236  if (!$form instanceof ilPropertyFormGUI) {
237  $form = $this->initForm();
238  }
239  $main_tpl->setContent($form->getHTML());
240  }
initForm(int $a_mode=self::MODE_EDIT)
setTabActive(string $a_id)
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:

◆ editReferenceObject()

ilContainerReferenceGUI::editReferenceObject ( )

Definition at line 221 of file class.ilContainerReferenceGUI.php.

References ilObjectGUI\editObject().

221  : void
222  {
223  $this->editObject();
224  }
+ Here is the call graph for this function:

◆ executeCommand()

ilContainerReferenceGUI::executeCommand ( )

Definition at line 65 of file class.ilContainerReferenceGUI.php.

References ilObjectGUI\$ctrl, $tabs, ILIAS\Repository\ctrl(), initForm(), null, ilObjectGUI\prepareOutput(), and ilObjectGUI\setCreationMode().

65  : void
66  {
67  $ilCtrl = $this->ctrl;
68  $ilTabs = $this->tabs;
69 
70  if ($this->cont_request->getCreationMode() === self::MODE_CREATE) {
71  $this->setCreationMode(true);
72  }
73 
74  $next_class = $ilCtrl->getNextClass($this);
75  $cmd = $ilCtrl->getCmd();
76 
77  $this->prepareOutput();
78 
79  switch ($next_class) {
80  case "ilpropertyformgui":
81  $form = $this->initForm($this->creation_mode ? self::MODE_CREATE : self::MODE_EDIT);
82  $this->ctrl->forwardCommand($form);
83  break;
84 
85  case 'ilpermissiongui':
86  $ilTabs->setTabActive('perm_settings');
87  $ilCtrl->forwardCommand(new ilPermissionGUI($this));
88  break;
89 
90  default:
91  if ($cmd === null || $cmd === '' || $cmd === 'view') {
92  $cmd = "edit";
93  }
94  $cmd .= "Object";
95  $this->$cmd();
96  break;
97  }
98  }
prepareOutput(bool $show_sub_objects=true)
initForm(int $a_mode=self::MODE_EDIT)
setCreationMode(bool $mode=true)
If true, a creation screen is displayed the current [ref_id] does belong to the parent class The mode...
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:

◆ firstEditObject()

ilContainerReferenceGUI::firstEditObject ( )
protected

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

References ilObjectGUI\editObject().

216  : void
217  {
218  $this->editObject();
219  }
+ Here is the call graph for this function:

◆ getId()

ilContainerReferenceGUI::getId ( )

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

References ilObjectGUI\$obj_id.

411  : int
412  {
413  return $this->obj_id;
414  }

◆ getReferenceType()

ilContainerReferenceGUI::getReferenceType ( )

Definition at line 381 of file class.ilContainerReferenceGUI.php.

References $reference_type.

Referenced by ilObjCourseReferenceGUI\getTabs(), and getTabs().

381  : string
382  {
383  return $this->reference_type;
384  }
+ Here is the caller graph for this function:

◆ getTabs()

ilContainerReferenceGUI::getTabs ( )
protected

Definition at line 386 of file class.ilContainerReferenceGUI.php.

References $DIC, ILIAS\Repository\access(), ILIAS\Repository\ctrl(), and getReferenceType().

386  : void
387  {
388  global $DIC;
389 
390  $ilHelp = $DIC['ilHelp'];
391  $ilHelp->setScreenIdComponent($this->getReferenceType());
392 
393  if ($this->access->checkAccess('write', '', $this->object->getRefId())) {
394  $this->tabs_gui->addTarget(
395  "settings",
396  $this->ctrl->getLinkTarget($this, "edit"),
397  [],
398  ""
399  );
400  }
401  if ($this->access->checkAccess('edit_permission', '', $this->object->getRefId())) {
402  $this->tabs_gui->addTarget(
403  "perm_settings",
404  $this->ctrl->getLinkTargetByClass([get_class($this), 'ilpermissiongui'], "perm"),
405  ["perm", "info", "owner"],
406  'ilpermissiongui'
407  );
408  }
409  }
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:

◆ getTargetType()

ilContainerReferenceGUI::getTargetType ( )

Definition at line 376 of file class.ilContainerReferenceGUI.php.

References $target_type.

Referenced by initForm().

376  : string
377  {
378  return $this->target_type;
379  }
+ Here is the caller graph for this function:

◆ initCreateForm()

ilContainerReferenceGUI::initCreateForm ( string  $new_type)
protected

Definition at line 191 of file class.ilContainerReferenceGUI.php.

References initForm().

Referenced by saveObject().

192  {
193  return $this->initForm(self::MODE_CREATE);
194  }
initForm(int $a_mode=self::MODE_EDIT)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initForm()

ilContainerReferenceGUI::initForm ( int  $a_mode = self::MODE_EDIT)
protected

Definition at line 242 of file class.ilContainerReferenceGUI.php.

References $form, ilPropertyFormGUI\addCommandButton(), ilPropertyFormGUI\addItem(), ILIAS\Repository\ctrl(), ILIAS\Repository\form(), getTargetType(), ILIAS\Repository\lng(), ILIAS\Repository\object(), ilFormGUI\setFormAction(), ilPropertyFormGUI\setTitle(), ilRadioGroupInputGUI\setValue(), ilRadioOption\setValue(), ilObject\TITLE_LENGTH, ilContainerReference\TITLE_TYPE_CUSTOM, and ilContainerReference\TITLE_TYPE_REUSE.

Referenced by createObject(), editObject(), executeCommand(), initCreateForm(), and updateObject().

243  {
244  $form = new ilPropertyFormGUI();
245 
246  if ($a_mode === self::MODE_CREATE) {
247  $form->setTitle($this->lng->txt($this->getReferenceType() . '_new'));
248 
249  $this->ctrl->setParameter($this, 'creation_mode', $a_mode);
250  $this->ctrl->setParameter(
251  $this,
252  'new_type',
253  $this->cont_request->getNewType()
254  );
255  } else {
256  $form->setTitle($this->lng->txt($this->reference_type . '_settings'));
257  }
258 
259  $form->setFormAction($this->ctrl->getFormAction($this));
260  if ($a_mode === self::MODE_CREATE) {
261  $lv = $this->getTargetType() . "r_add"; // see also https://mantis.ilias.de/view.php?id=31863
262  $form->addCommandButton('save', $this->lng->txt($lv));
263  $form->addCommandButton('cancel', $this->lng->txt('cancel'));
264  } else {
265  $form->addCommandButton('update', $this->lng->txt('save'));
266  }
267 
268  // title type
269  $ttype = new ilRadioGroupInputGUI($this->lng->txt('title'), 'title_type');
270  if ($a_mode === self::MODE_EDIT) {
271  $ttype->setValue((string) $this->object->getTitleType());
272  } else {
273  $ttype->setValue((string) ilContainerReference::TITLE_TYPE_REUSE);
274  }
275 
276  $reuse = new ilRadioOption($this->lng->txt('objref_reuse_title'));
278  $ttype->addOption($reuse);
279 
280  $custom = new ilRadioOption($this->lng->txt('objref_custom_title'));
282 
283  // title
284  $title = new ilTextInputGUI($this->lng->txt('title'), 'title');
285  $title->setSize(min(40, ilObject::TITLE_LENGTH));
286  $title->setMaxLength(ilObject::TITLE_LENGTH);
287  $title->setRequired(true);
288 
289  if ($a_mode === self::MODE_EDIT) {
290  $title->setValue($this->object->getTitle());
291  }
292 
293  $custom->addSubItem($title);
294  $ttype->addOption($custom);
295  $form->addItem($ttype);
296 
297  $repo = new ilRepositorySelector2InputGUI($this->lng->txt("objref_edit_ref"), "target_id");
298  $repo->setRequired(true);
299  $repo->getExplorerGUI()->setSelectableTypes([$this->getTargetType()]);
300  $repo->getExplorerGUI()->setTypeWhiteList(
301  array_merge(
302  [$this->getTargetType()],
303  ["root", "cat", "grp", "fold", "crs"]
304  )
305  );
306  $repo->getExplorerGUI()->setClickablePermission('visible');
307  $repo->setInfo($this->lng->txt($this->getReferenceType() . '_edit_info'));
308 
309  if ($a_mode === self::MODE_EDIT) {
310  $repo->getExplorerGUI()->setPathOpen($this->object->getTargetRefId());
311  $repo->setValue($this->object->getTargetRefId());
312  }
313 
314  $form->addItem($repo);
315  $this->form = $form;
316  return $form;
317  }
This class represents an option in a radio group.
const TITLE_LENGTH
This class represents a property in a property form.
setFormAction(string $a_formaction)
setValue(string $a_value)
addCommandButton(string $a_cmd, string $a_text, string $a_id="")
form( $class_path, string $cmd, string $submit_caption="")
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadPropertiesFromSettingsForm()

ilContainerReferenceGUI::loadPropertiesFromSettingsForm ( ilPropertyFormGUI  $form)
protected

Definition at line 319 of file class.ilContainerReferenceGUI.php.

References ilObjectGUI\$access, $DIC, ilObject\_lookupObjId(), ilObject\_lookupTitle(), ilObject\_lookupType(), ilRBACAccessHandler\checkAccess(), ilPropertyFormGUI\getInput(), ilPropertyFormGUI\getItemByPostVar(), ILIAS\Repository\lng(), ILIAS\Repository\object(), ilContainerReference\TITLE_TYPE_CUSTOM, and ilContainerReference\TITLE_TYPE_REUSE.

Referenced by updateObject().

319  : bool
320  {
321  global $DIC;
322 
323  $ok = true;
324  $access = $DIC->access();
325 
326  // check access
327  if (
328  !$access->checkAccess('visible', '', (int) $form->getInput('target_id'))
329  ) {
330  $ok = false;
331  $form->getItemByPostVar('target_id')->setAlert($this->lng->txt('permission_denied'));
332  }
333  // check target type
334  if (ilObject::_lookupType((int) $form->getInput('target_id'), true) !== $this->target_type) {
335  $ok = false;
336  $form->getItemByPostVar('target_id')->setAlert(
337  $this->lng->txt('objref_failure_target_type') .
338  ': ' .
339  $this->lng->txt('obj_' . $this->target_type)
340  );
341  }
342 
343  $this->object->setTargetId(
344  ilObject::_lookupObjId((int) $form->getInput('target_id'))
345  );
346 
347  // set title after target id, so that the title can be reused immediately
348  $this->object->setTitleType((int) $form->getInput('title_type'));
349  if ((int) $form->getInput('title_type') === ilContainerReference::TITLE_TYPE_CUSTOM) {
350  $this->object->setTitle($form->getInput('title'));
351  } elseif ((int) $form->getInput('title_type') === ilContainerReference::TITLE_TYPE_REUSE) {
352  $this->object->setTitle(ilObject::_lookupTitle($this->object->getTargetId()));
353  }
354 
355  return $ok;
356  }
getItemByPostVar(string $a_post_var)
checkAccess(string $a_permission, string $a_cmd, int $a_ref_id, string $a_type="", ?int $a_obj_id=null, ?int $a_tree_id=null)
check access for an object (provide $a_type and $a_obj_id if available for better performance) ...
getInput(string $a_post_var, bool $ensureValidation=true)
Returns the input of an item, if item provides getInput method and as fallback the value of the HTTP-...
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
global $DIC
Definition: shib_login.php:22
ilAccessHandler $access
static _lookupType(int $id, bool $reference=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ redirectObject()

ilContainerReferenceGUI::redirectObject ( )

Definition at line 109 of file class.ilContainerReferenceGUI.php.

References ilObjectGUI\$ctrl, ILIAS\Repository\object(), and ilCtrl\setParameterByClass().

109  : void
110  {
111  $ilCtrl = $this->ctrl;
112 
113  $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $this->object->getTargetRefId());
114  $ilCtrl->redirectByClass("ilrepositorygui", "");
115  }
setParameterByClass(string $a_class, string $a_parameter, $a_value)
+ Here is the call graph for this function:

◆ saveObject()

ilContainerReferenceGUI::saveObject ( )

Definition at line 137 of file class.ilContainerReferenceGUI.php.

References ilObjectGUI\$access, afterSave(), ilPropertyFormGUI\checkInput(), ilObjectGUI\checkPermissionBool(), createObject(), ILIAS\Repository\ctrl(), ILIAS\Repository\form(), ilObjectGUI\getDidacticTemplateVar(), ilPropertyFormGUI\getHTML(), ilPropertyFormGUI\getInput(), initCreateForm(), ILIAS\Repository\lng(), ilObjectGUI\putObjectInTree(), and ilPropertyFormGUI\setValuesByPost().

137  : void
138  {
139  $ilAccess = $this->access;
140 
141  if ($this->cont_request->getTargetId() === 0) {
142  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'));
143  $this->createObject();
144  return;
145  }
146  if (!$ilAccess->checkAccess(
147  'visible',
148  '',
149  $this->cont_request->getTargetId()
150  )) {
151  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('permission_denied'));
152  $this->createObject();
153  return;
154  }
155 
156  if (!$this->checkPermissionBool("create", "", $this->requested_new_type)) {
157  $this->error->raiseError($this->lng->txt("no_create_permission"), $this->error->MESSAGE);
158  }
159 
160  $this->lng->loadLanguageModule($this->requested_new_type);
161  $this->ctrl->setParameter($this, "new_type", $this->requested_new_type);
162 
163  $form = $this->initCreateForm($this->requested_new_type);
164  if ($form->checkInput()) {
165  $this->ctrl->setParameter($this, "new_type", "");
166 
167  $class_name = "ilObj" . $this->obj_definition->getClassName($this->requested_new_type);
168  $newObj = new $class_name();
169  $newObj->setType($this->requested_new_type);
170  $newObj->setTitle($form->getInput("title"));
171  $newObj->setDescription($form->getInput("desc"));
172  $newObj->processAutoRating();
173  $newObj->create();
174 
175  $this->putObjectInTree($newObj);
176 
177  if ($this->form->getInput('didactic_template')) {
178  $dtpl = $this->getDidacticTemplateVar("dtpl");
179  // Object calls initCreateForm again in getDidacticTemplateVar
180  $this->form->checkInput();
181  $newObj->applyDidacticTemplate($dtpl);
182  }
183 
184  $this->afterSave($newObj);
185  }
186 
188  $this->tpl->setContent($form->getHTML());
189  }
getDidacticTemplateVar(string $type)
Get didactic template setting from creation screen.
getInput(string $a_post_var, bool $ensureValidation=true)
Returns the input of an item, if item provides getInput method and as fallback the value of the HTTP-...
putObjectInTree(ilObject $obj, ?int $parent_node_id=null)
Add object to tree at given position.
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
form( $class_path, string $cmd, string $submit_caption="")
ilAccessHandler $access
+ Here is the call graph for this function:

◆ updateObject()

ilContainerReferenceGUI::updateObject ( )

Definition at line 358 of file class.ilContainerReferenceGUI.php.

References ilPropertyFormGUI\checkInput(), ilObjectGUI\checkPermission(), ILIAS\Repository\ctrl(), ilObjectGUI\editObject(), initForm(), ILIAS\Repository\lng(), loadPropertiesFromSettingsForm(), and ilPropertyFormGUI\setValuesByPost().

358  : void
359  {
360  $this->checkPermission('write');
361 
362  $form = $this->initForm();
363  if (
364  $form->checkInput() &&
366  ) {
367  $this->object->update();
368  $this->tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'), true);
369  $this->ctrl->redirect($this, 'edit');
370  }
372  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('err_check_input'));
373  $this->editObject($form);
374  }
loadPropertiesFromSettingsForm(ilPropertyFormGUI $form)
initForm(int $a_mode=self::MODE_EDIT)
checkPermission(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
+ Here is the call graph for this function:

Field Documentation

◆ $cont_request

StandardGUIRequest ilContainerReferenceGUI::$cont_request
protected

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

◆ $error

ilErrorHandling ilContainerReferenceGUI::$error
protected

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

Referenced by createObject().

◆ $existing_objects

array ilContainerReferenceGUI::$existing_objects = []
protected

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

◆ $form

ilPropertyFormGUI ilContainerReferenceGUI::$form
protected

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

Referenced by ilObjCourseReferenceGUI\initForm(), and initForm().

◆ $reference_type

string ilContainerReferenceGUI::$reference_type
protected

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

Referenced by getReferenceType().

◆ $tabs

ilTabsGUI ilContainerReferenceGUI::$tabs
protected

Definition at line 32 of file class.ilContainerReferenceGUI.php.

Referenced by editObject(), and executeCommand().

◆ $target_type

string ilContainerReferenceGUI::$target_type
protected

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

Referenced by getTargetType().

◆ MAX_SELECTION_ENTRIES

const ilContainerReferenceGUI::MAX_SELECTION_ENTRIES = 50

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

◆ MODE_CREATE

const ilContainerReferenceGUI::MODE_CREATE = 1

Definition at line 29 of file class.ilContainerReferenceGUI.php.

◆ MODE_EDIT

const ilContainerReferenceGUI::MODE_EDIT = 2

Definition at line 30 of file class.ilContainerReferenceGUI.php.


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