19use ILIAS\components\OrgUnit\ARHelper\DIC;
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');
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");
145 $this->object->getRefId()
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);
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());
246 $irss->append(
$info);
257 $ilLocator =
$DIC[
'ilLocator'];
258 if (is_object($this->
object)) {
259 $ilLocator->addItem($this->
object->getTitle(), $this->ctrl->getLinkTarget($this,
""),
"", $this->node_id);
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');
320 $in_file->setSuffixes([
'ris',
'bib',
'bibtex']);
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 $info_file_limitations = $this->
lng->txt(
'file_allowed_suffixes') .
" .bib, .bibtex, .ris";
489 $section_replace_bibliographic_file = $this->ui_factory
494 self::PROP_BIBLIOGRAPHIC_FILE => $this->ui_factory
498 $bibl_upload_handler,
499 $this->
lng->txt(
'bibliography_file'),
500 $info_file_limitations
503 ->withAdditionalTransformation(
504 $this->getValidBiblFileSuffixConstraint()
507 $this->lng->txt(
'replace_bibliography_file')
510 return $this->ui_factory->input()->container()->form()->standard(
511 $this->
ctrl->getFormAction($this, self::CMD_REPLACE_BIBLIOGRAPHIC_FILE),
513 self::SECTION_REPLACE_BIBLIOGRAPHIC_FILE => $section_replace_bibliographic_file
520 return $this->
refinery->custom()->constraint(
521 function ($bibl_file_input):
bool {
523 $rid = $bibl_file_input[0];
524 $resource_identifier =
$DIC->resourceStorage()->manage()->find($rid);
525 if ($resource_identifier !==
null) {
526 $bibl_file =
$DIC->resourceStorage()->manage()->getCurrentRevision($resource_identifier);
527 $bibl_file_suffix = $bibl_file->getInformation()->getSuffix();
528 if (in_array($bibl_file_suffix, [
'ris',
'bib',
'bibtex'])) {
534 $this->
lng->txt(
'msg_error_invalid_bibl_file_suffix')
544 public function setTabs(): void
548 $ilHelp =
$DIC[
'ilHelp'];
552 $ilHelp->setScreenIdComponent(
'bibl');
554 if (
$DIC->access()->checkAccess(
'read',
"", $this->object->getRefId())) {
555 $DIC->tabs()->addTab(
558 ->txt(self::TAB_CONTENT),
559 $this->ctrl->getLinkTarget($this, self::CMD_SHOW_CONTENT)
563 if (
$DIC->access()->checkAccess(
'visible',
"", $this->object->getRefId())
564 ||
$DIC->access()->checkAccess(
'read',
"", $this->object->getRefId())
566 $DIC->tabs()->addTab(
570 $this->ctrl->getLinkTargetByClass(
"ilinfoscreengui",
"showSummary")
574 if (
$DIC->access()->checkAccess(
'write',
"", $this->object->getRefId())) {
575 $DIC->tabs()->addTab(
576 self::SUBTAB_SETTINGS,
578 ->txt(self::SUBTAB_SETTINGS),
579 $this->ctrl->getLinkTarget($this, self::CMD_EDIT_OBJECT)
583 if (
$DIC->access()->checkAccess(
"write",
"", $this->object->getRefId())) {
584 $DIC->tabs()->addTab(
587 ->txt(self::TAB_EXPORT),
588 $this->ctrl->getLinkTargetByClass(
"ilexportgui",
"")
592 if (
$DIC->access()->checkAccess(
'edit_permission',
"", $this->object->getRefId())) {
593 $DIC->tabs()->addTab(
594 self::TAB_ID_PERMISSIONS,
596 ->txt(
"perm_settings"),
597 $this->ctrl->getLinkTargetByClass(
"ilpermissiongui",
"perm")
605 $DIC->tabs()->addSubTab(
606 self::SUBTAB_SETTINGS,
608 ->txt(self::SUBTAB_SETTINGS),
609 $this->ctrl->getLinkTarget($this, self::CMD_EDIT_OBJECT)
611 $DIC->tabs()->addSubTab(
612 self::SUB_TAB_FILTER,
614 ->txt(
"bibl_filter"),
627 $this->
error->raiseError($this->
lng->txt(
"msg_no_perm_write"), $this->error->MESSAGE);
630 $this->tabs_gui->activateTab(
"settings");
641 self::PROP_TITLE_AND_DESC => $this->
object->getObjectProperties()->getPropertyTitleAndDescription(
648 $this->lng->txt(
'bibl_edit'),
653 self::PROP_ONLINE_STATUS => $this->
object->getObjectProperties()->getPropertyIsOnline()->toForm(
659 $this->lng->txt(
'rep_activation_availability'),
664 self::PROP_TILE_IMAGE => $this->
object->getObjectProperties()->getPropertyTileImage()->toForm(
670 $this->lng->txt(
'settings_presentation_header'),
674 return $this->ui_factory->input()->container()->form()->standard(
675 $this->
ctrl->getFormAction($this, self::CMD_UPDATE_OBJECT),
677 self::SECTION_EDIT_BIBLIOGRAPHY => $section_edit_bibliography,
678 self::SECTION_AVAILABILITY => $section_availability,
679 self::SECTION_PRESENTATION => $section_presentation
695 $read_access = $this->
access->checkAccess(
'read',
"", $this->
object->getRefId());
696 $online = $this->
object->getObjectProperties()->getPropertyIsOnline()->getIsOnline();
697 $write_access = $this->
access->checkAccess(
'write',
"", $this->
object->getRefId());
698 if (($read_access && $online) || $write_access) {
699 $this->tabs_gui->activateTab(self::TAB_CONTENT);
701 $btn_download_original_file = $this->
ui()->factory()->button()->primary(
702 $this->
lng->txt(
'download_original_file'),
703 $this->ctrl->getLinkTargetByClass(self::class, self::CMD_SEND_FILE)
705 $this->
toolbar->addComponent($btn_download_original_file);
708 $btn_overwrite_bibliographic_file = $this->
ui()->factory()->button()->standard(
709 $this->
lng->txt(
'replace_bibliography_file'),
710 $this->ctrl->getLinkTargetByClass(self::class, self::CMD_OVERWRITE_BIBLIOGRAPHIC_FILE)
712 $this->
toolbar->addComponent($btn_overwrite_bibliographic_file);
716 $this->tpl->setContent($table_gui->getRenderedTableAndExistingFilters());
719 $this->tpl->setPermanentLink(
"bibl", $this->
object->getRefId());
722 $this->tpl->setOnScreenMessage(
726 ->txt(
"msg_no_perm_read_item"),
739 $table->writeFilterToSession();
740 $table->resetOffset();
741 $this->
ctrl->redirect($this, self::CMD_SHOW_CONTENT);
747 $table->resetFilter();
748 $table->resetOffset();
749 $this->
ctrl->redirect($this, self::CMD_SHOW_CONTENT);
759 if (
$DIC[
'ilAccess']->checkAccess(
'read',
"", $this->
object->getRefId())) {
760 if (!$this->
object->isMigrated()) {
761 $file_path = $this->
object->getLegacyAbsolutePath();
763 if (is_file($file_path)) {
766 $this->
object->getFilename(),
767 'application/octet-stream'
770 $this->tpl->setOnScreenMessage(
'failure',
$DIC[
'lng']->txt(
"file_not_found"));
775 $this->storage->consume()->download($this->
object->getResourceId())->run();
786 if (
$DIC->access()->checkAccess(
'read',
"", $this->object->getRefId())) {
788 $entry = $this->facade->entryFactory()
789 ->findByIdAndTypeString(
$id, $this->
object->getFileTypeAsString());
801 $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));
852 $ilNewsItem->setUserId(
$DIC->user()->getId());
854 $ilNewsItem->setContentTextIsLangVar(
false);
855 $ilNewsItem->create();
882 $a_new_object->parseFileToDatabase();
884 parent::afterImport($a_new_object);
891 $this->tpl->setOnScreenMessage(
'failure',
$DIC->language()->txt(
"no_permission"),
true);
Builds a Color from either hex- or rgb values.
Class ilBiblEntryDetailPresentationGUI.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilBiblFieldFilterGUI.
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
Export User Interface Class.
static deliverFileAttached(string $path_to_file, ?string $download_file_name=null, ?string $mime_type=null, bool $delete_file=false)
A news item can be created by different sources.
static setNotification(int $type, int $user_id, int $id, bool $status=true)
Set notification status for object and user.
const TYPE_DATA_COLLECTION
Class ilObjBibliographicGUI.
const SECTION_EDIT_BIBLIOGRAPHY
ilBiblFieldFactory $field_factory
overwriteBibliographicFile()
infoScreen()
this one is called from the info button in the repository not very nice to set cmdClass/Cmd manually,...
const SECTION_PRESENTATION
initCreateForm(string $new_type)
updateObject()
updates object entry in object_data
const PROP_TITLE_AND_DESC
ilObjBibliographicStakeholder $stakeholder
afterSave(ilObject $a_new_object)
Post (successful) object creation hook.
editObject()
edit object @access public
getValidBiblFileSuffixConstraint()
ILIAS Refinery Factory $refinery
const CMD_OVERWRITE_BIBLIOGRAPHIC_FILE
ilBiblFieldFilterFactory $filter_factory
const SECTION_AVAILABILITY
ilBiblTranslationFactory $translation_factory
ilBiblFactoryFacade $facade
addLocatorItems()
Functions to be overwritten.
replaceBibliograficFileInit()
const SECTION_REPLACE_BIBLIOGRAPHIC_FILE
executeCommand()
executeCommand
addNews(int $obj_id, string $change='created')
static _goto(string $a_target)
_goto Deep link
removeFromDesk()
Remove from desktop.
getStandardCmd()
getStandardCmd
sendFile()
provide file as a download
addToDesk()
Add desktop item.
showContent()
shows the overview page with all entries in a table
ilBiblTypeFactory $type_factory
const PROP_BIBLIOGRAPHIC_FILE
const CMD_REPLACE_BIBLIOGRAPHIC_FILE
view()
view object content (repository/workspace switch)
Class ilObjBibliographicStakeholder.
Class ilObjBibliographic.
New implementation of ilObjectGUI.
setTabs()
create tabs (repository/workspace switch)
__construct(int $id=0, int $id_type=self::REPOSITORY_NODE_ID, int $parent_node_id=0)
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $node_id=null)
putObjectInTree(ilObject $obj, ?int $parent_node_id=null)
Add object to tree at given position.
prepareOutput(bool $show_sub_objects=true)
GUI class for the workflow of copying objects.
static _gotoRepositoryRoot(bool $raise_error=false)
Goto repository root.
initDidacticTemplate(ilPropertyFormGUI $form)
addHeaderAction()
Add header action menu.
afterImport(ilObject $new_object)
Post (successful) object import hook.
getDidacticTemplateVar(string $type)
Get didactic template setting from creation screen.
Class ilObject Basic functions for all objects.
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
Class ilResourceStorageInfoGUI.
This class represents a text area property in a property form.
This class represents a text property in a property form.
A constraint encodes some resrtictions on values.
This is how the factory for UI elements looks.
static http()
Fetches the global http state from ILIAS.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc