diff options
| author | tgloeggl <tgloeggl@uos.de> | 2022-01-13 14:38:39 +0100 |
|---|---|---|
| committer | tgloeggl <tgloeggl@uos.de> | 2022-07-28 13:59:21 +0200 |
| commit | da3db0c846bd2c3498a487727ddb11b37324824f (patch) | |
| tree | 4b0b13adb6a1f55716372b75887e139d7f94df85 /lib/models/Courseware/CustomFiles.php | |
| parent | 7d087fcdf3218f8101e592b78f948479b3d02fe2 (diff) | |
working on creating plugin-api for im- and exportticket-334
fix bug
fix passing of custom file to block
fix custom-file creation on client side
working on crud custom file api for courseware blocks
create correct link for custom file
add read part of CRUD
add delete part of CRUD
change behaviour of add a new file, contents are passed via separate route
update custom-file content
add route to patch metadata of custom-file
changes to export for reference
fix jsonapi for custom-files
export custom-files
correctly import custom files
remove custom files from file-refs
revert changes to block
remove obsolte use statement in Block
revert changes to BlockType and Download-Block
remove obsolete implements from DownloadBlock
add doku, fix exporting of blocks without custom-files
remove debugging messages and now obsolete code
cleaning up
rework custom file check
fix error and remove call to mime-type for custom files
rename interface methods
do not assign variables in function calls
Diffstat (limited to 'lib/models/Courseware/CustomFiles.php')
| -rw-r--r-- | lib/models/Courseware/CustomFiles.php | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/lib/models/Courseware/CustomFiles.php b/lib/models/Courseware/CustomFiles.php new file mode 100644 index 0000000..21a0ea6 --- /dev/null +++ b/lib/models/Courseware/CustomFiles.php @@ -0,0 +1,69 @@ +<?php + +namespace Courseware; + +use Courseware\Filesystem\CustomFile; + +/** + * This interface enables a courseware-block to have a user defined representation + * of files. This enables a block to have its own internal representation for + * arbitrary content as well allowing the import and export of said content in + * a defined and coherent way. + */ +interface CustomFiles +{ + /** + * Returns an array of CustomFile objects belongig to this block + * + * @return array<int, CustomFile> + */ + public function getCustomFiles() : array; + + /** + * create a new custom file, the contents have to be set by updateCustomFilesContent afterwards + * + * @param array $metadata any additional metadata needed, like id + * @param string $content the files contets + * + * @return CustomFile the newly created custom file + */ + public function createCustomFile(CustomFile $custom_file) : CustomFile; + + /** + * returns the contents for the custom file with the passed id + * + * @param string $id the id for the custom file + * + * @return string + */ + public function readCustomFile($id) : string; + + /** + * update the attributes of the custom file for the passed id + * + * @param string $id + * @param array $metadata + * + * @return CustomFile + */ + public function updateCustomFileMetadata($id, CustomFile $custom_file) : CustomFile; + + /** + * update the contents of the customf ile for the passed id + * + * @param string $id + * @param string $content + * + * @return CustomFile + */ + public function updateCustomFileContent($id, $content) : CustomFile; + + /** + * delete the custom file for the passed id + * + * @param string $id + * + * @return bool + */ + public function deleteCustomFile($id) : bool; +} |
