ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilRemoteObjectBaseGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4include_once('Services/Object/classes/class.ilObject2GUI.php');
5
13abstract class ilRemoteObjectBaseGUI extends ilObject2GUI
14{
15 public function __construct($a_id = 0, $a_id_type = self::REPOSITORY_NODE_ID, $a_parent_node_id = 0)
16 {
17 parent::__construct($a_id, $a_id_type, $a_parent_node_id);
18
19 $this->lng->loadLanguageModule('ecs');
20 }
21
22 public function executeCommand()
23 {
24 global $ilTabs;
25
26 $next_class = $this->ctrl->getNextClass($this);
27 $cmd = $this->ctrl->getCmd();
28
29 $this->prepareOutput();
30
31 switch ($next_class) {
32 case 'ilinfoscreengui':
33 // forwards command
34 $this->infoScreen();
35 break;
36
37 case 'ilpermissiongui':
38 $ilTabs->activateTab('id_permissions');
39 include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
40 $this->ctrl->forwardCommand(new ilPermissionGUI($this));
41 break;
42
43 case "ilcommonactiondispatchergui":
44 include_once("Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
46 $this->ctrl->forwardCommand($gui);
47 break;
48
49 default:
50 if (!$cmd || $cmd == 'view') {
51 $cmd = "editSettings";
52 }
53 $cmd .= "Object";
54 $this->$cmd();
55 break;
56 }
57 return true;
58 }
59
63 public function showObject()
64 {
65 global $ilUser;
66
67 if ($ilUser->getId() == ANONYMOUS_USER_ID ||
68 $this->object->isLocalObject()) {
69 ilUtil::redirect($this->object->getRemoteLink());
70 } else {
71 $link = $this->object->getFullRemoteLink();
72 ilUtil::redirect($link);
73 }
74 }
75
79 public function setTabs()
80 {
81 global $ilTabs;
82
83 if ($this->checkPermissionBool('visible')) {
84 $ilTabs->addTab(
85 "info",
86 $this->lng->txt("info_short"),
87 $this->ctrl->getLinkTarget($this, "infoScreen")
88 );
89 }
90
91 if ($this->checkPermissionBool('write')) {
92 $ilTabs->addTab(
93 "edit",
94 $this->lng->txt("edit"),
95 $this->ctrl->getLinkTarget($this, "edit")
96 );
97 }
98
99 // will add permissions if needed
100 parent::setTabs();
101 }
102
108 public function callObject()
109 {
110 include_once './Services/Tracking/classes/class.ilChangeEvent.php';
112 $this->getType(),
113 $this->object->getRefId(),
114 $this->object->getId(),
115 $GLOBALS['ilUser']->getId()
116 );
117
118
119 // check if the assigned object is hosted on the same installation
120 $link = $this->object->getFullRemoteLink();
121 if ($link) {
122 ilUtil::redirect($link);
123 return true;
124 } else {
125 ilUtil::sendFailure('Cannot call remote object.');
126 $this->infoScreenObject();
127 return false;
128 }
129 }
130
136 public function infoScreenObject()
137 {
138 $this->ctrl->setCmd("showSummary");
139 $this->ctrl->setCmdClass("ilinfoscreengui");
140 $this->infoScreen();
141 }
142
146 public function infoScreen()
147 {
148 global $ilErr,$ilUser,$ilTabs;
149
150 if (!$this->checkPermissionBool('visible')) {
151 $ilErr->raiseError($this->lng->txt('msg_no_perm_read'), $ilErr->MESSAGE);
152 }
153
154 $ilTabs->activateTab('info');
155
156 include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
157 $info = new ilInfoScreenGUI($this);
158
159 if ($ilUser->getId() == ANONYMOUS_USER_ID ||
160 $this->object->isLocalObject()) {
161 $info->addButton(
162 $this->lng->txt($this->getType() . '_call'),
163 $this->object->getRemoteLink(),
164 'target="_blank"'
165 );
166 } else {
167 $info->addButton(
168 $this->lng->txt($this->getType() . '_call'),
169 $this->ctrl->getLinkTarget($this, 'call'),
170 'target="_blank"'
171 );
172 }
173
174 $info->addSection($this->lng->txt('ecs_general_info'));
175 $info->addProperty($this->lng->txt('title'), $this->object->getTitle());
176 if (strlen($this->object->getOrganization())) {
177 $info->addProperty($this->lng->txt('organization'), $this->object->getOrganization());
178 }
179 if (strlen($this->object->getDescription())) {
180 $info->addProperty($this->lng->txt('description'), $this->object->getDescription());
181 }
182 if (strlen($loc = $this->object->getLocalInformation())) {
183 $info->addProperty($this->lng->txt('ecs_local_information'), $this->object->getLocalInformation());
184 }
185
187
188 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordGUI.php');
189 $record_gui = new ilAdvancedMDRecordGUI(
191 $this->getType(),
192 $this->object->getId()
193 );
194 $record_gui->setInfoObject($info);
195 $record_gui->parse();
196
197 $this->ctrl->forwardCommand($info);
198 }
199
205 protected function addCustomInfoFields(ilInfoScreenGUI $a_info)
206 {
207 }
208
214 public function editObject(ilPropertyFormGUI $a_form = null)
215 {
216 global $ilErr,$ilTabs;
217
218 if (!$this->checkPermissionBool('write')) {
219 $ilErr->raiseError($this->lng->txt('msg_no_perm_read'), $ilErr->MESSAGE);
220 }
221
222 $ilTabs->activateTab('edit');
223
224 if (!$a_form) {
225 $a_form = $this->initEditForm();
226 }
227 $this->tpl->setContent($a_form->getHTML());
228 }
229
235 protected function initEditForm()
236 {
237 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
238 $form = new ilPropertyFormGUI();
239 $form->setFormAction($this->ctrl->getFormAction($this));
240 $form->setTitle($this->lng->txt('ecs_general_info'));
241 $form->addCommandButton('update', $this->lng->txt('save'));
242 $form->addCommandButton('edit', $this->lng->txt('cancel'));
243
244 $text = new ilTextInputGUI($this->lng->txt('title'), 'title');
245 $text->setValue($this->object->getTitle());
246 $text->setSize(min(40, ilObject::TITLE_LENGTH));
247 $text->setMaxLength(ilObject::TITLE_LENGTH);
248 $text->setDisabled(true);
249 $form->addItem($text);
250
251 $area = new ilTextAreaInputGUI($this->lng->txt('description'), 'description');
252 $area->setValue($this->object->getDescription());
253 $area->setRows(3);
254 $area->setCols(80);
255 $area->setDisabled(true);
256 $form->addItem($area);
257
258 $area = new ilTextAreaInputGUI($this->lng->txt('ecs_local_information'), 'local_info');
259 $area->setValue($this->object->getLocalInformation());
260 $area->setRows(3);
261 $area->setCols(80);
262 $form->addItem($area);
263
264 $this->addCustomEditForm($form);
265
266 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordGUI.php');
267 $record_gui = new ilAdvancedMDRecordGUI(
269 $this->getType(),
270 $this->object->getId()
271 );
272 $record_gui->setPropertyForm($form);
273 $record_gui->parse();
274
275 return $form;
276 }
277
283 protected function addCustomEditForm(ilPropertyFormGUI $a_form)
284 {
285 }
286
290 public function updateObject()
291 {
292 global $ilErr;
293
294 if (!$this->checkPermissionBool('write')) {
295 $ilErr->raiseError($this->lng->txt('msg_no_perm_read'), $ilErr->MESSAGE);
296 }
297
298 $form = $this->initEditForm();
299 if ($form->checkInput()) {
300 $this->object->setLocalInformation($a_form->getInput('local_info'));
301
303
304 $this->object->update();
305
306 // Save advanced meta data
307 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordGUI.php');
308 $record_gui = new ilAdvancedMDRecordGUI(
310 $this->getType(),
311 $this->object->getId()
312 );
313 $record_gui->loadFromPost();
314 $record_gui->saveValues();
315
316 ilUtil::sendSuccess($this->lng->txt("settings_saved"));
317 $this->editObject();
318 }
319
320 $form->setValuesByPost();
321 $this->editObject($form);
322 }
323
329 protected function updateCustomValues(ilPropertyFormGUI $a_form)
330 {
331 }
332
338 public static function _goto($a_target)
339 {
340 global $ilErr, $lng, $ilAccess;
341
342 //static if ($this->checkPermissionBool("visible", "", "", $a_target))
343 if ($ilAccess->checkAccess('visible', '', $a_target)) {
344 $_GET["cmd"] = "infoScreen";
345 $_GET["ref_id"] = $a_target;
346 $_GET["baseClass"] = "ilRepositoryGUI";
347 include("ilias.php");
348 exit;
349 }
350 //static else if ($this->checkPermissionBool("read", "", "", ROOT_FOLDER_ID))
351 if ($ilAccess->checkAccess('read', '', ROOT_FOLDER_ID)) {
352 $_GET["cmd"] = "frameset";
353 $_GET["target"] = "";
354 $_GET["ref_id"] = ROOT_FOLDER_ID;
356 $lng->txt("msg_no_perm_read_item"),
358 ), true);
359 $_GET["baseClass"] = "ilRepositoryGUI";
360 include("ilias.php");
361 exit;
362 }
363
364 $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
365 }
366}
sprintf('%.4f', $callTime)
$_GET["client_id"]
An exception for terminatinating execution or to throw for unit testing.
static _recordReadEvent( $a_type, $a_ref_id, $obj_id, $usr_id, $isCatchupWriteEvents=true, $a_ext_rc=false, $a_ext_time=false)
Records a read event and catches up with write events.
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
Class ilInfoScreenGUI.
New implementation of ilObjectGUI.
getType()
Functions that must be overwritten.
prepareOutput($a_show_subobjects=true)
prepare output
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_node_id=null)
Check permission.
editObject()
edit object
static _lookupObjId($a_id)
const TITLE_LENGTH
max length of object title
static _lookupTitle($a_id)
lookup object title
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
This class represents a property form user interface.
__construct($a_id=0, $a_id_type=self::REPOSITORY_NODE_ID, $a_parent_node_id=0)
Constructor.
static _goto($a_target)
redirect script
infoScreenObject()
this one is called from the info button in the repository not very nice to set cmdClass/Cmd manually,...
addCustomEditForm(ilPropertyFormGUI $a_form)
Add custom fields to edit form.
editObject(ilPropertyFormGUI $a_form=null)
Edit settings.
addCustomInfoFields(ilInfoScreenGUI $a_info)
Add custom fields to info screen.
initEditForm()
Init edit settings form.
updateCustomValues(ilPropertyFormGUI $a_form)
Update object custom values.
This class represents a text area property in a property form.
This class represents a text property in a property form.
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static redirect($a_script)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
$info
Definition: index.php:5
if(isset($_POST['submit'])) $form
$ilUser
Definition: imgupload.php:18
$text
Definition: errorreport.php:18