ILIAS  release_8 Revision v8.23
ilObjMDSettingsGUI Class Reference

Meta Data Settings. More...

+ Inheritance diagram for ilObjMDSettingsGUI:
+ Collaboration diagram for ilObjMDSettingsGUI:

Public Member Functions

 __construct ($a_data, $a_id, bool $a_call_by_reference=true, bool $a_prepare_output=true)
 
 executeCommand ()
 
 getAdminTabs ()
 
 showGeneralSettings (?ilPropertyFormGUI $form=null)
 
 initGeneralSettingsForm (string $a_mode="edit")
 
 saveGeneralSettings ()
 
 showCopyrightSettings (?ilPropertyFormGUI $form=null)
 
 saveCopyrightSettings ()
 
 showCopyrightUsages ()
 
 editEntry (?StandardForm $form=null)
 
 addEntry (?StandardForm $form=null)
 
 saveEntry ()
 
 confirmDeleteEntries ()
 
 deleteEntries ()
 
 updateEntry ()
 
 initCopyrightEditForm (string $a_mode='edit')
 
 saveCopyrightPosition ()
 
- 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

 initEntryIdFromQuery ()
 
 initEntryIdFromPost ()
 
 getType ()
 
 getParentObjType ()
 
 getAdministrationFormId ()
 
 initSettingsForm ()
 
 initMDSettings ()
 
- 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

ilPropertyFormGUI $form = null
 
ilMDSettings $md_settings = null
 
ilMDCopyrightSelectionEntry $entry = null
 
GlobalHttpState $http
 
Factory $refinery
 
UIFactory $ui_factory
 
UIRenderer $ui_renderer
 
- 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 = ""
 

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

ilObjMDSettingsGUI::__construct (   $a_data,
  $a_id,
bool  $a_call_by_reference = true,
bool  $a_prepare_output = true 
)

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

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

45  {
46  global $DIC;
47  parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
48 
49  $this->type = 'mds';
50  $this->lng->loadLanguageModule("meta");
51  $this->http = $DIC->http();
52  $this->refinery = $DIC->refinery();
53  $this->ui_factory = $DIC->ui()->factory();
54  $this->ui_renderer = $DIC->ui()->renderer();
55  }
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

◆ addEntry()

ilObjMDSettingsGUI::addEntry ( ?StandardForm  $form = null)

Definition at line 288 of file class.ilObjMDSettingsGUI.php.

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

Referenced by saveEntry().

288  : void
289  {
290  if (!$form instanceof StandardForm) {
291  $form = $this->initCopyrightEditForm('add');
292  }
293  $this->tabs_gui->clearTargets();
294  $this->tabs_gui->setBackTarget(
295  $this->lng->txt('back'),
296  $post_url = $this->ctrl->getLinkTarget($this, 'showCopyrightSettings')
297  );
298  $this->tpl->setContent($this->ui_renderer->render($form));
299  }
initCopyrightEditForm(string $a_mode='edit')
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ confirmDeleteEntries()

ilObjMDSettingsGUI::confirmDeleteEntries ( )

Definition at line 335 of file class.ilObjMDSettingsGUI.php.

References ILIAS\Repository\ctrl(), ilMDCopyrightSelectionEntry\getTitle(), initEntryIdFromPost(), ILIAS\Repository\lng(), and showCopyrightSettings().

335  : void
336  {
337  $entry_ids = $this->initEntryIdFromPost();
338  if (!count($entry_ids)) {
339  $this->tpl->setOnScreenMessage('info', $this->lng->txt('select_one'));
340  $this->showCopyrightSettings();
341  return;
342  }
343 
344  $c_gui = new ilConfirmationGUI();
345  // set confirm/cancel commands
346  $c_gui->setFormAction($this->ctrl->getFormAction($this, "deleteEntries"));
347  $c_gui->setHeaderText($this->lng->txt("md_delete_cp_sure"));
348  $c_gui->setCancel($this->lng->txt("cancel"), "showCopyrightSettings");
349  $c_gui->setConfirm($this->lng->txt("confirm"), "deleteEntries");
350 
351  // add items to delete
352  foreach ($entry_ids as $entry_id) {
353  $entry = new ilMDCopyrightSelectionEntry($entry_id);
354  $c_gui->addItem('entry_id[]', (string) $entry_id, $entry->getTitle());
355  }
356  $this->tpl->setContent($c_gui->getHTML());
357  }
ilMDCopyrightSelectionEntry $entry
showCopyrightSettings(?ilPropertyFormGUI $form=null)
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:

