ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules 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 
21 {
22  function getType()
23  {
24  return "file";
25  }
26 
27  // ???
28  function _forwards()
29  {
30  return array();
31  }
32 
33  function executeCommand()
34  {
35  global $ilNavigationHistory, $ilCtrl, $ilUser, $ilTabs, $ilAccess, $ilErr;
36 
37  $next_class = $this->ctrl->getNextClass($this);
38  $cmd = $this->ctrl->getCmd();
39 
40  if($this->id_type == self::WORKSPACE_NODE_ID)
41  {
42  include_once "Services/Form/classes/class.ilFileInputGUI.php";
44  }
45 
46  if(!$this->getCreationMode())
47  {
48  // do not move this payment block!!
49  if(IS_PAYMENT_ENABLED)
50  {
51  include_once './Services/Payment/classes/class.ilPaymentObject.php';
52  if(ANONYMOUS_USER_ID == $ilUser->getId() && isset($_GET['transaction']))
53  {
54  $transaction = $_GET['transaction'];
55  include_once './Services/Payment/classes/class.ilPaymentBookings.php';
56  $valid_transaction = ilPaymentBookings::_readBookingByTransaction($transaction);
57  }
58 
59  if(ilPaymentObject::_requiresPurchaseToAccess($this->node_id, $type = (isset($_GET['purchasetype'])
60  ? $_GET['purchasetype'] : NULL) ))
61  {
62  $this->setLocator();
63  $this->tpl->getStandardTemplate();
64 
65  include_once './Services/Payment/classes/class.ilShopPurchaseGUI.php';
66  $pp = new ilShopPurchaseGUI((int)$this->node_id);
67  $ret = $this->ctrl->forwardCommand($pp);
68  return true;
69  }
70  }
71  else if($this->id_type == self::REPOSITORY_NODE_ID
72  && $this->checkPermissionBool("read"))
73  {
74  $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $this->node_id);
75  $link = $ilCtrl->getLinkTargetByClass("ilrepositorygui", "infoScreen");
76  $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $_GET["ref_id"]);
77 
78  // add entry to navigation history
79  $ilNavigationHistory->addItem($this->node_id,
80  $link, "file");
81  }
82  }
83 
84  $this->prepareOutput();
85 
86  switch ($next_class)
87  {
88  case "ilinfoscreengui":
89  $this->infoScreenForward(); // forwards command
90  break;
91 
92  case 'ilmdeditorgui':
93  if(!$this->checkPermissionBool("write"))
94  {
95  $ilErr->raiseError($this->lng->txt('permission_denied'),$ilErr->WARNING);
96  }
97 
98  $ilTabs->activateTab("id_meta");
99 
100  include_once 'Services/MetaData/classes/class.ilMDEditorGUI.php';
101 
102  $md_gui =& new ilMDEditorGUI($this->object->getId(), 0, $this->object->getType());
103  $md_gui->addObserver($this->object,'MDUpdateListener','General');
104 
105  // todo: make this work
106  $md_gui->addObserver($this->object,'MDUpdateListener','Technical');
107 
108  $this->ctrl->forwardCommand($md_gui);
109  break;
110 
111  // repository permissions
112  case 'ilpermissiongui':
113  $ilTabs->activateTab("id_permissions");
114  include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
115  $perm_gui =& new ilPermissionGUI($this);
116  $ret =& $this->ctrl->forwardCommand($perm_gui);
117  break;
118 
119  case "ilexportgui":
120  if(!$this->checkPermissionBool("write"))
121  {
122  $ilErr->raiseError($this->lng->txt('permission_denied'),$ilErr->WARNING);
123  }
124  $ilTabs->activateTab("export");
125  include_once("./Services/Export/classes/class.ilExportGUI.php");
126  $exp_gui = new ilExportGUI($this);
127  $exp_gui->addFormat("xml");
128  $ret = $this->ctrl->forwardCommand($exp_gui);
129  break;
130 
131  case 'ilobjectcopygui':
132  include_once './Services/Object/classes/class.ilObjectCopyGUI.php';
133  $cp = new ilObjectCopyGUI($this);
134  $cp->setType('file');
135  $this->ctrl->forwardCommand($cp);
136  break;
137 
138  // personal workspace permissions
139  case "ilworkspaceaccessgui";
140  $ilTabs->activateTab("id_permissions");
141  include_once('./Services/PersonalWorkspace/classes/class.ilWorkspaceAccessGUI.php');
142  $wspacc = new ilWorkspaceAccessGUI($this->node_id, $this->getAccessHandler());
143  $this->ctrl->forwardCommand($wspacc);
144  break;
145 
146  case "ilcommonactiondispatchergui":
147  include_once("Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
149  $this->ctrl->forwardCommand($gui);
150  break;
151 
152  default:
153  // in personal workspace use object2gui
154  if($this->id_type == self::WORKSPACE_NODE_ID)
155  {
156  $this->addHeaderAction();
157 
158  // coming from goto we need default command
159  if (empty($cmd))
160  {
161  $ilCtrl->setCmd("infoScreen");
162  }
163  $ilTabs->clearTargets();
164  return parent::executeCommand();
165  }
166 
167  if (empty($cmd))
168  {
169  $cmd = "infoScreen";
170  }
171 
172  $this->$cmd();
173  break;
174  }
175 
176  $this->addHeaderAction();
177  }
178 
179  protected function initCreationForms()
180  {
181  $forms = array();
182 
183  if($this->id_type == self::WORKSPACE_NODE_ID)
184  {
185  include_once "Services/DiskQuota/classes/class.ilDiskQuotaHandler.php";
187  {
188  $this->lng->loadLanguageModule("file");
189  ilUtil::sendFailure($this->lng->txt("personal_workspace_quota_exceeded_warning"), true);
190  $this->ctrl->redirect($this, "cancel");
191  }
192  }
193 
194  // use drag-and-drop upload if configured
195  require_once("Services/FileUpload/classes/class.ilFileUploadSettings.php");
197  {
198  $forms[] = $this->initMultiUploadForm();
199  }
200  else
201  {
202  $forms[] = $this->initSingleUploadForm();
203  $forms[] = $this->initZipUploadForm();
204  }
205 
206  // repository only
207  if($this->id_type != self::WORKSPACE_NODE_ID)
208  {
209  $forms[self::CFORM_IMPORT] = $this->initImportForm('file');
210  $forms[self::CFORM_CLONE] = $this->fillCloneTemplate(null, "file");
211  }
212 
213  return $forms;
214  }
215 
219  public function initSingleUploadForm()
220  {
221  global $lng;
222 
223  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
224  $single_form_gui = new ilPropertyFormGUI();
225  $single_form_gui->setMultipart(true);
226 
227  // File Title
228  $in_title = new ilTextInputGUI($lng->txt("title"), "title");
229  $in_title->setInfo($this->lng->txt("if_no_title_then_filename"));
230  $in_title->setSize(min(40, ilObject::TITLE_LENGTH));
231  $in_title->setMaxLength(ilObject::TITLE_LENGTH);
232  $single_form_gui->addItem($in_title);
233 
234  // File Description
235  $in_descr = new ilTextAreaInputGUI($lng->txt("description"), "description");
236  $single_form_gui->addItem($in_descr);
237 
238  // File
239  $in_file = new ilFileInputGUI($lng->txt("file"), "upload_file");
240  $in_file->setRequired(true);
241  $single_form_gui->addItem($in_file);
242 
243  $single_form_gui->addCommandButton("save", $this->lng->txt($this->type."_add"));
244  $single_form_gui->addCommandButton("saveAndMeta", $this->lng->txt("file_add_and_metadata"));
245  $single_form_gui->addCommandButton("cancel", $lng->txt("cancel"));
246 
247  $single_form_gui->setTableWidth("600px");
248  $single_form_gui->setTarget($this->getTargetFrame("save"));
249  $single_form_gui->setTitle($this->lng->txt($this->type."_new"));
250  $single_form_gui->setTitleIcon(ilUtil::getImagePath('icon_file.svg'), $this->lng->txt('obj_file'));
251 
252  $this->ctrl->setParameter($this, "new_type", "file");
253 
254  $single_form_gui->setFormAction($this->ctrl->getFormAction($this, "save"));
255 
256  return $single_form_gui;
257  }
258 
264  function save()
265  {
266  global $objDefinition, $ilUser;
267 
268  if (!$this->checkPermissionBool("create", "", "file"))
269  {
270  $this->ilErr->raiseError($this->lng->txt("permission_denied"),$this->ilErr->MESSAGE);
271  }
272 
273  $single_form_gui = $this->initSingleUploadForm();
274 
275  if ($single_form_gui->checkInput())
276  {
277  $title = $single_form_gui->getInput("title");
278  $description = $single_form_gui->getInput("description");
279  $upload_file = $single_form_gui->getInput("upload_file");
280 
281  if (trim($title) == "")
282  {
283  $title = $upload_file["name"];
284  }
285  else
286  {
287  // BEGIN WebDAV: Ensure that object title ends with the filename extension
288  $fileExtension = ilObjFileAccess::_getFileExtension($upload_file["name"]);
289  $titleExtension = ilObjFileAccess::_getFileExtension($title);
290  if ($titleExtension != $fileExtension && strlen($fileExtension) > 0)
291  {
292  $title .= '.'.$fileExtension;
293  }
294  // END WebDAV: Ensure that object title ends with the filename extension
295  }
296 
297  // create and insert file in grp_tree
298  include_once("./Modules/File/classes/class.ilObjFile.php");
299  $fileObj = new ilObjFile();
300  $fileObj->setTitle($title);
301  $fileObj->setDescription($description);
302  $fileObj->setFileName($upload_file["name"]);
303  //$fileObj->setFileType($upload_file["type"]);
304  include_once("./Services/Utilities/classes/class.ilMimeTypeUtil.php");
305  $fileObj->setFileType(ilMimeTypeUtil::getMimeType(
306  "", $upload_file["name"], $upload_file["type"]));
307  $fileObj->setFileSize($upload_file["size"]);
308  $this->object_id = $fileObj->create();
309 
310  $this->putObjectInTree($fileObj, $this->parent_id);
311 
312  // upload file to filesystem
313  $fileObj->createDirectory();
314  $fileObj->getUploadFile($upload_file["tmp_name"],
315  $upload_file["name"]);
316 
317  $this->handleAutoRating($fileObj);
318 
319  // BEGIN ChangeEvent: Record write event.
320  require_once('Services/Tracking/classes/class.ilChangeEvent.php');
321  ilChangeEvent::_recordWriteEvent($fileObj->getId(), $ilUser->getId(), 'create');
322  // END ChangeEvent: Record write event.
323 
324  ilUtil::sendSuccess($this->lng->txt("file_added"),true);
325 
326  if ($this->ctrl->getCmd() == "saveAndMeta")
327  {
328  $this->ctrl->setParameter($this, "new_type", "");
329  $target = $this->ctrl->getLinkTargetByClass(array("ilobjfilegui", "ilmdeditorgui"), "listSection", "", false, false);
330  ilUtil::redirect($target);
331  }
332  else
333  {
334  $this->ctrl->returnToParent($this);
335  }
336  }
337  else
338  {
339  $single_form_gui->setValuesByPost();
340  $this->tpl->setContent($single_form_gui->getHTML());
341  }
342  }
343 
349  function saveAndMeta()
350  {
351  $this->save();
352  }
353 
357  public function initZipUploadForm($a_mode = "create")
358  {
359  global $lng;
360 
361  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
362  $zip_form_gui = new ilPropertyFormGUI();
363  $zip_form_gui->setMultipart(true);
364 
365  // File
366  $in_file = new ilFileInputGUI($lng->txt("file"), "zip_file");
367  $in_file->setRequired(true);
368  $in_file->setSuffixes(array("zip"));
369  $zip_form_gui->addItem($in_file);
370 
371  // Take over structure
372  $in_str = new ilCheckboxInputGUI($this->lng->txt("take_over_structure"), "adopt_structure");
373  $in_str->setInfo($this->lng->txt("take_over_structure_info"));
374  $zip_form_gui->addItem($in_str);
375 
376  $zip_form_gui->addCommandButton("saveUnzip", $this->lng->txt($this->type."_add"));
377  $zip_form_gui->addCommandButton("cancel", $lng->txt("cancel"));
378 
379  $zip_form_gui->setTableWidth("600px");
380  $zip_form_gui->setTarget($this->getTargetFrame("save"));
381  $zip_form_gui->setTitle($this->lng->txt("header_zip"));
382  $zip_form_gui->setTitleIcon(ilUtil::getImagePath('icon_file.svg'), $this->lng->txt('obj_file'));
383 
384  $this->ctrl->setParameter($this, "new_type", "file");
385 
386  $zip_form_gui->setFormAction($this->ctrl->getFormAction($this, "saveUnzip"));
387 
388  return $zip_form_gui;
389  }
390 
396  function saveUnzip()
397  {
398  $zip_form_gui = $this->initZipUploadForm();
399 
400  if ($this->checkPermissionBool("create", "", "file"))
401  {
402  if ($zip_form_gui->checkInput())
403  {
404  $zip_file = $zip_form_gui->getInput("zip_file");
405  $adopt_structure = $zip_form_gui->getInput("adopt_structure");
406 
407  include_once ("Services/Utilities/classes/class.ilFileUtils.php");
408 
409  // Create unzip-directory
410  $newDir = ilUtil::ilTempnam();
411  ilUtil::makeDir($newDir);
412 
413  // Check if permission is granted for creation of object, if necessary
414  if($this->id_type != self::WORKSPACE_NODE_ID)
415  {
416 
417  $type = ilObject::_lookupType((int)$this->parent_id, true);
418  }
419  else
420  {
421  $type = ilObject::_lookupType($this->tree->lookupObjectId($this->parent_id), false);
422  }
423 
424  $tree = $access_handler = null;
425  switch($type)
426  {
427  // workspace structure
428  case 'wfld':
429  case 'wsrt':
430  $permission = $this->checkPermissionBool("create", "", "wfld");
431  $containerType = "WorkspaceFolder";
432  $tree = $this->tree;
433  $access_handler = $this->getAccessHandler();
434  break;
435 
436  // use categories as structure
437  case 'cat':
438  case 'root':
439  $permission = $this->checkPermissionBool("create", "", "cat");
440  $containerType = "Category";
441  break;
442 
443  // use folders as structure (in courses)
444  default:
445  $permission = $this->checkPermissionBool("create", "", "fold");
446  $containerType = "Folder";
447  break;
448  }
449  // processZipFile (
450  // Dir to unzip,
451  // Path to uploaded file,
452  // should a structure be created (+ permission check)?
453  // ref_id of parent
454  // object that contains files (folder or category)
455  // should sendInfo be persistent?)
456  try
457  {
458  $processDone = ilFileUtils::processZipFile( $newDir,
459  $zip_file["tmp_name"],
460  ($adopt_structure && $permission),
461  $this->parent_id,
462  $containerType,
463  $tree,
465  ilUtil::sendSuccess($this->lng->txt("file_added"),true);
466  }
467  catch (ilFileUtilsException $e)
468  {
469  ilUtil::sendFailure($e->getMessage(), true);
470  }
471 
472  ilUtil::delDir($newDir);
473  $this->ctrl->returnToParent($this);
474  }
475  else
476  {
477  $zip_form_gui->setValuesByPost();
478  $this->tpl->setContent($zip_form_gui->getHTML());
479  }
480  }
481  else
482  {
483  $this->ilErr->raiseError($this->lng->txt("permission_denied"),$this->ilErr->MESSAGE);
484  }
485  }
486 
492  function update()
493  {
494  global $ilTabs;
495 
496  $form = $this->initPropertiesForm();
497  if(!$form->checkInput())
498  {
499  $ilTabs->activateTab("settings");
500  $form->setValuesByPost();
501  $this->tpl->setContent($form->getHTML());
502  return false;
503  }
504 
505  $data = $form->getInput('file');
506 
507  // delete trailing '/' in filename
508  while (substr($data["name"],-1) == '/')
509  {
510  $data["name"] = substr($data["name"],0,-1);
511  }
512 
513  $filename = empty($data["name"]) ? $this->object->getFileName() : $data["name"];
514  $title = $form->getInput('title');
515  if(strlen(trim($title)) == 0)
516  {
517  $title = $filename;
518  }
519  else
520  {
521  $title = $this->object->checkFileExtension($filename,$title);
522  }
523  $this->object->setTitle($title);
524 
525  if (!empty($data["name"]))
526  {
527  switch($form->getInput('replace'))
528  {
529  case 1:
530  $this->object->deleteVersions();
531  $this->object->clearDataDirectory();
532  $this->object->replaceFile($data['tmp_name'],$data['name']);
533  break;
534  case 0:
535  $this->object->addFileVersion($data['tmp_name'],$data['name']);
536  break;
537  }
538  $this->object->setFileName($data['name']);
539  include_once("./Services/Utilities/classes/class.ilMimeTypeUtil.php");
540  $this->object->setFileType(ilMimeTypeUtil::getMimeType(
541  "", $data["name"], $data["type"]));
542  $this->object->setFileSize($data['size']);
543  }
544 
545  $this->object->setDescription($form->getInput('description'));
546  $this->object->setRating($form->getInput('rating'));
547 
548  $this->update = $this->object->update();
549 
550  // BEGIN ChangeEvent: Record update event.
551  if (!empty($data["name"]))
552  {
553  require_once('Services/Tracking/classes/class.ilChangeEvent.php');
554  global $ilUser;
555  ilChangeEvent::_recordWriteEvent($this->object->getId(), $ilUser->getId(), 'update');
556  ilChangeEvent::_catchupWriteEvents($this->object->getId(), $ilUser->getId());
557  }
558  // END ChangeEvent: Record update event.
559 
560  // Update ecs export settings
561  include_once 'Modules/File/classes/class.ilECSFileSettings.php';
562  $ecs = new ilECSFileSettings($this->object);
563  $ecs->handleSettingsUpdate();
564 
565  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"),true);
566  ilUtil::redirect($this->ctrl->getLinkTarget($this,'edit','',false,false));
567  }
568 
574  function edit()
575  {
576  global $ilTabs, $ilErr;
577 
578  if (!$this->checkPermissionBool("write"))
579  {
580  $ilErr->raiseError($this->lng->txt("msg_no_perm_write"));
581  }
582 
583  $ilTabs->activateTab("settings");
584 
585  $form = $this->initPropertiesForm();
586 
587  $val = array();
588  $val['title'] = $this->object->getTitle();
589  $val['description'] = $this->object->getLongDescription();
590  $val['rating'] = $this->object->hasRating();
591  $form->setValuesByArray($val);
592 
593  // Edit ecs export settings
594  include_once 'Modules/File/classes/class.ilECSFileSettings.php';
595  $ecs = new ilECSFileSettings($this->object);
596  $ecs->addSettingsToForm($form, 'file');
597 
598  $this->tpl->setContent($form->getHTML());
599  return true;
600  }
601 
607  protected function initPropertiesForm()
608  {
609  include_once('./Services/Form/classes/class.ilPropertyFormGUI.php');
610 
611  $this->lng->loadLanguageModule('file');
612 
613  $form = new ilPropertyFormGUI();
614  $form->setFormAction($this->ctrl->getFormAction($this),'update');
615  $form->setTitle($this->lng->txt('file_edit'));
616  $form->addCommandButton('update',$this->lng->txt('save'));
617  $form->addCommandButton('cancel',$this->lng->txt('cancel'));
618 
619  $title = new ilTextInputGUI($this->lng->txt('title'),'title');
620  $title->setValue($this->object->getTitle());
621  $title->setInfo($this->lng->txt("if_no_title_then_filename"));
622  $form->addItem($title);
623 
624  $upload_possible = true;
625  if($this->id_type == self::WORKSPACE_NODE_ID)
626  {
627  include_once "Services/DiskQuota/classes/class.ilDiskQuotaHandler.php";
628  $upload_possible = ilDiskQuotaHandler::isUploadPossible();
629  }
630 
631  if($upload_possible)
632  {
633  $file = new ilFileInputGUI($this->lng->txt('obj_file'),'file');
634  $file->setRequired(false);
635  // $file->enableFileNameSelection('title');
636  $form->addItem($file);
637 
638  $group = new ilRadioGroupInputGUI('','replace');
639  $group->setValue(0);
640 
641  $replace = new ilRadioOption($this->lng->txt('replace_file'),1);
642  $replace->setInfo($this->lng->txt('replace_file_info'));
643  $group->addOption($replace);
644 
645 
646  $keep = new ilRadioOption($this->lng->txt('file_new_version'),0);
647  $keep->setInfo($this->lng->txt('file_new_version_info'));
648  $group->addOption($keep);
649 
650  $file->addSubItem($group);
651  }
652  else
653  {
654  $file = new ilNonEditableValueGUI($this->lng->txt('obj_file'));
655  $file->setValue($this->lng->txt("personal_workspace_quota_exceeded_warning"));
656  $form->addItem($file);
657  }
658 
659  $desc = new ilTextAreaInputGUI($this->lng->txt('description'),'description');
660  $desc->setRows(3);
661  #$desc->setCols(40);
662  $form->addItem($desc);
663 
664  if($this->id_type == self::REPOSITORY_NODE_ID)
665  {
666  $this->lng->loadLanguageModule('rating');
667  $rate = new ilCheckboxInputGUI($this->lng->txt('rating_activate_rating'), 'rating');
668  $rate->setInfo($this->lng->txt('rating_activate_rating_info'));
669  $form->addItem($rate);
670  }
671 
672  return $form;
673  }
674 
675  function sendFile()
676  {
677  global $ilUser, $ilCtrl;
678 
679  if(ANONYMOUS_USER_ID == $ilUser->getId() && isset($_GET['transaction']) )
680  {
681  $this->object->sendFile($_GET["hist_id"]);
682  }
683 
684  if ($this->checkPermissionBool("read"))
685  {
686  // BEGIN ChangeEvent: Record read event.
687  require_once('Services/Tracking/classes/class.ilChangeEvent.php');
688  global $ilUser;
689  // Record read event and catchup with write events
690  ilChangeEvent::_recordReadEvent($this->object->getType(), $this->object->getRefId(),
691  $this->object->getId(), $ilUser->getId());
692  // END ChangeEvent: Record read event.
693 
694  $this->object->sendFile($_GET["hist_id"]);
695  }
696  else
697  {
698  $this->ilErr->raiseError($this->lng->txt("permission_denied"),$this->ilErr->MESSAGE);
699  }
700  return true;
701  }
702 
703 
709  function versions()
710  {
711  global $ilTabs;
712 
713  $ilTabs->activateTab("id_versions");
714 
715  if (!$this->checkPermissionBool("write"))
716  {
717  $this->ilErr->raiseError($this->lng->txt("permission_denied"),$this->ilErr->MESSAGE);
718  }
719 
720  // get versions
721  $versions = $this->object->getVersions();
722 
723  // build versions table
724  require_once("Modules/File/classes/class.ilFileVersionTableGUI.php");
725  $table = new ilFileVersionTableGUI($this, "versions");
726  $table->setMaxCount(sizeof($versions));
727  $table->setData($versions);
728 
729  $this->tpl->setVariable("ADM_CONTENT", $table->getHTML());
730  }
731 
737  function infoScreen()
738  {
739  $this->ctrl->setCmd("showSummary");
740  $this->ctrl->setCmdClass("ilinfoscreengui");
741  $this->infoScreenForward();
742  }
743 
747  function infoScreenForward()
748  {
749  global $ilTabs, $ilErr, $ilToolbar;
750 
751  $ilTabs->activateTab("id_info");
752 
753  if (!$this->checkPermissionBool("visible"))
754  {
755  $ilErr->raiseError($this->lng->txt("msg_no_perm_read"));
756  }
757 
758  include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
759  $info = new ilInfoScreenGUI($this);
760 
761  if ($this->checkPermissionBool("read", "sendfile"))
762  {
763  // #9876
764  $this->lng->loadLanguageModule("file");
765 
766  // #14378
767  include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
768  $button = ilLinkButton::getInstance();
769  $button->setCaption("file_download");
770  $button->setPrimary(true);
771 
772  // get permanent download link for repository
773  if ($this->id_type == self::REPOSITORY_NODE_ID)
774  {
775  $button->setUrl(ilObjFileAccess::_getPermanentDownloadLink($this->node_id));
776  }
777  else
778  {
779  $button->setUrl($this->ctrl->getLinkTarget($this, "sendfile"));
780  }
781 
782  $ilToolbar->addButtonInstance($button);
783  }
784 
785  $info->enablePrivateNotes();
786 
787  if ($this->checkPermissionBool("read"))
788  {
789  $info->enableNews();
790  }
791 
792  // no news editing for files, just notifications
793  $info->enableNewsEditing(false);
794  if ($this->checkPermissionBool("write"))
795  {
796  $news_set = new ilSetting("news");
797  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
798 
799  if ($enable_internal_rss)
800  {
801  $info->setBlockProperty("news", "settings", true);
802  $info->setBlockProperty("news", "public_notifications_option", true);
803  }
804  }
805 
806 
807  // standard meta data
808  $info->addMetaDataSections($this->object->getId(),0, $this->object->getType());
809 
810  $info->addSection($this->lng->txt("file_info"));
811  $info->addProperty($this->lng->txt("filename"),
812  $this->object->getFileName());
813  // BEGIN WebDAV Guess file type.
814  $info->addProperty($this->lng->txt("type"),
815  $this->object->guessFileType());
816  // END WebDAV Guess file type.
817  $info->addProperty($this->lng->txt("size"),
818  ilFormat::formatSize(ilObjFile::_lookupFileSize($this->object->getId()),'long'));
819  $info->addProperty($this->lng->txt("version"),
820  $this->object->getVersion());
821 
822  // using getVersions function instead of ilHistory direct
823  $uploader = $this->object->getVersions();
824  $uploader = array_shift($uploader);
825  $uploader = $uploader["user_id"];
826 
827  $this->lng->loadLanguageModule("file");
828  include_once "Services/User/classes/class.ilUserUtil.php";
829  $info->addProperty($this->lng->txt("file_uploaded_by"), ilUserUtil::getNamePresentation($uploader));
830 
831  // download link added in repository
832  if ($this->id_type == self::REPOSITORY_NODE_ID && $this->checkPermissionBool("read", "sendfile"))
833  {
834  $tpl = new ilTemplate("tpl.download_link.html", true, true, "Modules/File");
835  $tpl->setVariable("LINK", ilObjFileAccess::_getPermanentDownloadLink($this->node_id));
836  $info->addProperty($this->lng->txt("download_link"), $tpl->get());
837  }
838 
839  if($this->id_type == self::WORKSPACE_NODE_ID)
840  {
841  $info->addProperty($this->lng->txt("perma_link"), $this->getPermanentLinkWidget());
842  }
843 
844  // display previews
845  include_once("./Services/Preview/classes/class.ilPreview.php");
846  if (!$this->ctrl->isAsynch() &&
847  ilPreview::hasPreview($this->object->getId(), $this->object->getType()) &&
848  $this->checkPermissionBool("read"))
849  {
850  include_once("./Services/Preview/classes/class.ilPreviewGUI.php");
851 
852  // get context for access checks later on
853  $context;
854  switch ($this->id_type)
855  {
856  case self::WORKSPACE_NODE_ID:
857  case self::WORKSPACE_OBJECT_ID:
859  break;
860 
861  default:
863  break;
864  }
865 
866  $preview = new ilPreviewGUI($this->node_id, $context, $this->object->getId(), $this->access_handler);
867  $info->addProperty($this->lng->txt("preview"), $preview->getInlineHTML());
868  }
869 
870  // forward the command
871  // $this->ctrl->setCmd("showSummary");
872  // $this->ctrl->setCmdClass("ilinfoscreengui");
873  $this->ctrl->forwardCommand($info);
874  }
875 
876 
877  // get tabs
878  function setTabs()
879  {
880  global $ilTabs, $lng, $ilHelp;
881 
882  $ilHelp->setScreenIdComponent("file");
883 
884  $this->ctrl->setParameter($this,"ref_id",$this->node_id);
885 
886  if ($this->checkPermissionBool("visible"))
887  {
888  $ilTabs->addTab("id_info",
889  $lng->txt("info_short"),
890  $this->ctrl->getLinkTargetByClass(array("ilobjfilegui", "ilinfoscreengui"), "showSummary"));
891  }
892 
893  if ($this->checkPermissionBool("write"))
894  {
895  $ilTabs->addTab("settings",
896  $lng->txt("edit"),
897  $this->ctrl->getLinkTarget($this, "edit"));
898  }
899 
900  if ($this->checkPermissionBool("write"))
901  {
902  $ilTabs->addTab("id_versions",
903  $lng->txt("versions"),
904  $this->ctrl->getLinkTarget($this, "versions"));
905  }
906 
907  // meta data
908  if ($this->checkPermissionBool("write"))
909  {
910  $ilTabs->addTab("id_meta",
911  $lng->txt("meta_data"),
912  $this->ctrl->getLinkTargetByClass(array('ilobjfilegui','ilmdeditorgui'),'listSection'));
913  }
914 
915  // export
916  if ($this->checkPermissionBool("write"))
917  {
918  $ilTabs->addTab("export",
919  $lng->txt("export"),
920  $this->ctrl->getLinkTargetByClass("ilexportgui", ""));
921  }
922 
923  // will add permission tab if needed
924  parent::setTabs();
925  }
926 
927  public static function _goto($a_target, $a_additional = null)
928  {
929  global $ilErr, $lng, $ilAccess;
930 
931  if($a_additional && substr($a_additional, -3) == "wsp")
932  {
933  $_GET["baseClass"] = "ilsharedresourceGUI";
934  $_GET["wsp_id"] = $a_target;
935  include("ilias.php");
936  exit;
937  }
938 
939  // added support for direct download goto links
940  if($a_additional && substr($a_additional, -8) == "download")
941  {
942  ilObjectGUI::_gotoRepositoryNode($a_target, "sendfile");
943  }
944 
945  // static method, no workspace support yet
946 
947  if ($ilAccess->checkAccess("visible", "", $a_target))
948  {
949  ilObjectGUI::_gotoRepositoryNode($a_target, "infoScreen");
950  }
951  else if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID))
952  {
953  ilUtil::sendFailure(sprintf($lng->txt("msg_no_perm_read_item"),
956  }
957 
958  $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
959  }
960 
964  function addLocatorItems()
965  {
966  global $ilLocator;
967 
968  if (is_object($this->object))
969  {
970  $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, ""), "", $this->node_id);
971  }
972  }
973 
979  public function initMultiUploadForm()
980  {
981  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
982  $dnd_form_gui = new ilPropertyFormGUI();
983  $dnd_form_gui->setMultipart(true);
984  $dnd_form_gui->setHideLabels();
985 
986  // file input
987  include_once("Services/Form/classes/class.ilDragDropFileInputGUI.php");
988  $dnd_input = new ilDragDropFileInputGUI($this->lng->txt("files"), "upload_files");
989  $dnd_input->setArchiveSuffixes(array("zip"));
990  $dnd_input->setCommandButtonNames("uploadFiles", "cancel");
991  $dnd_form_gui->addItem($dnd_input);
992 
993  // add commands
994  $dnd_form_gui->addCommandButton("uploadFiles", $this->lng->txt("upload_files"));
995  $dnd_form_gui->addCommandButton("cancel", $this->lng->txt("cancel"));
996 
997  $dnd_form_gui->setTableWidth("100%");
998  $dnd_form_gui->setTarget($this->getTargetFrame("save"));
999  $dnd_form_gui->setTitle($this->lng->txt("upload_files_title"));
1000  $dnd_form_gui->setTitleIcon(ilUtil::getImagePath('icon_file.gif'), $this->lng->txt('obj_file'));
1001 
1002  $this->ctrl->setParameter($this, "new_type", "file");
1003  $dnd_form_gui->setFormAction($this->ctrl->getFormAction($this, "uploadFiles"));
1004 
1005  return $dnd_form_gui;
1006  }
1007 
1011  public function uploadFiles()
1012  {
1013  include_once("./Services/JSON/classes/class.ilJsonUtil.php");
1014 
1015  $response = new stdClass();
1016  $response->error = null;
1017  $response->debug = null;
1018 
1019  $files = $_FILES;
1020 
1021  // #14249 - race conditions because of concurrent uploads
1022  $after_creation_callback = (int)$_REQUEST["crtcb"];
1023  if($after_creation_callback)
1024  {
1025  $this->after_creation_callback_objects = array();
1026  unset($_REQUEST["crtcb"]);
1027  }
1028 
1029  // load form
1030  $dnd_form_gui = $this->initMultiUploadForm();
1031  if ($dnd_form_gui->checkInput())
1032  {
1033  try
1034  {
1035  if (!$this->checkPermissionBool("create", "", "file"))
1036  {
1037  $response->error = $this->lng->txt("permission_denied");
1038  }
1039  else
1040  {
1041  // handle the file
1042  $fileresult = $this->handleFileUpload($dnd_form_gui->getInput("upload_files"));
1043  if ($fileresult)
1044  $response = (object)array_merge((array)$response, (array)$fileresult);
1045  }
1046  }
1047  catch (Exception $ex)
1048  {
1049  $response->error = $ex->getMessage() . " ## " . $ex->getTraceAsString();
1050  }
1051  }
1052  else
1053  {
1054  $dnd_input = $dnd_form_gui->getItemByPostVar("upload_files");
1055  $response->error = $dnd_input->getAlert();
1056  }
1057 
1058  if($after_creation_callback &&
1059  sizeof($this->after_creation_callback_objects))
1060  {
1061  foreach($this->after_creation_callback_objects as $new_file_obj)
1062  {
1063  ilObject2GUI::handleAfterSaveCallback($new_file_obj, $after_creation_callback);
1064  }
1065  unset($this->after_creation_callback_objects);
1066  }
1067 
1068  // send response object (don't use 'application/json' as IE wants to download it!)
1069  header('Vary: Accept');
1070  header('Content-type: text/plain');
1071  echo ilJsonUtil::encode($response);
1072 
1073  // no further processing!
1074  exit;
1075  }
1076 
1083  protected function handleFileUpload($file_upload)
1084  {
1085  global $ilUser;
1086 
1087  // file upload params
1088  $filename = ilUtil::stripSlashes($file_upload["name"]);
1089  $type = ilUtil::stripSlashes($file_upload["type"]);
1090  $size = ilUtil::stripSlashes($file_upload["size"]);
1091  $temp_name = $file_upload["tmp_name"];
1092 
1093  // additional params
1094  $title = ilUtil::stripSlashes($file_upload["title"]);
1095  $description = ilUtil::stripSlashes($file_upload["description"]);
1096  $extract = ilUtil::stripSlashes($file_upload["extract"]);
1097  $keep_structure = ilUtil::stripSlashes($file_upload["keep_structure"]);
1098 
1099  // create answer object
1100  $response = new stdClass();
1101  $response->fileName = $filename;
1102  $response->fileSize = intval($size);
1103  $response->fileType = $type;
1104  $response->fileUnzipped = $extract;
1105  $response->error = null;
1106 
1107  // extract archive?
1108  if ($extract)
1109  {
1110  $zip_file = $filename;
1111  $adopt_structure = $keep_structure;
1112 
1113  include_once ("Services/Utilities/classes/class.ilFileUtils.php");
1114 
1115  // Create unzip-directory
1116  $newDir = ilUtil::ilTempnam();
1117  ilUtil::makeDir($newDir);
1118 
1119  // Check if permission is granted for creation of object, if necessary
1120  if($this->id_type != self::WORKSPACE_NODE_ID)
1121  {
1122  $type = ilObject::_lookupType((int)$this->parent_id, true);
1123  }
1124  else
1125  {
1126  $type = ilObject::_lookupType($this->tree->lookupObjectId($this->parent_id), false);
1127  }
1128 
1129  $tree = $access_handler = null;
1130  switch($type)
1131  {
1132  // workspace structure
1133  case 'wfld':
1134  case 'wsrt':
1135  $permission = $this->checkPermissionBool("create", "", "wfld");
1136  $containerType = "WorkspaceFolder";
1137  $tree = $this->tree;
1138  $access_handler = $this->getAccessHandler();
1139  break;
1140 
1141  // use categories as structure
1142  case 'cat':
1143  case 'root':
1144  $permission = $this->checkPermissionBool("create", "", "cat");
1145  $containerType = "Category";
1146  break;
1147 
1148  // use folders as structure (in courses)
1149  default:
1150  $permission = $this->checkPermissionBool("create", "", "fold");
1151  $containerType = "Folder";
1152  break;
1153  }
1154 
1155  try
1156  {
1157  // processZipFile (
1158  // Dir to unzip,
1159  // Path to uploaded file,
1160  // should a structure be created (+ permission check)?
1161  // ref_id of parent
1162  // object that contains files (folder or category)
1163  // should sendInfo be persistent?)
1165  $newDir,
1166  $temp_name,
1167  ($adopt_structure && $permission),
1168  $this->parent_id,
1169  $containerType,
1170  $tree,
1171  $access_handler);
1172  }
1173  catch (ilFileUtilsException $e)
1174  {
1175  $response->error = $e->getMessage();
1176  }
1177  catch (Exception $ex)
1178  {
1179  $response->error = $ex->getMessage();
1180  }
1181 
1182  ilUtil::delDir($newDir);
1183 
1184  // #15404
1185  if($this->id_type != self::WORKSPACE_NODE_ID)
1186  {
1187  foreach(ilFileUtils::getNewObjects() as $parent_ref_id => $objects)
1188  {
1189  if($parent_ref_id != $this->parent_id)
1190  {
1191  continue;
1192  }
1193 
1194  foreach($objects as $object)
1195  {
1196  $this->after_creation_callback_objects[] = $object;
1197  }
1198  }
1199  }
1200  }
1201  else
1202  {
1203  if (trim($title) == "")
1204  {
1205  $title = $filename;
1206  }
1207  else
1208  {
1209  // BEGIN WebDAV: Ensure that object title ends with the filename extension
1211  $titleExtension = ilObjFileAccess::_getFileExtension($title);
1212  if ($titleExtension != $fileExtension && strlen($fileExtension) > 0)
1213  {
1214  $title .= '.'.$fileExtension;
1215  }
1216  // END WebDAV: Ensure that object title ends with the filename extension
1217  }
1218 
1219  // create and insert file in grp_tree
1220  include_once("./Modules/File/classes/class.ilObjFile.php");
1221  $fileObj = new ilObjFile();
1222  $fileObj->setTitle($title);
1223  $fileObj->setDescription($description);
1224  $fileObj->setFileName($filename);
1225 
1226  include_once("./Services/Utilities/classes/class.ilMimeTypeUtil.php");
1227  $fileObj->setFileType(ilMimeTypeUtil::getMimeType("", $filename, $type));
1228  $fileObj->setFileSize($size);
1229  $this->object_id = $fileObj->create();
1230 
1231  $this->putObjectInTree($fileObj, $this->parent_id);
1232 
1233  // see uploadFiles()
1234  if(is_array($this->after_creation_callback_objects))
1235  {
1236  $this->after_creation_callback_objects[] = $fileObj;
1237  }
1238 
1239  // upload file to filesystem
1240  $fileObj->createDirectory();
1241  $fileObj->raiseUploadError(false);
1242  $fileObj->getUploadFile($temp_name, $filename);
1243 
1244  $this->handleAutoRating($fileObj);
1245 
1246  // BEGIN ChangeEvent: Record write event.
1247  require_once('./Services/Tracking/classes/class.ilChangeEvent.php');
1248  ilChangeEvent::_recordWriteEvent($fileObj->getId(), $ilUser->getId(), 'create');
1249  // END ChangeEvent: Record write event.
1250  }
1251 
1252  return $response;
1253  }
1254 
1258  function deleteVersions()
1259  {
1260  global $ilTabs, $ilLocator;
1261 
1262  // get ids either from GET (if single item was clicked) or
1263  // from POST (if multiple items were selected)
1264  $version_ids = isset($_GET["hist_id"]) ? array($_GET["hist_id"]) : $_POST["hist_id"];
1265 
1266  if (count($version_ids) < 1)
1267  {
1268  ilUtil::sendFailure($this->lng->txt("no_checkbox"), true);
1269  $this->ctrl->redirect($this, "versions");
1270  }
1271  else
1272  {
1273  $ilTabs->activateTab("id_versions");
1274 
1275  // check if all versions are selected
1276  $versionsToKeep = array_udiff($this->object->getVersions(), $version_ids, array($this, "compareHistoryIds"));
1277  if (count($versionsToKeep) < 1)
1278  {
1279  // set our message
1280  ilUtil::sendQuestion($this->lng->txt("file_confirm_delete_all_versions"));
1281 
1282  // show confirmation gui
1283  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
1284  $conf_gui = new ilConfirmationGUI();
1285  $conf_gui->setFormAction($this->ctrl->getFormAction($this, "versions"));
1286  $conf_gui->setCancel($this->lng->txt("cancel"), "cancelDeleteFile");
1287  $conf_gui->setConfirm($this->lng->txt("confirm"), "confirmDeleteFile");
1288 
1289  $conf_gui->addItem("id[]", $this->ref_id, $this->object->getTitle(),
1290  ilObject::_getIcon($this->object->getId(), "small", $this->object->getType()),
1291  $this->lng->txt("icon")." ".$this->lng->txt("obj_".$this->object->getType()));
1292 
1293  $html = $conf_gui->getHTML();
1294  }
1295  else
1296  {
1297  include_once("./Modules/File/classes/class.ilFileVersionTableGUI.php");
1298 
1299  ilUtil::sendQuestion($this->lng->txt("file_confirm_delete_versions"));
1300  $versions = $this->object->getVersions($version_ids);
1301 
1302  $table = new ilFileVersionTableGUI($this, 'versions', true);
1303  $table->setMaxCount(sizeof($versions));
1304  $table->setData($versions);
1305 
1306  $html = $table->getHTML();
1307  }
1308 
1309  $this->tpl->setVariable('ADM_CONTENT', $html);
1310  }
1311  }
1312 
1317  {
1318  global $ilTabs;
1319 
1320  // has the user the rights to delete versions?
1321  if (!$this->checkPermissionBool("write"))
1322  {
1323  $this->ilErr->raiseError($this->lng->txt("permission_denied"), $this->ilErr->MESSAGE);
1324  }
1325 
1326  // delete versions after confirmation
1327  if (count($_POST["hist_id"]) > 0)
1328  {
1329  $this->object->deleteVersions($_POST["hist_id"]);
1330  ilUtil::sendSuccess($this->lng->txt("file_versions_deleted"), true);
1331  }
1332 
1333  $this->ctrl->setParameter($this, "hist_id", "");
1334  $this->ctrl->redirect($this, "versions");
1335  }
1336 
1341  {
1342  $this->ctrl->redirect($this, "versions");
1343  }
1344 
1349  {
1350  // has the user the rights to delete the file?
1351  if (!$this->checkPermissionBool("write"))
1352  {
1353  $this->ilErr->raiseError($this->lng->txt("permission_denied"), $this->ilErr->MESSAGE);
1354  }
1355 
1356  // delete this file object
1357  include_once("./Services/Repository/classes/class.ilRepUtilGUI.php");
1358  $ru = new ilRepUtilGUI($this);
1359  $ru->deleteObjects($this->parent_id, array($this->ref_id));
1360 
1361  // redirect to parent object
1362  $this->ctrl->setParameterByClass("ilrepositorygui", "ref_id", $this->parent_id);
1363  $this->ctrl->redirectByClass("ilrepositorygui");
1364  }
1365 
1369  function cancelDeleteFile()
1370  {
1371  $this->ctrl->redirect($this, "versions");
1372  }
1373 
1381  function compareHistoryIds($v1, $v2)
1382  {
1383  if (is_array($v1))
1384  $v1 = (int)$v1["hist_entry_id"];
1385  else if (!is_int($v1))
1386  $v1 = (int)$v1;
1387 
1388  if (is_array($v2))
1389  $v2 = (int)$v2["hist_entry_id"];
1390  else if (!is_int($v2))
1391  $v2 = (int)$v2;
1392 
1393  return $v1 - $v2;
1394  }
1395 
1399  function rollbackVersion()
1400  {
1401  global $ilTabs;
1402 
1403  // has the user the rights to delete the file?
1404  if (!$this->checkPermissionBool("write"))
1405  {
1406  $this->ilErr->raiseError($this->lng->txt("permission_denied"), $this->ilErr->MESSAGE);
1407  }
1408 
1409  // get ids either from GET (if single item was clicked) or
1410  // from POST (if multiple items were selected)
1411  $version_ids = isset($_GET["hist_id"]) ? array($_GET["hist_id"]) : $_POST["hist_id"];
1412 
1413  // more than one entry selected?
1414  if (count($version_ids) != 1)
1415  {
1416  ilUtil::sendInfo($this->lng->txt("file_rollback_select_exact_one"), true);
1417  $this->ctrl->redirect($this, "versions");
1418  }
1419 
1420  // rollback the version
1421  $new_version = $this->object->rollback($version_ids[0]);
1422 
1423  ilUtil::sendSuccess(sprintf($this->lng->txt("file_rollback_done"), $new_version["rollback_version"]), true);
1424  $this->ctrl->redirect($this, "versions");
1425  }
1426 
1427  protected function initHeaderAction($a_sub_type = null, $a_sub_id = null)
1428  {
1429  $lg = parent::initHeaderAction($a_sub_type, $a_sub_id);
1430  if(is_object($lg))
1431  {
1432  if($this->object->hasRating())
1433  {
1434  $lg->enableRating(true, null, false,
1435  array("ilcommonactiondispatchergui", "ilratinggui"));
1436  }
1437  }
1438  return $lg;
1439  }
1440 
1441 } // END class.ilObjFileGUI
1442 ?>
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
setLocator()
set Locator
initSingleUploadForm()
FORM: Init single upload form.
Class ilECSFileSettings.
This class represents an option in a radio group.
ILIAS Setting Class.
static _getIcon($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
Get icon for repository item.
print $file
infoScreenForward()
show information screen
$size
Definition: RandomTest.php:79
exit
Definition: login.php:54
static _getPermanentDownloadLink($ref_id)
Gets the permanent download link for the file.
Class ilInfoScreenGUI.
$_POST['username']
Definition: cron.php:12
handleFileUpload($file_upload)
Handles the upload of a single file and adds it to the parent object.
This class represents a property form user interface.
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_node_id=null)
Check permission.
New implementation of ilObjectGUI.
rollbackVersion()
Performs a rollback with the selected file version.
GUI class for the workflow of copying objects.
cancelDeleteFile()
Cancels the file deletion.
const TITLE_LENGTH
max length of object title
$_GET["client_id"]
This class represents a file property in a property form.
getAccessHandler()
Get access handler.
$preview
static _getFileExtension($a_file_name)
Gets the file extension of the specified file name.
initZipUploadForm($a_mode="create")
FORM: Init zip upload form.
getPermanentLinkWidget($a_append=null, $a_center=false)
Class ilShopPurchaseGUI.
$cmd
Definition: sahs_server.php:35
static _requiresPurchaseToAccess($a_ref_id, $a_purchasetype='')
this function should be used by all buyable repository objects !!
fillCloneTemplate($a_tpl_varname, $a_type)
addObserver(&$a_class, $a_method, $a_element)
static _gotoRepositoryRoot($a_raise_error=false)
Goto repository root.
setArchiveSuffixes($a_suffixes)
Set accepted archive suffixes.
This class represents a checkbox property in a property form.
static _lookupTitle($a_id)
lookup object title
setInfo($a_info)
Set Info.
static _goto($a_target, $a_additional=null)
static getNamePresentation($a_user_id, $a_user_image=false, $a_profile_link=false, $a_profile_back_link="", $a_force_first_lastname=false, $a_omit_login=false, $a_sortable=true)
Default behaviour is:
global $ilCtrl
Definition: ilias.php:18
setInfo($a_info)
Set Information Text.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
compareHistoryIds($v1, $v2)
Compares two versions either by passing a history entry or an id.
Export User Interface Class.
initImportForm($a_new_type)
Init object import form.
This class represents a property in a property form.
static encode($mixed, $suppress_native=false)
static hasPreview($a_obj_id, $a_type="")
Determines whether the object with the specified reference id has a preview.
static getMimeType($a_file="", $a_filename="", $a_mime="")
Get Mime type.
initHeaderAction($a_sub_type=null, $a_sub_id=null)
static _gotoRepositoryNode($a_ref_id, $a_cmd="frameset")
Goto repository root.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
confirmDeleteFile()
Deletes this file object.
static _lookupObjId($a_id)
special template class to simplify handling of ITX/PEAR
Class ilObjFile.
handleAutoRating(ilObject $a_new_obj)
Repository GUI Utilities.
This class represents a text property in a property form.
static isUploadPossible($a_additional_size=null)
uploadFiles()
Called after a file was uploaded.
saveUnzip()
saveUnzip object
static handleAfterSaveCallback(ilObject $a_obj, $a_callback_ref_id)
After creation callback.
getTargetFrame($a_cmd, $a_target_frame="")
save()
save object
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static sendQuestion($a_info="", $a_keep=false)
Send Question to Screen.
static _lookupType($a_id, $a_reference=false)
lookup object type
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$filename
Definition: buildRTE.php:89
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
ACL access handler GUI.
_recordReadEvent($a_type, $a_ref_id, $obj_id, $usr_id, $isCatchupWriteEvents=true, $a_ext_rc=false, $a_ext_time=false)
Records a read event and catches up with write events.
putObjectInTree(ilObject $a_obj, $a_parent_node_id=null)
Add object to tree at given position.
edit()
edit object
saveAndMeta()
save object
static ilTempnam()
Create a temporary file in an ILIAS writable directory.
This class represents a non editable value in a property form.
global $ilUser
Definition: imgupload.php:15
infoScreen()
this one is called from the info button in the repository not very nice to set cmdClass/Cmd manually...
static getNewObjects()
static formatSize($size, $a_mode='short', $a_lng=null)
Returns the specified file size value in a human friendly form.
GUI class for file objects.
This class represents a text area property in a property form.
confirmDeleteVersions()
Deletes the file versions that were confirmed by the user.
initMultiUploadForm()
Initializes the upload form for multiple files.
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
deleteVersions()
Displays a confirmation screen with selected file versions that should be deleted.
setPersonalWorkspaceQuotaCheck($a_value)
cancelDeleteVersions()
Cancels the file version deletion.
setValue($a_value)
Set Value.
_catchupWriteEvents($obj_id, $usr_id, $timestamp=null)
Catches up with all write events which occured before the specified timestamp.
static redirect($a_script)
http redirect to other script
versions()
file versions/history
addHeaderAction()
Add header action menu.
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
static _readBookingByTransaction($a_transaction)
_lookupFileSize($a_id)
Lookups the file size of the file in bytes.
Class ilFileVersionTableGUI.
processZipFile($a_directory, $a_file, $structure, $ref_id=null, $containerType=null, $tree=null, $access_handler=null)
unzips in given directory and processes uploaded zip for use as single files
setRequired($a_required)
Set Required.
_recordWriteEvent($obj_id, $usr_id, $action, $parent_obj_id=null)
Records a write event.
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
static isDragAndDropUploadEnabled()
Gets whether drag and drop file upload is enabled.
This class represents a file input property where multiple files can be dopped in a property form...
update()
updates object entry in object_data
Class to report exception.
Confirmation screen class.