ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
class.ilObjBibliographicGUI.php
Go to the documentation of this file.
1 <?php
2 
23 
40 {
41  use \ILIAS\Modules\OrgUnit\ARHelper\DIC;
42 
43  public const P_ENTRY_ID = 'entry_id';
44  public const CMD_SHOW_CONTENT = 'showContent';
45  public const CMD_SEND_FILE = "sendFile";
46  public const TAB_CONTENT = "content";
47  public const SUB_TAB_FILTER = "filter";
48  public const CMD_VIEW = "view";
49  public const TAB_EXPORT = "export";
50  public const TAB_SETTINGS = self::SUBTAB_SETTINGS;
51  public const TAB_ID_RECORDS = "id_records";
52  public const TAB_ID_PERMISSIONS = "id_permissions";
53  public const TAB_ID_INFO = "id_info";
54  public const CMD_SHOW_DETAILS = "showDetails";
55  public const SUBTAB_SETTINGS = "settings";
56  public const CMD_EDIT_OBJECT = 'editObject';
57  public const CMD_UPDATE_OBJECT = "updateObject";
58  public const CMD_SETTINGS = "settings";
59  public const CMD_OVERWRITE_BIBLIOGRAPHIC_FILE = "overwriteBibliographicFile";
60  public const CMD_REPLACE_BIBLIOGRAPHIC_FILE = "replaceBibliographicFile";
61  public const SECTION_REPLACE_BIBLIOGRAPHIC_FILE = 'section_replace_bibliographic_file';
62  public const PROP_BIBLIOGRAPHIC_FILE = "bibliographic_file";
63  public const SECTION_EDIT_BIBLIOGRAPHY = 'section_edit_bibliography';
64  public const PROP_TITLE_AND_DESC = 'title_and_desc';
65  public const SECTION_AVAILABILITY = 'section_availability';
66  public const PROP_ONLINE_STATUS = 'online_status';
67  public const SECTION_PRESENTATION = 'section_presentation';
68  public const PROP_TILE_IMAGE = 'tile_image';
70 
71  public ?ilObject $object = null;
72  protected ?\ilBiblFactoryFacade $facade = null;
73  protected \ilBiblTranslationFactory $translation_factory;
74  protected \ilBiblFieldFactory $field_factory;
75  protected \ilBiblFieldFilterFactory $filter_factory;
76  protected \ilBiblTypeFactory $type_factory;
77 
78  protected ilHelpGUI $help;
79  protected Services $storage;
80  protected \ilObjBibliographicStakeholder $stakeholder;
81  protected \ILIAS\HTTP\Services $http;
82  protected \ILIAS\UI\Factory $ui_factory;
83  protected \ILIAS\Refinery\Factory $refinery;
84  protected ?string $cmd = self::CMD_SHOW_CONTENT;
85 
86  public function __construct(int $a_id = 0, int $a_id_type = self::REPOSITORY_NODE_ID, int $a_parent_node_id = 0)
87  {
88  global $DIC;
89 
90  $this->help = $DIC['ilHelp'];
91  $this->storage = $DIC['resource_storage'];
92  $this->stakeholder = new ilObjBibliographicStakeholder();
93  $this->http = $DIC->http();
94  $this->ui_factory = $DIC->ui()->factory();
95  $this->refinery = $DIC->refinery();
96  $this->upload_limit = $DIC["ui.upload_limit_resolver"];
97 
98  parent::__construct($a_id, $a_id_type, $a_parent_node_id);
99  $DIC->language()->loadLanguageModule('bibl');
100  $DIC->language()->loadLanguageModule('content');
101  $DIC->language()->loadLanguageModule('obj');
102  $DIC->language()->loadLanguageModule('cntr');
103 
104  if (is_object($this->object)) {
106  $obj = $this->object;
107  $this->facade = new ilBiblFactoryFacade($obj);
108  }
109  }
110 
114  public function getStandardCmd(): string
115  {
116  return self::CMD_VIEW;
117  }
118 
123  public function getType(): string
124  {
125  return "bibl";
126  }
127 
131  public function executeCommand(): void
132  {
133  global $DIC;
134  $ilNavigationHistory = $DIC['ilNavigationHistory'];
135 
136  // Navigation History
137  $link = $this->dic()->ctrl()->getLinkTarget($this, $this->getStandardCmd());
138  if ($this->object != null) {
139  $ilNavigationHistory->addItem($this->object->getRefId(), $link, "bibl");
140  $this->addHeaderAction();
141  }
142 
143  // general Access Check, especially for single entries not matching the object
144  if ($this->object instanceof ilObjBibliographic && !$DIC->access()->checkAccess(
145  'read',
146  "",
147  $this->object->getRefId()
148  )) {
149  $this->handleNonAccess();
150  }
151 
152  $next_class = $this->dic()->ctrl()->getNextClass($this);
153  $this->cmd = $this->dic()->ctrl()->getCmd();
154  switch ($next_class) {
155  case strtolower(ilInfoScreenGUI::class):
156  $this->prepareOutput();
157  $this->dic()->tabs()->activateTab(self::TAB_ID_INFO);
158  $this->infoScreenForward();
159  break;
160  case strtolower(ilCommonActionDispatcherGUI::class):
161  $this->prepareOutput();
163  $this->ctrl->forwardCommand($gui);
164  break;
165  case strtolower(ilPermissionGUI::class):
166  $this->prepareOutput();
167  $this->dic()->tabs()->activateTab(self::TAB_ID_PERMISSIONS);
168  $this->ctrl->forwardCommand(new ilPermissionGUI($this));
169  break;
170  case strtolower(ilObjectCopyGUI::class):
171  $cp = new ilObjectCopyGUI($this);
172  $cp->setType('bibl');
173  $this->dic()['tpl']->loadStandardTemplate();
174  $this->ctrl->forwardCommand($cp);
175  break;
176  case strtolower(ilExportGUI::class):
177  $this->prepareOutput();
178  $this->dic()->tabs()->setTabActive(self::TAB_EXPORT);
179  $exp_gui = new ilExportGUI($this);
180  $exp_gui->addFormat("xml");
181  $this->ctrl->forwardCommand($exp_gui);
182  break;
183  case strtolower(ilBiblFieldFilterGUI::class):
184  $this->prepareOutput();
185  $this->dic()->tabs()->setTabActive(self::TAB_SETTINGS);
186  $this->initSubTabs();
187  $this->tabs_gui->activateSubTab(self::SUB_TAB_FILTER);
188  $this->ctrl->forwardCommand(new ilBiblFieldFilterGUI($this->facade));
189  break;
190  case strtolower(ilObjBibliographicUploadHandlerGUI::class):
191  $rid = "";
192  if ($this->object && $this->object->getResourceId()) {
193  $rid = $this->object->getResourceId()->serialize();
194  }
195  $this->ctrl->forwardCommand(new ilObjBibliographicUploadHandlerGUI($rid));
196  break;
197  default:
198  $this->prepareOutput();
199  $cmd = $this->ctrl->getCmd(self::CMD_SHOW_CONTENT);
200  switch ($cmd) {
201  case self::CMD_SETTINGS:
202  case self::CMD_EDIT_OBJECT:
203  case self::CMD_UPDATE_OBJECT:
204  $this->initSubTabs();
205  $this->tabs_gui->activateSubTab(self::SUBTAB_SETTINGS);
206  $this->{$cmd}();
207  break;
208  default:
209  $this->{$cmd}();
210  break;
211  }
212  break;
213  }
214  }
215 
221  public function infoScreen(): void
222  {
223  $this->ctrl->setCmd("showSummary");
224  $this->ctrl->setCmdClass(ilInfoScreenGUI::class);
225  $this->infoScreenForward();
226  }
227 
231  public function infoScreenForward(): void
232  {
233  global $DIC;
238  if (!$this->checkPermissionBoolAndReturn("visible") && !$this->checkPermissionBoolAndReturn('read')) {
239  $this->tpl->setOnScreenMessage('failure', $DIC['lng']->txt("msg_no_perm_read"), true);
240  $this->ctrl->redirectByClass('ilDashboardGUI', '');
241  }
242  $DIC->tabs()->activateTab(self::TAB_ID_INFO);
243  $info = new ilInfoScreenGUI($this);
244 
245  $info->enablePrivateNotes();
246  $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
247 
248  // Storage Info
249  $irss = new ilResourceStorageInfoGUI($this->object->getResourceId());
250  $irss->append($info);
251 
252  $this->ctrl->forwardCommand($info);
253  }
254 
255  /*
256  * addLocatorItems
257  */
258  public function addLocatorItems(): void
259  {
260  global $DIC;
261  $ilLocator = $DIC['ilLocator'];
262  if (is_object($this->object)) {
263  $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, ""), "", $this->node_id);
264  }
265  }
266 
271  public static function _goto(string $a_target): void
272  {
273  global $DIC;
274 
275  $id = explode("_", $a_target);
276  $DIC->ctrl()->setTargetScript('ilias.php');
277  $DIC->ctrl()->setParameterByClass(ilObjBibliographicGUI::class, "ref_id", (int) ($id[0] ?? 1));
278  // Detail-View
279  if (isset($id[1]) && $id[1] !== '') {
280  $DIC->ctrl()
281  ->setParameterByClass(ilObjBibliographicGUI::class, ilObjBibliographicGUI::P_ENTRY_ID, $id[1]);
282  $DIC->ctrl()->redirectByClass(
283  array(
284  ilRepositoryGUI::class,
285  ilObjBibliographicGUI::class,
286  ),
287  self::CMD_SHOW_DETAILS
288  );
289  } else {
290  $DIC->ctrl()->redirectByClass(
291  array(
292  ilRepositoryGUI::class,
293  ilObjBibliographicGUI::class,
294  ),
295  self::CMD_VIEW
296  );
297  }
298  }
299 
303  protected function initCreationForms(string $a_new_type): array
304  {
305  global $DIC;
306 
307  $forms = parent::initCreationForms($a_new_type);
308  // Add File-Upload
309  $in_file = new ilFileInputGUI($DIC->language()->txt("bibliography_file"), "bibliographic_file");
310  $in_file->setSuffixes(array("ris", "bib", "bibtex"));
311  $in_file->setRequired(true);
312  $forms[self::CFORM_NEW]->addItem($in_file);
313  $this->ctrl->saveParameterByClass('ilobjrootfoldergui', 'new_type');
314  $forms[self::CFORM_NEW]->setFormAction($this->ctrl->getFormActionByClass('ilobjrootfoldergui', "save"));
315 
316  return $forms;
317  }
318 
319  public function save(): void
320  {
321  $form = $this->initCreationForms($this->getType());
322  if ($form[self::CFORM_NEW]->checkInput()) {
323  parent::save();
324  } else {
325  $form = $form[self::CFORM_NEW];
326  $form->setValuesByPost();
327  $this->ui()->mainTemplate()->setContent($form->getHtml());
328  }
329  }
330 
331  public function updateObject(): void
332  {
333  $form = $this->getSettingsForm();
334  $form = $form->withRequest($this->http->request());
335  $result = $form->getInputGroup()->getContent();
336 
337  if (!$result->isOK()) {
338  $this->tpl->setOnScreenMessage('failure', $result->error(), true);
339  $this->tpl->setContent(
340  $this->ui()->renderer()->render([$form])
341  );
342  } else {
343  $values = $result->value();
344 
345  $this->object->getObjectProperties()->storePropertyTitleAndDescription(
346  $values[self::SECTION_EDIT_BIBLIOGRAPHY][self::PROP_TITLE_AND_DESC]
347  );
348  $this->object->getObjectProperties()->storePropertyIsOnline(
349  $values[self::SECTION_AVAILABILITY][self::PROP_ONLINE_STATUS]
350  );
351  $this->object->getObjectProperties()->storePropertyTileImage(
352  $values[self::SECTION_PRESENTATION][self::PROP_TILE_IMAGE]
353  );
354 
355  $this->tpl->setOnScreenMessage('success', $this->lng->txt('changes_saved'), true);
356  $this->ctrl->redirect($this, self::CMD_SETTINGS);
357  }
358  }
359 
360  protected function afterSave(ilObject $a_new_object): void
361  {
362  $this->addNews($a_new_object->getId(), 'created');
363  $this->ctrl->redirect($this, self::CMD_EDIT_OBJECT);
364  }
365 
366  protected function settings(): void
367  {
368  $this->tpl->setContent($this->ui()->renderer()->render($this->getSettingsForm()));
369  }
370 
371  private function replaceBibliograficFileInit(): void
372  {
373  $this->tabs()->clearTargets();
374  $this->tabs()->setBackTarget(
375  $this->lng->txt('back'),
376  $this->ctrl->getLinkTarget($this, self::CMD_SHOW_CONTENT)
377  );
378 
379  $this->tpl->setOnScreenMessage(
380  'info',
381  $this->lng->txt('replace_bibliography_file_info')
382  );
383  }
384 
385  public function overwriteBibliographicFile(): void
386  {
388 
389  $this->tpl->setContent($this->ui()->renderer()->render($this->getReplaceBibliographicFileForm()));
390  }
391 
392  public function replaceBibliographicFile(): void
393  {
395 
396  $form = $this->getReplaceBibliographicFileForm();
397  $form = $form->withRequest($this->http->request());
398  $data = $form->getData();
399  if ($data !== null && $bibl_file_rid = $this->storage->manage()->find(
400  $data[self::SECTION_REPLACE_BIBLIOGRAPHIC_FILE][self::PROP_BIBLIOGRAPHIC_FILE][0]
401  )) {
405  $bibl_obj = $this->getObject();
406  $bibl_filename = $this->storage->manage()->getResource($bibl_file_rid)->getCurrentRevision()->getTitle();
407  $bibl_filetype = $bibl_obj->determineFileTypeByFileName($bibl_filename);
408 
409  $bibl_obj->setResourceId($bibl_file_rid);
410  $bibl_obj->setFilename($bibl_filename);
411  $bibl_obj->setFileType($bibl_filetype);
412  $bibl_obj->update();
413  $bibl_obj->parseFileToDatabase();
414 
415  $this->tpl->setOnScreenMessage('success', $this->lng->txt('changes_saved'), true);
416  $this->ctrl->redirect($this, self::CMD_SHOW_CONTENT);
417  }
418 
419  $this->tpl->setContent(
420  $this->ui()->renderer()->render([$form])
421  );
422  }
423 
424  protected function getReplaceBibliographicFileForm(): Standard
425  {
430  $bibl_obj = $this->getObject();
431  $rid = $bibl_obj->getResourceId() ? $bibl_obj->getResourceId()->serialize() : "";
432  $bibl_upload_handler = new ilObjBibliographicUploadHandlerGUI($rid);
433 
434  $max_filesize_bytes = $this->upload_limit->getPhpUploadLimitInBytes();
435  $max_filesize_mb = round($max_filesize_bytes / 1024 / 1024, 1);
436  $info_file_limitations = $this->lng->txt('file_notice') . " " . number_format($max_filesize_mb, 1) . " MB <br>"
437  . $this->lng->txt('file_allowed_suffixes') . " .bib, .bibtex, .ris";
438  $section_replace_bibliographic_file = $this->ui_factory
439  ->input()
440  ->field()
441  ->section(
442  [
443  self::PROP_BIBLIOGRAPHIC_FILE => $this->ui_factory
444  ->input()
445  ->field()
446  ->file(
447  $bibl_upload_handler,
448  $this->lng->txt('bibliography_file'),
449  $info_file_limitations
450  )
451  ->withMaxFileSize($max_filesize_bytes)
452  ->withRequired(true)
453  ->withAdditionalTransformation(
455  )
456  ],
457  $this->lng->txt('replace_bibliography_file')
458  );
459 
460  return $this->ui_factory->input()->container()->form()->standard(
461  $this->ctrl->getFormAction($this, self::CMD_REPLACE_BIBLIOGRAPHIC_FILE),
462  [
463  self::SECTION_REPLACE_BIBLIOGRAPHIC_FILE => $section_replace_bibliographic_file
464  ]
465  );
466  }
467 
468  protected function getValidBiblFileSuffixConstraint(): \ILIAS\Refinery\Constraint
469  {
470  return $this->refinery->custom()->constraint(
471  function ($bibl_file_input): bool {
472  global $DIC;
473  $rid = $bibl_file_input[0];
474  $resource_identifier = $DIC->resourceStorage()->manage()->find($rid);
475  if ($resource_identifier !== null) {
476  $bibl_file = $DIC->resourceStorage()->manage()->getCurrentRevision($resource_identifier);
477  $bibl_file_suffix = $bibl_file->getInformation()->getSuffix();
478  if (in_array($bibl_file_suffix, ['ris', 'bib', 'bibtex'])) {
479  return true;
480  }
481  }
482  return false;
483  },
484  $this->lng->txt('msg_error_invalid_bibl_file_suffix')
485  );
486  }
487 
493  public function setTabs(): void
494  {
495  global $DIC;
496 
497  $ilHelp = $DIC['ilHelp'];
501  $ilHelp->setScreenIdComponent('bibl');
502  // info screen
503  if ($DIC->access()->checkAccess('read', "", $this->object->getRefId())) {
504  $DIC->tabs()->addTab(
505  self::TAB_CONTENT,
506  $DIC->language()
507  ->txt(self::TAB_CONTENT),
508  $this->ctrl->getLinkTarget($this, self::CMD_SHOW_CONTENT)
509  );
510  }
511  // info screen
512  if ($DIC->access()->checkAccess('visible', "", $this->object->getRefId())
513  || $DIC->access()->checkAccess('read', "", $this->object->getRefId())
514  ) {
515  $DIC->tabs()->addTab(
516  self::TAB_ID_INFO,
517  $DIC->language()
518  ->txt("info_short"),
519  $this->ctrl->getLinkTargetByClass("ilinfoscreengui", "showSummary")
520  );
521  }
522  // settings
523  if ($DIC->access()->checkAccess('write', "", $this->object->getRefId())) {
524  $DIC->tabs()->addTab(
525  self::SUBTAB_SETTINGS,
526  $DIC->language()
527  ->txt(self::SUBTAB_SETTINGS),
528  $this->ctrl->getLinkTarget($this, self::CMD_EDIT_OBJECT)
529  );
530  }
531  // export
532  if ($DIC->access()->checkAccess("write", "", $this->object->getRefId())) {
533  $DIC->tabs()->addTab(
534  self::TAB_EXPORT,
535  $DIC->language()
536  ->txt(self::TAB_EXPORT),
537  $this->ctrl->getLinkTargetByClass("ilexportgui", "")
538  );
539  }
540  // edit permissions
541  if ($DIC->access()->checkAccess('edit_permission', "", $this->object->getRefId())) {
542  $DIC->tabs()->addTab(
543  self::TAB_ID_PERMISSIONS,
544  $DIC->language()
545  ->txt("perm_settings"),
546  $this->ctrl->getLinkTargetByClass("ilpermissiongui", "perm")
547  );
548  }
549  }
550 
551  protected function initSubTabs(): void
552  {
553  global $DIC;
554  $DIC->tabs()->addSubTab(
555  self::SUBTAB_SETTINGS,
556  $DIC->language()
557  ->txt(self::SUBTAB_SETTINGS),
558  $this->ctrl->getLinkTarget($this, self::CMD_EDIT_OBJECT)
559  );
560  $DIC->tabs()->addSubTab(
561  self::SUB_TAB_FILTER,
562  $DIC->language()
563  ->txt("bibl_filter"),
564  $this->ctrl->getLinkTargetByClass(ilBiblFieldFilterGUI::class, ilBiblFieldFilterGUI::CMD_STANDARD)
565  );
566  }
567 
572  public function editObject(): void
573  {
574  if (!$this->checkPermissionBool("write")) {
575  $this->error->raiseError($this->lng->txt("msg_no_perm_write"), $this->error->MESSAGE);
576  }
577 
578  $this->tabs_gui->activateTab("settings");
579  $form = $this->getSettingsForm();
580  $this->tpl->setContent($this->ui()->renderer()->render($form));
581  }
582 
583  public function getSettingsForm(): Standard
584  {
585  $field_factory = $this->ui_factory->input()->field();
586 
587  $section_edit_bibliography = $field_factory->section(
588  [
589  self::PROP_TITLE_AND_DESC => $this->object->getObjectProperties()->getPropertyTitleAndDescription(
590  )->toForm(
591  $this->lng,
592  $field_factory,
593  $this->refinery
594  )
595  ],
596  $this->lng->txt('bibl_edit'),
597  ''
598  );
599  $section_availability = $field_factory->section(
600  [
601  self::PROP_ONLINE_STATUS => $this->object->getObjectProperties()->getPropertyIsOnline()->toForm(
602  $this->lng,
603  $field_factory,
604  $this->refinery
605  )
606  ],
607  $this->lng->txt('rep_activation_availability'),
608  ''
609  );
610  $section_presentation = $field_factory->section(
611  [
612  self::PROP_TILE_IMAGE => $this->object->getObjectProperties()->getPropertyTileImage()->toForm(
613  $this->lng,
614  $field_factory,
615  $this->refinery
616  )
617  ],
618  $this->lng->txt('settings_presentation_header'),
619  ''
620  );
621 
622  return $this->ui_factory->input()->container()->form()->standard(
623  $this->ctrl->getFormAction($this, self::CMD_UPDATE_OBJECT),
624  [
625  self::SECTION_EDIT_BIBLIOGRAPHY => $section_edit_bibliography,
626  self::SECTION_AVAILABILITY => $section_availability,
627  self::SECTION_PRESENTATION => $section_presentation
628  ]
629  );
630  }
631 
632  public function render(): void
633  {
634  $this->showContent();
635  }
636 
640  public function showContent(): void
641  {
642  global $DIC;
643 
644  // if user has read permission and object is online OR user has write permissions
645  $read_access = $DIC->access()->checkAccess('read', "", $this->object->getRefId());
646  $online = $this->object->getObjectProperties()->getPropertyIsOnline()->getIsOnline();
647  $write_access = $DIC->access()->checkAccess('write', "", $this->object->getRefId());
648  if (($read_access && $online) || $write_access) {
649  $DIC->tabs()->activateTab(self::TAB_CONTENT);
650 
651  $btn_download_original_file = $this->ui()->factory()->button()->primary(
652  $this->lng->txt('download_original_file'),
653  $this->ctrl()->getLinkTargetByClass(self::class, self::CMD_SEND_FILE)
654  );
655  $this->toolbar->addComponent($btn_download_original_file);
656 
657  $btn_overwrite_bibliographic_file = $this->ui()->factory()->button()->standard(
658  $this->lng->txt('replace_bibliography_file'),
659  $this->ctrl()->getLinkTargetByClass(self::class, self::CMD_OVERWRITE_BIBLIOGRAPHIC_FILE)
660  );
661  $this->toolbar->addComponent($btn_overwrite_bibliographic_file);
662 
663  $table = new ilBiblEntryTableGUI($this, $this->facade, $this->ui());
664  $html = $table->getHTML();
665  $DIC->ui()->mainTemplate()->setContent($html);
666 
667  //Permanent Link
668  $DIC->ui()->mainTemplate()->setPermanentLink("bibl", $this->object->getRefId());
669  } else {
670  $object_title = ilObject::_lookupTitle(ilObject::_lookupObjId($this->ref_id));
671  $this->tpl->setOnScreenMessage(
672  'failure',
673  sprintf(
674  $DIC->language()
675  ->txt("msg_no_perm_read_item"),
676  $object_title
677  ),
678  true
679  );
680  //redirect to repository without any parameters
681  $this->handleNonAccess();
682  }
683  }
684 
685  protected function applyFilter(): void
686  {
687  $table = new ilBiblEntryTableGUI($this, $this->facade, $this->ui());
688  $table->writeFilterToSession();
689  $table->resetOffset();
690  $this->ctrl->redirect($this, self::CMD_SHOW_CONTENT);
691  }
692 
693  protected function resetFilter(): void
694  {
695  $table = new ilBiblEntryTableGUI($this, $this->facade, $this->ui());
696  $table->resetFilter();
697  $table->resetOffset();
698  $this->ctrl->redirect($this, self::CMD_SHOW_CONTENT);
699  }
700 
704  public function sendFile(): void
705  {
706  global $DIC;
707 
708  if ($DIC['ilAccess']->checkAccess('read', "", $this->object->getRefId())) {
709  if (!$this->object->isMigrated()) {
710  $file_path = $this->object->getLegacyAbsolutePath();
711  if ($file_path) {
712  if (is_file($file_path)) {
714  $file_path,
715  $this->object->getFilename(),
716  'application/octet-stream'
717  );
718  } else {
719  $this->tpl->setOnScreenMessage('failure', $DIC['lng']->txt("file_not_found"));
720  $this->showContent();
721  }
722  }
723  } else {
724  $this->storage->consume()->download($this->object->getResourceId())->run();
725  }
726  } else {
727  $this->handleNonAccess();
728  }
729  }
730 
731  public function showDetails(): void
732  {
733  global $DIC;
734 
735  if ($DIC->access()->checkAccess('read', "", $this->object->getRefId())) {
736  $id = $DIC->http()->request()->getQueryParams()[self::P_ENTRY_ID];
737  $entry = $this->facade->entryFactory()
738  ->findByIdAndTypeString($id, $this->object->getFileTypeAsString());
739  $bibGUI = new ilBiblEntryDetailPresentationGUI(
740  $entry,
741  $this->facade,
742  $this->ctrl(),
743  $this->help,
744  $this->lng(),
745  $this->tpl(),
746  $this->tabs(),
747  $this->ui()
748  );
749 
750  $DIC->ui()->mainTemplate()->setContent($bibGUI->getHTML());
751  } else {
752  $this->handleNonAccess();
753  }
754  }
755 
756  public function view(): void
757  {
758  $this->showContent();
759  }
760 
761  public function toggleNotification(): void
762  {
763  global $DIC;
764  $ntf = $DIC->http()->wrapper()->query()->retrieve(
765  "ntf",
766  $DIC->refinery()->to()->int()
767  );
768 
769  switch ($ntf) {
770  case 1:
773  $DIC->user()
774  ->getId(),
776  false
777  );
778  break;
779  case 2:
782  $DIC->user()
783  ->getId(),
785  true
786  );
787  break;
788  }
789  $DIC->ctrl()->redirect($this, "");
790  }
791 
792  public function addNews(int $obj_id, string $change = 'created'): void
793  {
794  global $DIC;
795 
796  $ilNewsItem = new ilNewsItem();
797  $ilNewsItem->setTitle($DIC->language()->txt('news_title_' . $change));
798  $ilNewsItem->setPriority(NEWS_NOTICE);
799  $ilNewsItem->setContext($obj_id, $this->getType());
800  $ilNewsItem->setUserId($DIC->user()->getId());
801  $ilNewsItem->setVisibility(NEWS_USERS);
802  $ilNewsItem->setContentTextIsLangVar(false);
803  $ilNewsItem->create();
804  }
805 
810  public function addToDesk(): void
811  {
812  $this->addToDeskObject();
813  }
814 
819  public function removeFromDesk(): void
820  {
821  $this->removeFromDeskObject();
822  }
823 
824  protected function afterImport(ilObject $a_new_object): void
825  {
829  $a_new_object->parseFileToDatabase();
830 
831  parent::afterImport($a_new_object);
832  }
833 
834  private function handleNonAccess(): void
835  {
836  global $DIC;
837 
838  $this->tpl->setOnScreenMessage('failure', $DIC->language()->txt("no_permission"), true);
840  }
841 }
afterSave(ilObject $a_new_object)
Class ilObjBibliographicGUI.
Class ilInfoScreenGUI.
removeFromDesk()
Remove from desktop.
New implementation of ilObjectGUI.
GUI class for the workflow of copying objects.
ilBiblFieldFilterFactory $filter_factory
This class represents a file property in a property form.
Class ChatMainBarProvider .
Help GUI class.
prepareOutput(bool $show_sub_objects=true)
setSuffixes(array $a_suffixes)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilObjBibliographicStakeholder $stakeholder
sendFile()
provide file as a download
Class ilResourceStorageInfoGUI.
static _lookupObjId(int $ref_id)
global $DIC
Definition: feed.php:28
Export User Interface Class.
static http()
Fetches the global http state from ILIAS.
__construct(VocabulariesInterface $vocabularies)
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $node_id=null)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupTitle(int $obj_id)
static setNotification(int $type, int $user_id, int $id, bool $status=true)
Set notification status for object and user.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static deliverFileAttached(string $path_to_file, ?string $download_file_name=null, ?string $mime_type=null, bool $delete_file=false)
Class ilObjBibliographicStakeholder.
const NEWS_NOTICE
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(int $id=0, int $id_type=self::REPOSITORY_NODE_ID, int $parent_node_id=0)
afterImport(ilObject $new_object)
Post (successful) object import hook.
ilBiblTranslationFactory $translation_factory
This describes a standard form.
Definition: Standard.php:26
setTabs()
create tabs (repository/workspace switch)
A news item can be created by different sources.
addNews(int $obj_id, string $change='created')
showContent()
shows the overview page with all entries in a table
ILIAS Refinery Factory $refinery
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
const NEWS_USERS
static _goto(string $a_target)
_goto Deep link
Class ilObjBibliographic.
Class ilBiblEntryDetailPresentationGUI.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addHeaderAction()
Add header action menu.
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
static _gotoRepositoryRoot(bool $raise_error=false)
Goto repository root.
infoScreen()
this one is called from the info button in the repository not very nice to set cmdClass/Cmd manually...