◆ deleteEntries()

ilObjMDSettingsGUI::deleteEntries ( )

Definition at line 359 of file class.ilObjMDSettingsGUI.php.

References ilMDCopyrightSelectionEntry\delete(), initEntryIdFromPost(), ILIAS\Repository\lng(), and showCopyrightSettings().

359  : bool
360  {
361  $entry_ids = $this->initEntryIdFromPost();
362  if (!count($entry_ids)) {
363  $this->tpl->setOnScreenMessage('info', $this->lng->txt('select_one'));
364  $this->showCopyrightSettings();
365  return true;
366  }
367 
368  foreach ($entry_ids as $entry_id) {
369  $entry = new ilMDCopyrightSelectionEntry($entry_id);
370  $entry->delete();
371  }
372  $this->tpl->setOnScreenMessage('success', $this->lng->txt('md_copyrights_deleted'));
373  $this->showCopyrightSettings();
374  return true;
375  }
ilMDCopyrightSelectionEntry $entry
showCopyrightSettings(?ilPropertyFormGUI $form=null)
+ Here is the call graph for this function:

◆ editEntry()

ilObjMDSettingsGUI::editEntry ( ?StandardForm  $form = null)

Definition at line 274 of file class.ilObjMDSettingsGUI.php.

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

Referenced by updateEntry().

274  : void
275  {
276  $this->ctrl->saveParameter($this, 'entry_id');
277  if (!$form instanceof StandardForm) {
278  $form = $this->initCopyrightEditForm();
279  }
280  $this->tabs_gui->clearTargets();
281  $this->tabs_gui->setBackTarget(
282  $this->lng->txt('back'),
283  $post_url = $this->ctrl->getLinkTarget($this, 'showCopyrightSettings')
284  );
285  $this->tpl->setContent($this->ui_renderer->render($form));
286  }
initCopyrightEditForm(string $a_mode='edit')
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilObjMDSettingsGUI::executeCommand ( )

Definition at line 83 of file class.ilObjMDSettingsGUI.php.

References ilAdvancedMDSettingsGUI\CONTEXT_ADMINISTRATION, ILIAS\Repository\ctrl(), initEntryIdFromQuery(), initMDSettings(), ILIAS\Repository\lng(), and ilObjectGUI\prepareOutput().

83  : void
84  {
85  $next_class = $this->ctrl->getNextClass($this);
86  $cmd = $this->ctrl->getCmd();
87 
88  $this->prepareOutput();
89 
90  if (!$this->rbac_system->checkAccess("visible,read", $this->object->getRefId())) {
91  $this->error->raiseError($this->lng->txt('no_permission'), $this->error->WARNING);
92  }
93 
94  switch ($next_class) {
95  case 'iladvancedmdsettingsgui':
96  $this->tabs_gui->setTabActive('md_advanced');
97  $adv_md = new ilAdvancedMDSettingsGUI(
99  $this->ref_id
100  );
101  $ret = $this->ctrl->forwardCommand($adv_md);
102  break;
103 
104  case 'ilpermissiongui':
105  $this->tabs_gui->setTabActive('perm_settings');
106 
107  $perm_gui = new ilPermissionGUI($this);
108  $ret = $this->ctrl->forwardCommand($perm_gui);
109  break;
110 
111  case 'ilmdcopyrightusagegui':
112  // this command is used if copyrightUsageGUI calls getParentReturn (see ...UsageGUI->setTabs)
113  $this->ctrl->setReturn($this, 'showCopyrightSettings');
114  $copyright_id = $this->initEntryIdFromQuery();
115  $gui = new ilMDCopyrightUsageGUI($copyright_id);
116  $this->ctrl->forwardCommand($gui);
117  break;
118 
119  default:
120  $this->initMDSettings();
121  if (!$cmd || $cmd === 'view') {
122  $cmd = "showGeneralSettings";
123  }
124 
125  $this->$cmd();
126  break;
127  }
128  }
prepareOutput(bool $show_sub_objects=true)
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
+ Here is the call graph for this function:

