ILIAS  release_7 Revision v7.30-3-g800a261c036
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
73
77 public function executeCommand()
78 {
79 $cmd = $this->ctrl->getCmd();
80
81 switch ($cmd) {
82 case 'edit':
83 $this->edit();
84 break;
85 case 'update':
86 $this->update();
87 break;
88 }
89
90 return true;
91 }
92
93
94 public function edit()
95 {
96 $form = $this->initForm();
97 $this->tpl->setContent($form->getHTML());
98 }
99
100
101 public function initForm()
102 {
103 $form = new ilPropertyFormGUI();
104 $input = new ilTextInputGUI($this->lng->txt("ext_id"), "ext_id");
105 $input->setValue($this->parent_object->getImportId());
106 $form->addItem($input);
107 $form->setFormAction($this->ctrl->getFormAction($this));
108 $form->addCommandButton("update", $this->lng->txt("save"));
109
110 return $form;
111 }
112
113
114 public function update()
115 {
116 $form = $this->initForm();
117 $form->setValuesByPost();
118 if ($form->checkInput()) {
119 $this->parent_object->setImportId($form->getItemByPostVar("ext_id")->getValue());
120 $this->parent_object->update();
121 ilUtil::sendSuccess($this->lng->txt("ext_id_updated"), true);
122 $this->ctrl->redirect($this, "edit");
123 } else {
124 $this->tpl->setContent($form->getHTML());
125 }
126 }
127}
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 sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
global $DIC
Definition: goto.php:24