blob: 21a0ea6b2611b49b00942dca307ff921275c392d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
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;
}
|