◆ getAdministrationFormId()

ilObjMDSettingsGUI::getAdministrationFormId ( )
protected

Definition at line 140 of file class.ilObjMDSettingsGUI.php.

References ilAdministrationSettingsFormHandler\FORM_META_COPYRIGHT.

Referenced by initSettingsForm().

+ Here is the caller graph for this function:

◆ getAdminTabs()

ilObjMDSettingsGUI::getAdminTabs ( )

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

References ILIAS\Repository\ctrl().

145  : void
146  {
147  if ($this->rbac_system->checkAccess("visible,read", $this->object->getRefId())) {
148  $this->tabs_gui->addTarget(
149  "md_general_settings",
150  $this->ctrl->getLinkTarget($this, "showGeneralSettings"),
151  array("showGeneralSettings", "view")
152  );
153 
154  $this->tabs_gui->addTarget(
155  "md_copyright",
156  $this->ctrl->getLinkTarget($this, "showCopyrightSettings"),
157  array("showCopyrightSettings")
158  );
159 
160  $this->tabs_gui->addTarget(
161  "md_advanced",
162  $this->ctrl->getLinkTargetByClass('iladvancedmdsettingsgui', ""),
163  '',
164  'iladvancedmdsettingsgui'
165  );
166  }
167 
168  if ($this->rbac_system->checkAccess('edit_permission', $this->object->getRefId())) {
169  $this->tabs_gui->addTarget(
170  "perm_settings",
171  $this->ctrl->getLinkTargetByClass('ilpermissiongui', "perm"),
172  array(),
173  'ilpermissiongui'
174  );
175  }
176  }
+ Here is the call graph for this function:

◆ getParentObjType()

ilObjMDSettingsGUI::getParentObjType ( )
protected

Definition at line 135 of file class.ilObjMDSettingsGUI.php.

135  : string
136  {
137  return 'meta';
138  }

◆ getType()

ilObjMDSettingsGUI::getType ( )
protected

Definition at line 130 of file class.ilObjMDSettingsGUI.php.

References ilObjectGUI\$type.

130  : string
131  {
132  return $this->type;
133  }

◆ initCopyrightEditForm()

ilObjMDSettingsGUI::initCopyrightEditForm ( string  $a_mode = 'edit')

Definition at line 432 of file class.ilObjMDSettingsGUI.php.

References ILIAS\UI\Implementation\Component\Input\$inputs, ILIAS\Repository\ctrl(), initEntryIdFromQuery(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), ILIAS\UI\Implementation\Component\Input\ViewControl\withAdditionalTransformation(), and ILIAS\UI\Implementation\Component\Input\withValue().

Referenced by addEntry(), editEntry(), saveEntry(), and updateEntry().

