ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilObjFileGUI.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  +-----------------------------------------------------------------------------+
5  | ILIAS open source |
6  +-----------------------------------------------------------------------------+
7  | Copyright (c) 1998-2006 ILIAS open source, University of Cologne |
8  | |
9  | This program is free software; you can redistribute it and/or |
10  | modify it under the terms of the GNU General Public License |
11  | as published by the Free Software Foundation; either version 2 |
12  | of the License, or (at your option) any later version. |
13  | |
14  | This program is distributed in the hope that it will be useful, |
15  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
16  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
17  | GNU General Public License for more details. |
18  | |
19  | You should have received a copy of the GNU General Public License |
20  | along with this program; if not, write to the Free Software |
21  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
22  +-----------------------------------------------------------------------------+
23 */
24 
25 
26 require_once "./classes/class.ilObjectGUI.php";
27 require_once "./Modules/File/classes/class.ilObjFile.php";
28 require_once "./Modules/File/classes/class.ilObjFileAccess.php";
29 
41 {
46  function ilObjFileGUI($a_data,$a_id,$a_call_by_reference = true, $a_prepare_output = true)
47  {
48  $this->type = "file";
49  $this->ilObjectGUI($a_data,$a_id,$a_call_by_reference, false);
50  }
51 
52  function _forwards()
53  {
54  return array();
55  }
56 
57  function &executeCommand()
58  {
59  global $ilAccess, $ilNavigationHistory;
60 
61  // add entry to navigation history
62  if (!$this->getCreationMode() &&
63  $ilAccess->checkAccess("read", "", $_GET["ref_id"]))
64  {
65  $ilNavigationHistory->addItem($_GET["ref_id"],
66  "repository.php?cmd=infoScreen&ref_id=".$_GET["ref_id"], "file");
67  }
68 
69  $next_class = $this->ctrl->getNextClass($this);
70  $cmd = $this->ctrl->getCmd();
71 
72  if(!$this->getCreationMode())
73  {
74  include_once 'payment/classes/class.ilPaymentObject.php';
75  if(ilPaymentObject::_isBuyable($this->object->getRefId()) &&
76  !ilPaymentObject::_hasAccess($this->object->getRefId()))
77  {
78  $this->setLocator();
79  $this->tpl->getStandardTemplate();
80 
81  include_once 'Services/Payment/classes/class.ilShopPurchaseGUI.php';
82  $pp = new ilShopPurchaseGUI((int)$_GET['ref_id']);
83  $ret = $this->ctrl->forwardCommand($pp);
84  return true;
85  }
86  }
87 
88  $this->prepareOutput();
89 
90 //var_dump($_GET);
91 //var_dump($_POST);
92 //var_dump($_SESSION);
93 //echo "-$cmd-";
94  switch ($next_class)
95  {
96  case "ilinfoscreengui":
97  $this->infoScreen(); // forwards command
98  break;
99 
100  case 'ilmdeditorgui':
101 
102  include_once 'Services/MetaData/classes/class.ilMDEditorGUI.php';
103 
104  $md_gui =& new ilMDEditorGUI($this->object->getId(), 0, $this->object->getType());
105  $md_gui->addObserver($this->object,'MDUpdateListener','General');
106 
107  // todo: make this work
108  $md_gui->addObserver($this->object,'MDUpdateListener','Technical');
109 
110  $this->ctrl->forwardCommand($md_gui);
111  break;
112 
113  case 'ilpermissiongui':
114  include_once("./classes/class.ilPermissionGUI.php");
115  $perm_gui =& new ilPermissionGUI($this);
116  $ret =& $this->ctrl->forwardCommand($perm_gui);
117  break;
118 
119  default:
120  if (empty($cmd))
121  {
122  // does not seem to work
123  //$this->ctrl->returnToParent($this);
124  //$cmd = "view";
125  $cmd = "infoScreen";
126  }
127 
128  $cmd .= "Object";
129  $this->$cmd();
130  break;
131  }
132  }
133 
139  function createObject($a_reload_form = "")
140  {
141  global $rbacsystem, $ilCtrl;
142 
143  $new_type = $_POST["new_type"] ? $_POST["new_type"] : $_GET["new_type"];
144 
145  if (!$rbacsystem->checkAccess("create", $_GET["ref_id"], $new_type))
146  {
147  $this->ilErr->raiseError($this->lng->txt("permission_denied"),$this->ilErr->MESSAGE);
148  }
149 
150  // fill in saved values in case of error
151  $this->getTemplateFile("new",$this->type);
152 
153  if ($a_reload_form != "single_upload")
154  {
155  $this->initSingleUploadForm("create");
156  }
157  $this->tpl->setVariable("SINGLE_UPLOAD_FORM", $this->single_form_gui->getHtml());
158 
159  if ($a_reload_form != "zip_upload")
160  {
161  $this->initZipUploadForm("create");
162  }
163 
164  $this->tpl->setVariable("ZIP_UPLOAD_FORM", $this->zip_form_gui->getHtml());
165 
166  $this->tpl->setVariable("TXT_REQUIRED_FLD", $this->lng->txt("required_field"));
167  $this->tpl->setVariable("TXT_TAKE_OVER_STRUCTURE", $this->lng->txt("take_over_structure"));
168  $this->tpl->setVariable("TXT_HEADER_ZIP", $this->lng->txt("header_zip"));
169 
170  $this->fillCloneTemplate('DUPLICATE','file');
171  }
172 
178  public function initSingleUploadForm($a_mode = "create")
179  {
180  global $lng;
181 
182  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
183  $this->single_form_gui = new ilPropertyFormGUI();
184  $this->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  $this->single_form_gui->addItem($in_title);
192 
193  // File Description
194  $in_descr = new ilTextAreaInputGUI($lng->txt("description"), "description");
195  $this->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  $this->single_form_gui->addItem($in_file);
201 
202  // save and cancel commands
203  if ($a_mode == "create")
204  {
205  $this->single_form_gui->addCommandButton("save", $this->lng->txt($this->type."_add"));
206  $this->single_form_gui->addCommandButton("saveAndMeta", $this->lng->txt("file_add_and_metadata"));
207  $this->single_form_gui->addCommandButton("cancel", $lng->txt("cancel"));
208  }
209  else
210  {
211  //$this->single_form_gui->addCommandButton("update", $lng->txt("save"));
212  //$this->single_form_gui->addCommandButton("cancelUpdate", $lng->txt("cancel"));
213  }
214 
215  $this->single_form_gui->setTableWidth("60%");
216  $this->single_form_gui->setTarget($this->getTargetFrame("save"));
217  $this->single_form_gui->setTitle($this->lng->txt($this->type."_new"));
218  $this->single_form_gui->setTitleIcon(ilUtil::getImagePath('icon_file.gif'), $this->lng->txt('obj_file'));
219 
220  if ($a_mode == "create")
221  {
222  $this->ctrl->setParameter($this, "new_type", "file");
223  }
224  $this->single_form_gui->setFormAction($this->ctrl->getFormAction($this));
225  }
226 
232  public function initZipUploadForm($a_mode = "create")
233  {
234  global $lng;
235 
236  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
237  $this->zip_form_gui = new ilPropertyFormGUI();
238  $this->zip_form_gui->setMultipart(true);
239 
240  // File
241  $in_file = new ilFileInputGUI($lng->txt("file"), "zip_file");
242  $in_file->setRequired(true);
243  $in_file->setSuffixes(array("zip"));
244  $this->zip_form_gui->addItem($in_file);
245 
246  // Take over structure
247  $in_str = new ilCheckboxInputGUI($this->lng->txt("take_over_structure"), "adopt_structure");
248  $in_str->setInfo($this->lng->txt("take_over_structure_info"));
249  $this->zip_form_gui->addItem($in_str);
250 
251  // save and cancel commands
252  if ($a_mode == "create")
253  {
254  $this->zip_form_gui->addCommandButton("saveUnzip", $this->lng->txt($this->type."_add"));
255  $this->zip_form_gui->addCommandButton("cancel", $lng->txt("cancel"));
256  }
257  else
258  {
259  //$this->zip_form_gui->addCommandButton("update", $lng->txt("save"));
260  //$this->zip_form_gui->addCommandButton("cancelUpdate", $lng->txt("cancel"));
261  }
262 
263  $this->zip_form_gui->setTableWidth("60%");
264  $this->zip_form_gui->setTarget($this->getTargetFrame("save"));
265  $this->zip_form_gui->setTitle($this->lng->txt("header_zip"));
266  $this->zip_form_gui->setTitleIcon(ilUtil::getImagePath('icon_file.gif'), $this->lng->txt('obj_file'));
267 
268  if ($a_mode == "create")
269  {
270  $this->ctrl->setParameter($this, "new_type", "file");
271  }
272  $this->zip_form_gui->setFormAction($this->ctrl->getFormAction($this));
273  }
274 
280  function saveUnzipObject()
281  {
282  global $rbacsystem;
283 
284  $this->initZipUploadForm("create");
285 
286  if ($rbacsystem->checkAccess("create", $_GET["ref_id"], "file")) {
287  if ($this->zip_form_gui->checkInput())
288  {
289  $zip_file = $this->zip_form_gui->getInput("zip_file");
290  $adopt_structure = $this->zip_form_gui->getInput("adopt_structure");
291 
292  include_once ("Services/Utilities/classes/class.ilFileUtils.php");
293 
294  // Create unzip-directory
295  $newDir = ilUtil::ilTempnam();
296  ilUtil::makeDir($newDir);
297 
298  // Check if permission is granted for creation of object, if necessary
299  if (ilObject::_lookupType($_GET["ref_id"], TRUE) == "cat")
300  {
301  $permission = $rbacsystem->checkAccess("create", $_GET["ref_id"], "cat");
302  $containerType = "Category";
303  }
304  else {
305  $permission = $rbacsystem->checkAccess("create", $_GET["ref_id"], "fold");
306  $containerType = "Folder";
307  }
308 
309  // processZipFile (
310  // Dir to unzip,
311  // Path to uploaded file,
312  // should a structure be created (+ permission check)?
313  // ref_id of parent
314  // object that contains files (folder or category)
315  // should sendInfo be persistent?)
316  try
317  {
318  $processDone = ilFileUtils::processZipFile( $newDir,
319  $zip_file["tmp_name"],
320  ($adopt_structure && $permission),
321  $_GET["ref_id"],
322  $containerType,
323  true);
324  ilUtil::sendInfo($this->lng->txt("file_added"),true);
325  }
326  catch (ilFileUtilsException $e)
327  {
328  ilUtil::sendInfo($e->getMessage(), true);
329  }
330 
331  ilUtil::delDir($newDir);
332  $this->ctrl->returnToParent($this);
333  }
334  else
335  {
336  $this->zip_form_gui->setValuesByPost();
337  $this->createObject("zip_upload");
338  }
339  }
340  else
341  {
342  $this->ilErr->raiseError($this->lng->txt("permission_denied"),$this->ilErr->MESSAGE);
343  }
344  }
345 
351  function saveObject()
352  {
353  global $rbacsystem, $objDefinition, $ilUser;
354 
355  $this->initSingleUploadForm("create");
356 
357  if ($this->single_form_gui->checkInput())
358  {
359  $title = $this->single_form_gui->getInput("title");
360  $description = $this->single_form_gui->getInput("description");
361  $upload_file = $this->single_form_gui->getInput("upload_file");
362 
363  if (trim($title) == "")
364  {
365  $title = $upload_file["name"];
366  }
367  else
368  {
369  // BEGIN WebDAV: Ensure that object title ends with the filename extension
370  $fileExtension = ilObjFileAccess::_getFileExtension($upload_file["name"]);
371  $titleExtension = ilObjFileAccess::_getFileExtension($title);
372  if ($titleExtension != $fileExtension && strlen($fileExtension) > 0)
373  {
374  $title .= '.'.$fileExtension;
375  }
376  // END WebDAV: Ensure that object title ends with the filename extension
377  }
378 
379  // create and insert file in grp_tree
380  include_once("./Modules/File/classes/class.ilObjFile.php");
381  $fileObj = new ilObjFile();
382  $fileObj->setTitle($title);
383  $fileObj->setDescription($description);
384  $fileObj->setFileName($upload_file["name"]);
385  //$fileObj->setFileType($upload_file["type"]);
386  include_once("./Services/Utilities/classes/class.ilMimeTypeUtil.php");
387  $fileObj->setFileType(ilMimeTypeUtil::getMimeType(
388  "", $upload_file["name"], $upload_file["type"]));
389  $fileObj->setFileSize($upload_file["size"]);
390  $fileObj->create();
391  $fileObj->createReference();
392  $fileObj->putInTree($_GET["ref_id"]);
393  $fileObj->setPermissions($_GET["ref_id"]);
394  // upload file to filesystem
395  $fileObj->createDirectory();
396  $fileObj->getUploadFile($upload_file["tmp_name"],
397  $upload_file["name"]);
398 
399  // BEGIN ChangeEvent: Record write event.
400  require_once('Services/Tracking/classes/class.ilChangeEvent.php');
402  {
403  ilChangeEvent::_recordWriteEvent($fileObj->getId(), $ilUser->getId(), 'create');
404  }
405  // END ChangeEvent: Record write event.
406  ilUtil::sendInfo($this->lng->txt("file_added"),true);
407 
408  $this->ctrl->setParameter($this, "ref_id", $fileObj->getRefId());
409  if ($this->ctrl->getCmd() == "saveAndMeta")
410  {
411  $target =
412  $this->ctrl->getLinkTargetByClass(array("ilobjfilegui", "ilmdeditorgui"), "listSection");
413  $target = str_replace("new_type=", "nt=", $target);
414  ilUtil::redirect($this->getReturnLocation("save", $target));
415  }
416  else
417  {
418  $this->ctrl->returnToParent($this);
419  }
420  }
421  else
422  {
423  $this->single_form_gui->setValuesByPost();
424  $this->createObject("single_upload");
425  }
426  }
427 
433  function saveAndMetaObject()
434  {
435  $this->saveObject();
436  }
437 
443  function updateObject()
444  {
445  $data = $_FILES["Fobject"];
446 
447  // delete trailing '/' in filename
448  while (substr($data["name"]["file"],-1) == '/')
449  {
450  $data["name"]["file"] = substr($data["name"]["file"],0,-1);
451  }
452 
453  if (empty($data["name"]["file"]) && empty($_POST["Fobject"]["title"]))
454  {
455  $this->ilias->raiseError($this->lng->txt("msg_no_title"),$this->ilias->error_obj->MESSAGE);
456  }
457 
458  $filename = empty($data["name"]["file"]) ? $this->object->getFileName() : $data["name"]["file"];
459  $title = ilUtil::stripSlashes($_POST["Fobject"]["title"]);
460  if(strlen(trim($title)) == 0)
461  {
462  $title = $filename;
463  }
464  else
465  {
466  // BEGIN WebDAV: Ensure that object title ends with the filename extension
468  $titleExtension = ilObjFileAccess::_getFileExtension($title);
469  if ($titleExtension != $fileExtension && strlen($fileExtension) > 0)
470  {
471  $title .= '.'.$fileExtension;
472  }
473  // END WebDAV: Ensure that object title ends with the filename extension
474  }
475  $this->object->setTitle($title);
476 
477  if (!empty($data["name"]["file"]))
478  {
479  $this->object->replaceFile($_FILES["Fobject"]["tmp_name"]["file"],$_FILES["Fobject"]["name"]["file"]);
480  $this->object->setFileName($_FILES["Fobject"]["name"]["file"]);
481  //$this->object->setFileType($_FILES["Fobject"]["type"]["file"]);
482  include_once("./Services/Utilities/classes/class.ilMimeTypeUtil.php");
483  $this->object->setFileType(ilMimeTypeUtil::getMimeType(
484  "", $_FILES["Fobject"]["name"]["file"], $_FILES["Fobject"]["type"]["file"]));
485  $this->object->setFileSize($_FILES["Fobject"]["size"]["file"]);
486  }
487 
488  $this->object->setDescription(ilUtil::stripSlashes($_POST["Fobject"]["desc"]));
489 
490  $this->update = $this->object->update();
491 
492  // BEGIN ChangeEvent: Record update event.
493  if (!empty($data["name"]["file"]))
494  {
495  require_once('Services/Tracking/classes/class.ilChangeEvent.php');
497  {
498  global $ilUser;
499  ilChangeEvent::_recordWriteEvent($this->object->getId(), $ilUser->getId(), 'update');
500  ilChangeEvent::_catchupWriteEvents($this->object->getId(), $ilUser->getId());
501  }
502  }
503  // END ChangeEvent: Record update event.
504 
505  ilUtil::sendInfo($this->lng->txt("msg_obj_modified"),true);
506 //echo "-".$this->ctrl->getLinkTarget($this)."-";
507  ilUtil::redirect($this->getReturnLocation("update",$this->ctrl->getLinkTarget($this, "edit")));
508  }
509 
510 
516  function editObject()
517  {
518  global $rbacsystem, $ilAccess;
519 
520  if (!$ilAccess->checkAccess("write", "", $this->ref_id))
521  {
522  $this->ilias->raiseError($this->lng->txt("msg_no_perm_write"),$this->ilias->error_obj->MESSAGE);
523  }
524 
525  $fields = array();
526 
527  if ($_SESSION["error_post_vars"])
528  {
529  // fill in saved values in case of error
530  $fields["title"] = ilUtil::prepareFormOutput($_SESSION["error_post_vars"]["Fobject"]["title"],true);
531  $fields["desc"] = ilUtil::prepareFormOutput($_SESSION["error_post_vars"]["Fobject"]["desc"], true);
532  }
533  else
534  {
535  $fields["title"] = ilUtil::prepareFormOutput($this->object->getTitle());
536  $fields["desc"] = ilUtil::prepareFormOutput($this->object->getLongDescription());
537  }
538 
539  $this->getTemplateFile("edit");
540  $this->tpl->setVariable("TXT_TITLE", $this->lng->txt("title"));
541  $this->tpl->setVariable("TITLE", $fields["title"]);
542  $this->tpl->setVariable("TXT_DESC", $this->lng->txt("desc"));
543  $this->tpl->setVariable("DESC", $fields["desc"]);
544  $this->tpl->setVariable("TXT_REPLACE_FILE", $this->lng->txt("replace_file"));
545  //$this->tpl->parseCurrentBlock();
546 
547  $obj_str = ($this->call_by_reference) ? "" : "&obj_id=".$this->obj_id;
548 
549  $this->tpl->setVariable("FORMACTION", $this->getFormAction("update",$this->ctrl->getFormAction($this, "update").$obj_str));
550  $this->tpl->setVariable("TXT_HEADER", $this->lng->txt($this->object->getType()."_edit"));
551  $this->tpl->setVariable("TARGET", $this->getTargetFrame("update"));
552  $this->tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
553  $this->tpl->setVariable("TXT_SUBMIT", $this->lng->txt("save"));
554  $this->tpl->setVariable("CMD_SUBMIT", "update");
555  $this->tpl->setVariable("TXT_REQUIRED_FLD", $this->lng->txt("required_field"));
556  //$this->tpl->parseCurrentBlock();
557  }
558 
559  function sendFileObject()
560  {
561  global $ilAccess;
562 
563  if ($ilAccess->checkAccess("read", "", $this->ref_id))
564  {
565  // BEGIN ChangeEvent: Record read event.
566  require_once('Services/Tracking/classes/class.ilChangeEvent.php');
568  {
569  global $ilUser;
570  // Record read event and catchup with write events
571  ilChangeEvent::_recordReadEvent($this->object->getId(), $ilUser->getId());
572  }
573  // END ChangeEvent: Record read event.
574 
575  $this->object->sendFile($_GET["hist_id"]);
576  }
577  else
578  {
579  $this->ilErr->raiseError($this->lng->txt("permission_denied"),$this->ilErr->MESSAGE);
580  }
581  return true;
582  }
583 
584 
590  function versionsObject()
591  {
592  global $rbacsystem, $ilAccess;
593 
594  if (!$ilAccess->checkAccess("read", "", $_GET["ref_id"]))
595  {
596  $this->ilErr->raiseError($this->lng->txt("permission_denied"),$this->ilErr->MESSAGE);
597  }
598 
599  require_once("classes/class.ilHistoryGUI.php");
600 
601  $hist_gui =& new ilHistoryGUI($this->object->getId());
602 
603  // not nice, should be changed, if ilCtrl handling
604  // has been introduced to administration
605  $hist_html = $hist_gui->getVersionsTable(
606  array("ref_id" => $_GET["ref_id"], "cmd" => "versions",
607  "cmdClass" =>$_GET["cmdClass"], "cmdNode" =>$_GET["cmdNode"]));
608 
609  $this->tpl->setVariable("ADM_CONTENT", $hist_html);
610  }
611 
617  function infoScreenObject()
618  {
619  $this->ctrl->setCmd("showSummary");
620  $this->ctrl->setCmdClass("ilinfoscreengui");
621  $this->infoScreen();
622  }
623 
627  function infoScreen()
628  {
629  global $ilAccess;
630 
631  if (!$ilAccess->checkAccess("visible", "", $this->ref_id))
632  {
633  $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
634  }
635 
636  include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
637  $info = new ilInfoScreenGUI($this);
638 
639  if ($ilAccess->checkAccess("read", "sendfile", $this->ref_id))
640  {
641  $info->addButton($this->lng->txt("file_read"), $this->ctrl->getLinkTarget($this, "sendfile"));
642  }
643 
644  $info->enablePrivateNotes();
645 
646  if ($ilAccess->checkAccess("read", "", $_GET["ref_id"]))
647  {
648  $info->enableNews();
649  }
650 
651  // no news editing for files, just notifications
652  $info->enableNewsEditing(false);
653  if ($ilAccess->checkAccess("write", "", $_GET["ref_id"]))
654  {
655  $news_set = new ilSetting("news");
656  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
657 
658  if ($enable_internal_rss)
659  {
660  $info->setBlockProperty("news", "settings", true);
661  $info->setBlockProperty("news", "public_notifications_option", true);
662  }
663  }
664 
665 
666  // standard meta data
667  $info->addMetaDataSections($this->object->getId(),0, $this->object->getType());
668 
669  $info->addSection($this->lng->txt("file_info"));
670  $info->addProperty($this->lng->txt("filename"),
671  $this->object->getFileName());
672  // BEGIN WebDAV Guess file type.
673  $info->addProperty($this->lng->txt("type"),
674  $this->object->guessFileType());
675  // END WebDAV Guess file type.
676  $info->addProperty($this->lng->txt("size"),
677  ilObjFile::_lookupFileSize($this->object->getId(), true));
678  $info->addProperty($this->lng->txt("version"),
679  $this->object->getVersion());
680 
681  // forward the command
682  $this->ctrl->forwardCommand($info);
683  }
684 
685 
686  // get tabs
687  function getTabs(&$tabs_gui)
688  {
689  global $rbacsystem, $ilAccess;
690 
691 //echo "-".$this->ctrl->getCmd()."-";
692 
693  $this->ctrl->setParameter($this,"ref_id",$this->ref_id);
694 
695  if ($ilAccess->checkAccess("visible", "", $this->ref_id))
696  {
697  $force_active = ($this->ctrl->getNextClass() == "ilinfoscreengui"
698  || strtolower($_GET["cmdClass"]) == "ilnotegui")
699  ? true
700  : false;
701  $tabs_gui->addTarget("info_short",
702  $this->ctrl->getLinkTargetByClass(
703  array("ilobjfilegui", "ilinfoscreengui"), "showSummary"),
704  array("showSummary","", "infoScreen"),
705  "", "", $force_active);
706  }
707 
708  if ($ilAccess->checkAccess("write", "", $this->ref_id))
709  {
710  $tabs_gui->addTarget("edit",
711  $this->ctrl->getLinkTarget($this, "edit"), "edit", "");
712  }
713 
714  // meta data
715  if ($ilAccess->checkAccess("write", "", $this->ref_id))
716  {
717  $tabs_gui->addTarget("meta_data",
718  $this->ctrl->getLinkTargetByClass(array('ilobjfilegui','ilmdeditorgui'),'listSection'),
719  "", 'ilmdeditorgui');
720  }
721 
722  if ($ilAccess->checkAccess("write", "", $this->ref_id))
723  {
724  $tabs_gui->addTarget("versions",
725  $this->ctrl->getLinkTarget($this, "versions"), "versions", get_class($this));
726  }
727 
728  if ($ilAccess->checkAccess("edit_permission", "", $this->ref_id))
729  {
730  $tabs_gui->addTarget("perm_settings",
731  $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"), array("perm","info","owner"), 'ilpermissiongui');
732  }
733  }
734 
735  function _goto($a_target)
736  {
737  global $ilAccess, $ilErr, $lng;
738 
739  if ($ilAccess->checkAccess("visible", "", $a_target))
740  {
741  $_GET["cmd"] = "infoScreen";
742  $_GET["ref_id"] = $a_target;
743  include("repository.php");
744  exit;
745  }
746  else if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID))
747  {
748  $_GET["cmd"] = "frameset";
749  $_GET["target"] = "";
750  $_GET["ref_id"] = ROOT_FOLDER_ID;
751  ilUtil::sendInfo(sprintf($lng->txt("msg_no_perm_read_item"),
753  include("repository.php");
754  exit;
755  }
756 
757  $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
758 
759  }
760 
764  function addLocatorItems()
765  {
766  global $ilLocator;
767 
768  if (is_object($this->object))
769  {
770  $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, ""), "", $_GET["ref_id"]);
771  }
772  }
773 
774 } // END class.ilObjFileGUI
775 ?>