ILIAS  trunk Revision v11.0_alpha-1744-gb0451eebef4
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilAdvancedMDRecordExportFiles Class Reference
+ Collaboration diagram for ilAdvancedMDRecordExportFiles:

Public Member Functions

 __construct (int $user_id, ?ObjectId $a_obj_id=null)
 
 readFilesInfo ()
 
 create (string $a_xml)
 
 download (string $file_id, string|null $filename_overwrite=null)
 
 deleteByFileId (int $user_id, string $file_id)
 

Protected Attributes

const SIZE = 'size'
 
const DATE = 'date'
 
const NAME = 'name'
 
ilAMDRecordFileFactory $amd_record_file_factory
 
string $export_dir = ''
 
ObjectId null $object_id
 
int $user_id
 

Detailed Description

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Todo:
use logger and filestorage

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

Constructor & Destructor Documentation

◆ __construct()

ilAdvancedMDRecordExportFiles::__construct ( int  $user_id,
?ObjectId  $a_obj_id = null 
)

Definition at line 40 of file class.ilAdvancedMDRecordExportFiles.php.

References $user_id.

43  {
44  $this->amd_record_file_factory = new ilAMDRecordFileFactory();
45  $this->user_id = $user_id;
46  $this->object_id = $a_obj_id;
47  }

Member Function Documentation

◆ create()

ilAdvancedMDRecordExportFiles::create ( string  $a_xml)

Definition at line 67 of file class.ilAdvancedMDRecordExportFiles.php.

Referenced by ilAdvancedMDSettingsGUI\exportRecords().

69  : void {
70  $file_name = time() . '.xml';
71  $stream = Streams::ofString($a_xml);
72  if (is_null($this->object_id)) {
73  $this->amd_record_file_factory->handler()->addGlobalFile(
74  $this->user_id,
75  $file_name,
76  $stream
77  );
78  }
79  if (!is_null($this->object_id)) {
80  $this->amd_record_file_factory->handler()->addFile(
81  $this->object_id,
82  $this->user_id,
83  $file_name,
84  $stream
85  );
86  }
87  }
+ Here is the caller graph for this function:

◆ deleteByFileId()

ilAdvancedMDRecordExportFiles::deleteByFileId ( int  $user_id,
string  $file_id 
)

Definition at line 108 of file class.ilAdvancedMDRecordExportFiles.php.

Referenced by ilAdvancedMDSettingsGUI\deleteFiles().

111  : bool {
112  $global = is_null($this->object_id);
113  if ($global) {
114  $this->amd_record_file_factory->handler()->deleteGlobal(
115  $user_id,
116  $file_id
117  );
118  }
119  if (!$global) {
120  $this->amd_record_file_factory->handler()->delete(
121  $this->object_id,
122  $user_id,
123  $file_id
124  );
125  }
126  return true;
127  }
+ Here is the caller graph for this function:

◆ download()

ilAdvancedMDRecordExportFiles::download ( string  $file_id,
string|null  $filename_overwrite = null 
)

Definition at line 89 of file class.ilAdvancedMDRecordExportFiles.php.

Referenced by ilAdvancedMDSettingsGUI\downloadFile().

92  : void {
93  if (is_null($this->object_id)) {
94  $this->amd_record_file_factory->handler()->downloadGlobal(
95  $file_id,
96  $filename_overwrite
97  );
98  }
99  if (!is_null($this->object_id)) {
100  $this->amd_record_file_factory->handler()->download(
101  $this->object_id,
102  $file_id,
103  $filename_overwrite
104  );
105  }
106  }
+ Here is the caller graph for this function:

◆ readFilesInfo()

ilAdvancedMDRecordExportFiles::readFilesInfo ( )
Returns
array array e.g array(records => 'ECS-Server',size => '123',created' => 121212)

Definition at line 52 of file class.ilAdvancedMDRecordExportFiles.php.

Referenced by ilAdvancedMDSettingsGUI\confirmDeleteFiles(), and ilAdvancedMDSettingsGUI\showFiles().

52  : array
53  {
54  $file_info = [];
55  $elements = is_null($this->object_id)
56  ? $this->amd_record_file_factory->handler()->getGlobalFiles()
57  : $this->amd_record_file_factory->handler()->getFilesByObjectId($this->object_id);
58  foreach ($elements as $element) {
59  $file_id = $element->getIRSS()->getResourceIdSerialized();
60  $file_info[$file_id][self::SIZE] = $element->getIRSS()->getResourceSize();
61  $file_info[$file_id][self::DATE] = $element->getIRSS()->getCreationDate()->getTimestamp();
62  $file_info[$file_id][self::NAME] = $element->getIRSS()->getRecords();
63  }
64  return $file_info;
65  }
+ Here is the caller graph for this function:

Field Documentation

◆ $amd_record_file_factory

ilAMDRecordFileFactory ilAdvancedMDRecordExportFiles::$amd_record_file_factory
protected

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

◆ $export_dir

string ilAdvancedMDRecordExportFiles::$export_dir = ''
protected

Definition at line 36 of file class.ilAdvancedMDRecordExportFiles.php.

◆ $object_id

ObjectId null ilAdvancedMDRecordExportFiles::$object_id
protected

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

◆ $user_id

int ilAdvancedMDRecordExportFiles::$user_id
protected

Definition at line 38 of file class.ilAdvancedMDRecordExportFiles.php.

Referenced by __construct().

◆ DATE

const ilAdvancedMDRecordExportFiles::DATE = 'date'
protected

Definition at line 33 of file class.ilAdvancedMDRecordExportFiles.php.

◆ NAME

const ilAdvancedMDRecordExportFiles::NAME = 'name'
protected

Definition at line 34 of file class.ilAdvancedMDRecordExportFiles.php.

◆ SIZE

const ilAdvancedMDRecordExportFiles::SIZE = 'size'
protected

Definition at line 32 of file class.ilAdvancedMDRecordExportFiles.php.


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