432  : StandardForm
433  {
434  if (!is_object($this->entry)) {
435  $this->entry = new ilMDCopyrightSelectionEntry($this->initEntryIdFromQuery());
436  }
437 
438  $inputs = [];
439  $ff = $this->ui_factory->input()->field();
440 
441  $title = $ff
442  ->text($this->lng->txt('title'))
443  ->withValue($this->entry->getTitle())
444  ->withRequired(true)
445  ->withMaxLength(255);
446  $inputs['title'] = $title;
447 
448  $des = $ff
449  ->textarea($this->lng->txt('description'))
450  ->withValue($this->entry->getDescription());
451  $inputs['description'] = $des;
452 
453  $usage = $ff
454  ->radio($this->lng->txt('meta_copyright_usage'))
455  ->withOption('0', $this->lng->txt('meta_copyright_in_use'))
456  ->withOption('1', $this->lng->txt('meta_copyright_outdated'))
457  ->withValue((int) $this->entry->getOutdated());
458  $inputs['outdated'] = $usage;
459 
460  $cp_data = $this->entry->getCopyrightData();
461 
462  $full_name = $ff
463  ->text($this->lng->txt('md_copyright_full_name'))
464  ->withValue($cp_data->fullName());
465 
466  $link = $ff
467  ->url(
468  $this->lng->txt('md_copyright_link'),
469  $this->lng->txt('md_copyright_link_info')
470  )
471  ->withValue((string) $cp_data->link())
473  $this->refinery->custom()->transformation(fn ($v) => $v instanceof URI ? $v : null)
474  );
475 
476  $image_link = $ff
477  ->url($this->lng->txt('md_copyright_image_link'))
478  ->withValue((string) $cp_data->imageLink())
479  ->withAdditionalTransformation($this->refinery->custom()->transformation(
480  fn ($v) => $v instanceof URI ? $v : null
481  ));
482 
483  $alt_text = $ff
484  ->text(
485  $this->lng->txt('md_copyright_alt_text'),
486  $this->lng->txt('md_copyright_alt_text_info')
487  )
488  ->withValue($cp_data->altText());
489 
490  $cop = $ff
491  ->section(
492  [
493  'full_name' => $full_name,
494  'link' => $link,
495  'image_link' => $image_link,
496  'alt_text' => $alt_text
497  ],
498  $this->lng->txt('md_copyright_value')
499  );
500  $inputs['copyright'] = $cop;
501 
502  $form_title = '';
503  $post_url = '';
504  switch ($a_mode) {
505  case 'edit':
506  $form_title = $this->lng->txt('md_copyright_edit');
507  $post_url = $this->ctrl->getLinkTarget($this, 'updateEntry');
508  break;
509 
510  case 'add':
511  $form_title = $this->lng->txt('md_copyright_add');
512  $post_url = $this->ctrl->getLinkTarget($this, 'saveEntry');
513  break;
514  }
515  return $this->ui_factory->input()->container()->form()->standard(
516  $post_url,
517  [$ff->section($inputs, $form_title)]
518  );
519  }
The scope of this class is split ilias-conform URI's into components.
Definition: URI.php:34
withValue($value)
Get an input like this with another value displayed on the client side.
Definition: Group.php:59
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initEntryIdFromPost()

ilObjMDSettingsGUI::initEntryIdFromPost ( )
protected

Definition at line 69 of file class.ilObjMDSettingsGUI.php.

References ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

Referenced by confirmDeleteEntries(), and deleteEntries().

69  : array
70  {
71  $entries = [];
72  if ($this->http->wrapper()->post()->has('entry_id')) {
73  return $this->http->wrapper()->post()->retrieve(
74  'entry_id',
75  $this->refinery->kindlyTo()->listOf(
76  $this->refinery->kindlyTo()->int()
77  )
78  );
79  }
80  return [];
81  }
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initEntryIdFromQuery()

ilObjMDSettingsGUI::initEntryIdFromQuery ( )
protected

Definition at line 57 of file class.ilObjMDSettingsGUI.php.

References ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

Referenced by executeCommand(), initCopyrightEditForm(), showCopyrightUsages(), and updateEntry().

57  : int
58  {
59  $entry_id = 0;
60  if ($this->http->wrapper()->query()->has('entry_id')) {
61  $entry_id = $this->http->wrapper()->query()->retrieve(
62  'entry_id',
63  $this->refinery->kindlyTo()->int()
64  );
65  }
66  return $entry_id;
67  }
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initGeneralSettingsForm()

ilObjMDSettingsGUI::initGeneralSettingsForm ( string  $a_mode = "edit")

Definition at line 186 of file class.ilObjMDSettingsGUI.php.

