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