41 use \ILIAS\Modules\OrgUnit\ARHelper\DIC;
81 protected \ILIAS\HTTP\Services
$http;
84 protected ?
string $cmd = self::CMD_SHOW_CONTENT;
86 public function __construct(
int $a_id = 0,
int $a_id_type = self::REPOSITORY_NODE_ID,
int $a_parent_node_id = 0)
90 $this->
help = $DIC[
'ilHelp'];
91 $this->storage = $DIC[
'resource_storage'];
93 $this->
http = $DIC->http();
94 $this->ui_factory = $DIC->ui()->factory();
96 $this->upload_limit = $DIC[
"ui.upload_limit_resolver"];
99 $DIC->language()->loadLanguageModule(
'bibl');
100 $DIC->language()->loadLanguageModule(
'content');
101 $DIC->language()->loadLanguageModule(
'obj');
102 $DIC->language()->loadLanguageModule(
'cntr');
104 if (is_object($this->
object)) {
116 return self::CMD_VIEW;
134 $ilNavigationHistory = $DIC[
'ilNavigationHistory'];
137 $link = $this->dic()->ctrl()->getLinkTarget($this, $this->
getStandardCmd());
138 if ($this->
object != null) {
139 $ilNavigationHistory->addItem($this->
object->getRefId(), $link,
"bibl");
152 $next_class = $this->dic()->ctrl()->getNextClass($this);
153 $this->cmd = $this->dic()->ctrl()->getCmd();
154 switch ($next_class) {
155 case strtolower(ilInfoScreenGUI::class):
157 $this->dic()->tabs()->activateTab(self::TAB_ID_INFO);
158 $this->infoScreenForward();
160 case strtolower(ilCommonActionDispatcherGUI::class):
163 $this->
ctrl->forwardCommand($gui);
165 case strtolower(ilPermissionGUI::class):
167 $this->dic()->tabs()->activateTab(self::TAB_ID_PERMISSIONS);
170 case strtolower(ilObjectCopyGUI::class):
172 $cp->setType(
'bibl');
173 $this->dic()[
'tpl']->loadStandardTemplate();
174 $this->
ctrl->forwardCommand($cp);
176 case strtolower(ilExportGUI::class):
178 $this->dic()->tabs()->setTabActive(self::TAB_EXPORT);
180 $exp_gui->addFormat(
"xml");
181 $this->
ctrl->forwardCommand($exp_gui);
183 case strtolower(ilBiblFieldFilterGUI::class):
185 $this->dic()->tabs()->setTabActive(self::TAB_SETTINGS);
187 $this->tabs_gui->activateSubTab(self::SUB_TAB_FILTER);
190 case strtolower(ilObjBibliographicUploadHandlerGUI::class):
192 if ($this->
object && $this->
object->getResourceId()) {
193 $rid = $this->
object->getResourceId()->serialize();
199 $cmd = $this->
ctrl->getCmd(self::CMD_SHOW_CONTENT);
201 case self::CMD_SETTINGS:
202 case self::CMD_EDIT_OBJECT:
203 case self::CMD_UPDATE_OBJECT:
205 $this->tabs_gui->activateSubTab(self::SUBTAB_SETTINGS);
223 $this->
ctrl->setCmd(
"showSummary");
224 $this->
ctrl->setCmdClass(ilInfoScreenGUI::class);
225 $this->infoScreenForward();
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,
307 $forms = parent::initCreationForms($a_new_type);
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"));
322 if ($form[self::CFORM_NEW]->checkInput()) {
325 $form = $form[self::CFORM_NEW];
326 $form->setValuesByPost();
327 $this->
ui()->mainTemplate()->setContent($form->getHtml());
334 $form = $form->withRequest($this->
http->request());
335 $result = $form->getInputGroup()->getContent();
337 if (!$result->isOK()) {
338 $this->tpl->setOnScreenMessage(
'failure', $result->error(),
true);
339 $this->tpl->setContent(
340 $this->
ui()->renderer()->
render([$form])
343 $values = $result->value();
345 $this->
object->getObjectProperties()->storePropertyTitleAndDescription(
346 $values[self::SECTION_EDIT_BIBLIOGRAPHY][self::PROP_TITLE_AND_DESC]
348 $this->
object->getObjectProperties()->storePropertyIsOnline(
349 $values[self::SECTION_AVAILABILITY][self::PROP_ONLINE_STATUS]
351 $this->
object->getObjectProperties()->storePropertyTileImage(
352 $values[self::SECTION_PRESENTATION][self::PROP_TILE_IMAGE]
355 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'changes_saved'),
true);
356 $this->
ctrl->redirect($this, self::CMD_SETTINGS);
363 $this->
ctrl->redirect($this, self::CMD_EDIT_OBJECT);
373 $this->
tabs()->clearTargets();
374 $this->
tabs()->setBackTarget(
375 $this->
lng->txt(
'back'),
376 $this->
ctrl->getLinkTarget($this, self::CMD_SHOW_CONTENT)
379 $this->tpl->setOnScreenMessage(
381 $this->
lng->txt(
'replace_bibliography_file_info')
389 $this->tpl->setContent($this->
ui()->renderer()->
render($this->getReplaceBibliographicFileForm()));
392 public function replaceBibliographicFile():
void 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]
406 $bibl_filename = $this->storage->manage()->getResource($bibl_file_rid)->getCurrentRevision()->getTitle();
407 $bibl_filetype = $bibl_obj->determineFileTypeByFileName($bibl_filename);
409 $bibl_obj->setResourceId($bibl_file_rid);
410 $bibl_obj->setFilename($bibl_filename);
411 $bibl_obj->setFileType($bibl_filetype);
413 $bibl_obj->parseFileToDatabase();
415 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'changes_saved'),
true);
416 $this->
ctrl->redirect($this, self::CMD_SHOW_CONTENT);
419 $this->tpl->setContent(
420 $this->
ui()->renderer()->
render([$form])
424 protected function getReplaceBibliographicFileForm():
Standard 431 $rid = $bibl_obj->getResourceId() ? $bibl_obj->getResourceId()->serialize() :
"";
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
443 self::PROP_BIBLIOGRAPHIC_FILE => $this->ui_factory
447 $bibl_upload_handler,
448 $this->
lng->txt(
'bibliography_file'),
449 $info_file_limitations
451 ->withMaxFileSize($max_filesize_bytes)
453 ->withAdditionalTransformation(
457 $this->
lng->txt(
'replace_bibliography_file')
460 return $this->ui_factory->input()->container()->form()->standard(
461 $this->
ctrl->getFormAction($this, self::CMD_REPLACE_BIBLIOGRAPHIC_FILE),
463 self::SECTION_REPLACE_BIBLIOGRAPHIC_FILE => $section_replace_bibliographic_file
470 return $this->
refinery->custom()->constraint(
471 function ($bibl_file_input):
bool {
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'])) {
484 $this->
lng->txt(
'msg_error_invalid_bibl_file_suffix')
493 public function setTabs():
void 497 $ilHelp = $DIC[
'ilHelp'];
501 $ilHelp->setScreenIdComponent(
'bibl');
503 if ($DIC->access()->checkAccess(
'read',
"", $this->
object->getRefId())) {
504 $DIC->tabs()->addTab(
507 ->txt(self::TAB_CONTENT),
508 $this->
ctrl->getLinkTarget($this, self::CMD_SHOW_CONTENT)
512 if ($DIC->access()->checkAccess(
'visible',
"", $this->
object->getRefId())
513 || $DIC->access()->checkAccess(
'read',
"", $this->
object->getRefId())
515 $DIC->tabs()->addTab(
519 $this->
ctrl->getLinkTargetByClass(
"ilinfoscreengui",
"showSummary")
523 if ($DIC->access()->checkAccess(
'write',
"", $this->
object->getRefId())) {
524 $DIC->tabs()->addTab(
525 self::SUBTAB_SETTINGS,
527 ->txt(self::SUBTAB_SETTINGS),
528 $this->
ctrl->getLinkTarget($this, self::CMD_EDIT_OBJECT)
532 if ($DIC->access()->checkAccess(
"write",
"", $this->
object->getRefId())) {
533 $DIC->tabs()->addTab(
536 ->txt(self::TAB_EXPORT),
537 $this->
ctrl->getLinkTargetByClass(
"ilexportgui",
"")
541 if ($DIC->access()->checkAccess(
'edit_permission',
"", $this->
object->getRefId())) {
542 $DIC->tabs()->addTab(
543 self::TAB_ID_PERMISSIONS,
545 ->txt(
"perm_settings"),
546 $this->
ctrl->getLinkTargetByClass(
"ilpermissiongui",
"perm")
554 $DIC->tabs()->addSubTab(
555 self::SUBTAB_SETTINGS,
557 ->txt(self::SUBTAB_SETTINGS),
558 $this->
ctrl->getLinkTarget($this, self::CMD_EDIT_OBJECT)
560 $DIC->tabs()->addSubTab(
561 self::SUB_TAB_FILTER,
563 ->txt(
"bibl_filter"),
575 $this->error->raiseError($this->
lng->txt(
"msg_no_perm_write"), $this->error->MESSAGE);
578 $this->tabs_gui->activateTab(
"settings");
580 $this->tpl->setContent($this->
ui()->renderer()->
render($form));
585 $field_factory = $this->ui_factory->input()->field();
587 $section_edit_bibliography = $field_factory->section(
589 self::PROP_TITLE_AND_DESC => $this->
object->getObjectProperties()->getPropertyTitleAndDescription(
596 $this->
lng->txt(
'bibl_edit'),
599 $section_availability = $field_factory->section(
601 self::PROP_ONLINE_STATUS => $this->
object->getObjectProperties()->getPropertyIsOnline()->toForm(
607 $this->
lng->txt(
'rep_activation_availability'),
610 $section_presentation = $field_factory->section(
612 self::PROP_TILE_IMAGE => $this->
object->getObjectProperties()->getPropertyTileImage()->toForm(
618 $this->
lng->txt(
'settings_presentation_header'),
622 return $this->ui_factory->input()->container()->form()->standard(
623 $this->
ctrl->getFormAction($this, self::CMD_UPDATE_OBJECT),
625 self::SECTION_EDIT_BIBLIOGRAPHY => $section_edit_bibliography,
626 self::SECTION_AVAILABILITY => $section_availability,
627 self::SECTION_PRESENTATION => $section_presentation
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);
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)
655 $this->
toolbar->addComponent($btn_download_original_file);
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)
661 $this->
toolbar->addComponent($btn_overwrite_bibliographic_file);
664 $html = $table->getHTML();
665 $DIC->ui()->mainTemplate()->setContent(
$html);
668 $DIC->ui()->mainTemplate()->setPermanentLink(
"bibl", $this->
object->getRefId());
671 $this->tpl->setOnScreenMessage(
675 ->txt(
"msg_no_perm_read_item"),
688 $table->writeFilterToSession();
689 $table->resetOffset();
690 $this->
ctrl->redirect($this, self::CMD_SHOW_CONTENT);
696 $table->resetFilter();
697 $table->resetOffset();
698 $this->
ctrl->redirect($this, self::CMD_SHOW_CONTENT);
708 if ($DIC[
'ilAccess']->checkAccess(
'read',
"", $this->
object->getRefId())) {
709 if (!$this->
object->isMigrated()) {
710 $file_path = $this->
object->getLegacyAbsolutePath();
712 if (is_file($file_path)) {
715 $this->
object->getFilename(),
716 'application/octet-stream' 719 $this->tpl->setOnScreenMessage(
'failure', $DIC[
'lng']->txt(
"file_not_found"));
724 $this->storage->consume()->download($this->
object->getResourceId())->run();
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());
750 $DIC->ui()->mainTemplate()->setContent($bibGUI->getHTML());
764 $ntf = $DIC->http()->wrapper()->query()->retrieve(
766 $DIC->refinery()->to()->int()
789 $DIC->ctrl()->redirect($this,
"");
797 $ilNewsItem->setTitle($DIC->language()->txt(
'news_title_' . $change));
799 $ilNewsItem->setContext($obj_id, $this->
getType());
800 $ilNewsItem->setUserId($DIC->user()->getId());
802 $ilNewsItem->setContentTextIsLangVar(
false);
803 $ilNewsItem->create();
829 $a_new_object->parseFileToDatabase();
831 parent::afterImport($a_new_object);
838 $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
append(ilInfoScreenGUI $info)
getValidBiblFileSuffixConstraint()
removeFromDesk()
Remove from desktop.
New implementation of ilObjectGUI.
GUI class for the workflow of copying objects.
ilBiblFieldFilterFactory $filter_factory
Class ChatMainBarProvider .
const PROP_TITLE_AND_DESC
executeCommand()
executeCommand
editObject()
edit object public
const SECTION_AVAILABILITY
prepareOutput(bool $show_sub_objects=true)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilObjBibliographicStakeholder $stakeholder
overwriteBibliographicFile()
sendFile()
provide file as a download
addToDesk()
Add desktop item.
ilBiblFactoryFacade $facade
Class ilResourceStorageInfoGUI.
ILIAS HTTP Services $http
static _lookupObjId(int $ref_id)
const TYPE_DATA_COLLECTION
Export User Interface Class.
ilBiblTypeFactory $type_factory
static http()
Fetches the global http state from ILIAS.
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 CMD_OVERWRITE_BIBLIOGRAPHIC_FILE
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)
ILIAS UI Factory $ui_factory
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)
initCreationForms(string $a_new_type)
replaceBibliograficFileInit()
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
getStandardCmd()
getStandardCmd
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
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...