ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilObjDataCollectionGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
4
5require_once('./Services/Object/classes/class.ilObject2GUI.php');
6require_once('./Services/Export/classes/class.ilExportGUI.php');
7require_once('./Services/YUI/classes/class.ilYuiUtil.php');
8require_once('./Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php');
9
33
34 /*
35 * __construct
36 */
37 const GET_DCL_GTR = "dcl_gtr";
38 const GET_REF_ID = "ref_id";
39
40
41 public function __construct($a_id = 0, $a_id_type = self::REPOSITORY_NODE_ID, $a_parent_node_id = 0) {
42 global $lng, $ilCtrl, $tpl;
43
44 parent::__construct($a_id, $a_id_type, $a_parent_node_id);
45
46 $lng->loadLanguageModule("dcl");
47
48 if (isset($_REQUEST['table_id'])) {
49 $this->table_id = $_REQUEST['table_id'];
50 } elseif ($a_id > 0) {
51 $this->table_id = $this->object->getMainTableId();
52 }
56 if (!$ilCtrl->isAsynch()) {
59 $tpl->addJavaScript('Modules/DataCollection/js/ilDataCollection.js');
60 $tpl->addJavaScript("Modules/DataCollection/js/datacollection.js");
61 $this->tpl->addOnLoadCode("ilDataCollection.setEditUrl('" . $ilCtrl->getLinkTargetByClass(array(
62 'ilrepositorygui',
63 'ilobjdatacollectiongui',
64 'ildatacollectionrecordeditgui'
65 ), 'edit', '', true) . "');");
66 $this->tpl->addOnLoadCode("ilDataCollection.setCreateUrl('" . $ilCtrl->getLinkTargetByClass(array(
67 'ilrepositorygui',
68 'ilobjdatacollectiongui',
69 'ildatacollectionrecordeditgui'
70 ), 'create', '', true) . "');");
71 $this->tpl->addOnLoadCode("ilDataCollection.setSaveUrl('" . $ilCtrl->getLinkTargetByClass(array(
72 'ilrepositorygui',
73 'ilobjdatacollectiongui',
74 'ildatacollectionrecordeditgui'
75 ), 'save', '', true) . "');");
76 $this->tpl->addOnLoadCode("ilDataCollection.setDataUrl('" . $ilCtrl->getLinkTargetByClass(array(
77 'ilrepositorygui',
78 'ilobjdatacollectiongui',
79 'ildatacollectionrecordeditgui'
80 ), 'getRecordData', '', true) . "');");
81 }
82 $ilCtrl->saveParameter($this, "table_id");
83 }
84
85
89 public function getStandardCmd() {
90 return "render";
91 }
92
93
97 public function getType() {
98 return "dcl";
99 }
100
101
106 public function executeCommand() {
107 global $ilCtrl, $ilTabs, $ilNavigationHistory, $ilUser, $tpl;
111 // Navigation History
112 $link = $ilCtrl->getLinkTarget($this, "render");
113
114 if ($this->object != NULL) {
115 $ilNavigationHistory->addItem($this->object->getRefId(), $link, "dcl");
116 }
117
118 // Direct-Link Resource, redirect to viewgui
119 if ($_GET[self::GET_DCL_GTR]) {
120 $ilCtrl->setParameterByClass('ildatacollectionrecordviewgui', 'record_id', $_GET[self::GET_DCL_GTR]);
121 $ilCtrl->redirectByClass('ildatacollectionrecordviewgui', 'renderRecord');
122 }
123
124 $next_class = $ilCtrl->getNextClass($this);
125
126 if (!$this->getCreationMode() AND $next_class != "ilinfoscreengui" AND !$this->checkPermissionBool("read")) {
127 $tpl->getStandardTemplate();
128 $tpl->setContent("Permission Denied.");
129
130 return;
131 }
132
133 switch ($next_class) {
134 case "ilinfoscreengui":
135 $this->prepareOutput();
136 $ilTabs->activateTab("id_info");
137 $this->infoScreenForward();
138 break;
139
140 case "ilcommonactiondispatchergui":
141 require_once('./Services/Object/classes/class.ilCommonActionDispatcherGUI.php');
143 $gui->enableCommentsSettings(false);
144 $this->ctrl->forwardCommand($gui);
145 break;
146
147 case "ilpermissiongui":
148 $this->prepareOutput();
149 $ilTabs->activateTab("id_permissions");
150 require_once('./Services/AccessControl/classes/class.ilPermissionGUI.php');
151 $perm_gui = new ilPermissionGUI($this);
152 $this->ctrl->forwardCommand($perm_gui);
153 break;
154
155 case "ilobjectcopygui":
156 require_once('./Services/Object/classes/class.ilObjectCopyGUI.php');
157 $cp = new ilObjectCopyGUI($this);
158 $cp->setType("dcl");
159 $tpl->getStandardTemplate();
160 $this->ctrl->forwardCommand($cp);
161 break;
162
163 case "ildatacollectionfieldlistgui":
164 $this->prepareOutput();
165 $this->addListFieldsTabs("list_fields");
166 $ilTabs->setTabActive("id_fields");
167 require_once('./Modules/DataCollection/classes/class.ilDataCollectionFieldListGUI.php');
168 $fieldlist_gui = new ilDataCollectionFieldListGUI($this, $this->table_id);
169 $this->ctrl->forwardCommand($fieldlist_gui);
170 break;
171
172 case "ildatacollectiontableeditgui":
173 $this->prepareOutput();
174 $ilTabs->setTabActive("id_fields");
175 require_once('./Modules/DataCollection/classes/class.ilDataCollectionTableEditGUI.php');
176 $tableedit_gui = new ilDataCollectionTableEditGUI($this);
177 $this->ctrl->forwardCommand($tableedit_gui);
178 break;
179
180 case "ildatacollectionfieldeditgui":
181 $this->prepareOutput();
182 $ilTabs->activateTab("id_fields");
183 require_once('./Modules/DataCollection/classes/class.ilDataCollectionFieldEditGUI.php');
184 $fieldedit_gui = new ilDataCollectionFieldEditGUI($this, $this->table_id, $_REQUEST["field_id"]);
185 $this->ctrl->forwardCommand($fieldedit_gui);
186 break;
187
188 case "ildatacollectionrecordlistgui":
189 $this->addHeaderAction(false);
190 $this->prepareOutput();
191 $ilTabs->activateTab("id_records");
192 require_once('./Modules/DataCollection/classes/class.ilDataCollectionRecordListGUI.php');
193 $recordlist_gui = new ilDataCollectionRecordListGUI($this, $this->table_id);
194 $this->ctrl->forwardCommand($recordlist_gui);
195 break;
196
197 case "ildatacollectionrecordeditgui":
198 $this->prepareOutput();
199 $ilTabs->activateTab("id_records");
200 require_once('./Modules/DataCollection/classes/class.ilDataCollectionRecordEditGUI.php');
201 $recordedit_gui = new ilDataCollectionRecordEditGUI($this);
202 $this->ctrl->forwardCommand($recordedit_gui);
203 break;
204
205 case "ildatacollectionrecordviewviewdefinitiongui":
206 $this->prepareOutput();
207
208 // page editor will set its own tabs
209 $ilTabs->clearTargets();
210 $ilTabs->setBackTarget($this->lng->txt("back"), $ilCtrl->getLinkTargetByClass("ildatacollectionfieldlistgui", "listFields"));
211
212 require_once('./Modules/DataCollection/classes/class.ilDataCollectionRecordViewViewdefinitionGUI.php');
213 $recordedit_gui = new ilDataCollectionRecordViewViewdefinitionGUI($this->table_id);
214
215 // needed for editor
216 $recordedit_gui->setStyleId(ilObjStyleSheet::getEffectiveContentStyleId(0, "dcl"));
217
218 if (!$this->checkPermissionBool("write")) {
219 $recordedit_gui->setEnableEditing(false);
220 }
221
222 $ret = $this->ctrl->forwardCommand($recordedit_gui);
223 if ($ret != "") {
224 $this->tpl->setContent($ret);
225 }
226
227 $ilTabs->removeTab('history');
228 $ilTabs->removeTab('clipboard'); // Fixme
229 $ilTabs->removeTab('pg');
230 break;
231
232 case "ildatacollectionrecordlistviewdefinitiongui":
233 $this->prepareOutput();
234 $this->addListFieldsTabs("list_viewdefinition");
235 $ilTabs->setTabActive("id_fields");
236 require_once('./Modules/DataCollection/classes/class.ilDataCollectionRecordListViewdefinitionGUI.php');
237 $recordlist_gui = new ilDataCollectionRecordListViewdefinitionGUI($this, $this->table_id);
238 $this->ctrl->forwardCommand($recordlist_gui);
239 break;
240
241 case "ilobjfilegui":
242 $this->prepareOutput();
243 $ilTabs->setTabActive("id_records");
244 require_once('./Modules/File/classes/class.ilObjFile.php');
245 $file_gui = new ilObjFile($this);
246 $this->ctrl->forwardCommand($file_gui);
247 break;
248
249 case "ildatacollectionrecordviewgui":
250 $this->prepareOutput();
251 require_once('./Modules/DataCollection/classes/class.ilDataCollectionRecordViewGUI.php');
252 $recordview_gui = new ilDataCollectionRecordViewGUI($this);
253 $this->ctrl->forwardCommand($recordview_gui);
254 $ilTabs->clearTargets();
255 $ilTabs->setBackTarget($this->lng->txt("back"), $ilCtrl->getLinkTargetByClass("ilObjDataCollectionGUI", ""));
256 break;
257
258 case "ilratinggui":
259 $rgui = new ilRatingGUI();
260 $rgui->setObject($_GET['record_id'], "dcl_record", $_GET["field_id"], "dcl_field");
261 $rgui->executeCommand();
262 $ilCtrl->redirectByClass("ilDataCollectionRecordListGUI", "listRecords");
263 break;
264
265 case 'ilnotegui':
266 $this->prepareOutput();
267 require_once('./Modules/DataCollection/classes/class.ilDataCollectionRecordViewGUI.php');
268 // Forward the command to recordViewGUI
269 $recordviewGui = new ilDataCollectionRecordViewGUI($this);
270 $this->ctrl->forwardCommand($recordviewGui);
271 $ilTabs->clearTargets();
272 $ilTabs->setBackTarget($this->lng->txt("back"), $ilCtrl->getLinkTargetByClass("ilObjDataCollectionGUI", ""));
273 break;
274 case "ilexportgui":
275 $this->prepareOutput();
276 $ilTabs->setTabActive("export");
277// $this->setLocator();
278 $exp_gui = new ilExportGUI($this);
279 $exp_gui->addFormat("xml");
280 $this->ctrl->forwardCommand($exp_gui);
281 break;
282 default:
283 return parent::executeCommand();
284 }
285
286 return true;
287 }
288
289
295 public function infoScreen() {
296 $this->ctrl->setCmd("showSummary");
297 $this->ctrl->setCmdClass("ilinfoscreengui");
298 $this->infoScreenForward();
299 }
300
301
305 public function render() {
306 global $ilCtrl;
307
308 $ilCtrl->redirectByClass("ildatacollectionrecordlistgui", "listRecords");
309 }
310
311
315 public function infoScreenForward() {
316 global $ilTabs, $ilErr;
317
318 $ilTabs->activateTab("id_info");
319
320 if (!$this->checkPermissionBool("visible")) {
321 $ilErr->raiseError($this->lng->txt("msg_no_perm_read"));
322 }
323
324 require_once('./Services/InfoScreen/classes/class.ilInfoScreenGUI.php');
325 $info = new ilInfoScreenGUI($this);
326 $info->enablePrivateNotes();
327 $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
328
329 $this->ctrl->forwardCommand($info);
330 }
331
332
333 public function addLocatorItems() {
334 global $ilLocator;
335
336 if (is_object($this->object)) {
337 $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, ""), "", $this->node_id);
338 }
339 }
340
341
345 public static function _goto($a_target) {
346 $id = explode("_", $a_target);
347
348 $_GET["baseClass"] = "ilRepositoryGUI";
349 $_GET[self::GET_REF_ID] = $id[0];
350 $_GET[self::GET_DCL_GTR] = $id[1]; //recordID
351 $_GET["cmd"] = "listRecords";
352 require_once('./ilias.php');
353 exit;
354 }
355
356
362 protected function initCreationForms($a_new_type) {
363 $forms = parent::initCreationForms($a_new_type);
364
365 return $forms;
366 }
367
368
372 protected function afterSave(ilObject $a_new_object) {
373 ilUtil::sendSuccess($this->lng->txt("object_added"), true);
374 $this->ctrl->redirectByClass("ilDataCollectionFieldListGUI", "listFields");
375 }
376
377
384 public function setTabs() {
385 global $ilAccess, $ilTabs, $lng, $ilHelp;
386
387 $ilHelp->setScreenIdComponent("dcl");
388
389 // list records
390 if ($ilAccess->checkAccess('read', "", $this->object->getRefId())) {
391 $ilTabs->addTab("id_records", $lng->txt("content"), $this->ctrl->getLinkTargetByClass("ildatacollectionrecordlistgui", "listRecords"));
392 }
393
394 // info screen
395 if ($ilAccess->checkAccess('visible', "", $this->object->getRefId())) {
396 $ilTabs->addTab("id_info", $lng->txt("info_short"), $this->ctrl->getLinkTargetByClass("ilinfoscreengui", "showSummary"));
397 }
398
399 // settings
400 if ($ilAccess->checkAccess('write', "", $this->object->getRefId())) {
401 $ilTabs->addTab("id_settings", $lng->txt("settings"), $this->ctrl->getLinkTarget($this, "editObject"));
402 }
403
404 // list fields
405 if ($ilAccess->checkAccess('write', "", $this->object->getRefId())) {
406 $ilTabs->addTab("id_fields", $lng->txt("dcl_list_fields"), $this->ctrl->getLinkTargetByClass("ildatacollectionfieldlistgui", "listFields"));
407 }
408
409 // export
410 if ($ilAccess->checkAccess("write", "", $this->object->getRefId())) {
411 $ilTabs->addTab("export", $lng->txt("export"), $this->ctrl->getLinkTargetByClass("ilexportgui", ""));
412 }
413
414 // edit permissions
415 if ($ilAccess->checkAccess('edit_permission', "", $this->object->getRefId())) {
416 $ilTabs->addTab("id_permissions", $lng->txt("perm_settings"), $this->ctrl->getLinkTargetByClass("ilpermissiongui", "perm"));
417 }
418 }
419
420
424 public function addListFieldsTabs($a_active) {
425 global $ilTabs, $ilCtrl, $lng;
426
427 $ilTabs->addSubTab("list_fields", $lng->txt("dcl_list_fields"), $ilCtrl->getLinkTargetByClass("ildatacollectionfieldlistgui", "listFields"));
428
429 $ilCtrl->setParameterByClass("ildatacollectionrecordviewviewdefinitiongui", "table_id", $this->table_id);
430 $ilTabs->addSubTab("view_viewdefinition", $lng->txt("dcl_record_view_viewdefinition"), $ilCtrl->getLinkTargetByClass("ildatacollectionrecordviewviewdefinitiongui", "edit"));
431
432 $ilTabs->activateSubTab($a_active);
433 }
434
435
439 protected function initEditCustomForm(ilPropertyFormGUI $a_form) {
440 global $ilCtrl, $ilErr, $ilTabs;
441
442 $ilTabs->activateTab("id_settings");
443
444 // is_online
445 $cb = new ilCheckboxInputGUI($this->lng->txt("online"), "is_online");
446 $cb->setInfo($this->lng->txt("dcl_online_info"));
447 $a_form->addItem($cb);
448
449 // Notification
450 $cb = new ilCheckboxInputGUI($this->lng->txt("dcl_activate_notification"), "notification");
451 $cb->setInfo($this->lng->txt("dcl_notification_info"));
452 $a_form->addItem($cb);
453 }
454
455
459 public function listRecords() {
460 global $ilCtrl;
461
462 $ilCtrl->redirectByClass("ildatacollectionrecordlistgui", "listRecords");
463 }
464
465
469 public function getDataCollectionObject() {
470 $obj = new ilObjDataCollection($this->ref_id, true);
471
472 return $obj;
473 }
474
475
481 public function getEditFormCustomValues(array &$a_values) {
482 $a_values["is_online"] = $this->object->getOnline();
483 $a_values["rating"] = $this->object->getRating();
484 $a_values["public_notes"] = $this->object->getPublicNotes();
485 $a_values["approval"] = $this->object->getApproval();
486 $a_values["notification"] = $this->object->getNotification();
487
488 return $a_values;
489 }
490
491
495 public function updateCustom(ilPropertyFormGUI $a_form) {
496 global $ilUser;
497
498 $this->object->setOnline($a_form->getInput("is_online"));
499 $this->object->setRating($a_form->getInput("rating"));
500 $this->object->setPublicNotes($a_form->getInput("public_notes"));
501 $this->object->setApproval($a_form->getInput("approval"));
502 $this->object->setNotification($a_form->getInput("notification"));
503 $this->emptyInfo();
504 }
505
506
507 private function emptyInfo() {
508 global $lng;
509 $this->table = ilDataCollectionCache::getTableCache($this->object->getMainTableId());
510 $tables = $this->object->getTables();
511 if (count($tables) == 1 AND count($this->table->getRecordFields()) == 0 AND count($this->table->getRecords()) == 0
512 AND $this->object->getOnline()
513 ) {
514 ilUtil::sendInfo($lng->txt("dcl_no_content_warning"), true);
515 }
516 }
517
518
519
520 public function toggleNotification() {
521 global $ilCtrl, $ilUser;
522
523 require_once('./Services/Notification/classes/class.ilNotification.php');
524 switch ($_GET["ntf"]) {
525 case 1:
527 break;
528 case 2:
530 break;
531 }
532 $ilCtrl->redirectByClass("ildatacollectionrecordlistgui", "listRecords");
533 }
534
535
541 public function addHeaderAction($a_redraw = false) {
542 global $ilUser, $ilAccess, $tpl, $lng, $ilCtrl;
543
544 require_once('./Services/Object/classes/class.ilCommonActionDispatcherGUI.php');
545 $dispatcher = new ilCommonActionDispatcherGUI(ilCommonActionDispatcherGUI::TYPE_REPOSITORY, $ilAccess, "dcl", $this->ref_id, $this->obj_id);
546
547 require_once('./Services/Object/classes/class.ilObjectListGUI.php');
548 ilObjectListGUI::prepareJSLinks($this->ctrl->getLinkTarget($this, "redrawHeaderAction", "", true), $ilCtrl->getLinkTargetByClass(array(
549 "ilcommonactiondispatchergui",
550 "ilnotegui"
551 ), "", "", true, false), $ilCtrl->getLinkTargetByClass(array( "ilcommonactiondispatchergui", "iltagginggui" ), "", "", true, false));
552
553 $lg = $dispatcher->initHeaderAction();
554 //$lg->enableNotes(true);
555 //$lg->enableComments(ilObjWiki::_lookupPublicNotes($this->getPageObject()->getParentId()), false);
556
557 // notification
558 if ($ilUser->getId() != ANONYMOUS_USER_ID AND $this->object->getNotification() == 1) {
559 require_once('./Services/Notification/classes/class.ilNotification.php');
561 //Command Activate Notification
562 $ilCtrl->setParameter($this, "ntf", 1);
563 $lg->addCustomCommand($ilCtrl->getLinkTarget($this, "toggleNotification"), "dcl_notification_deactivate_dcl");
564
565 $lg->addHeaderIcon("not_icon", ilUtil::getImagePath("notification_on.svg"), $lng->txt("dcl_notification_activated"));
566 } else {
567 //Command Deactivate Notification
568 $ilCtrl->setParameter($this, "ntf", 2);
569 $lg->addCustomCommand($ilCtrl->getLinkTarget($this, "toggleNotification"), "dcl_notification_activate_dcl");
570
571 $lg->addHeaderIcon("not_icon", ilUtil::getImagePath("notification_off.svg"), $lng->txt("dcl_notification_deactivated"));
572 }
573 $ilCtrl->setParameter($this, "ntf", "");
574 }
575
576 if (!$a_redraw) {
577 $tpl->setHeaderActionMenu($lg->getHeaderAction());
578 } else {
579 return $lg->getHeaderAction();
580 }
581
582 $tpl->setHeaderActionMenu($lg->getHeaderAction());
583 }
584}
585
586?>
$_GET["client_id"]
This class represents a checkbox property in a property form.
Class ilCommonActionDispatcherGUI.
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
Class ilDataCollectionFieldEditGUI.
Class ilDataCollectionFieldListGUI.
Class ilDataCollectionRecordEditGUI.
Class ilDataCollectionRecordListGUI.
Class ilDataCollectionRecordViewGUI.
Export User Interface Class.
Class ilInfoScreenGUI.
static setNotification($type, $user_id, $id, $status=true)
Set notification status for object and user.
static hasNotification($type, $user_id, $id)
Check notification status for object and user.
Class ilObjDataCollectionGUI.
render()
show Content; redirect to ilDataCollectionRecordListGUI::listRecords
infoScreenForward()
show information screen
addLocatorItems()
Functions to be overwritten.
setTabs()
setTabs create tabs (repository/workspace switch)
initEditCustomForm(ilPropertyFormGUI $a_form)
updateCustom(ilPropertyFormGUI $a_form)
infoScreen()
this one is called from the info button in the repository not very nice to set cmdClass/Cmd manually,...
Class ilObjDataCollection.
Class ilObjFile.
static getEffectiveContentStyleId($a_style_id, $a_type="")
Get effective Style Id.
New implementation of ilObjectGUI.
& executeCommand()
execute command
__construct($a_id=0, $a_id_type=self::REPOSITORY_NODE_ID, $a_parent_node_id=0)
Constructor.
prepareOutput()
prepare output
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_node_id=null)
Check permission.
getCreationMode()
get creation mode
GUI class for the workflow of copying objects.
addHeaderAction()
Add header action menu.
Class ilObject Basic functions for all objects.
static initJavascript()
Init javascript.
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
This class represents a property form user interface.
addItem($a_item)
Add Item (Property, SectionHeader).
getInput($a_post_var, $ensureValidation=true)
Returns the value of a HTTP-POST variable, identified by the passed id.
Class ilRatingGUI.
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static initConnection()
Init YUI Connection module.
$lg
Definition: example_018.php:62
$info
Definition: example_052.php:80
global $ilCtrl
Definition: ilias.php:18
exit
Definition: login.php:54
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
global $ilUser
Definition: imgupload.php:15