83 protected ?
string $cmd = self::CMD_SHOW_CONTENT;
85 public function __construct(
int $a_id = 0,
int $a_id_type = self::REPOSITORY_NODE_ID,
int $a_parent_node_id = 0)
89 $this->
help = $DIC[
'ilHelp'];
90 $this->storage = $DIC[
'resource_storage'];
92 $this->ui_factory = $DIC->ui()->factory();
96 $DIC->language()->loadLanguageModule(
'bibl');
97 $DIC->language()->loadLanguageModule(
'content');
98 $DIC->language()->loadLanguageModule(
'obj');
99 $DIC->language()->loadLanguageModule(
'cntr');
113 return self::CMD_VIEW;
132 $ilNavigationHistory = $DIC[
'ilNavigationHistory'];
135 $link = $this->dic()->ctrl()->getLinkTarget($this, $this->
getStandardCmd());
136 if ($this->
object !=
null) {
137 $ilNavigationHistory->addItem($this->
object->getRefId(), $link,
"bibl");
150 $next_class = $this->dic()->ctrl()->getNextClass($this);
151 $this->cmd = $this->dic()->ctrl()->getCmd();
152 switch ($next_class) {
153 case strtolower(ilInfoScreenGUI::class):
155 $this->dic()->tabs()->activateTab(self::TAB_ID_INFO);
156 $this->infoScreenForward();
158 case strtolower(ilCommonActionDispatcherGUI::class):
161 $this->
ctrl->forwardCommand($gui);
163 case strtolower(ilPermissionGUI::class):
165 $this->dic()->tabs()->activateTab(self::TAB_ID_PERMISSIONS);
168 case strtolower(ilObjectCopyGUI::class):
170 $cp->setType(
'bibl');
171 $this->dic()[
'tpl']->loadStandardTemplate();
172 $this->
ctrl->forwardCommand($cp);
174 case strtolower(ilExportGUI::class):
176 $this->dic()->tabs()->setTabActive(self::TAB_EXPORT);
178 $exp_gui->addFormat(
"xml");
179 $this->
ctrl->forwardCommand($exp_gui);
181 case strtolower(ilBiblFieldFilterGUI::class):
183 $this->dic()->tabs()->setTabActive(self::TAB_SETTINGS);
185 $this->tabs_gui->activateSubTab(self::SUB_TAB_FILTER);
188 case strtolower(ilObjBibliographicUploadHandlerGUI::class):
190 if ($this->
object && $this->
object->getResourceId()) {
191 $rid = $this->
object->getResourceId()->serialize();
197 $cmd = $this->
ctrl->getCmd(self::CMD_SHOW_CONTENT);
199 case self::CMD_SETTINGS:
200 case self::CMD_EDIT_OBJECT:
201 case self::CMD_UPDATE_OBJECT:
203 $this->tabs_gui->activateSubTab(self::SUBTAB_SETTINGS);
221 $this->
ctrl->redirectByClass(ilInfoScreenGUI::class,
"showSummary");
227 public function infoScreenForward():
void 234 if (!$this->checkPermissionBoolAndReturn(
"visible") && !$this->checkPermissionBoolAndReturn(
'read')) {
235 $this->tpl->setOnScreenMessage(
'failure', $DIC[
'lng']->txt(
"msg_no_perm_read"),
true);
236 $this->
ctrl->redirectByClass(
'ilDashboardGUI',
'');
238 $DIC->tabs()->activateTab(self::TAB_ID_INFO);
241 $info->enablePrivateNotes();
242 $info->addMetaDataSections($this->
object->getId(), 0, $this->
object->getType());
257 $ilLocator = $DIC[
'ilLocator'];
258 if (is_object($this->
object)) {
267 public static function _goto(
string $a_target): void
271 $id = explode(
"_", $a_target);
272 $DIC->ctrl()->setTargetScript(
'ilias.php');
273 $DIC->ctrl()->setParameterByClass(ilObjBibliographicGUI::class,
"ref_id", (
int) (
$id[0] ?? 1));
275 if (isset(
$id[1]) &&
$id[1] !==
'') {
278 $DIC->ctrl()->redirectByClass(
280 ilRepositoryGUI::class,
281 ilObjBibliographicGUI::class,
283 self::CMD_SHOW_DETAILS
286 $DIC->ctrl()->redirectByClass(
288 ilRepositoryGUI::class,
289 ilObjBibliographicGUI::class,
303 $form->setTarget(
'_top');
304 $form->setFormAction($this->
ctrl->getFormAction($this,
'save'));
305 $form->setTitle($this->
lng->txt($new_type .
'_new'));
310 $ti->setRequired(
true);
319 $in_file =
new ilFileInputGUI($this->
lng->txt(
'bibliography_file'),
'bibliographic_file');
321 $in_file->setRequired(
true);
322 $form->addItem($in_file);
326 $form->addCommandButton(
'save', $this->
lng->txt($new_type .
'_add'));
327 $form->addCommandButton(
'cancel', $this->
lng->txt(
'cancel'));
336 if ($form->checkInput()) {
339 $form->setValuesByPost();
340 $this->
ui()->mainTemplate()->setContent($form->getHtml());
349 $this->error->raiseError($this->
lng->txt(
'no_create_permission'), $this->error->MESSAGE);
352 $this->
lng->loadLanguageModule($this->requested_new_type);
353 $this->
ctrl->setParameter($this,
'new_type', $this->requested_new_type);
356 if ($form->checkInput()) {
357 $this->
ctrl->setParameter($this,
'new_type',
'');
360 $newObj->setTitle($form->getInput(
'title'));
361 $newObj->setDescription($form->getInput(
'desc'));
362 $newObj->processAutoRating();
369 $newObj->applyDidacticTemplate($dtpl);
375 $form->setValuesByPost();
376 $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(
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);
413 $this->
ctrl->redirect($this, self::CMD_EDIT_OBJECT);
423 if (!$this->
access->checkAccess(
'write',
"", $this->object->getRefId())) {
424 $this->
ctrl->redirect($this, self::CMD_SHOW_CONTENT);
427 $this->
tabs()->clearTargets();
428 $this->
tabs()->setBackTarget(
429 $this->
lng->txt(
'back'),
430 $this->
ctrl->getLinkTarget($this, self::CMD_SHOW_CONTENT)
433 $this->tpl->setOnScreenMessage(
435 $this->
lng->txt(
'replace_bibliography_file_info')
443 $this->tpl->setContent($this->
ui()->
renderer()->
render($this->getReplaceBibliographicFileForm()));
446 public function replaceBibliographicFile():
void 450 $form = $this->getReplaceBibliographicFileForm();
451 $form = $form->withRequest($this->
http->request());
452 $data = $form->getData();
453 if (
$data !==
null && $bibl_file_rid = $this->storage->manage()->find(
454 $data[self::SECTION_REPLACE_BIBLIOGRAPHIC_FILE][self::PROP_BIBLIOGRAPHIC_FILE][0]
460 $bibl_filename = $this->storage->manage()->getResource($bibl_file_rid)->getCurrentRevision()->getTitle();
461 $bibl_filetype = $bibl_obj->determineFileTypeByFileName($bibl_filename);
463 $bibl_obj->setResourceId($bibl_file_rid);
464 $bibl_obj->setFilename($bibl_filename);
465 $bibl_obj->setFileType($bibl_filetype);
467 $bibl_obj->parseFileToDatabase();
469 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'changes_saved'),
true);
470 $this->
ctrl->redirect($this, self::CMD_SHOW_CONTENT);
473 $this->tpl->setContent(
478 protected function getReplaceBibliographicFileForm():
Standard 485 $rid = $bibl_obj->getResourceId() ? $bibl_obj->getResourceId()->serialize() :
"";
488 $max_filesize_bytes = $this->upload_limit->getPhpUploadLimitInBytes();
489 $max_filesize_mb = round($max_filesize_bytes / 1024 / 1024, 1);
490 $info_file_limitations = $this->
lng->txt(
'file_notice') .
" " . number_format($max_filesize_mb, 1) .
" MB <br>" 491 . $this->
lng->txt(
'file_allowed_suffixes') .
" .bib, .bibtex, .ris";
492 $section_replace_bibliographic_file = $this->ui_factory
497 self::PROP_BIBLIOGRAPHIC_FILE => $this->ui_factory
501 $bibl_upload_handler,
502 $this->
lng->txt(
'bibliography_file'),
503 $info_file_limitations
505 ->withMaxFileSize($max_filesize_bytes)
507 ->withAdditionalTransformation(
511 $this->
lng->txt(
'replace_bibliography_file')
514 return $this->ui_factory->input()->container()->form()->standard(
515 $this->
ctrl->getFormAction($this, self::CMD_REPLACE_BIBLIOGRAPHIC_FILE),
517 self::SECTION_REPLACE_BIBLIOGRAPHIC_FILE => $section_replace_bibliographic_file
524 return $this->
refinery->custom()->constraint(
525 function ($bibl_file_input):
bool {
527 $rid = $bibl_file_input[0];
528 $resource_identifier = $DIC->resourceStorage()->manage()->find($rid);
529 if ($resource_identifier !==
null) {
530 $bibl_file = $DIC->resourceStorage()->manage()->getCurrentRevision($resource_identifier);
531 $bibl_file_suffix = $bibl_file->getInformation()->getSuffix();
532 if (in_array($bibl_file_suffix, [
'ris',
'bib',
'bibtex'])) {
538 $this->
lng->txt(
'msg_error_invalid_bibl_file_suffix')
548 public function setTabs():
void 552 $ilHelp = $DIC[
'ilHelp'];
556 $ilHelp->setScreenIdComponent(
'bibl');
558 if ($DIC->access()->checkAccess(
'read',
"", $this->
object->getRefId())) {
559 $DIC->tabs()->addTab(
562 ->txt(self::TAB_CONTENT),
563 $this->
ctrl->getLinkTarget($this, self::CMD_SHOW_CONTENT)
567 if ($DIC->access()->checkAccess(
'visible',
"", $this->
object->getRefId())
568 || $DIC->access()->checkAccess(
'read',
"", $this->
object->getRefId())
570 $DIC->tabs()->addTab(
574 $this->
ctrl->getLinkTargetByClass(
"ilinfoscreengui",
"showSummary")
578 if ($DIC->access()->checkAccess(
'write',
"", $this->
object->getRefId())) {
579 $DIC->tabs()->addTab(
580 self::SUBTAB_SETTINGS,
582 ->txt(self::SUBTAB_SETTINGS),
583 $this->
ctrl->getLinkTarget($this, self::CMD_EDIT_OBJECT)
587 if ($DIC->access()->checkAccess(
"write",
"", $this->
object->getRefId())) {
588 $DIC->tabs()->addTab(
591 ->txt(self::TAB_EXPORT),
592 $this->
ctrl->getLinkTargetByClass(
"ilexportgui",
"")
596 if ($DIC->access()->checkAccess(
'edit_permission',
"", $this->
object->getRefId())) {
597 $DIC->tabs()->addTab(
598 self::TAB_ID_PERMISSIONS,
600 ->txt(
"perm_settings"),
601 $this->
ctrl->getLinkTargetByClass(
"ilpermissiongui",
"perm")
609 $DIC->tabs()->addSubTab(
610 self::SUBTAB_SETTINGS,
612 ->txt(self::SUBTAB_SETTINGS),
613 $this->
ctrl->getLinkTarget($this, self::CMD_EDIT_OBJECT)
615 $DIC->tabs()->addSubTab(
616 self::SUB_TAB_FILTER,
618 ->txt(
"bibl_filter"),
631 $this->error->raiseError($this->
lng->txt(
"msg_no_perm_write"), $this->error->MESSAGE);
634 $this->tabs_gui->activateTab(
"settings");
641 $field_factory = $this->ui_factory->input()->field();
643 $section_edit_bibliography = $field_factory->section(
645 self::PROP_TITLE_AND_DESC => $this->
object->getObjectProperties()->getPropertyTitleAndDescription(
652 $this->
lng->txt(
'bibl_edit'),
655 $section_availability = $field_factory->section(
657 self::PROP_ONLINE_STATUS => $this->
object->getObjectProperties()->getPropertyIsOnline()->toForm(
663 $this->
lng->txt(
'rep_activation_availability'),
666 $section_presentation = $field_factory->section(
668 self::PROP_TILE_IMAGE => $this->
object->getObjectProperties()->getPropertyTileImage()->toForm(
674 $this->
lng->txt(
'settings_presentation_header'),
678 return $this->ui_factory->input()->container()->form()->standard(
679 $this->
ctrl->getFormAction($this, self::CMD_UPDATE_OBJECT),
681 self::SECTION_EDIT_BIBLIOGRAPHY => $section_edit_bibliography,
682 self::SECTION_AVAILABILITY => $section_availability,
683 self::SECTION_PRESENTATION => $section_presentation
699 $read_access = $this->
access->checkAccess(
'read',
"", $this->
object->getRefId());
700 $online = $this->
object->getObjectProperties()->getPropertyIsOnline()->getIsOnline();
701 $write_access = $this->
access->checkAccess(
'write',
"", $this->
object->getRefId());
702 if (($read_access && $online) || $write_access) {
703 $this->tabs_gui->activateTab(self::TAB_CONTENT);
705 $btn_download_original_file = $this->
ui()->factory()->button()->primary(
706 $this->
lng->txt(
'download_original_file'),
707 $this->
ctrl->getLinkTargetByClass(self::class, self::CMD_SEND_FILE)
709 $this->
toolbar->addComponent($btn_download_original_file);
712 $btn_overwrite_bibliographic_file = $this->
ui()->factory()->button()->standard(
713 $this->
lng->txt(
'replace_bibliography_file'),
714 $this->
ctrl->getLinkTargetByClass(self::class, self::CMD_OVERWRITE_BIBLIOGRAPHIC_FILE)
716 $this->
toolbar->addComponent($btn_overwrite_bibliographic_file);
720 $this->tpl->setContent($table_gui->getRenderedTableAndExistingFilters());
723 $this->tpl->setPermanentLink(
"bibl", $this->
object->getRefId());
726 $this->tpl->setOnScreenMessage(
730 ->txt(
"msg_no_perm_read_item"),
743 $table->writeFilterToSession();
744 $table->resetOffset();
745 $this->
ctrl->redirect($this, self::CMD_SHOW_CONTENT);
751 $table->resetFilter();
752 $table->resetOffset();
753 $this->
ctrl->redirect($this, self::CMD_SHOW_CONTENT);
763 if ($DIC[
'ilAccess']->checkAccess(
'read',
"", $this->
object->getRefId())) {
764 if (!$this->
object->isMigrated()) {
765 $file_path = $this->
object->getLegacyAbsolutePath();
767 if (is_file($file_path)) {
770 $this->
object->getFilename(),
771 'application/octet-stream' 774 $this->tpl->setOnScreenMessage(
'failure', $DIC[
'lng']->txt(
"file_not_found"));
779 $this->storage->consume()->download($this->
object->getResourceId())->run();
790 if ($DIC->access()->checkAccess(
'read',
"", $this->
object->getRefId())) {
791 $id = $DIC->http()->request()->getQueryParams()[self::P_ENTRY_ID];
792 $entry = $this->facade->entryFactory()
793 ->findByIdAndTypeString(
$id, $this->
object->getFileTypeAsString());
805 $DIC->ui()->mainTemplate()->setContent($bibGUI->getHTML());
820 $ntf = $DIC->http()->wrapper()->query()->retrieve(
822 $DIC->refinery()->to()->int()
845 $DIC->ctrl()->redirect($this,
"");
853 $ilNewsItem->setTitle($DIC->language()->txt(
'news_title_' . $change));
855 $ilNewsItem->setContext($obj_id, $this->
getType());
856 $ilNewsItem->setUserId($DIC->user()->getId());
858 $ilNewsItem->setContentTextIsLangVar(
false);
859 $ilNewsItem->create();
886 $a_new_object->parseFileToDatabase();
888 parent::afterImport($a_new_object);
895 $this->tpl->setOnScreenMessage(
'failure', $DIC->language()->txt(
"no_permission"),
true);
afterSave(ilObject $a_new_object)
Class ilObjBibliographicGUI.
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
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)
ilObjBibliographicStakeholder $stakeholder
overwriteBibliographicFile()
sendFile()
provide file as a download
addToDesk()
Add desktop item.
ilBiblFactoryFacade $facade
Class ilResourceStorageInfoGUI.
static _lookupObjId(int $ref_id)
const TYPE_DATA_COLLECTION
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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
initDidacticTemplate(ilPropertyFormGUI $form)
__construct(int $id=0, int $id_type=self::REPOSITORY_NODE_ID, int $parent_node_id=0)
putObjectInTree(ilObject $obj, ?int $parent_node_id=null)
Add object to tree at given position.
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.
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...