ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilObjFileGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 require_once "./Services/Object/classes/class.ilObject2GUI.php";
5 require_once "./Modules/File/classes/class.ilObjFile.php";
6 require_once "./Modules/File/classes/class.ilObjFileAccess.php";
7 
20 {
21  function getType()
22  {
23  return "file";
24  }
25 
26  // ???
27  function _forwards()
28  {
29  return array();
30  }
31 
32  function executeCommand()
33  {
34  global $ilNavigationHistory, $ilCtrl, $ilUser, $ilTabs, $ilAccess, $ilErr;
35 
36  $next_class = $this->ctrl->getNextClass($this);
37  $cmd = $this->ctrl->getCmd();
38 
39  if(!$this->getCreationMode())
40  {
41  // do not move this payment block!!
42  if(IS_PAYMENT_ENABLED)
43  {
44  include_once './Services/Payment/classes/class.ilPaymentObject.php';
45  if(ANONYMOUS_USER_ID == $ilUser->getId() && isset($_GET['transaction']))
46  {
47  $transaction = $_GET['transaction'];
48  include_once './Services/Payment/classes/class.ilPaymentBookings.php';
49  $valid_transaction = ilPaymentBookings::_readBookingByTransaction($transaction);
50  }
51 
52  if(ilPaymentObject::_requiresPurchaseToAccess($this->node_id, $type = (isset($_GET['purchasetype'])
53  ? $_GET['purchasetype'] : NULL) ))
54  {
55  $this->setLocator();
56  $this->tpl->getStandardTemplate();
57 
58  include_once './Services/Payment/classes/class.ilShopPurchaseGUI.php';
59  $pp = new ilShopPurchaseGUI((int)$this->node_id);
60  $ret = $this->ctrl->forwardCommand($pp);
61  return true;
62  }
63  }
64  else if($this->id_type == self::REPOSITORY_NODE_ID
65  && $this->checkPermissionBool("read"))
66  {
67  $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $this->node_id);
68  $link = $ilCtrl->getLinkTargetByClass("ilrepositorygui", "infoScreen");
69  $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $_GET["ref_id"]);
70 
71  // add entry to navigation history
72  $ilNavigationHistory->addItem($this->node_id,
73  $link, "file");
74  }
75  }
76 
77  $this->prepareOutput();
78 
79  switch ($next_class)
80  {
81  case "ilinfoscreengui":
82  $this->infoScreenForward(); // forwards command
83  break;
84 
85  case 'ilmdeditorgui':
86  if(!$this->checkPermissionBool("write"))
87  {
88  $ilErr->raiseError($this->lng->txt('permission_denied'),$ilErr->WARNING);
89  }
90 
91  $ilTabs->activateTab("id_meta");
92 
93  include_once 'Services/MetaData/classes/class.ilMDEditorGUI.php';
94 
95  $md_gui =& new ilMDEditorGUI($this->object->getId(), 0, $this->object->getType());
96  $md_gui->addObserver($this->object,'MDUpdateListener','General');
97 
98  // todo: make this work
99  $md_gui->addObserver($this->object,'MDUpdateListener','Technical');
100 
101  $this->ctrl->forwardCommand($md_gui);
102  break;
103 
104  // repository permissions
105  case 'ilpermissiongui':
106  $ilTabs->activateTab("id_permissions");
107  include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
108  $perm_gui =& new ilPermissionGUI($this);
109  $ret =& $this->ctrl->forwardCommand($perm_gui);
110  break;
111 
112  case "ilexportgui":
113  $ilTabs->activateTab("export");
114  include_once("./Services/Export/classes/class.ilExportGUI.php");
115  $exp_gui = new ilExportGUI($this);
116  $exp_gui->addFormat("xml");
117  $ret = $this->ctrl->forwardCommand($exp_gui);
118  break;
119 
120  case 'ilobjectcopygui':
121  include_once './Services/Object/classes/class.ilObjectCopyGUI.php';
122  $cp = new ilObjectCopyGUI($this);
123  $cp->setType('file');
124  $this->ctrl->forwardCommand($cp);
125  break;
126 
127  // personal workspace permissions
128  case "ilworkspaceaccessgui";
129  $ilTabs->activateTab("id_permissions");
130  include_once('./Services/PersonalWorkspace/classes/class.ilWorkspaceAccessGUI.php');
131  $wspacc = new ilWorkspaceAccessGUI($this->node_id, $this->getAccessHandler());
132  $this->ctrl->forwardCommand($wspacc);
133  break;
134 
135  // personal workspace header actions
136  case "ilcommonactiondispatchergui":
137  include_once("Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
139  $this->ctrl->forwardCommand($gui);
140  break;
141 
142  default:
143  // in personal workspace use object2gui
144  if($this->id_type == self::WORKSPACE_NODE_ID)
145  {
146  $this->addHeaderAction();
147 
148  // coming from goto we need default command
149  if (empty($cmd))
150  {
151  $ilCtrl->setCmd("infoScreen");
152  }
153  $ilTabs->clearTargets();
154  return parent::executeCommand();
155  }
156 
157  if (empty($cmd))
158  {
159  $cmd = "infoScreen";
160  }
161 
162  $this->$cmd();
163  break;
164  }
165 
166  $this->addHeaderAction();
167  }
168 
169  protected function initCreationForms()
170  {
171  $forms = array();
172  $forms[] = $this->initSingleUploadForm();
173  $forms[] = $this->initZipUploadForm();
174 
175  // repository only
176  if($this->id_type != self::WORKSPACE_NODE_ID)
177  {
178  $forms[self::CFORM_CLONE] = $this->fillCloneTemplate(null, "file");
179  }
180 
181  return $forms;
182  }
183 
187  public function initSingleUploadForm()
188  {
189  global $lng;
190 
191  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
192  $single_form_gui = new ilPropertyFormGUI();
193  $single_form_gui->setMultipart(true);
194 
195  // File Title
196  $in_title = new ilTextInputGUI($lng->txt("title"), "title");
197  $in_title->setInfo($this->lng->txt("if_no_title_then_filename"));
198  $in_title->setMaxLength(128);
199  $in_title->setSize(40);
200  $single_form_gui->addItem($in_title);
201 
202  // File Description
203  $in_descr = new ilTextAreaInputGUI($lng->txt("description"), "description");
204  $single_form_gui->addItem($in_descr);
205 
206  // File
207  $in_file = new ilFileInputGUI($lng->txt("file"), "upload_file");
208  $in_file->setRequired(true);
209  $single_form_gui->addItem($in_file);
210 
211  $single_form_gui->addCommandButton("save", $this->lng->txt($this->type."_add"));
212  $single_form_gui->addCommandButton("saveAndMeta", $this->lng->txt("file_add_and_metadata"));
213  $single_form_gui->addCommandButton("cancel", $lng->txt("cancel"));
214 
215  $single_form_gui->setTableWidth("600px");
216  $single_form_gui->setTarget($this->getTargetFrame("save"));
217  $single_form_gui->setTitle($this->lng->txt($this->type."_new"));
218  $single_form_gui->setTitleIcon(ilUtil::getImagePath('icon_file.png'), $this->lng->txt('obj_file'));
219 
220  $this->ctrl->setParameter($this, "new_type", "file");
221 
222  $single_form_gui->setFormAction($this->ctrl->getFormAction($this, "save"));
223 
224  return $single_form_gui;
225  }
226 
232  function save()
233  {
234  global $objDefinition, $ilUser;
235 
236  if (!$this->checkPermissionBool("create", "", "file"))
237  {
238  $this->ilErr->raiseError($this->lng->txt("permission_denied"),$this->ilErr->MESSAGE);
239  }
240 
241  $single_form_gui = $this->initSingleUploadForm();
242 
243  if ($single_form_gui->checkInput())
244  {
245  $title = $single_form_gui->getInput("title");
246  $description = $single_form_gui->getInput("description");
247  $upload_file = $single_form_gui->getInput("upload_file");
248 
249  if (trim($title) == "")
250  {
251  $title = $upload_file["name"];
252  }
253  else
254  {
255  // BEGIN WebDAV: Ensure that object title ends with the filename extension
256  $fileExtension = ilObjFileAccess::_getFileExtension($upload_file["name"]);
257  $titleExtension = ilObjFileAccess::_getFileExtension($title);
258  if ($titleExtension != $fileExtension && strlen($fileExtension) > 0)
259  {
260  $title .= '.'.$fileExtension;
261  }
262  // END WebDAV: Ensure that object title ends with the filename extension
263  }
264 
265  // create and insert file in grp_tree
266  include_once("./Modules/File/classes/class.ilObjFile.php");
267  $fileObj = new ilObjFile();
268  $fileObj->setTitle($title);
269  $fileObj->setDescription($description);
270  $fileObj->setFileName($upload_file["name"]);
271  //$fileObj->setFileType($upload_file["type"]);
272  include_once("./Services/Utilities/classes/class.ilMimeTypeUtil.php");
273  $fileObj->setFileType(ilMimeTypeUtil::getMimeType(
274  "", $upload_file["name"], $upload_file["type"]));
275  $fileObj->setFileSize($upload_file["size"]);
276  $this->object_id = $fileObj->create();
277 
278  $this->putObjectInTree($fileObj, $this->parent_id);
279 
280  // upload file to filesystem
281  $fileObj->createDirectory();
282  $fileObj->getUploadFile($upload_file["tmp_name"],
283  $upload_file["name"]);
284 
285  // BEGIN ChangeEvent: Record write event.
286  require_once('Services/Tracking/classes/class.ilChangeEvent.php');
287  ilChangeEvent::_recordWriteEvent($fileObj->getId(), $ilUser->getId(), 'create');
288  // END ChangeEvent: Record write event.
289 
290  ilUtil::sendSuccess($this->lng->txt("file_added"),true);
291 
292  if ($this->ctrl->getCmd() == "saveAndMeta")
293  {
294  $this->ctrl->setParameter($this, "new_type", "");
295  $target = $this->ctrl->getLinkTargetByClass(array("ilobjfilegui", "ilmdeditorgui"), "listSection", "", false, false);
296  ilUtil::redirect($target);
297  }
298  else
299  {
300  $this->ctrl->returnToParent($this);
301  }
302  }
303  else
304  {
305  $single_form_gui->setValuesByPost();
306  $this->tpl->setContent($single_form_gui->getHTML());
307  }
308  }
309 
315  function saveAndMeta()
316  {
317  $this->save();
318  }
319 
323  public function initZipUploadForm($a_mode = "create")
324  {
325  global $lng;
326 
327  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
328  $zip_form_gui = new ilPropertyFormGUI();
329  $zip_form_gui->setMultipart(true);
330 
331  // File
332  $in_file = new ilFileInputGUI($lng->txt("file"), "zip_file");
333  $in_file->setRequired(true);
334  $in_file->setSuffixes(array("zip"));
335  $zip_form_gui->addItem($in_file);
336 
337  // Take over structure
338  $in_str = new ilCheckboxInputGUI($this->lng->txt("take_over_structure"), "adopt_structure");
339  $in_str->setInfo($this->lng->txt("take_over_structure_info"));
340  $zip_form_gui->addItem($in_str);
341 
342  $zip_form_gui->addCommandButton("saveUnzip", $this->lng->txt($this->type."_add"));
343  $zip_form_gui->addCommandButton("cancel", $lng->txt("cancel"));
344 
345  $zip_form_gui->setTableWidth("600px");
346  $zip_form_gui->setTarget($this->getTargetFrame("save"));
347  $zip_form_gui->setTitle($this->lng->txt("header_zip"));
348  $zip_form_gui->setTitleIcon(ilUtil::getImagePath('icon_file.png'), $this->lng->txt('obj_file'));
349 
350  $this->ctrl->setParameter($this, "new_type", "file");
351 
352  $zip_form_gui->setFormAction($this->ctrl->getFormAction($this, "saveUnzip"));
353 
354  return $zip_form_gui;
355  }
356 
362  function saveUnzip()
363  {
364  $zip_form_gui = $this->initZipUploadForm();
365 
366  if ($this->checkPermissionBool("create", "", "file"))
367  {
368  if ($zip_form_gui->checkInput())
369  {
370  $zip_file = $zip_form_gui->getInput("zip_file");
371  $adopt_structure = $zip_form_gui->getInput("adopt_structure");
372 
373  include_once ("Services/Utilities/classes/class.ilFileUtils.php");
374 
375  // Create unzip-directory
376  $newDir = ilUtil::ilTempnam();
377  ilUtil::makeDir($newDir);
378 
379  // Check if permission is granted for creation of object, if necessary
380  if($this->id_type != self::WORKSPACE_NODE_ID)
381  {
382 
383  $type = ilObject::_lookupType((int)$this->parent_id, true);
384  }
385  else
386  {
387  $type = ilObject::_lookupType($this->tree->lookupObjectId($this->parent_id), false);
388  }
389 
390  $tree = $access_handler = null;
391  switch($type)
392  {
393  // workspace structure
394  case 'wfld':
395  case 'wsrt':
396  $permission = $this->checkPermissionBool("create", "", "wfld");
397  $containerType = "WorkspaceFolder";
398  $tree = $this->tree;
399  $access_handler = $this->getAccessHandler();
400  break;
401 
402  // use categories as structure
403  case 'cat':
404  case 'root':
405  $permission = $this->checkPermissionBool("create", "", "cat");
406  $containerType = "Category";
407  break;
408 
409  // use folders as structure (in courses)
410  default:
411  $permission = $this->checkPermissionBool("create", "", "fold");
412  $containerType = "Folder";
413  break;
414  }
415  // processZipFile (
416  // Dir to unzip,
417  // Path to uploaded file,
418  // should a structure be created (+ permission check)?
419  // ref_id of parent
420  // object that contains files (folder or category)
421  // should sendInfo be persistent?)
422  try
423  {
424  $processDone = ilFileUtils::processZipFile( $newDir,
425  $zip_file["tmp_name"],
426  ($adopt_structure && $permission),
427  $this->parent_id,
428  $containerType,
429  $tree,
431  ilUtil::sendSuccess($this->lng->txt("file_added"),true);
432  }
433  catch (ilFileUtilsException $e)
434  {
435  ilUtil::sendFailure($e->getMessage(), true);
436  }
437 
438  ilUtil::delDir($newDir);
439  $this->ctrl->returnToParent($this);
440  }
441  else
442  {
443  $zip_form_gui->setValuesByPost();
444  $this->tpl->setContent($zip_form_gui->getHTML());
445  }
446  }
447  else
448  {
449  $this->ilErr->raiseError($this->lng->txt("permission_denied"),$this->ilErr->MESSAGE);
450  }
451  }
452 
458  function update()
459  {
460  global $ilTabs;
461 
462  $form = $this->initPropertiesForm();
463  if(!$form->checkInput())
464  {
465  $ilTabs->activateTab("settings");
466  $form->setValuesByPost();
467  $this->tpl->setContent($form->getHTML());
468  return false;
469  }
470 
471  $data = $form->getInput('file');
472 
473  // delete trailing '/' in filename
474  while (substr($data["name"],-1) == '/')
475  {
476  $data["name"] = substr($data["name"],0,-1);
477  }
478 
479  $filename = empty($data["name"]) ? $this->object->getFileName() : $data["name"];
480  $title = $form->getInput('title');
481  if(strlen(trim($title)) == 0)
482  {
483  $title = $filename;
484  }
485  else
486  {
487  $title = $this->object->checkFileExtension($filename,$title);
488  }
489  $this->object->setTitle($title);
490 
491  if (!empty($data["name"]))
492  {
493  switch($form->getInput('replace'))
494  {
495  case 1:
496  $this->object->deleteVersions();
497  $this->object->clearDataDirectory();
498  $this->object->replaceFile($data['tmp_name'],$data['name']);
499  break;
500  case 0:
501  $this->object->addFileVersion($data['tmp_name'],$data['name']);
502  break;
503  }
504  $this->object->setFileName($data['name']);
505  include_once("./Services/Utilities/classes/class.ilMimeTypeUtil.php");
506  $this->object->setFileType(ilMimeTypeUtil::getMimeType(
507  "", $data["name"], $data["type"]));
508  $this->object->setFileSize($data['size']);
509  }
510  $this->object->setDescription($form->getInput('description'));
511  $this->update = $this->object->update();
512 
513  // BEGIN ChangeEvent: Record update event.
514  if (!empty($data["name"]))
515  {
516  require_once('Services/Tracking/classes/class.ilChangeEvent.php');
517  global $ilUser;
518  ilChangeEvent::_recordWriteEvent($this->object->getId(), $ilUser->getId(), 'update');
519  ilChangeEvent::_catchupWriteEvents($this->object->getId(), $ilUser->getId());
520  }
521  // END ChangeEvent: Record update event.
522 
523  // Update ecs export settings
524  include_once 'Modules/File/classes/class.ilECSFileSettings.php';
525  $ecs = new ilECSFileSettings($this->object);
526  $ecs->handleSettingsUpdate();
527 
528  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"),true);
529  ilUtil::redirect($this->ctrl->getLinkTarget($this,'edit','',false,false));
530  }
531 
537  function edit()
538  {
539  global $ilTabs, $ilErr;
540 
541  if (!$this->checkPermissionBool("write"))
542  {
543  $ilErr->raiseError($this->lng->txt("msg_no_perm_write"));
544  }
545 
546  $ilTabs->activateTab("settings");
547 
548  $form = $this->initPropertiesForm();
549 
550  $val = array();
551  $val['title'] = $this->object->getTitle();
552  $val['description'] = $this->object->getLongDescription();
553  $form->setValuesByArray($val);
554 
555  // Edit ecs export settings
556  include_once 'Modules/File/classes/class.ilECSFileSettings.php';
557  $ecs = new ilECSFileSettings($this->object);
558  $ecs->addSettingsToForm($form, 'file');
559 
560  $this->tpl->setContent($form->getHTML());
561  return true;
562  }
563 
569  protected function initPropertiesForm()
570  {
571  include_once('./Services/Form/classes/class.ilPropertyFormGUI.php');
572 
573  $this->lng->loadLanguageModule('file');
574 
575  $form = new ilPropertyFormGUI();
576  $form->setFormAction($this->ctrl->getFormAction($this),'update');
577  $form->setTitle($this->lng->txt('file_edit'));
578  $form->addCommandButton('update',$this->lng->txt('save'));
579  $form->addCommandButton('cancel',$this->lng->txt('cancel'));
580 
581  $title = new ilTextInputGUI($this->lng->txt('title'),'title');
582  $title->setValue($this->object->getTitle());
583  $title->setInfo($this->lng->txt("if_no_title_then_filename"));
584  $form->addItem($title);
585 
586  $file = new ilFileInputGUI($this->lng->txt('obj_file'),'file');
587  $file->setRequired(false);
588 // $file->enableFileNameSelection('title');
589  $form->addItem($file);
590 
591  $group = new ilRadioGroupInputGUI('','replace');
592  $group->setValue(0);
593 
594  $replace = new ilRadioOption($this->lng->txt('replace_file'),1);
595  $replace->setInfo($this->lng->txt('replace_file_info'));
596  $group->addOption($replace);
597 
598 
599  $keep = new ilRadioOption($this->lng->txt('file_new_version'),0);
600  $keep->setInfo($this->lng->txt('file_new_version_info'));
601  $group->addOption($keep);
602 
603  $file->addSubItem($group);
604 
605  $desc = new ilTextAreaInputGUI($this->lng->txt('description'),'description');
606  $desc->setRows(3);
607  #$desc->setCols(40);
608  $form->addItem($desc);
609 
610  return $form;
611  }
612 
613  function sendFile()
614  {
615  global $ilUser, $ilCtrl;
616 
617  if(ANONYMOUS_USER_ID == $ilUser->getId() && isset($_GET['transaction']) )
618  {
619  $this->object->sendFile($_GET["hist_id"]);
620  }
621 
622  if ($this->checkPermissionBool("read"))
623  {
624  // BEGIN ChangeEvent: Record read event.
625  require_once('Services/Tracking/classes/class.ilChangeEvent.php');
626  global $ilUser;
627  // Record read event and catchup with write events
628  ilChangeEvent::_recordReadEvent($this->object->getType(), $this->object->getRefId(),
629  $this->object->getId(), $ilUser->getId());
630  // END ChangeEvent: Record read event.
631 
632  $this->object->sendFile($_GET["hist_id"]);
633  }
634  else
635  {
636  $this->ilErr->raiseError($this->lng->txt("permission_denied"),$this->ilErr->MESSAGE);
637  }
638  return true;
639  }
640 
641 
647  function versions()
648  {
649  global $ilTabs;
650 
651  $ilTabs->activateTab("id_versions");
652 
653  if (!$this->checkPermissionBool("write"))
654  {
655  $this->ilErr->raiseError($this->lng->txt("permission_denied"),$this->ilErr->MESSAGE);
656  }
657 
658  require_once("./Services/History/classes/class.ilHistoryGUI.php");
659 
660  $hist_gui =& new ilHistoryGUI($this->object->getId());
661 
662  // not nice, should be changed, if ilCtrl handling
663  // has been introduced to administration
664  $hist_html = $hist_gui->getVersionsTable(
665  array("ref_id" => $this->node_id, "cmd" => "versions",
666  "cmdClass" =>$_GET["cmdClass"], "cmdNode" =>$_GET["cmdNode"]));
667 
668  $this->tpl->setVariable("ADM_CONTENT", $hist_html);
669  }
670 
676  function infoScreen()
677  {
678  $this->ctrl->setCmd("showSummary");
679  $this->ctrl->setCmdClass("ilinfoscreengui");
680  $this->infoScreenForward();
681  }
682 
686  function infoScreenForward()
687  {
688  global $ilTabs, $ilErr;
689 
690  $ilTabs->activateTab("id_info");
691 
692  if (!$this->checkPermissionBool("visible"))
693  {
694  $ilErr->raiseError($this->lng->txt("msg_no_perm_read"));
695  }
696 
697  include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
698  $info = new ilInfoScreenGUI($this);
699 
700  if ($this->checkPermissionBool("read", "sendfile"))
701  {
702  // 9876
703  $this->lng->loadLanguageModule("file");
704  $info->addButton($this->lng->txt("file_download"), $this->ctrl->getLinkTarget($this, "sendfile"));
705  }
706 
707  $info->enablePrivateNotes();
708 
709  if ($this->checkPermissionBool("read"))
710  {
711  $info->enableNews();
712  }
713 
714  // no news editing for files, just notifications
715  $info->enableNewsEditing(false);
716  if ($this->checkPermissionBool("write"))
717  {
718  $news_set = new ilSetting("news");
719  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
720 
721  if ($enable_internal_rss)
722  {
723  $info->setBlockProperty("news", "settings", true);
724  $info->setBlockProperty("news", "public_notifications_option", true);
725  }
726  }
727 
728 
729  // standard meta data
730  $info->addMetaDataSections($this->object->getId(),0, $this->object->getType());
731 
732  $info->addSection($this->lng->txt("file_info"));
733  $info->addProperty($this->lng->txt("filename"),
734  $this->object->getFileName());
735  // BEGIN WebDAV Guess file type.
736  $info->addProperty($this->lng->txt("type"),
737  $this->object->guessFileType());
738  // END WebDAV Guess file type.
739  $info->addProperty($this->lng->txt("size"),
740  ilFormat::formatSize(ilObjFile::_lookupFileSize($this->object->getId()),'long'));
741  $info->addProperty($this->lng->txt("version"),
742  $this->object->getVersion());
743 
744  include_once "./Services/History/classes/class.ilHistory.php";
745  $uploader = ilHistory::_getEntriesForObject($this->object->getId(), $this->object->getType());
746  $uploader = array_shift($uploader);
747  $uploader = $uploader["user_id"];
748 
749  $this->lng->loadLanguageModule("file");
750  include_once "Services/User/classes/class.ilUserUtil.php";
751  $info->addProperty($this->lng->txt("file_uploaded_by"), ilUserUtil::getNamePresentation($uploader));
752 
753  if($this->id_type == self::WORKSPACE_NODE_ID)
754  {
755  $info->addProperty($this->lng->txt("perma_link"), $this->getPermanentLinkWidget());
756  }
757 
758  // forward the command
759  // $this->ctrl->setCmd("showSummary");
760  // $this->ctrl->setCmdClass("ilinfoscreengui");
761  $this->ctrl->forwardCommand($info);
762  }
763 
764 
765  // get tabs
766  function setTabs()
767  {
768  global $ilTabs, $lng, $ilHelp;
769 
770  $ilHelp->setScreenIdComponent("file");
771 
772  $this->ctrl->setParameter($this,"ref_id",$this->node_id);
773 
774  if ($this->checkPermissionBool("visible"))
775  {
776  $ilTabs->addTab("id_info",
777  $lng->txt("info_short"),
778  $this->ctrl->getLinkTargetByClass(array("ilobjfilegui", "ilinfoscreengui"), "showSummary"));
779  }
780 
781  if ($this->checkPermissionBool("write"))
782  {
783  $ilTabs->addTab("settings",
784  $lng->txt("edit"),
785  $this->ctrl->getLinkTarget($this, "edit"));
786  }
787 
788  if ($this->checkPermissionBool("write"))
789  {
790  $ilTabs->addTab("id_versions",
791  $lng->txt("versions"),
792  $this->ctrl->getLinkTarget($this, "versions"));
793  }
794 
795  // meta data
796  if ($this->checkPermissionBool("write"))
797  {
798  $ilTabs->addTab("id_meta",
799  $lng->txt("meta_data"),
800  $this->ctrl->getLinkTargetByClass(array('ilobjfilegui','ilmdeditorgui'),'listSection'));
801  }
802 
803  // export
804  if ($this->checkPermissionBool("write"))
805  {
806  $ilTabs->addTab("export",
807  $lng->txt("export"),
808  $this->ctrl->getLinkTargetByClass("ilexportgui", ""));
809  }
810 
811  // will add permission tab if needed
812  parent::setTabs();
813  }
814 
815  function _goto($a_target, $a_additional = null)
816  {
817  global $ilErr, $lng, $ilAccess;
818 
819  if($a_additional && substr($a_additional, -3) == "wsp")
820  {
821  $_GET["baseClass"] = "ilsharedresourceGUI";
822  $_GET["wsp_id"] = $a_target;
823  include("ilias.php");
824  exit;
825  }
826 
827  // static method, no workspace support yet
828 
829  if ($ilAccess->checkAccess("visible", "", $a_target))
830  {
831  ilObjectGUI::_gotoRepositoryNode($a_target, "infoScreen");
832  }
833  else if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID))
834  {
835  ilUtil::sendFailure(sprintf($lng->txt("msg_no_perm_read_item"),
838  }
839 
840  $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
841  }
842 
846  function addLocatorItems()
847  {
848  global $ilLocator;
849 
850  if (is_object($this->object))
851  {
852  $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, ""), "", $this->node_id);
853  }
854  }
855 
856 } // END class.ilObjFileGUI
857 ?>