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();
98 $DIC->language()->loadLanguageModule(
'bibl');
99 $DIC->language()->loadLanguageModule(
'content');
100 $DIC->language()->loadLanguageModule(
'obj');
101 $DIC->language()->loadLanguageModule(
'cntr');
115 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();
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);
226 $this->infoScreenForward();
232 public function infoScreenForward():
void 239 if (!$this->checkPermissionBoolAndReturn(
"visible") && !$this->checkPermissionBoolAndReturn(
'read')) {
240 $this->tpl->setOnScreenMessage(
'failure', $DIC[
'lng']->txt(
"msg_no_perm_read"),
true);
241 $this->
ctrl->redirectByClass(
'ilDashboardGUI',
'');
243 $DIC->tabs()->activateTab(self::TAB_ID_INFO);
246 $info->enablePrivateNotes();
247 $info->addMetaDataSections($this->
object->getId(), 0, $this->
object->getType());
253 $this->
ctrl->forwardCommand($info);
262 $ilLocator = $DIC[
'ilLocator'];
263 if (is_object($this->
object)) {
272 public static function _goto(
string $a_target): void
276 $id = explode(
"_", $a_target);
277 $DIC->ctrl()->setTargetScript(
'ilias.php');
278 $DIC->ctrl()->setParameterByClass(ilObjBibliographicGUI::class,
"ref_id", (
int) (
$id[0] ?? 1));
280 if (isset(
$id[1]) &&
$id[1] !==
'') {
283 $DIC->ctrl()->redirectByClass(
285 ilRepositoryGUI::class,
286 ilObjBibliographicGUI::class,
288 self::CMD_SHOW_DETAILS
291 $DIC->ctrl()->redirectByClass(
293 ilRepositoryGUI::class,
294 ilObjBibliographicGUI::class,
308 $form->setTarget(
'_top');
309 $form->setFormAction($this->
ctrl->getFormAction($this,
'save'));
310 $form->setTitle($this->
lng->txt($new_type .
'_new'));
315 $ti->setRequired(
true);
324 $in_file =
new ilFileInputGUI($this->
lng->txt(
'bibliography_file'),
'bibliographic_file');
326 $in_file->setRequired(
true);
327 $form->addItem($in_file);
331 $form->addCommandButton(
'save', $this->
lng->txt($new_type .
'_add'));
332 $form->addCommandButton(
'cancel', $this->
lng->txt(
'cancel'));
341 if ($form->checkInput()) {
344 $form->setValuesByPost();
345 $this->
ui()->mainTemplate()->setContent($form->getHtml());
354 $this->error->raiseError($this->
lng->txt(
'no_create_permission'), $this->error->MESSAGE);
357 $this->
lng->loadLanguageModule($this->requested_new_type);
358 $this->
ctrl->setParameter($this,
'new_type', $this->requested_new_type);
361 if ($form->checkInput()) {
362 $this->
ctrl->setParameter($this,
'new_type',
'');
365 $newObj->setTitle($form->getInput(
'title'));
366 $newObj->setDescription($form->getInput(
'desc'));
367 $newObj->processAutoRating();
374 $newObj->applyDidacticTemplate($dtpl);
380 $form->setValuesByPost();
381 $this->tpl->setContent($form->getHTML());
388 $form = $form->withRequest($this->
http->request());
389 $result = $form->getInputGroup()->getContent();
391 if (!$result->isOK()) {
392 $this->tpl->setOnScreenMessage(
'failure', $result->error(),
true);
393 $this->tpl->setContent(
397 $values = $result->value();
399 $this->
object->getObjectProperties()->storePropertyTitleAndDescription(
400 $values[self::SECTION_EDIT_BIBLIOGRAPHY][self::PROP_TITLE_AND_DESC]
402 $this->
object->getObjectProperties()->storePropertyIsOnline(
403 $values[self::SECTION_AVAILABILITY][self::PROP_ONLINE_STATUS]
405 $this->
object->getObjectProperties()->storePropertyTileImage(
406 $values[self::SECTION_PRESENTATION][self::PROP_TILE_IMAGE]
409 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'changes_saved'),
true);
410 $this->
ctrl->redirect($this, self::CMD_SETTINGS);
418 $this->
ctrl->redirect($this, self::CMD_EDIT_OBJECT);
428 if (!
$DIC->access()->checkAccess(
'write',
"", $this->
object->getRefId())) {
429 $this->
ctrl->redirect($this, self::CMD_SHOW_CONTENT);
432 $this->
tabs()->clearTargets();
433 $this->
tabs()->setBackTarget(
434 $this->
lng->txt(
'back'),
435 $this->
ctrl->getLinkTarget($this, self::CMD_SHOW_CONTENT)
438 $this->tpl->setOnScreenMessage(
440 $this->
lng->txt(
'replace_bibliography_file_info')
448 $this->tpl->setContent($this->
ui()->
renderer()->
render($this->getReplaceBibliographicFileForm()));
451 public function replaceBibliographicFile():
void 455 $form = $this->getReplaceBibliographicFileForm();
456 $form = $form->withRequest($this->
http->request());
457 $data = $form->getData();
458 if (
$data !==
null && $bibl_file_rid = $this->storage->manage()->find(
459 $data[self::SECTION_REPLACE_BIBLIOGRAPHIC_FILE][self::PROP_BIBLIOGRAPHIC_FILE][0]
465 $bibl_filename = $this->storage->manage()->getResource($bibl_file_rid)->getCurrentRevision()->getTitle();
466 $bibl_filetype = $bibl_obj->determineFileTypeByFileName($bibl_filename);
468 $bibl_obj->setResourceId($bibl_file_rid);
469 $bibl_obj->setFilename($bibl_filename);
470 $bibl_obj->setFileType($bibl_filetype);
472 $bibl_obj->parseFileToDatabase();
474 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'changes_saved'),
true);
475 $this->
ctrl->redirect($this, self::CMD_SHOW_CONTENT);
478 $this->tpl->setContent(
483 protected function getReplaceBibliographicFileForm():
Standard 490 $rid = $bibl_obj->getResourceId() ? $bibl_obj->getResourceId()->serialize() :
"";
493 $section_replace_bibliographic_file = $this->ui_factory
498 self::PROP_BIBLIOGRAPHIC_FILE => $this->ui_factory
502 $bibl_upload_handler,
503 $this->
lng->txt(
'bibliography_file')
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')
547 public function setTabs():
void 551 $ilHelp = $DIC[
'ilHelp'];
555 $ilHelp->setScreenIdComponent(
'bibl');
557 if ($DIC->access()->checkAccess(
'read',
"", $this->
object->getRefId())) {
558 $DIC->tabs()->addTab(
561 ->txt(self::TAB_CONTENT),
562 $this->
ctrl->getLinkTarget($this, self::CMD_SHOW_CONTENT)
566 if ($DIC->access()->checkAccess(
'visible',
"", $this->
object->getRefId())
567 || $DIC->access()->checkAccess(
'read',
"", $this->
object->getRefId())
569 $DIC->tabs()->addTab(
573 $this->
ctrl->getLinkTargetByClass(
"ilinfoscreengui",
"showSummary")
577 if ($DIC->access()->checkAccess(
'write',
"", $this->
object->getRefId())) {
578 $DIC->tabs()->addTab(
579 self::SUBTAB_SETTINGS,
581 ->txt(self::SUBTAB_SETTINGS),
582 $this->
ctrl->getLinkTarget($this, self::CMD_EDIT_OBJECT)
586 if ($DIC->access()->checkAccess(
"write",
"", $this->
object->getRefId())) {
587 $DIC->tabs()->addTab(
590 ->txt(self::TAB_EXPORT),
591 $this->
ctrl->getLinkTargetByClass(
"ilexportgui",
"")
595 if ($DIC->access()->checkAccess(
'edit_permission',
"", $this->
object->getRefId())) {
596 $DIC->tabs()->addTab(
597 self::TAB_ID_PERMISSIONS,
599 ->txt(
"perm_settings"),
600 $this->
ctrl->getLinkTargetByClass(
"ilpermissiongui",
"perm")
608 $DIC->tabs()->addSubTab(
609 self::SUBTAB_SETTINGS,
611 ->txt(self::SUBTAB_SETTINGS),
612 $this->
ctrl->getLinkTarget($this, self::CMD_EDIT_OBJECT)
614 $DIC->tabs()->addSubTab(
615 self::SUB_TAB_FILTER,
617 ->txt(
"bibl_filter"),
630 $this->error->raiseError($this->
lng->txt(
"msg_no_perm_write"), $this->error->MESSAGE);
633 $this->tabs_gui->activateTab(
"settings");
640 $field_factory = $this->ui_factory->input()->field();
642 $section_edit_bibliography = $field_factory->section(
644 self::PROP_TITLE_AND_DESC => $this->
object->getObjectProperties()->getPropertyTitleAndDescription(
651 $this->
lng->txt(
'bibl_edit'),
654 $section_availability = $field_factory->section(
656 self::PROP_ONLINE_STATUS => $this->
object->getObjectProperties()->getPropertyIsOnline()->toForm(
662 $this->
lng->txt(
'rep_activation_availability'),
665 $section_presentation = $field_factory->section(
667 self::PROP_TILE_IMAGE => $this->
object->getObjectProperties()->getPropertyTileImage()->toForm(
673 $this->
lng->txt(
'settings_presentation_header'),
677 return $this->ui_factory->input()->container()->form()->standard(
678 $this->
ctrl->getFormAction($this, self::CMD_UPDATE_OBJECT),
680 self::SECTION_EDIT_BIBLIOGRAPHY => $section_edit_bibliography,
681 self::SECTION_AVAILABILITY => $section_availability,
682 self::SECTION_PRESENTATION => $section_presentation
700 $read_access = $DIC->access()->checkAccess(
'read',
"", $this->
object->getRefId());
701 $online = $this->
object->getObjectProperties()->getPropertyIsOnline()->getIsOnline();
702 $write_access = $DIC->access()->checkAccess(
'write',
"", $this->
object->getRefId());
703 if (($read_access && $online) || $write_access) {
704 $DIC->tabs()->activateTab(self::TAB_CONTENT);
706 $btn_download_original_file = $this->
ui()->factory()->button()->primary(
707 $this->
lng->txt(
'download_original_file'),
708 $this->
ctrl()->getLinkTargetByClass(self::class, self::CMD_SEND_FILE)
710 $this->
toolbar->addComponent($btn_download_original_file);
713 $btn_overwrite_bibliographic_file = $this->
ui()->factory()->button()->standard(
714 $this->
lng->txt(
'replace_bibliography_file'),
715 $this->
ctrl()->getLinkTargetByClass(self::class, self::CMD_OVERWRITE_BIBLIOGRAPHIC_FILE)
717 $this->
toolbar->addComponent($btn_overwrite_bibliographic_file);
721 $DIC->ui()->mainTemplate()->setContent($table_gui->getRenderedTableAndExistingFilters());
724 $DIC->ui()->mainTemplate()->setPermanentLink(
"bibl", $this->
object->getRefId());
727 $this->tpl->setOnScreenMessage(
731 ->txt(
"msg_no_perm_read_item"),
744 $table->writeFilterToSession();
745 $table->resetOffset();
746 $this->
ctrl->redirect($this, self::CMD_SHOW_CONTENT);
752 $table->resetFilter();
753 $table->resetOffset();
754 $this->
ctrl->redirect($this, self::CMD_SHOW_CONTENT);
764 if ($DIC[
'ilAccess']->checkAccess(
'read',
"", $this->
object->getRefId())) {
765 if (!$this->
object->isMigrated()) {
766 $file_path = $this->
object->getLegacyAbsolutePath();
768 if (is_file($file_path)) {
771 $this->
object->getFilename(),
772 'application/octet-stream' 775 $this->tpl->setOnScreenMessage(
'failure', $DIC[
'lng']->txt(
"file_not_found"));
780 $this->storage->consume()->download($this->
object->getResourceId())->run();
791 if ($DIC->access()->checkAccess(
'read',
"", $this->
object->getRefId())) {
792 $id = $DIC->http()->request()->getQueryParams()[self::P_ENTRY_ID];
793 $entry = $this->facade->entryFactory()
794 ->findByIdAndTypeString(
$id, $this->
object->getFileTypeAsString());
806 $DIC->ui()->mainTemplate()->setContent($bibGUI->getHTML());
821 $ntf = $DIC->http()->wrapper()->query()->retrieve(
823 $DIC->refinery()->to()->int()
846 $DIC->ctrl()->redirect($this,
"");
854 $ilNewsItem->setTitle($DIC->language()->txt(
'news_title_' . $change));
856 $ilNewsItem->setContext($obj_id, $this->
getType());
857 $ilNewsItem->setUserId($DIC->user()->getId());
859 $ilNewsItem->setContentTextIsLangVar(
false);
860 $ilNewsItem->create();
887 $a_new_object->parseFileToDatabase();
889 parent::afterImport($a_new_object);
896 $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.
ILIAS HTTP Services $http
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.
Class ilBiblFieldFilterGUI.
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...