ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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 {
33 case 'ilinfoscreengui':
34 // forwards command
35 $this->infoScreen();
36 break;
37
38 case 'ilpermissiongui':
39 $ilTabs->activateTab('id_permissions');
40 include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
41 $this->ctrl->forwardCommand(new ilPermissionGUI($this));
42 break;
43
44 case "ilcommonactiondispatchergui":
45 include_once("Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
47 $this->ctrl->forwardCommand($gui);
48 break;
49
50 default:
51 if(!$cmd || $cmd == 'view')
52 {
53 $cmd = "editSettings";
54 }
55 $cmd .= "Object";
56 $this->$cmd();
57 break;
58 }
59 return true;
60 }
61
65 public function showObject()
66 {
67 global $ilUser;
68
69 if($ilUser->getId() == ANONYMOUS_USER_ID ||
70 $this->object->isLocalObject())
71 {
72 ilUtil::redirect($this->object->getRemoteLink());
73 }
74 else
75 {
76 $link = $this->object->getFullRemoteLink();
77 ilUtil::redirect($link);
78 }
79 }
80
84 public function setTabs()
85 {
86 global $ilTabs;
87
88 if($this->checkPermissionBool('visible'))
89 {
90 $ilTabs->addTab("info", $this->lng->txt("info_short"),
91 $this->ctrl->getLinkTarget($this, "infoScreen"));
92 }
93
94 if($this->checkPermissionBool('write'))
95 {
96 $ilTabs->addTab("edit", $this->lng->txt("edit"),
97 $this->ctrl->getLinkTarget($this, "edit"));
98 }
99
100 // will add permissions if needed
101 parent::setTabs();
102 }
103
109 public function callObject()
110 {
111 include_once './Services/Tracking/classes/class.ilChangeEvent.php';
113 $this->getType(),
114 $this->object->getRefId(),
115 $this->object->getId(),
116 $GLOBALS['ilUser']->getId()
117 );
118
119
120 // check if the assigned object is hosted on the same installation
121 $link = $this->object->getFullRemoteLink();
122 if($link)
123 {
124 ilUtil::redirect($link);
125 return true;
126 }
127 else
128 {
129 ilUtil::sendFailure('Cannot call remote object.');
130 $this->infoScreenObject();
131 return false;
132 }
133 }
134
141 {
142 $this->ctrl->setCmd("showSummary");
143 $this->ctrl->setCmdClass("ilinfoscreengui");
144 $this->infoScreen();
145 }
146
150 public function infoScreen()
151 {
152 global $ilErr,$ilUser,$ilTabs;
153
154 if(!$this->checkPermissionBool('visible'))
155 {
156 $ilErr->raiseError($this->lng->txt('msg_no_perm_read'),$ilErr->MESSAGE);
157 }
158
159 $ilTabs->activateTab('info');
160
161 include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
162 $info = new ilInfoScreenGUI($this);
163
164 if($ilUser->getId() == ANONYMOUS_USER_ID ||
165 $this->object->isLocalObject())
166 {
167 $info->addButton($this->lng->txt($this->getType().'_call'),
168 $this->object->getRemoteLink(),
169 'target="_blank"');
170 }
171 else
172 {
173 $info->addButton($this->lng->txt($this->getType().'_call'),
174 $this->ctrl->getLinkTarget($this,'call'),
175 'target="_blank"');
176 }
177
178 $info->addSection($this->lng->txt('ecs_general_info'));
179 $info->addProperty($this->lng->txt('title'),$this->object->getTitle());
180 if(strlen($this->object->getOrganization()))
181 {
182 $info->addProperty($this->lng->txt('organization'),$this->object->getOrganization());
183 }
184 if(strlen($this->object->getDescription()))
185 {
186 $info->addProperty($this->lng->txt('description'),$this->object->getDescription());
187 }
188 if(strlen($loc = $this->object->getLocalInformation()))
189 {
190 $info->addProperty($this->lng->txt('ecs_local_information'),$this->object->getLocalInformation());
191 }
192
194
195 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordGUI.php');
197 $this->getType(),$this->object->getId());
198 $record_gui->setInfoObject($info);
199 $record_gui->parse();
200
201 $this->ctrl->forwardCommand($info);
202 }
203
209 protected function addCustomInfoFields(ilInfoScreenGUI $a_info)
210 {
211
212 }
213
219 public function editObject(ilPropertyFormGUI $a_form = null)
220 {
221 global $ilErr,$ilTabs;
222
223 if(!$this->checkPermissionBool('write'))
224 {
225 $ilErr->raiseError($this->lng->txt('msg_no_perm_read'),$ilErr->MESSAGE);
226 }
227
228 $ilTabs->activateTab('edit');
229
230 if(!$a_form)
231 {
232 $a_form = $this->initEditForm();
233 }
234 $this->tpl->setContent($a_form->getHTML());
235 }
236
242 protected function initEditForm()
243 {
244 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
245 $form = new ilPropertyFormGUI();
246 $form->setFormAction($this->ctrl->getFormAction($this));
247 $form->setTitle($this->lng->txt('ecs_general_info'));
248 $form->addCommandButton('update',$this->lng->txt('save'));
249 $form->addCommandButton('edit',$this->lng->txt('cancel'));
250
251 $text = new ilTextInputGUI($this->lng->txt('title'),'title');
252 $text->setValue($this->object->getTitle());
253 $text->setSize(min(40, ilObject::TITLE_LENGTH));
254 $text->setMaxLength(ilObject::TITLE_LENGTH);
255 $text->setDisabled(true);
256 $form->addItem($text);
257
258 $area = new ilTextAreaInputGUI($this->lng->txt('description'),'description');
259 $area->setValue($this->object->getDescription());
260 $area->setRows(3);
261 $area->setCols(80);
262 $area->setDisabled(true);
263 $form->addItem($area);
264
265 $area = new ilTextAreaInputGUI($this->lng->txt('ecs_local_information'),'local_info');
266 $area->setValue($this->object->getLocalInformation());
267 $area->setRows(3);
268 $area->setCols(80);
269 $form->addItem($area);
270
271 $this->addCustomEditForm($form);
272
273 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordGUI.php');
275 $this->getType(),$this->object->getId());
276 $record_gui->setPropertyForm($form);
277 $record_gui->parse();
278
279 return $form;
280 }
281
287 protected function addCustomEditForm(ilPropertyFormGUI $a_form)
288 {
289
290 }
291
295 public function updateObject()
296 {
297 global $ilErr;
298
299 if(!$this->checkPermissionBool('write'))
300 {
301 $ilErr->raiseError($this->lng->txt('msg_no_perm_read'),$ilErr->MESSAGE);
302 }
303
304 $form = $this->initEditForm();
305 if($form->checkInput())
306 {
307 $this->object->setLocalInformation($a_form->getInput('local_info'));
308
309 $this->updateCustomValues($form);
310
311 $this->object->update();
312
313 // Save advanced meta data
314 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordGUI.php');
316 $this->getType(), $this->object->getId());
317 $record_gui->loadFromPost();
318 $record_gui->saveValues();
319
320 ilUtil::sendSuccess($this->lng->txt("settings_saved"));
321 $this->editObject();
322 }
323
324 $form->setValuesByPost();
325 $this->editObject($form);
326 }
327
333 protected function updateCustomValues(ilPropertyFormGUI $a_form)
334 {
335
336 }
337
343 public static function _goto($a_target)
344 {
345 global $ilErr, $lng, $ilAccess;
346
347 //static if ($this->checkPermissionBool("visible", "", "", $a_target))
348 if($ilAccess->checkAccess('visible','',$a_target))
349 {
350 $_GET["cmd"] = "infoScreen";
351 $_GET["ref_id"] = $a_target;
352 $_GET["baseClass"] = "ilRepositoryGUI";
353 include("ilias.php");
354 exit;
355 }
356 //static else if ($this->checkPermissionBool("read", "", "", ROOT_FOLDER_ID))
357 if($ilAccess->checkAccess('read','',ROOT_FOLDER_ID))
358 {
359 $_GET["cmd"] = "frameset";
360 $_GET["target"] = "";
361 $_GET["ref_id"] = ROOT_FOLDER_ID;
362 ilUtil::sendFailure(sprintf($lng->txt("msg_no_perm_read_item"),
364 $_GET["baseClass"] = "ilRepositoryGUI";
365 include("ilias.php");
366 exit;
367 }
368
369 $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
370 }
371}
372
373?>
$_GET["client_id"]
_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()
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)
http redirect to other script
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$text
$info
Definition: example_052.php:80
$GLOBALS['PHPCAS_CLIENT']
This global variable is used by the interface class phpCAS.
Definition: CAS.php:276
exit
Definition: login.php:54
$cmd
Definition: sahs_server.php:35
global $ilUser
Definition: imgupload.php:15