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