ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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
15 protected $tabs_gui;
19 protected $form;
23 protected $toolbar;
27 protected $ctrl;
31 protected $tpl;
35 protected $object;
39 protected $lng;
43 protected $ilAccess;
44
45
49 function __construct($parent_gui) {
50 global $DIC;
51 $tpl = $DIC['tpl'];
52 $ilCtrl = $DIC['ilCtrl'];
53 $ilTabs = $DIC['ilTabs'];
54 $ilToolbar = $DIC['ilToolbar'];
55 $lng = $DIC['lng'];
56 $ilAccess = $DIC['ilAccess'];
57 $this->tpl = $tpl;
58 $this->ctrl = $ilCtrl;
59 $this->parent_gui = $parent_gui;
60 $this->parent_object = $parent_gui->object;
61 $this->tabs_gui = $this->parent_gui->tabs_gui;
62 $this->toolbar = $ilToolbar;
63 $this->lng = $lng;
64 $this->ilAccess = $ilAccess;
65 $this->lng->loadLanguageModule('user');
66 if (! $this->ilAccess->checkaccess("write", "", $this->parent_gui->object->getRefId())) {
67 ilUtil::sendFailure($this->lng->txt("permission_denied"), true);
68 }
69 }
70
74 public function executeCommand()
75 {
76 $cmd = $this->ctrl->getCmd();
77
78 switch ($cmd) {
79 case 'edit':
80 $this->edit();
81 break;
82 case 'update':
83 $this->update();
84 break;
85 }
86 return true;
87 }
88
89 public function edit() {
90 $form = $this->initForm();
91 $this->tpl->setContent($form->getHTML());
92 }
93
94 public function initForm() {
96 $input = new ilTextInputGUI($this->lng->txt("ext_id"), "ext_id");
97 $input->setValue($this->parent_object->getImportId());
98 $form->addItem($input);
99 $form->setFormAction($this->ctrl->getFormAction($this));
100 $form->addCommandButton("update", $this->lng->txt("save"));
101
102 return $form;
103 }
104
105 public function update() {
106 $form = $this->initForm();
107 $form->setValuesByPost();
108 if ($form->checkInput()) {
109 $this->parent_object->setImportId($form->getItemByPostVar("ext_id")->getValue());
110 $this->parent_object->update();
111 ilUtil::sendSuccess($this->lng->txt("ext_id_updated"), true);
112 $this->ctrl->redirect($this,"edit");
113 } else {
114 $this->tpl->setContent($form->getHTML());
115 }
116 }
117}
118?>
An exception for terminatinating execution or to throw for unit testing.
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
$cmd
Definition: sahs_server.php:35
global $DIC