83 protected \ILIAS\HTTP\Services
$http;
86 protected ?
string $cmd = self::CMD_SHOW_CONTENT;
88 public function __construct(
int $a_id = 0,
int $a_id_type = self::REPOSITORY_NODE_ID,
int $a_parent_node_id = 0)
92 $this->
help = $DIC[
'ilHelp'];
93 $this->storage = $DIC[
'resource_storage'];
95 $this->
http = $DIC->http();
96 $this->ui_factory = $DIC->ui()->factory();
98 $this->upload_limit = $DIC[
"ui.upload_limit_resolver"];
101 $DIC->language()->loadLanguageModule(
'bibl');
102 $DIC->language()->loadLanguageModule(
'content');
103 $DIC->language()->loadLanguageModule(
'obj');
104 $DIC->language()->loadLanguageModule(
'cntr');
118 return self::CMD_VIEW;
136 $ilNavigationHistory = $DIC[
'ilNavigationHistory'];
139 $link = $this->dic()->ctrl()->getLinkTarget($this, $this->
getStandardCmd());
140 if ($this->
object != null) {
141 $ilNavigationHistory->addItem($this->
object->getRefId(), $link,
"bibl");
154 $next_class = $this->dic()->ctrl()->getNextClass($this);
155 $this->cmd = $this->dic()->ctrl()->getCmd();
156 switch ($next_class) {
157 case strtolower(ilInfoScreenGUI::class):
159 $this->dic()->tabs()->activateTab(self::TAB_ID_INFO);
160 $this->infoScreenForward();
162 case strtolower(ilCommonActionDispatcherGUI::class):
165 $this->
ctrl->forwardCommand($gui);
167 case strtolower(ilPermissionGUI::class):
169 $this->dic()->tabs()->activateTab(self::TAB_ID_PERMISSIONS);
172 case strtolower(ilObjectCopyGUI::class):
174 $cp->setType(
'bibl');
175 $this->dic()[
'tpl']->loadStandardTemplate();
176 $this->
ctrl->forwardCommand($cp);
178 case strtolower(ilExportGUI::class):
180 $this->dic()->tabs()->setTabActive(self::TAB_EXPORT);
182 $exp_gui->addFormat(
"xml");
183 $this->
ctrl->forwardCommand($exp_gui);
185 case strtolower(ilBiblFieldFilterGUI::class):
187 $this->dic()->tabs()->setTabActive(self::TAB_SETTINGS);
189 $this->tabs_gui->activateSubTab(self::SUB_TAB_FILTER);
192 case strtolower(ilObjBibliographicUploadHandlerGUI::class):
194 if ($this->
object && $this->
object->getResourceId()) {
195 $rid = $this->
object->getResourceId()->serialize();
201 $cmd = $this->
ctrl->getCmd(self::CMD_SHOW_CONTENT);
203 case self::CMD_SETTINGS:
204 case self::CMD_EDIT_OBJECT:
205 case self::CMD_UPDATE_OBJECT:
207 $this->tabs_gui->activateSubTab(self::SUBTAB_SETTINGS);
225 $this->
ctrl->redirectByClass(ilInfoScreenGUI::class,
"showSummary");
231 public function infoScreenForward():
void 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',
'');
242 $DIC->tabs()->activateTab(self::TAB_ID_INFO);
245 $info->enablePrivateNotes();
246 $info->addMetaDataSections($this->
object->getId(), 0, $this->
object->getType());
252 $this->
ctrl->forwardCommand($info);
261 $ilLocator = $DIC[
'ilLocator'];
262 if (is_object($this->
object)) {
271 public static function _goto(
string $a_target): void
275 $id = explode(
"_", $a_target);
276 $DIC->ctrl()->setTargetScript(
'ilias.php');
277 $DIC->ctrl()->setParameterByClass(ilObjBibliographicGUI::class,
"ref_id", (
int) (
$id[0] ?? 1));
279 if (isset(
$id[1]) &&
$id[1] !==
'') {
282 $DIC->ctrl()->redirectByClass(
284 ilRepositoryGUI::class,
285 ilObjBibliographicGUI::class,
287 self::CMD_SHOW_DETAILS
290 $DIC->ctrl()->redirectByClass(
292 ilRepositoryGUI::class,
293 ilObjBibliographicGUI::class,
306 $form->setTarget(
'_top');
307 $form->setFormAction($this->
ctrl->getFormAction($this,
'save'));
308 $form->setTitle($this->
lng->txt($new_type .
'_new'));
313 $ti->setRequired(
true);
322 $in_file =
new ilFileInputGUI($this->
lng->txt(
'bibliography_file'),
'bibliographic_file');
324 $in_file->setRequired(
true);
325 $form->addItem($in_file);
329 $form->addCommandButton(
'save', $this->
lng->txt($new_type .
'_add'));
330 $form->addCommandButton(
'cancel', $this->
lng->txt(
'cancel'));
338 if ($form->checkInput()) {
341 $form->setValuesByPost();
342 $this->
ui()->mainTemplate()->setContent($form->getHtml());
350 $this->error->raiseError($this->
lng->txt(
'no_create_permission'), $this->error->MESSAGE);
353 $this->
lng->loadLanguageModule($this->requested_new_type);
354 $this->
ctrl->setParameter($this,
'new_type', $this->requested_new_type);
357 if ($form->checkInput()) {
358 $this->
ctrl->setParameter($this,
'new_type',
'');
361 $newObj->setTitle($form->getInput(
'title'));
362 $newObj->setDescription($form->getInput(
'desc'));
363 $newObj->processAutoRating();
370 $newObj->applyDidacticTemplate($dtpl);
376 $form->setValuesByPost();
377 $this->tpl->setContent($form->getHTML());
383 $form = $form->withRequest($this->
http->request());
384 $result = $form->getInputGroup()->getContent();
386 if (!$result->isOK()) {
387 $this->tpl->setOnScreenMessage(
'failure', $result->error(),
true);
388 $this->tpl->setContent(
389 $this->
ui()->renderer()->
render([$form])
392 $values = $result->value();
394 $this->
object->getObjectProperties()->storePropertyTitleAndDescription(
395 $values[self::SECTION_EDIT_BIBLIOGRAPHY][self::PROP_TITLE_AND_DESC]
397 $this->
object->getObjectProperties()->storePropertyIsOnline(
398 $values[self::SECTION_AVAILABILITY][self::PROP_ONLINE_STATUS]
400 $this->
object->getObjectProperties()->storePropertyTileImage(
401 $values[self::SECTION_PRESENTATION][self::PROP_TILE_IMAGE]
404 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'changes_saved'),
true);
405 $this->
ctrl->redirect($this, self::CMD_SETTINGS);
412 $this->
ctrl->redirect($this, self::CMD_EDIT_OBJECT);
422 if (!$this->
access->checkAccess(
'write',
"", $this->object->getRefId())) {
423 $this->
ctrl->redirect($this, self::CMD_SHOW_CONTENT);
426 $this->
tabs()->clearTargets();
427 $this->
tabs()->setBackTarget(
428 $this->
lng->txt(
'back'),
429 $this->
ctrl->getLinkTarget($this, self::CMD_SHOW_CONTENT)
432 $this->tpl->setOnScreenMessage(
434 $this->
lng->txt(
'replace_bibliography_file_info')
442 $this->tpl->setContent($this->
ui()->renderer()->
render($this->getReplaceBibliographicFileForm()));
445 public function replaceBibliographicFile():
void 449 $form = $this->getReplaceBibliographicFileForm();
450 $form = $form->withRequest($this->
http->request());
451 $data = $form->getData();
452 if (
$data !== null && $bibl_file_rid = $this->storage->manage()->find(
453 $data[self::SECTION_REPLACE_BIBLIOGRAPHIC_FILE][self::PROP_BIBLIOGRAPHIC_FILE][0]
459 $bibl_filename = $this->storage->manage()->getResource($bibl_file_rid)->getCurrentRevision()->getTitle();
460 $bibl_filetype = $bibl_obj->determineFileTypeByFileName($bibl_filename);
462 $bibl_obj->setResourceId($bibl_file_rid);
463 $bibl_obj->setFilename($bibl_filename);
464 $bibl_obj->setFileType($bibl_filetype);
466 $bibl_obj->parseFileToDatabase();
468 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'changes_saved'),
true);
469 $this->
ctrl->redirect($this, self::CMD_SHOW_CONTENT);
472 $this->tpl->setContent(
473 $this->
ui()->renderer()->
render([$form])
477 protected function getReplaceBibliographicFileForm():
Standard 484 $rid = $bibl_obj->getResourceId() ? $bibl_obj->getResourceId()->serialize() :
"";
487 $max_filesize_bytes = $this->upload_limit->getPhpUploadLimitInBytes();
488 $max_filesize_mb = round($max_filesize_bytes / 1024 / 1024, 1);
489 $info_file_limitations = $this->
lng->txt(
'file_notice') .
" " . number_format($max_filesize_mb, 1) .
" MB <br>" 490 . $this->
lng->txt(
'file_allowed_suffixes') .
" .bib, .bibtex, .ris";
491 $section_replace_bibliographic_file = $this->ui_factory
496 self::PROP_BIBLIOGRAPHIC_FILE => $this->ui_factory
500 $bibl_upload_handler,
501 $this->
lng->txt(
'bibliography_file'),
502 $info_file_limitations
504 ->withMaxFileSize($max_filesize_bytes)
506 ->withAdditionalTransformation(
510 $this->
lng->txt(
'replace_bibliography_file')
513 return $this->ui_factory->input()->container()->form()->standard(
514 $this->
ctrl->getFormAction($this, self::CMD_REPLACE_BIBLIOGRAPHIC_FILE),
516 self::SECTION_REPLACE_BIBLIOGRAPHIC_FILE => $section_replace_bibliographic_file
523 return $this->
refinery->custom()->constraint(
524 function ($bibl_file_input):
bool {
526 $rid = $bibl_file_input[0];
527 $resource_identifier = $DIC->resourceStorage()->manage()->find($rid);
528 if ($resource_identifier !== null) {
529 $bibl_file = $DIC->resourceStorage()->manage()->getCurrentRevision($resource_identifier);
530 $bibl_file_suffix = $bibl_file->getInformation()->getSuffix();
531 if (in_array($bibl_file_suffix, [
'ris',
'bib',
'bibtex'])) {
537 $this->
lng->txt(
'msg_error_invalid_bibl_file_suffix')
546 public function setTabs():
void 550 $ilHelp = $DIC[
'ilHelp'];
554 $ilHelp->setScreenIdComponent(
'bibl');
556 if ($DIC->access()->checkAccess(
'read',
"", $this->
object->getRefId())) {
557 $DIC->tabs()->addTab(
560 ->txt(self::TAB_CONTENT),
561 $this->
ctrl->getLinkTarget($this, self::CMD_SHOW_CONTENT)
565 if ($DIC->access()->checkAccess(
'visible',
"", $this->
object->getRefId())
566 || $DIC->access()->checkAccess(
'read',
"", $this->
object->getRefId())
568 $DIC->tabs()->addTab(
572 $this->
ctrl->getLinkTargetByClass(
"ilinfoscreengui",
"showSummary")
576 if ($DIC->access()->checkAccess(
'write',
"", $this->
object->getRefId())) {
577 $DIC->tabs()->addTab(
578 self::SUBTAB_SETTINGS,
580 ->txt(self::SUBTAB_SETTINGS),
581 $this->
ctrl->getLinkTarget($this, self::CMD_EDIT_OBJECT)
585 if ($DIC->access()->checkAccess(
"write",
"", $this->
object->getRefId())) {
586 $DIC->tabs()->addTab(
589 ->txt(self::TAB_EXPORT),
590 $this->
ctrl->getLinkTargetByClass(
"ilexportgui",
"")
594 if ($DIC->access()->checkAccess(
'edit_permission',
"", $this->
object->getRefId())) {
595 $DIC->tabs()->addTab(
596 self::TAB_ID_PERMISSIONS,
598 ->txt(
"perm_settings"),
599 $this->
ctrl->getLinkTargetByClass(
"ilpermissiongui",
"perm")
607 $DIC->tabs()->addSubTab(
608 self::SUBTAB_SETTINGS,
610 ->txt(self::SUBTAB_SETTINGS),
611 $this->
ctrl->getLinkTarget($this, self::CMD_EDIT_OBJECT)
613 $DIC->tabs()->addSubTab(
614 self::SUB_TAB_FILTER,
616 ->txt(
"bibl_filter"),
628 $this->error->raiseError($this->
lng->txt(
"msg_no_perm_write"), $this->error->MESSAGE);
631 $this->tabs_gui->activateTab(
"settings");
633 $this->tpl->setContent($this->
ui()->renderer()->
render($form));
638 $field_factory = $this->ui_factory->input()->field();
640 $section_edit_bibliography = $field_factory->section(
642 self::PROP_TITLE_AND_DESC => $this->
object->getObjectProperties()->getPropertyTitleAndDescription(
649 $this->
lng->txt(
'bibl_edit'),
652 $section_availability = $field_factory->section(
654 self::PROP_ONLINE_STATUS => $this->
object->getObjectProperties()->getPropertyIsOnline()->toForm(
660 $this->
lng->txt(
'rep_activation_availability'),
663 $section_presentation = $field_factory->section(
665 self::PROP_TILE_IMAGE => $this->
object->getObjectProperties()->getPropertyTileImage()->toForm(
671 $this->
lng->txt(
'settings_presentation_header'),
675 return $this->ui_factory->input()->container()->form()->standard(
676 $this->
ctrl->getFormAction($this, self::CMD_UPDATE_OBJECT),
678 self::SECTION_EDIT_BIBLIOGRAPHY => $section_edit_bibliography,
679 self::SECTION_AVAILABILITY => $section_availability,
680 self::SECTION_PRESENTATION => $section_presentation
696 $read_access = $this->
access->checkAccess(
'read',
"", $this->
object->getRefId());
697 $online = $this->
object->getObjectProperties()->getPropertyIsOnline()->getIsOnline();
698 $write_access = $this->
access->checkAccess(
'write',
"", $this->
object->getRefId());
699 if (($read_access && $online) || $write_access) {
700 $this->tabs_gui->activateTab(self::TAB_CONTENT);
702 $btn_download_original_file = $this->
ui()->factory()->button()->primary(
703 $this->
lng->txt(
'download_original_file'),
704 $this->
ctrl->getLinkTargetByClass(self::class, self::CMD_SEND_FILE)
706 $this->
toolbar->addComponent($btn_download_original_file);
709 $btn_overwrite_bibliographic_file = $this->
ui()->factory()->button()->standard(
710 $this->
lng->txt(
'replace_bibliography_file'),
711 $this->
ctrl->getLinkTargetByClass(self::class, self::CMD_OVERWRITE_BIBLIOGRAPHIC_FILE)
713 $this->
toolbar->addComponent($btn_overwrite_bibliographic_file);
717 $this->tpl->setContent($table_gui->getRenderedTableAndExistingFilters());
720 $this->tpl->setPermanentLink(
"bibl", $this->
object->getRefId());
723 $this->tpl->setOnScreenMessage(
727 ->txt(
"msg_no_perm_read_item"),
740 $table->writeFilterToSession();
741 $table->resetOffset();
742 $this->
ctrl->redirect($this, self::CMD_SHOW_CONTENT);
748 $table->resetFilter();
749 $table->resetOffset();
750 $this->
ctrl->redirect($this, self::CMD_SHOW_CONTENT);
760 if ($DIC[
'ilAccess']->checkAccess(
'read',
"", $this->
object->getRefId())) {
761 if (!$this->
object->isMigrated()) {
762 $file_path = $this->
object->getLegacyAbsolutePath();
764 if (is_file($file_path)) {
767 $this->
object->getFilename(),
768 'application/octet-stream' 771 $this->tpl->setOnScreenMessage(
'failure', $DIC[
'lng']->txt(
"file_not_found"));
776 $this->storage->consume()->download($this->
object->getResourceId())->run();
787 if ($DIC->access()->checkAccess(
'read',
"", $this->
object->getRefId())) {
788 $id = $DIC->http()->request()->getQueryParams()[self::P_ENTRY_ID];
789 $entry = $this->facade->entryFactory()
790 ->findByIdAndTypeString(
$id, $this->
object->getFileTypeAsString());
802 $DIC->ui()->mainTemplate()->setContent($bibGUI->getHTML());
816 $ntf = $DIC->http()->wrapper()->query()->retrieve(
818 $DIC->refinery()->to()->int()
841 $DIC->ctrl()->redirect($this,
"");
849 $ilNewsItem->setTitle($DIC->language()->txt(
'news_title_' . $change));
851 $ilNewsItem->setContext($obj_id, $this->
getType());
852 $ilNewsItem->setUserId($DIC->user()->getId());
854 $ilNewsItem->setContentTextIsLangVar(
false);
855 $ilNewsItem->create();
881 $a_new_object->parseFileToDatabase();
883 parent::afterImport($a_new_object);
890 $this->tpl->setOnScreenMessage(
'failure', $DIC->language()->txt(
"no_permission"),
true);
afterSave(ilObject $a_new_object)
Class ilObjBibliographicGUI.
UploadLimitResolver $upload_limit
const SECTION_REPLACE_BIBLIOGRAPHIC_FILE
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
append(ilInfoScreenGUI $info)
getValidBiblFileSuffixConstraint()
removeFromDesk()
Remove from desktop.
New implementation of ilObjectGUI.
GUI class for the workflow of copying objects.
ilBiblFieldFilterFactory $filter_factory
const PROP_TITLE_AND_DESC
executeCommand()
executeCommand
getDidacticTemplateVar(string $type)
Get didactic template setting from creation screen.
A constraint encodes some resrtictions on values.
editObject()
edit object public
const SECTION_AVAILABILITY
prepareOutput(bool $show_sub_objects=true)
putObjectInTree(ilObject $obj, int $parent_node_id=null)
Add object to tree at given position.
ilObjBibliographicStakeholder $stakeholder
overwriteBibliographicFile()
sendFile()
provide file as a download
addToDesk()
Add desktop item.
ilBiblFactoryFacade $facade
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilResourceStorageInfoGUI.
ILIAS HTTP Services $http
static _lookupObjId(int $ref_id)
const TYPE_DATA_COLLECTION
ilBiblTypeFactory $type_factory
static http()
Fetches the global http state from ILIAS.
initCreateForm(string $new_type)
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.
static deliverFileAttached(string $path_to_file, ?string $download_file_name=null, ?string $mime_type=null, bool $delete_file=false)
This is how the factory for UI elements looks.
Class ilObjBibliographicStakeholder.
const CMD_OVERWRITE_BIBLIOGRAPHIC_FILE
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
initDidacticTemplate(ilPropertyFormGUI $form)
__construct(int $id=0, int $id_type=self::REPOSITORY_NODE_ID, int $parent_node_id=0)
const SECTION_PRESENTATION
const PROP_BIBLIOGRAPHIC_FILE
ilBiblFieldFactory $field_factory
afterImport(ilObject $new_object)
Post (successful) object import hook.
ilBiblTranslationFactory $translation_factory
setTabs()
create tabs (repository/workspace switch)
replaceBibliograficFileInit()
A news item can be created by different sources.
addNews(int $obj_id, string $change='created')
__construct(Container $dic, ilPlugin $plugin)
This class represents a text area property in a property form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
showContent()
shows the overview page with all entries in a table
ILIAS Refinery Factory $refinery
getStandardCmd()
getStandardCmd
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
const SECTION_EDIT_BIBLIOGRAPHY
static _gotoRepositoryRoot(bool $raise_error=false)
Goto repository root.
const CMD_REPLACE_BIBLIOGRAPHIC_FILE
infoScreen()
this one is called from the info button in the repository not very nice to set cmdClass/Cmd manually...