References $form, ILIAS\Repository\access(), ilPropertyFormGUI\addCommandButton(), ilPropertyFormGUI\addItem(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ilFormGUI\setFormAction(), and ilPropertyFormGUI\setTitle().

Referenced by saveGeneralSettings(), and showGeneralSettings().

187  {
188  $this->tabs_gui->setTabActive('md_general_settings');
189  $form = new ilPropertyFormGUI();
190  $ti = new ilTextInputGUI($this->lng->txt("md_delimiter"), "delimiter");
191  $ti->setInfo($this->lng->txt("md_delimiter_info"));
192  $ti->setMaxLength(1);
193  $ti->setSize(1);
194  $ti->setValue($this->md_settings->getDelimiter());
195  $form->addItem($ti);
196 
197  if ($this->access->checkAccess('write', '', $this->object->getRefId())) {
198  $form->addCommandButton("saveGeneralSettings", $this->lng->txt("save"));
199  $form->addCommandButton("showGeneralSettings", $this->lng->txt("cancel"));
200  }
201  $form->setTitle($this->lng->txt("md_general_settings"));
202  $form->setFormAction($this->ctrl->getFormAction($this));
203  return $form;
204  }
setFormAction(string $a_formaction)
addCommandButton(string $a_cmd, string $a_text, string $a_id="")
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initMDSettings()

ilObjMDSettingsGUI::initMDSettings ( )
protected

Definition at line 521 of file class.ilObjMDSettingsGUI.php.

References ilMDSettings\_getInstance().

Referenced by executeCommand().

521  : void
522  {
523  $this->md_settings = ilMDSettings::_getInstance();
524  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initSettingsForm()

ilObjMDSettingsGUI::initSettingsForm ( )
protected

Definition at line 407 of file class.ilObjMDSettingsGUI.php.

References $check, $form, ILIAS\Repository\access(), ilPropertyFormGUI\addCommandButton(), ilAdministrationSettingsFormHandler\addFieldsToForm(), ilPropertyFormGUI\addItem(), ILIAS\Repository\ctrl(), getAdministrationFormId(), ILIAS\Repository\lng(), ilFormGUI\setFormAction(), and ilPropertyFormGUI\setTitle().

Referenced by saveCopyrightSettings(), and showCopyrightSettings().

408  {
409  $form = new ilPropertyFormGUI();
410  $form->setFormAction($this->ctrl->getFormAction($this));
411  $form->setTitle($this->lng->txt('md_copyright_settings'));
412 
413  if ($this->access->checkAccess('write', '', $this->object->getRefId())) {
414  $form->addCommandButton('saveCopyrightSettings', $this->lng->txt('save'));
415  $form->addCommandButton('showCopyrightSettings', $this->lng->txt('cancel'));
416  }
417 
418  $check = new ilCheckboxInputGUI($this->lng->txt('md_copyright_enabled'), 'active');
419  $check->setChecked($this->md_settings->isCopyrightSelectionActive());
420  $check->setValue('1');
421  $check->setInfo($this->lng->txt('md_copyright_enable_info'));
422  $form->addItem($check);
423 
425  $this->getAdministrationFormId(),
426  $form,
427  $this
428  );
429  return $form;
430  }
This class represents a checkbox property in a property form.
setFormAction(string $a_formaction)
addCommandButton(string $a_cmd, string $a_text, string $a_id="")
static addFieldsToForm(int $a_form_id, ilPropertyFormGUI $a_form, ilObjectGUI $a_parent_gui)
$check
Definition: buildRTE.php:81
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveCopyrightPosition()

ilObjMDSettingsGUI::saveCopyrightPosition ( )

Definition at line 526 of file class.ilObjMDSettingsGUI.php.

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

526  : bool
527  {
528  if (!$this->http->wrapper()->post()->has('order')) {
529  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('err_select_one'), true);
530  $this->ctrl->redirect($this, 'showCopyrightSettings');
531  return false;
532  }
533  $positions = $this->http->wrapper()->post()->retrieve(
534  'order',
535  $this->refinery->kindlyTo()->dictOf(
536  $this->refinery->kindlyTo()->string()
537  )
538  );
539  asort($positions);
540  $position = 0;
541  foreach ($positions as $entry_id => $position_ignored) {
542  $copyright = new ilMDCopyrightSelectionEntry($entry_id);
543  $copyright->setOrderPosition($position++);
544  $copyright->update();
545  }
546  $this->tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'));
547  $this->ctrl->redirect($this, 'showCopyrightSettings');
548  return false;
549  }
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:

◆ saveCopyrightSettings()

ilObjMDSettingsGUI::saveCopyrightSettings ( )

Definition at line 252 of file class.ilObjMDSettingsGUI.php.

References ILIAS\Repository\access(), ilPropertyFormGUI\checkInput(), ILIAS\Repository\ctrl(), ilPropertyFormGUI\getInput(), initSettingsForm(), ILIAS\Repository\lng(), and showCopyrightSettings().

