ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilExtIdGUI.php
Go to the documentation of this file.
1<?php
2
25{
28 protected ilCtrl $ctrl;
31 protected ilLanguage $lng;
36
38 {
39 global $DIC;
40 $main_tpl = $DIC->ui()->mainTemplate();
41
42 $this->tpl = $DIC->ui()->mainTemplate();
43 $this->ctrl = $DIC->ctrl();
44 $this->parent_gui = $parent_gui;
45 $this->parent_object = $parent_gui->getObject();
46 $this->tabs_gui = $DIC->tabs();
47 $this->toolbar = $DIC->toolbar();
48 $this->lng = $DIC->language();
49 $this->ilAccess = $DIC->access();
50 $this->lng->loadLanguageModule('user');
51 if (!$this->ilAccess->checkaccess("write", "", $this->parent_gui->getObject()->getRefId())) {
52 $main_tpl->setOnScreenMessage('failure', $this->lng->txt("permission_denied"), true);
53 }
54 }
55
56 public function executeCommand(): bool
57 {
58 $cmd = $this->ctrl->getCmd();
59
60 switch ($cmd) {
61 case 'edit':
62 $this->edit();
63 break;
64 case 'update':
65 $this->update();
66 break;
67 }
68
69 return true;
70 }
71
72 public function edit(): void
73 {
74 $form = $this->initForm();
75 $this->tpl->setContent($form->getHTML());
76 }
77
78 public function initForm(): ilPropertyFormGUI
79 {
81 $input = new ilTextInputGUI($this->lng->txt("ext_id"), "ext_id");
82 $input->setValue($this->parent_object->getImportId());
83 $form->addItem($input);
84 $form->setFormAction($this->ctrl->getFormAction($this));
85 $form->addCommandButton("update", $this->lng->txt("save"));
86
87 return $form;
88 }
89
90 public function update(): void
91 {
92 $form = $this->initForm();
93 $form->setValuesByPost();
94 if ($form->checkInput()) {
95 $this->parent_object->setImportId($form->getItemByPostVar("ext_id")->getValue());
96 $this->parent_object->update();
97 $this->tpl->setOnScreenMessage('success', $this->lng->txt("ext_id_updated"), true);
98 $this->ctrl->redirect($this, "edit");
99 } else {
100 $this->tpl->setContent($form->getHTML());
101 }
102 }
103}
Class ilAccessHandler Checks access for ILIAS objects.
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
Class ilObjCategory.
Class ilObjectGUI Basic methods of all Output classes.
Class ilObject Basic functions for all objects.
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...
Interface ilAccessHandler This interface combines all available interfaces which can be called via gl...
global $DIC
Definition: shib_login.php:26