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