252  : void
253  {
254  if (!$this->access->checkAccess('write', '', $this->object->getRefId())) {
255  $this->ctrl->redirect($this, "showCopyrightSettings");
256  }
257  $form = $this->initSettingsForm();
258  if ($form->checkInput()) {
259  $this->md_settings->activateCopyrightSelection((bool) $form->getInput('active'));
260  $this->md_settings->save();
261  $this->tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'), true);
262  $this->ctrl->redirect($this, 'showCopyrightSettings');
263  }
264  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('err_check_input'), true);
266  }
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-...
showCopyrightSettings(?ilPropertyFormGUI $form=null)
+ Here is the call graph for this function:

◆ saveEntry()

ilObjMDSettingsGUI::saveEntry ( )

Definition at line 301 of file class.ilObjMDSettingsGUI.php.

References ilObjectGUI\$data, addEntry(), ILIAS\Repository\ctrl(), initCopyrightEditForm(), and ILIAS\Repository\lng().

301  : bool
302  {
303  $form = $this->initCopyrightEditForm('add')->withRequest($this->request);
304  if ($data = $form->getData()) {
305  $data = $data[0];
306  $this->entry = new ilMDCopyrightSelectionEntry(0);
307  $this->entry->setTitle($data['title']);
308  $this->entry->setDescription($data['description']);
309  $this->entry->setCopyrightData(
310  $data['copyright']['full_name'],
311  $data['copyright']['link'],
312  $data['copyright']['image_link'],
313  $data['copyright']['alt_text']
314  );
315  $this->entry->setOutdated((bool) $data['outdated']);
316  $this->entry->setLanguage('en');
317  $this->entry->setCopyrightAndOtherRestrictions(true);
318  $this->entry->setCosts(false);
319 
320  if (!$this->entry->validate()) {
321  $this->tpl->setOnScreenMessage('info', $this->lng->txt('fill_out_all_required_fields'));
322  $this->addEntry($form);
323  return false;
324  }
325  $this->entry->add();
326  $this->tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'), true);
327  $this->ctrl->redirect($this, 'showCopyrightSettings');
328  return true;
329  }
330  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('err_check_input'), true);
331  $this->addEntry($form);
332  return false;
333  }
addEntry(?StandardForm $form=null)
initCopyrightEditForm(string $a_mode='edit')
+ Here is the call graph for this function:

◆ saveGeneralSettings()

ilObjMDSettingsGUI::saveGeneralSettings ( )

Definition at line 206 of file class.ilObjMDSettingsGUI.php.

References ILIAS\Repository\access(), ilPropertyFormGUI\checkInput(), ILIAS\Repository\ctrl(), ilPropertyFormGUI\getInput(), initGeneralSettingsForm(), ILIAS\Repository\lng(), ilPropertyFormGUI\setValuesByPost(), and showGeneralSettings().

206  : void
207  {
208  if (!$this->access->checkAccess('write', '', $this->object->getRefId())) {
209  $this->ctrl->redirect($this, "showGeneralSettings");
210  }
211  $form = $this->initGeneralSettingsForm();
212  if ($form->checkInput()) {
213  $delim = $form->getInput('delimiter');
214  $delim = (
215  trim($delim) === '' ?
216  ',' :
217  trim($delim)
218  );
219  $this->md_settings->setDelimiter($delim);
220  $this->md_settings->save();
221  $this->tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'), true);
222  $this->ctrl->redirect($this, "showGeneralSettings");
223  }
224  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('err_check_input'), true);
226  $this->showGeneralSettings($form);
227  }
showGeneralSettings(?ilPropertyFormGUI $form=null)
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-...
initGeneralSettingsForm(string $a_mode="edit")
+ Here is the call graph for this function:

◆ showCopyrightSettings()

ilObjMDSettingsGUI::showCopyrightSettings ( ?ilPropertyFormGUI  $form = null)

Definition at line 229 of file class.ilObjMDSettingsGUI.php.

References ILIAS\Repository\access(), ilPropertyFormGUI\getHTML(), initSettingsForm(), ILIAS\Repository\lng(), and ILIAS\Repository\object().

Referenced by confirmDeleteEntries(), deleteEntries(), and saveCopyrightSettings().

229  : void
230  {
231  $this->tabs_gui->setTabActive('md_copyright');
232  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.settings.html', 'Services/MetaData');
233 
234  if (!$form instanceof ilPropertyFormGUI) {
235  $form = $this->initSettingsForm();
236  }
237  $this->tpl->setVariable('SETTINGS_TABLE', $form->getHTML());
238 
239  $has_write = $this->access->checkAccess('write', '', $this->object->getRefId());
240  $table_gui = new ilMDCopyrightTableGUI($this, 'showCopyrightSettings', $has_write);
241  $table_gui->setTitle($this->lng->txt("md_copyright_selection"));
242  $table_gui->parseSelections();
243 
244  if ($has_write) {
245  $table_gui->addCommandButton('addEntry', $this->lng->txt('add'));
246  $table_gui->addMultiCommand("confirmDeleteEntries", $this->lng->txt("delete"));
247  $table_gui->setSelectAllCheckbox("entry_id");
248  }
249  $this->tpl->setVariable('COPYRIGHT_TABLE', $table_gui->getHTML());
250  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showCopyrightUsages()

ilObjMDSettingsGUI::showCopyrightUsages ( )

Definition at line 268 of file class.ilObjMDSettingsGUI.php.

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

268  : void
269  {
270  $this->ctrl->setParameterByClass('ilmdcopyrightusagegui', 'entry_id', $this->initEntryIdFromQuery());
271  $this->ctrl->redirectByClass('ilmdcopyrightusagegui', "showUsageTable");
272  }
+ Here is the call graph for this function:

◆ showGeneralSettings()

ilObjMDSettingsGUI::showGeneralSettings ( ?ilPropertyFormGUI  $form = null)

Definition at line 178 of file class.ilObjMDSettingsGUI.php.

References ilPropertyFormGUI\getHTML(), and initGeneralSettingsForm().

Referenced by saveGeneralSettings().

178  : void
179  {
180  if (!$form instanceof ilPropertyFormGUI) {
181  $form = $this->initGeneralSettingsForm();
182  }
183  $this->tpl->setContent($form->getHTML());
184  }
initGeneralSettingsForm(string $a_mode="edit")
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateEntry()

ilObjMDSettingsGUI::updateEntry ( )

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

References ilObjectGUI\$data, ILIAS\Repository\ctrl(), editEntry(), initCopyrightEditForm(), initEntryIdFromQuery(), and ILIAS\Repository\lng().

377  : bool
378  {
379  $this->entry = new ilMDCopyrightSelectionEntry($this->initEntryIdFromQuery());
380  $form = $this->initCopyrightEditForm()->withRequest($this->request);
381  if ($data = $form->getData()) {
382  $data = $data[0];
383  $this->entry->setTitle($data['title']);
384  $this->entry->setDescription($data['description']);
385  $this->entry->setCopyrightData(
386  $data['copyright']['full_name'],
387  $data['copyright']['link'],
388  $data['copyright']['image_link'],
389  $data['copyright']['alt_text']
390  );
391  $this->entry->setOutdated((bool) $data['outdated']);
392  if (!$this->entry->validate()) {
393  $this->tpl->setOnScreenMessage('info', $this->lng->txt('fill_out_all_required_fields'));
394  $this->editEntry($form);
395  return false;
396  }
397  $this->entry->update();
398  $this->tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'), true);
399  $this->ctrl->redirect($this, 'showCopyrightSettings');
400  return true;
401  }
402  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('err_check_input'));
403  $this->editEntry($form);
404  return false;
405  }
initCopyrightEditForm(string $a_mode='edit')
editEntry(?StandardForm $form=null)
+ Here is the call graph for this function:

Field Documentation

◆ $entry

ilMDCopyrightSelectionEntry ilObjMDSettingsGUI::$entry = null
protected

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

◆ $form

ilPropertyFormGUI ilObjMDSettingsGUI::$form = null
protected

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

Referenced by initGeneralSettingsForm(), and initSettingsForm().

◆ $http

GlobalHttpState ilObjMDSettingsGUI::$http
protected

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

◆ $md_settings

ilMDSettings ilObjMDSettingsGUI::$md_settings = null
protected

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

◆ $refinery

Factory ilObjMDSettingsGUI::$refinery
protected

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

◆ $ui_factory

UIFactory ilObjMDSettingsGUI::$ui_factory
protected

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

◆ $ui_renderer

UIRenderer ilObjMDSettingsGUI::$ui_renderer
protected

Definition at line 42 of file class.ilObjMDSettingsGUI.php.


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