ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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
18{
19
23 public $object;
24 protected $log = null;
25
26
34 public function __construct($a_id = 0, $a_id_type = self::REPOSITORY_NODE_ID, $a_parent_node_id = 0)
35 {
36 $this->log = ilLoggerFactory::getLogger('file');
37 parent::__construct($a_id, $a_id_type, $a_parent_node_id);
38 }
39
40
41 public function getType()
42 {
43 return "file";
44 }
45
46
47 public function executeCommand()
48 {
49 global $DIC;
50 $ilNavigationHistory = $DIC['ilNavigationHistory'];
51 $ilCtrl = $DIC['ilCtrl'];
52 $ilUser = $DIC['ilUser'];
53 $ilTabs = $DIC['ilTabs'];
54 $ilAccess = $DIC['ilAccess'];
55 $ilErr = $DIC['ilErr'];
56
57 $next_class = $this->ctrl->getNextClass($this);
58 $cmd = $this->ctrl->getCmd();
59
60 if ($this->id_type == self::WORKSPACE_NODE_ID) {
62 }
63
64 if (!$this->getCreationMode()) {
65 if ($this->id_type == self::REPOSITORY_NODE_ID
66 && $this->checkPermissionBool("read")
67 ) {
68 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $this->node_id);
69 $link = $ilCtrl->getLinkTargetByClass("ilrepositorygui", "infoScreen");
70 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $_GET["ref_id"]);
71
72 // add entry to navigation history
73 $ilNavigationHistory->addItem(
74 $this->node_id,
75 $link,
76 "file"
77 );
78 }
79 }
80
81 $this->prepareOutput();
82
83 switch ($next_class) {
84 case "ilinfoscreengui":
85 $this->infoScreenForward(); // forwards command
86 break;
87
88 case 'ilobjectmetadatagui':
89 if (!$this->checkPermissionBool("write")) {
90 $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
91 }
92
93 $ilTabs->activateTab("id_meta");
94
95 $md_gui = new ilObjectMetaDataGUI($this->object);
96
97 // todo: make this work
98 // $md_gui->addMDObserver($this->object,'MDUpdateListener','Technical');
99
100 $this->ctrl->forwardCommand($md_gui);
101 break;
102
103 // repository permissions
104 case 'ilpermissiongui':
105 $ilTabs->activateTab("id_permissions");
106 $perm_gui = new ilPermissionGUI($this);
107 $ret = $this->ctrl->forwardCommand($perm_gui);
108 break;
109
110 case "ilexportgui":
111 $ilTabs->activateTab("export");
112 $exp_gui = new ilExportGUI($this);
113 $exp_gui->addFormat("xml");
114 $ret = $this->ctrl->forwardCommand($exp_gui);
115 break;
116
117 case 'ilobjectcopygui':
118 $cp = new ilObjectCopyGUI($this);
119 $cp->setType('file');
120 $this->ctrl->forwardCommand($cp);
121 break;
122
123 // personal workspace permissions
124 case "ilworkspaceaccessgui":
125 $ilTabs->activateTab("id_permissions");
126 $wspacc = new ilWorkspaceAccessGUI($this->node_id, $this->getAccessHandler());
127 $this->ctrl->forwardCommand($wspacc);
128 break;
129
130 case "ilcommonactiondispatchergui":
132 $this->ctrl->forwardCommand($gui);
133 break;
134
135 case "illearningprogressgui":
136 $ilTabs->activateTab('learning_progress');
137 $new_gui = new ilLearningProgressGUI(
139 $this->object->getRefId(),
140 $_GET['user_id'] ? $_GET['user_id'] : $ilUser->getId()
141 );
142 $this->ctrl->forwardCommand($new_gui);
143 $this->tabs_gui->setTabActive('learning_progress');
144 break;
145
146 default:
147 // in personal workspace use object2gui
148 if ($this->id_type == self::WORKSPACE_NODE_ID) {
149 $this->addHeaderAction();
150
151 // coming from goto we need default command
152 if (empty($cmd)) {
153 $ilCtrl->setCmd("infoScreen");
154 }
155 $ilTabs->clearTargets();
156
157 return parent::executeCommand();
158 }
159
160 if (empty($cmd)) {
161 $cmd = "infoScreen";
162 }
163
164 $this->$cmd();
165 break;
166 }
167
168 $this->addHeaderAction();
169 }
170
171
175 protected function initCreationForms($a_new_type)
176 {
177 $forms = array();
178
179 if ($this->id_type == self::WORKSPACE_NODE_ID) {
181 $this->lng->loadLanguageModule("file");
182 ilUtil::sendFailure($this->lng->txt("personal_workspace_quota_exceeded_warning"), true);
183 $this->ctrl->redirect($this, "cancel");
184 }
185 }
186
187 // use drag-and-drop upload if configured
189 $forms[] = $this->initMultiUploadForm();
190 } else {
191 $forms[] = $this->initSingleUploadForm();
192 $forms[] = $this->initZipUploadForm();
193 }
194
195 // repository only
196 if ($this->id_type != self::WORKSPACE_NODE_ID) {
197 $forms[self::CFORM_IMPORT] = $this->initImportForm('file');
198 $forms[self::CFORM_CLONE] = $this->fillCloneTemplate(null, "file");
199 }
200
201 return $forms;
202 }
203
204
208 public function initSingleUploadForm()
209 {
210 global $DIC;
211 $lng = $DIC['lng'];
212
213 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
214 $single_form_gui = new ilPropertyFormGUI();
215 $single_form_gui->setMultipart(true);
216
217 // File Title
218 $in_title = new ilTextInputGUI($lng->txt("title"), "title");
219 $in_title->setInfo($this->lng->txt("if_no_title_then_filename"));
220 $in_title->setSize(min(40, ilObject::TITLE_LENGTH));
221 $in_title->setMaxLength(ilObject::TITLE_LENGTH);
222 $single_form_gui->addItem($in_title);
223
224 // File Description
225 $in_descr = new ilTextAreaInputGUI($lng->txt("description"), "description");
226 $single_form_gui->addItem($in_descr);
227
228 // File
229 $in_file = new ilFileInputGUI($lng->txt("file"), "upload_file");
230 $in_file->setRequired(true);
231 $single_form_gui->addItem($in_file);
232
233 $single_form_gui->addCommandButton("save", $this->lng->txt($this->type . "_add"));
234 $single_form_gui->addCommandButton("saveAndMeta", $this->lng->txt("file_add_and_metadata"));
235 $single_form_gui->addCommandButton("cancel", $lng->txt("cancel"));
236
237 $single_form_gui->setTableWidth("600px");
238 $single_form_gui->setTarget($this->getTargetFrame("save"));
239 $single_form_gui->setTitle($this->lng->txt($this->type . "_new"));
240 $single_form_gui->setTitleIcon(ilUtil::getImagePath('icon_file.svg'), $this->lng->txt('obj_file'));
241
242 $this->ctrl->setParameter($this, "new_type", "file");
243
244 $single_form_gui->setFormAction($this->ctrl->getFormAction($this, "save"));
245
246 return $single_form_gui;
247 }
248
249
255 public function save()
256 {
257 global $DIC;
258 $ilUser = $DIC->user();
259
260 if (!$this->checkPermissionBool("create", "", "file")) {
261 $this->ilErr->raiseError($this->lng->txt("permission_denied"), $this->ilErr->MESSAGE);
262 }
263
264 $single_form_gui = $this->initSingleUploadForm();
265
266 if ($single_form_gui->checkInput()) {
267 $title = $single_form_gui->getInput("title");
268 $description = $single_form_gui->getInput("description");
269 $upload_file = $single_form_gui->getInput("upload_file");
270
271 if (trim($title) == "") {
272 $title = $upload_file["name"];
273 } else {
274 // BEGIN WebDAV: Ensure that object title ends with the filename extension
275 $fileExtension = ilObjFileAccess::_getFileExtension($upload_file["name"]);
277 if ($titleExtension != $fileExtension && strlen($fileExtension) > 0) {
278 $title .= '.' . $fileExtension;
279 }
280 // END WebDAV: Ensure that object title ends with the filename extension
281 }
282
283 // create and insert file in grp_tree
284
285 $fileObj = new ilObjFile();
286 $fileObj->setTitle($title);
287 $fileObj->setDescription($description);
288 $fileObj->setFileName($upload_file["name"]);
289
290 $fileObj->setFileType(ilMimeTypeUtil::getMimeType(
291 "",
292 $upload_file["name"],
293 $upload_file["type"]
294 ));
295 $fileObj->setFileSize($upload_file["size"]);
296 $this->object_id = $fileObj->create();
297
298 $this->putObjectInTree($fileObj, $this->parent_id);
299
300 // upload file to filesystem
301 $fileObj->createDirectory();
302 if ($result = $fileObj->getUploadFile($upload_file["tmp_name"], $upload_file["name"])) {
303 $fileObj->setFileName($result->getName());
304 }
305
306 $this->handleAutoRating($fileObj);
307
308 // BEGIN ChangeEvent: Record write event.
309 ilChangeEvent::_recordWriteEvent($fileObj->getId(), $ilUser->getId(), 'create');
310 // END ChangeEvent: Record write event.
311
312 ilUtil::sendSuccess($this->lng->txt("file_added"), true);
313
314 if ($this->ctrl->getCmd() == "saveAndMeta") {
315 $this->ctrl->setParameter($this, "new_type", "");
316 $target = $this->ctrl->getLinkTargetByClass(array("ilobjectmetadatagui", "ilmdeditorgui"), "listSection", "", false, false);
318 } else {
319 $this->ctrl->returnToParent($this);
320 }
321 } else {
322 $single_form_gui->setValuesByPost();
323 $this->tpl->setContent($single_form_gui->getHTML());
324 }
325 }
326
327
333 public function saveAndMeta()
334 {
335 $this->save();
336 }
337
338
342 public function initZipUploadForm($a_mode = "create")
343 {
344 global $DIC;
345 $lng = $DIC['lng'];
346
347 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
348 $zip_form_gui = new ilPropertyFormGUI();
349 $zip_form_gui->setMultipart(true);
350
351 // File
352 $in_file = new ilFileInputGUI($lng->txt("file"), "zip_file");
353 $in_file->setRequired(true);
354 $in_file->setSuffixes(array("zip"));
355 $zip_form_gui->addItem($in_file);
356
357 // Take over structure
358 $in_str = new ilCheckboxInputGUI($this->lng->txt("take_over_structure"), "adopt_structure");
359 $in_str->setInfo($this->lng->txt("take_over_structure_info"));
360 $zip_form_gui->addItem($in_str);
361
362 $zip_form_gui->addCommandButton("saveUnzip", $this->lng->txt($this->type . "_add"));
363 $zip_form_gui->addCommandButton("cancel", $lng->txt("cancel"));
364
365 $zip_form_gui->setTableWidth("600px");
366 $zip_form_gui->setTarget($this->getTargetFrame("save"));
367 $zip_form_gui->setTitle($this->lng->txt("header_zip"));
368 $zip_form_gui->setTitleIcon(ilUtil::getImagePath('icon_file.svg'), $this->lng->txt('obj_file'));
369
370 $this->ctrl->setParameter($this, "new_type", "file");
371
372 $zip_form_gui->setFormAction($this->ctrl->getFormAction($this, "saveUnzip"));
373
374 return $zip_form_gui;
375 }
376
377
383 public function saveUnzip()
384 {
385 $zip_form_gui = $this->initZipUploadForm();
386
387 if ($this->checkPermissionBool("create", "", "file")) {
388 if ($zip_form_gui->checkInput()) {
389 $zip_file = $zip_form_gui->getInput("zip_file");
390 $adopt_structure = $zip_form_gui->getInput("adopt_structure");
391
392 include_once("Services/Utilities/classes/class.ilFileUtils.php");
393
394 // Create unzip-directory
395 $newDir = ilUtil::ilTempnam();
396 ilUtil::makeDir($newDir);
397
398 // Check if permission is granted for creation of object, if necessary
399 if ($this->id_type != self::WORKSPACE_NODE_ID) {
400 $type = ilObject::_lookupType((int) $this->parent_id, true);
401 } else {
402 $type = ilObject::_lookupType($this->tree->lookupObjectId($this->parent_id), false);
403 }
404
405 $tree = $access_handler = null;
406 switch ($type) {
407 // workspace structure
408 case 'wfld':
409 case 'wsrt':
410 $permission = $this->checkPermissionBool("create", "", "wfld");
411 $containerType = "WorkspaceFolder";
414 break;
415
416 // use categories as structure
417 case 'cat':
418 case 'root':
419 $permission = $this->checkPermissionBool("create", "", "cat");
420 $containerType = "Category";
421 break;
422
423 // use folders as structure (in courses)
424 default:
425 $permission = $this->checkPermissionBool("create", "", "fold");
426 $containerType = "Folder";
427 break;
428 }
429 // processZipFile (
430 // Dir to unzip,
431 // Path to uploaded file,
432 // should a structure be created (+ permission check)?
433 // ref_id of parent
434 // object that contains files (folder or category)
435 // should sendInfo be persistent?)
436 try {
437 $processDone = ilFileUtils::processZipFile(
438 $newDir,
439 $zip_file["tmp_name"],
440 ($adopt_structure && $permission),
441 $this->parent_id,
442 $containerType,
443 $tree,
445 );
446 ilUtil::sendSuccess($this->lng->txt("file_added"), true);
447 } catch (ilFileUtilsException $e) {
448 ilUtil::sendFailure($e->getMessage(), true);
449 }
450
451 ilUtil::delDir($newDir);
452 $this->ctrl->returnToParent($this);
453 } else {
454 $zip_form_gui->setValuesByPost();
455 $this->tpl->setContent($zip_form_gui->getHTML());
456 }
457 } else {
458 $this->ilErr->raiseError($this->lng->txt("permission_denied"), $this->ilErr->MESSAGE);
459 }
460 }
461
462
468 public function update()
469 {
470 global $DIC;
471 $ilTabs = $DIC['ilTabs'];
472
473 $form = $this->initPropertiesForm();
474 if (!$form->checkInput()) {
475 $ilTabs->activateTab("settings");
476 $form->setValuesByPost();
477 $this->tpl->setContent($form->getHTML());
478
479 return false;
480 }
481
482 $data = $form->getInput('file');
483
484 // delete trailing '/' in filename
485 $data["name"] = rtrim($data["name"], '/');
486
487 $filename = empty($data["name"]) ? $this->object->getFileName() : $data["name"];
488 $title = $form->getInput('title');
489 if (strlen(trim($title)) == 0) {
491 } else {
492 $title = $this->object->checkFileExtension($filename, $title);
493 }
494 $this->object->setTitle($title);
495
496 if (!empty($data["name"])) {
497 $result = null;
498 switch ($form->getInput('replace')) {
499 case 1:
500 $this->object->deleteVersions();
501 $this->object->clearDataDirectory();
502 $result = $this->object->replaceFile($data['tmp_name'], $data['name']);
503 break;
504 case 0:
505 $result = $this->object->addFileVersion($data['tmp_name'], $data['name']);
506 break;
507 }
508 if ($result) {
509 $this->object->setFileType($result->getMimeType());
510 $this->object->setFileSize($result->getSize());
511 $this->object->setFilename($result->getName());
512 }
513 }
514
515 $this->object->setDescription($form->getInput('description'));
516 $this->object->setRating($form->getInput('rating'));
517
518 $this->update = $this->object->update();
519
520 // BEGIN ChangeEvent: Record update event.
521 if (!empty($data["name"])) {
522 require_once('Services/Tracking/classes/class.ilChangeEvent.php');
523 global $DIC;
524 $ilUser = $DIC['ilUser'];
525 ilChangeEvent::_recordWriteEvent($this->object->getId(), $ilUser->getId(), 'update');
526 ilChangeEvent::_catchupWriteEvents($this->object->getId(), $ilUser->getId());
527 }
528 // END ChangeEvent: Record update event.
529
530 // Update ecs export settings
531 include_once 'Modules/File/classes/class.ilECSFileSettings.php';
532 $ecs = new ilECSFileSettings($this->object);
533 $ecs->handleSettingsUpdate();
534
535 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
536 ilUtil::redirect($this->ctrl->getLinkTarget($this, 'versions', '', false, false));
537 }
538
539
545 public function edit()
546 {
547 global $DIC;
548 $ilTabs = $DIC['ilTabs'];
549 $ilErr = $DIC['ilErr'];
550
551 if (!$this->checkPermissionBool("write")) {
552 $ilErr->raiseError($this->lng->txt("msg_no_perm_write"));
553 }
554
555 $ilTabs->activateTab("settings");
556
557 $form = $this->initPropertiesForm();
558
559 $val = array();
560 $val['title'] = $this->object->getTitle();
561 $val['description'] = $this->object->getLongDescription();
562 $val['rating'] = $this->object->hasRating();
563 $form->setValuesByArray($val);
564
565 // Edit ecs export settings
566 include_once 'Modules/File/classes/class.ilECSFileSettings.php';
567 $ecs = new ilECSFileSettings($this->object);
568 $ecs->addSettingsToForm($form, 'file');
569
570 $this->tpl->setContent($form->getHTML());
571
572 return true;
573 }
574
575
582 protected function initPropertiesForm()
583 {
584 include_once('./Services/Form/classes/class.ilPropertyFormGUI.php');
585
586 $this->lng->loadLanguageModule('file');
587
588 $form = new ilPropertyFormGUI();
589 $form->setFormAction($this->ctrl->getFormAction($this), 'update');
590 $form->setTitle($this->lng->txt('file_edit'));
591 $form->addCommandButton('update', $this->lng->txt('save'));
592 $form->addCommandButton('cancel', $this->lng->txt('cancel'));
593
594 $title = new ilTextInputGUI($this->lng->txt('title'), 'title');
595 $title->setValue($this->object->getTitle());
596 $title->setInfo($this->lng->txt("if_no_title_then_filename"));
597 $form->addItem($title);
598
599 $upload_possible = true;
600 if ($this->id_type == self::WORKSPACE_NODE_ID) {
601 $upload_possible = ilDiskQuotaHandler::isUploadPossible();
602 }
603
604 if ($upload_possible) {
605 $file = new ilFileStandardDropzoneInputGUI($this->lng->txt('obj_file'), 'file');
606 $file->setRequired(false);
607 $form->addItem($file);
608
609 $group = new ilRadioGroupInputGUI('', 'replace');
610 $group->setValue(0);
611
612 $replace = new ilRadioOption($this->lng->txt('replace_file'), 1);
613 $replace->setInfo($this->lng->txt('replace_file_info'));
614 $group->addOption($replace);
615
616 $keep = new ilRadioOption($this->lng->txt('file_new_version'), 0);
617 $keep->setInfo($this->lng->txt('file_new_version_info'));
618 $group->addOption($keep);
619
620 $file->addSubItem($group);
621 } else {
622 $file = new ilNonEditableValueGUI($this->lng->txt('obj_file'));
623 $file->setValue($this->lng->txt("personal_workspace_quota_exceeded_warning"));
624 $form->addItem($file);
625 }
626
627 $desc = new ilTextAreaInputGUI($this->lng->txt('description'), 'description');
628 $desc->setRows(3);
629 #$desc->setCols(40);
630 $form->addItem($desc);
631
632 if ($this->id_type == self::REPOSITORY_NODE_ID) {
633 $this->lng->loadLanguageModule('rating');
634 $rate = new ilCheckboxInputGUI($this->lng->txt('rating_activate_rating'), 'rating');
635 $rate->setInfo($this->lng->txt('rating_activate_rating_info'));
636 $form->addItem($rate);
637 }
638
639 return $form;
640 }
641
642
643 public function sendFile()
644 {
645 global $DIC;
646
647 try {
648 if (ANONYMOUS_USER_ID == $DIC->user()->getId() && isset($_GET['transaction'])) {
649 $a_hist_entry_id = isset($_GET["hist_id"]) ? $_GET["hist_id"] : null;
650 $this->object->sendFile($a_hist_entry_id);
651 }
652
653 if ($this->checkPermissionBool("read")) {
654 // BEGIN ChangeEvent: Record read event.
655 require_once('Services/Tracking/classes/class.ilChangeEvent.php');
656
657 // Record read event and catchup with write events
659 $this->object->getType(),
660 $this->object->getRefId(),
661 $this->object->getId(),
662 $DIC->user()->getId()
663 );
664 // END ChangeEvent: Record read event.
665
666 require_once 'Services/Tracking/classes/class.ilLPStatusWrapper.php';
667 ilLPStatusWrapper::_updateStatus($this->object->getId(), $DIC->user()->getId());
668
669 $a_hist_entry_id = isset($_GET["hist_id"]) ? $_GET["hist_id"] : null;
670 $this->object->sendFile($a_hist_entry_id);
671 } else {
672 $this->ilErr->raiseError($this->lng->txt("permission_denied"), $this->ilErr->MESSAGE);
673 }
674 } catch (\ILIAS\Filesystem\Exception\FileNotFoundException $e) {
675 $this->ilErr->raiseError($e->getMessage(), $this->ilErr->MESSAGE);
676 }
677
678 return true;
679 }
680
681
687 public function versions()
688 {
689 global $DIC;
690 $ilTabs = $DIC['ilTabs'];
691
692 $ilTabs->activateTab("id_versions");
693
694 if (!$this->checkPermissionBool("write")) {
695 $this->ilErr->raiseError($this->lng->txt("permission_denied"), $this->ilErr->MESSAGE);
696 }
697
698 // get versions
699 $versions = $this->object->getVersions();
700
701 // build versions table
702 require_once("Modules/File/classes/class.ilFileVersionTableGUI.php");
703 $table = new ilFileVersionTableGUI($this, "versions");
704 $table->setMaxCount(sizeof($versions));
705 $table->setData($versions);
706
707 $this->tpl->setVariable("ADM_CONTENT", $table->getHTML());
708 }
709
710
716 public function infoScreen()
717 {
718 $this->ctrl->setCmd("showSummary");
719 $this->ctrl->setCmdClass("ilinfoscreengui");
720 $this->infoScreenForward();
721 }
722
723
727 public function infoScreenForward()
728 {
729 global $DIC;
730 $ilTabs = $DIC['ilTabs'];
731 $ilErr = $DIC['ilErr'];
732 $ilToolbar = $DIC['ilToolbar'];
733
734 $ilTabs->activateTab("id_info");
735
736 if (!$this->checkPermissionBool("visible") && !$this->checkPermissionBool("read")) {
737 $ilErr->raiseError($this->lng->txt("msg_no_perm_read"));
738 }
739
740 include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
741 $info = new ilInfoScreenGUI($this);
742
743 if ($this->checkPermissionBool("read", "sendfile")) {
744 // #9876
745 $this->lng->loadLanguageModule("file");
746
747 // #14378
748 include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
749 $button = ilLinkButton::getInstance();
750 $button->setCaption("file_download");
751 $button->setPrimary(true);
752
753 // get permanent download link for repository
754 if ($this->id_type == self::REPOSITORY_NODE_ID) {
755 $button->setUrl(ilObjFileAccess::_getPermanentDownloadLink($this->node_id));
756 } else {
757 $button->setUrl($this->ctrl->getLinkTarget($this, "sendfile"));
758 }
759
760 $ilToolbar->addButtonInstance($button);
761 }
762
763 $info->enablePrivateNotes();
764
765 if ($this->checkPermissionBool("read")) {
766 $info->enableNews();
767 }
768
769 // no news editing for files, just notifications
770 $info->enableNewsEditing(false);
771 if ($this->checkPermissionBool("write")) {
772 $news_set = new ilSetting("news");
773 $enable_internal_rss = $news_set->get("enable_rss_for_internal");
774
775 if ($enable_internal_rss) {
776 $info->setBlockProperty("news", "settings", true);
777 $info->setBlockProperty("news", "public_notifications_option", true);
778 }
779 }
780
781 // standard meta data
782 $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
783
784 // File Info
785 $info->addSection($this->lng->txt("file_info"));
786 $info->addProperty($this->lng->txt("filename"), $this->object->getFileName());
787 $info->addProperty($this->lng->txt("type"), $this->object->guessFileType());
788
789 $info->addProperty($this->lng->txt("size"), ilUtil::formatSize(ilObjFile::_lookupFileSize($this->object->getId()), 'long'));
790 $info->addProperty($this->lng->txt("version"), $this->object->getVersion());
791
792 if ($this->object->getPageCount() > 0) {
793 $info->addProperty($this->lng->txt("page_count"), $this->object->getPageCount());
794 }
795
796 // using getVersions function instead of ilHistory direct
797 $uploader = $this->object->getVersions();
798 $uploader = array_shift($uploader);
799 $uploader = $uploader["user_id"];
800
801 $this->lng->loadLanguageModule("file");
802 include_once "Services/User/classes/class.ilUserUtil.php";
803 $info->addProperty($this->lng->txt("file_uploaded_by"), ilUserUtil::getNamePresentation($uploader));
804
805 // download link added in repository
806 if ($this->id_type == self::REPOSITORY_NODE_ID && $this->checkPermissionBool("read", "sendfile")) {
807 $tpl = new ilTemplate("tpl.download_link.html", true, true, "Modules/File");
808 $tpl->setVariable("LINK", ilObjFileAccess::_getPermanentDownloadLink($this->node_id));
809 $info->addProperty($this->lng->txt("download_link"), $tpl->get());
810 }
811
812 if ($this->id_type == self::WORKSPACE_NODE_ID) {
813 $info->addProperty($this->lng->txt("perma_link"), $this->getPermanentLinkWidget());
814 }
815
816 // display previews
817 include_once("./Services/Preview/classes/class.ilPreview.php");
818 if (!$this->ctrl->isAsynch()
819 && ilPreview::hasPreview($this->object->getId(), $this->object->getType())
820 && $this->checkPermissionBool("read")
821 ) {
822 include_once("./Services/Preview/classes/class.ilPreviewGUI.php");
823
824 // get context for access checks later on
825 $context;
826 switch ($this->id_type) {
830 break;
831
832 default:
834 break;
835 }
836
837 $preview = new ilPreviewGUI($this->node_id, $context, $this->object->getId(), $this->access_handler);
838 $info->addProperty($this->lng->txt("preview"), $preview->getInlineHTML());
839 }
840
841 // forward the command
842 // $this->ctrl->setCmd("showSummary");
843 // $this->ctrl->setCmdClass("ilinfoscreengui");
844 $this->ctrl->forwardCommand($info);
845 }
846
847
848 // get tabs
849 public function setTabs()
850 {
851 global $DIC;
852 $ilTabs = $DIC['ilTabs'];
853 $lng = $DIC['lng'];
854 $ilHelp = $DIC['ilHelp'];
855
856 $ilHelp->setScreenIdComponent("file");
857
858 $this->ctrl->setParameter($this, "ref_id", $this->node_id);
859
860 if ($this->checkPermissionBool("visible") || $this->checkPermissionBool("read")) {
861 $ilTabs->addTab(
862 "id_info",
863 $lng->txt("info_short"),
864 $this->ctrl->getLinkTargetByClass(array("ilobjfilegui", "ilinfoscreengui"), "showSummary")
865 );
866 }
867
868 if ($this->checkPermissionBool("write")) {
869 $ilTabs->addTab(
870 "settings",
871 $lng->txt("edit"),
872 $this->ctrl->getLinkTarget($this, "edit")
873 );
874 }
875
876 if ($this->checkPermissionBool("write")) {
877 $ilTabs->addTab(
878 "id_versions",
879 $lng->txt("versions"),
880 $this->ctrl->getLinkTarget($this, "versions")
881 );
882 }
883
884 require_once 'Services/Tracking/classes/class.ilLearningProgressAccess.php';
885 if (ilLearningProgressAccess::checkAccess($this->object->getRefId())) {
886 $ilTabs->addTab(
887 'learning_progress',
888 $lng->txt('learning_progress'),
889 $this->ctrl->getLinkTargetByClass(array(__CLASS__, 'illearningprogressgui'), '')
890 );
891 }
892
893 // meta data
894 if ($this->checkPermissionBool("write")) {
895 include_once "Services/Object/classes/class.ilObjectMetaDataGUI.php";
896 $mdgui = new ilObjectMetaDataGUI($this->object);
897 $mdtab = $mdgui->getTab();
898 if ($mdtab) {
899 $ilTabs->addTab(
900 "id_meta",
901 $lng->txt("meta_data"),
902 $mdtab
903 );
904 }
905 }
906
907 // export
908 if ($this->checkPermissionBool("write")) {
909 $ilTabs->addTab(
910 "export",
911 $lng->txt("export"),
912 $this->ctrl->getLinkTargetByClass("ilexportgui", "")
913 );
914 }
915
916 // will add permission tab if needed
917 parent::setTabs();
918 }
919
920
921 public static function _goto($a_target, $a_additional = null)
922 {
923 global $DIC;
924 $ilErr = $DIC['ilErr'];
925 $lng = $DIC['lng'];
926 $ilAccess = $DIC['ilAccess'];
927
928 if ($a_additional && substr($a_additional, -3) == "wsp") {
929 $_GET["baseClass"] = "ilsharedresourceGUI";
930 $_GET["wsp_id"] = $a_target;
931 include("ilias.php");
932 exit;
933 }
934
935 // added support for direct download goto links
936 if ($a_additional && substr($a_additional, -8) == "download") {
937 ilObjectGUI::_gotoRepositoryNode($a_target, "sendfile");
938 }
939
940 // static method, no workspace support yet
941
942 if ($ilAccess->checkAccess("visible", "", $a_target)
943 || $ilAccess->checkAccess("read", "", $a_target)
944 ) {
945 ilObjectGUI::_gotoRepositoryNode($a_target, "infoScreen");
946 } else {
947 if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID)) {
949 $lng->txt("msg_no_perm_read_item"),
951 ), true);
953 }
954 }
955
956 $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
957 }
958
959
963 public function addLocatorItems()
964 {
965 global $DIC;
966 $ilLocator = $DIC['ilLocator'];
967
968 if (is_object($this->object)) {
969 $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, ""), "", $this->node_id);
970 }
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
1008
1012 public function uploadFiles()
1013 {
1014 global $DIC;
1015
1016 $response = new stdClass();
1017 $response->error = null;
1018 $response->debug = null;
1019
1020 $files = $_FILES;
1021
1022 // #14249 - race conditions because of concurrent uploads
1023 $after_creation_callback = (int) $_REQUEST["crtcb"];
1024 if ($after_creation_callback) {
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 try {
1033 if (!$this->checkPermissionBool("create", "", "file")) {
1034 $response->error = $this->lng->txt("permission_denied");
1035 } else {
1036 // handle the file
1037 $inp = $dnd_form_gui->getInput("upload_files");
1038 $this->log->debug("ilObjFileGUI::uploadFiles " . print_r($_POST, true));
1039 $this->log->debug("ilObjFileGUI::uploadFiles " . print_r($_FILES, true));
1040 $fileresult = $this->handleFileUpload($inp);
1041 if ($fileresult) {
1042 $response = (object) array_merge((array) $response, (array) $fileresult);
1043 }
1044 }
1045 } catch (Exception $ex) {
1046 $response->error = $ex->getMessage();
1047 }
1048 } else {
1049 $dnd_input = $dnd_form_gui->getItemByPostVar("upload_files");
1050 $response->error = $dnd_input->getAlert();
1051 }
1052
1053 if ($after_creation_callback
1054 && sizeof($this->after_creation_callback_objects)
1055 ) {
1056 foreach ($this->after_creation_callback_objects as $new_file_obj) {
1057 ilObject2GUI::handleAfterSaveCallback($new_file_obj, $after_creation_callback);
1058 }
1059 unset($this->after_creation_callback_objects);
1060 }
1061
1062 // send response object (don't use 'application/json' as IE wants to download it!)
1063 header('Vary: Accept');
1064 header('Content-type: text/plain');
1065
1066 foreach ($DIC->upload()->getResults() as $result) {
1067 if (!ilFileUtils::hasValidExtension($result->getName())) {
1068 $this->lng->loadLanguageModule('file');
1069 ilUtil::sendInfo($this->lng->txt('file_upload_info_file_with_critical_unknown_extension_later_renamed_when_downloading'), true);
1070 }
1071 }
1072 echo json_encode($response);
1073 // no further processing!
1074 exit;
1075 }
1076
1077
1085 protected function handleFileUpload($file_upload)
1086 {
1087 global $DIC;
1088 $ilUser = $DIC['ilUser'];
1089
1090 // file upload params
1091 $filename = ilUtil::stripSlashes($file_upload["name"]);
1092 $type = ilUtil::stripSlashes($file_upload["type"]);
1093 $size = ilUtil::stripSlashes($file_upload["size"]);
1094 $temp_name = $file_upload["tmp_name"];
1095
1096 // additional params
1097 $title = ilUtil::stripSlashes($file_upload["title"]);
1098 $description = ilUtil::stripSlashes($file_upload["description"]);
1099 $extract = ilUtil::stripSlashes($file_upload["extract"]);
1100 $keep_structure = ilUtil::stripSlashes($file_upload["keep_structure"]);
1101
1102 // create answer object
1103 $response = new stdClass();
1104 $response->fileName = $filename;
1105 $response->fileSize = intval($size);
1106 $response->fileType = $type;
1107 $response->fileUnzipped = $extract;
1108 $response->error = null;
1109
1110 // extract archive?
1111 if ($extract) {
1112 $zip_file = $filename;
1113 $adopt_structure = $keep_structure;
1114
1115 include_once("Services/Utilities/classes/class.ilFileUtils.php");
1116
1117 // Create unzip-directory
1118 $newDir = ilUtil::ilTempnam();
1119 ilUtil::makeDir($newDir);
1120
1121 // Check if permission is granted for creation of object, if necessary
1122 if ($this->id_type != self::WORKSPACE_NODE_ID) {
1123 $type = ilObject::_lookupType((int) $this->parent_id, true);
1124 } else {
1125 $type = ilObject::_lookupType($this->tree->lookupObjectId($this->parent_id), false);
1126 }
1127
1128 $tree = $access_handler = null;
1129 switch ($type) {
1130 // workspace structure
1131 case 'wfld':
1132 case 'wsrt':
1133 $permission = $this->checkPermissionBool("create", "", "wfld");
1134 $containerType = "WorkspaceFolder";
1137 break;
1138
1139 // use categories as structure
1140 case 'cat':
1141 case 'root':
1142 $permission = $this->checkPermissionBool("create", "", "cat");
1143 $containerType = "Category";
1144 break;
1145
1146 // use folders as structure (in courses)
1147 default:
1148 $permission = $this->checkPermissionBool("create", "", "fold");
1149 $containerType = "Folder";
1150 break;
1151 }
1152
1153 try {
1154 // processZipFile (
1155 // Dir to unzip,
1156 // Path to uploaded file,
1157 // should a structure be created (+ permission check)?
1158 // ref_id of parent
1159 // object that contains files (folder or category)
1160 // should sendInfo be persistent?)
1162 $newDir,
1163 $temp_name,
1164 ($adopt_structure && $permission),
1165 $this->parent_id,
1166 $containerType,
1167 $tree,
1169 );
1170 } catch (ilFileUtilsException $e) {
1171 $response->error = $e->getMessage();
1172 } catch (Exception $ex) {
1173 $response->error = $ex->getMessage();
1174 }
1175
1176 ilUtil::delDir($newDir);
1177
1178 // #15404
1179 if ($this->id_type != self::WORKSPACE_NODE_ID) {
1180 foreach (ilFileUtils::getNewObjects() as $parent_ref_id => $objects) {
1181 if ($parent_ref_id != $this->parent_id) {
1182 continue;
1183 }
1184
1185 foreach ($objects as $object) {
1186 $this->after_creation_callback_objects[] = $object;
1187 }
1188 }
1189 }
1190 } else {
1191 if (trim($title) == "") {
1192 $title = $filename;
1193 } else {
1194 // BEGIN WebDAV: Ensure that object title ends with the filename extension
1196 $titleExtension = ilObjFileAccess::_getFileExtension($title);
1197 if ($titleExtension != $fileExtension && strlen($fileExtension) > 0) {
1198 $title .= '.' . $fileExtension;
1199 }
1200 // END WebDAV: Ensure that object title ends with the filename extension
1201 }
1202
1203 // create and insert file in grp_tree
1204 $fileObj = new ilObjFile();
1205 $fileObj->setTitle($title);
1206 $fileObj->setDescription($description);
1207 $fileObj->setFileName($filename);
1208
1209 $fileObj->setFileType(ilMimeTypeUtil::getMimeType("", $filename, $type));
1210 $fileObj->setFileSize($size);
1211 $this->object_id = $fileObj->create();
1212
1213 $this->putObjectInTree($fileObj, $this->parent_id);
1214
1215 // see uploadFiles()
1216 if (is_array($this->after_creation_callback_objects)) {
1217 $this->after_creation_callback_objects[] = $fileObj;
1218 }
1219
1220 // upload file to filesystem
1221 $fileObj->createDirectory();
1222 $fileObj->raiseUploadError(false);
1223 $result = $fileObj->getUploadFile($temp_name, $filename);
1224 if ($result) {
1225 //if no title for the file was set use the filename as title
1226 if (empty($fileObj->getTitle())) {
1227 $fileObj->setTitle($result->getName());
1228 }
1229 $fileObj->setFileName($result->getName());
1230 }
1231 $fileObj->update();
1232 $this->handleAutoRating($fileObj);
1233
1234 ilChangeEvent::_recordWriteEvent($fileObj->getId(), $ilUser->getId(), 'create');
1235 }
1236
1237 return $response;
1238 }
1239
1240
1244 public function deleteVersions()
1245 {
1246 global $DIC;
1247 $ilTabs = $DIC['ilTabs'];
1248 $ilLocator = $DIC['ilLocator'];
1249
1250 // get ids either from GET (if single item was clicked) or
1251 // from POST (if multiple items were selected)
1252 $request = $DIC->http()->request();
1253
1254 $version_ids = [];
1255 if (isset($request->getQueryParams()['hist_id'])) {
1256 $version_ids = [$request->getQueryParams()['hist_id']];
1257 } elseif (isset($request->getParsedBody()['hist_id'])) {
1258 $version_ids = (array) $request->getParsedBody()['hist_id'];
1259 }
1260
1261 if (count($version_ids) < 1) {
1262 ilUtil::sendFailure($this->lng->txt("no_checkbox"), true);
1263 $this->ctrl->redirect($this, "versions");
1264 } else {
1265 $ilTabs->activateTab("id_versions");
1266
1267 // check if all versions are selected
1268 $versionsToKeep = array_udiff($this->object->getVersions(), $version_ids, array($this, "compareHistoryIds"));
1269 if (count($versionsToKeep) < 1) {
1270 // set our message
1271 ilUtil::sendQuestion($this->lng->txt("file_confirm_delete_all_versions"));
1272
1273 // show confirmation gui
1274 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
1275 $conf_gui = new ilConfirmationGUI();
1276 $conf_gui->setFormAction($this->ctrl->getFormAction($this, "versions"));
1277 $conf_gui->setCancel($this->lng->txt("cancel"), "cancelDeleteFile");
1278 $conf_gui->setConfirm($this->lng->txt("confirm"), "confirmDeleteFile");
1279
1280 $conf_gui->addItem(
1281 "id[]",
1282 $this->ref_id,
1283 $this->object->getTitle(),
1284 ilObject::_getIcon($this->object->getId(), "small", $this->object->getType()),
1285 $this->lng->txt("icon") . " " . $this->lng->txt("obj_" . $this->object->getType())
1286 );
1287
1288 $html = $conf_gui->getHTML();
1289 } else {
1290 include_once("./Modules/File/classes/class.ilFileVersionTableGUI.php");
1291
1292 ilUtil::sendQuestion($this->lng->txt("file_confirm_delete_versions"));
1293 $versions = $this->object->getVersions($version_ids);
1294
1295 $table = new ilFileVersionTableGUI($this, 'versions', true);
1296 $table->setMaxCount(sizeof($versions));
1297 $table->setData($versions);
1298
1299 $html = $table->getHTML();
1300 }
1301
1302 $this->tpl->setVariable('ADM_CONTENT', $html);
1303 }
1304 }
1305
1306
1310 public function confirmDeleteVersions()
1311 {
1312 global $DIC;
1313 $ilTabs = $DIC['ilTabs'];
1314
1315 // has the user the rights to delete versions?
1316 if (!$this->checkPermissionBool("write")) {
1317 $this->ilErr->raiseError($this->lng->txt("permission_denied"), $this->ilErr->MESSAGE);
1318 }
1319
1320 // delete versions after confirmation
1321 if (count($_POST["hist_id"]) > 0) {
1322 $this->object->deleteVersions($_POST["hist_id"]);
1323 ilUtil::sendSuccess($this->lng->txt("file_versions_deleted"), true);
1324 }
1325
1326 $this->ctrl->setParameter($this, "hist_id", "");
1327 $this->ctrl->redirect($this, "versions");
1328 }
1329
1330
1334 public function cancelDeleteVersions()
1335 {
1336 $this->ctrl->redirect($this, "versions");
1337 }
1338
1339
1343 public function confirmDeleteFile()
1344 {
1345 // has the user the rights to delete the file?
1346 if (!$this->checkPermissionBool("write")) {
1347 $this->ilErr->raiseError($this->lng->txt("permission_denied"), $this->ilErr->MESSAGE);
1348 }
1349
1350 // delete this file object
1351 include_once("./Services/Repository/classes/class.ilRepUtilGUI.php");
1352 $ru = new ilRepUtilGUI($this);
1353 $ru->deleteObjects($this->parent_id, array($this->ref_id));
1354
1355 // redirect to parent object
1356 $this->ctrl->setParameterByClass("ilrepositorygui", "ref_id", $this->parent_id);
1357 $this->ctrl->redirectByClass("ilrepositorygui");
1358 }
1359
1360
1364 public function cancelDeleteFile()
1365 {
1366 $this->ctrl->redirect($this, "versions");
1367 }
1368
1369
1378 public function compareHistoryIds($v1, $v2)
1379 {
1380 if (is_array($v1)) {
1381 $v1 = (int) $v1["hist_entry_id"];
1382 } else {
1383 if (!is_int($v1)) {
1384 $v1 = (int) $v1;
1385 }
1386 }
1387
1388 if (is_array($v2)) {
1389 $v2 = (int) $v2["hist_entry_id"];
1390 } else {
1391 if (!is_int($v2)) {
1392 $v2 = (int) $v2;
1393 }
1394 }
1395
1396 return $v1 - $v2;
1397 }
1398
1399
1403 public function rollbackVersion()
1404 {
1405 global $DIC;
1406 $ilTabs = $DIC['ilTabs'];
1407
1408 // has the user the rights to delete the file?
1409 if (!$this->checkPermissionBool("write")) {
1410 $this->ilErr->raiseError($this->lng->txt("permission_denied"), $this->ilErr->MESSAGE);
1411 }
1412
1413 // get ids either from GET (if single item was clicked) or
1414 // from POST (if multiple items were selected)
1415 $version_ids = isset($_GET["hist_id"]) ? array($_GET["hist_id"]) : $_POST["hist_id"];
1416
1417 // more than one entry selected?
1418 if (count($version_ids) != 1) {
1419 ilUtil::sendInfo($this->lng->txt("file_rollback_select_exact_one"), true);
1420 $this->ctrl->redirect($this, "versions");
1421 }
1422
1423 // rollback the version
1424 $new_version = $this->object->rollback($version_ids[0]);
1425
1426 ilUtil::sendSuccess(sprintf($this->lng->txt("file_rollback_done"), $new_version["rollback_version"]), true);
1427 $this->ctrl->redirect($this, "versions");
1428 }
1429
1430
1431 protected function initHeaderAction($a_sub_type = null, $a_sub_id = null)
1432 {
1433 $lg = parent::initHeaderAction($a_sub_type, $a_sub_id);
1434 if (is_object($lg)) {
1435 if ($this->object->hasRating()) {
1436 $lg->enableRating(
1437 true,
1438 null,
1439 false,
1440 array("ilcommonactiondispatchergui", "ilratinggui")
1441 );
1442 }
1443 }
1444
1445 return $lg;
1446 }
1447} // END class.ilObjFileGUI
sprintf('%.4f', $callTime)
$result
$size
Definition: RandomTest.php:84
$files
Definition: add-vimline.php:18
$_GET["client_id"]
$_POST["username"]
An exception for terminatinating execution or to throw for unit testing.
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 _catchupWriteEvents($obj_id, $usr_id, $timestamp=null)
Catches up with all write events which occured before the specified timestamp.
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)
Class ilFileStandardDropzoneInputGUI.
static isDragAndDropUploadEnabled()
Gets whether drag and drop file upload is enabled.
Class to report exception.
static hasValidExtension($a_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 _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)
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, $a_ctrl_path="ilpublicuserprofilegui")
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)
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
global $ilCtrl
Definition: ilias.php:18
$info
Definition: index.php:5
Class FlySystemFileAccessTest.
Class BaseForm.
$ret
Definition: parser.php:6
$type
$response
if(empty($password)) $table
Definition: pwgen.php:24
if(isset($_POST['submit'])) $form
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file
global $DIC
Definition: saml.php:7
$preview
$ilUser
Definition: imgupload.php:18