ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilExtIdGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3
11{
12
16 protected $tabs_gui;
20 protected $form;
24 protected $toolbar;
28 protected $ctrl;
32 protected $tpl;
36 protected $object;
40 protected $lng;
44 protected $ilAccess;
45
46
50 public function __construct($parent_gui)
51 {
52 global $DIC;
53 $tpl = $DIC['tpl'];
54 $ilCtrl = $DIC['ilCtrl'];
55 $ilTabs = $DIC['ilTabs'];
56 $ilToolbar = $DIC['ilToolbar'];
57 $lng = $DIC['lng'];
58 $ilAccess = $DIC['ilAccess'];
59 $this->tpl = $tpl;
60 $this->ctrl = $ilCtrl;
61 $this->parent_gui = $parent_gui;
62 $this->parent_object = $parent_gui->object;
63 $this->tabs_gui = $this->parent_gui->tabs_gui;
64 $this->toolbar = $ilToolbar;
65 $this->lng = $lng;
66 $this->ilAccess = $ilAccess;
67 $this->lng->loadLanguageModule('user');
68 if (!$this->ilAccess->checkaccess("write", "", $this->parent_gui->object->getRefId())) {
69 ilUtil::sendFailure($this->lng->txt("permission_denied"), true);
70 }
71 }
72
76 public function executeCommand()
77 {
78 $cmd = $this->ctrl->getCmd();
79
80 switch ($cmd) {
81 case 'edit':
82 $this->edit();
83 break;
84 case 'update':
85 $this->update();
86 break;
87 }
88 return true;
89 }
90
91 public function edit()
92 {
93 $form = $this->initForm();
94 $this->tpl->setContent($form->getHTML());
95 }
96
97 public function initForm()
98 {
100 $input = new ilTextInputGUI($this->lng->txt("ext_id"), "ext_id");
101 $input->setValue($this->parent_object->getImportId());
102 $form->addItem($input);
103 $form->setFormAction($this->ctrl->getFormAction($this));
104 $form->addCommandButton("update", $this->lng->txt("save"));
105
106 return $form;
107 }
108
109 public function update()
110 {
111 $form = $this->initForm();
112 $form->setValuesByPost();
113 if ($form->checkInput()) {
114 $this->parent_object->setImportId($form->getItemByPostVar("ext_id")->getValue());
115 $this->parent_object->update();
116 ilUtil::sendSuccess($this->lng->txt("ext_id_updated"), true);
117 $this->ctrl->redirect($this, "edit");
118 } else {
119 $this->tpl->setContent($form->getHTML());
120 }
121 }
122}
An exception for terminatinating execution or to throw for unit testing.
Class ilAccessHandler.
Class ilExtIdGUI.
__construct($parent_gui)
This class represents a property form user interface.
This class represents a text property in a property form.
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
global $ilCtrl
Definition: ilias.php:18
global $DIC
Definition: saml.php:7