ILIAS  release_8 Revision v8.24
class.ilExtIdGUI.php
Go to the documentation of this file.
1<?php
18/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
19
26{
29 protected ilCtrl $ctrl;
32 protected ilLanguage $lng;
37
39 {
40 global $DIC;
41 $main_tpl = $DIC->ui()->mainTemplate();
42
43 $this->tpl = $DIC->ui()->mainTemplate();
44 $this->ctrl = $DIC->ctrl();
45 $this->parent_gui = $parent_gui;
46 $this->parent_object = $parent_gui->getObject();
47 $this->tabs_gui = $DIC->tabs();
48 $this->toolbar = $DIC->toolbar();
49 $this->lng = $DIC->language();
50 $this->ilAccess = $DIC->access();
51 $this->lng->loadLanguageModule('user');
52 if (!$this->ilAccess->checkaccess("write", "", $this->parent_gui->getObject()->getRefId())) {
53 $main_tpl->setOnScreenMessage('failure', $this->lng->txt("permission_denied"), true);
54 }
55 }
56
57 public function executeCommand(): bool
58 {
59 $cmd = $this->ctrl->getCmd();
60
61 switch ($cmd) {
62 case 'edit':
63 $this->edit();
64 break;
65 case 'update':
66 $this->update();
67 break;
68 }
69
70 return true;
71 }
72
73 public function edit(): void
74 {
75 $form = $this->initForm();
76 $this->tpl->setContent($form->getHTML());
77 }
78
79 public function initForm(): ilPropertyFormGUI
80 {
82 $input = new ilTextInputGUI($this->lng->txt("ext_id"), "ext_id");
83 $input->setValue($this->parent_object->getImportId());
84 $form->addItem($input);
85 $form->setFormAction($this->ctrl->getFormAction($this));
86 $form->addCommandButton("update", $this->lng->txt("save"));
87
88 return $form;
89 }
90
91 public function update(): void
92 {
93 $form = $this->initForm();
94 $form->setValuesByPost();
95 if ($form->checkInput()) {
96 $this->parent_object->setImportId($form->getItemByPostVar("ext_id")->getValue());
97 $this->parent_object->update();
98 $this->tpl->setOnScreenMessage('success', $this->lng->txt("ext_id_updated"), true);
99 $this->ctrl->redirect($this, "edit");
100 } else {
101 $this->tpl->setContent($form->getHTML());
102 }
103 }
104}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilCtrl provides processing control methods.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(ilObjectGUI $parent_gui)
ilObject $parent_object
ilLanguage $lng
ilAccessHandler $ilAccess
ilToolbarGUI $toolbar
ilObjectGUI $parent_gui
ilPropertyFormGUI $form
ilTabsGUI $tabs_gui
ilObjCategory $object
ilGlobalTemplateInterface $tpl
setFormAction(string $a_formaction)
language handling
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilObjectGUI Basic methods of all Output classes.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a property form user interface.
addCommandButton(string $a_cmd, string $a_text, string $a_id="")
getItemByPostVar(string $a_post_var)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a text property in a property form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.php:28
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...