ILIAS  release_7 Revision v7.30-3-g800a261c036
ilObjFileSingleFileDelegate Class Reference

Class ilObjFileSingleFileDelegate. More...

+ Inheritance diagram for ilObjFileSingleFileDelegate:
+ Collaboration diagram for ilObjFileSingleFileDelegate:

Public Member Functions

 handle (int $parent_id, array $post_data, UploadResult $result, ilObjFileGUI $gui)
 
 getUploadedSuffixes ()
 
 handle (int $parent_id, array $post_data, UploadResult $result, ilObjFileGUI $gui)
 
 getUploadedSuffixes ()
 

Protected Attributes

 $object_id
 
 $uploaded_suffixes = []
 

Detailed Description

Member Function Documentation

◆ getUploadedSuffixes()

ilObjFileSingleFileDelegate::getUploadedSuffixes ( )

Implements ilObjUploadDelegateInterface.

Definition at line 72 of file class.ilObjFileSingleFileDelegate.php.

72 : array
73 {
74 return array_map('strtolower', $this->uploaded_suffixes);
75 }

◆ handle()

ilObjFileSingleFileDelegate::handle ( int  $parent_id,
array  $post_data,
UploadResult  $result,
ilObjFileGUI  $gui 
)

Implements ilObjUploadDelegateInterface.

Definition at line 37 of file class.ilObjFileSingleFileDelegate.php.

43 // Create new FileObject
44 $file = new ilObjFile();
45 $this->object_id = $file->create();
46 $gui->putObjectInTree($file, $parent_id);
47// $gui->handleAutoRating($file);
48
49 // Response
51
52 // Append Upload
53 $title = $post_data['title'];
54 $description = $post_data['description'];
55 try {
56 $file->appendUpload($result, $title ?? $result->getName());
57 $file->setDescription($description);
58 $file->update();
59 $response->fileName = $file->getFileName();
60 $response->fileSize = $file->getFileSize();
61 $response->fileType = $file->getFileType();
62 $response->error = null;
63 $this->uploaded_suffixes[] = $file->getFileExtension();
64 } catch (Exception $e) {
65 $file->delete();
66 $response->error = $e->getMessage();
67 }
68
69 return $response;
70 }
$result
Class ilObjFileUploadResponse.
Class ilObjFile.
putObjectInTree(ilObject $a_obj, $a_parent_node_id=null)
Add object to tree at given position.
$response

Field Documentation

◆ $object_id

ilObjFileSingleFileDelegate::$object_id
protected

Definition at line 30 of file class.ilObjFileSingleFileDelegate.php.

◆ $uploaded_suffixes

ilObjFileSingleFileDelegate::$uploaded_suffixes = []
protected

Definition at line 35 of file class.ilObjFileSingleFileDelegate.php.


The documentation for this class was generated from the following file: