ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilAdvancedMDRecordImportFiles Class Reference
+ Collaboration diagram for ilAdvancedMDRecordImportFiles:

Public Member Functions

 __construct ()
 
 getImportDirectory ()
 
 getImportFileByCreationDate (int $a_unix_time)
 Get import file by creation date. More...
 
 deleteFileByCreationDate (int $a_unix_time)
 Delete a file. More...
 
 moveUploadedFile (string $a_temp_name)
 move uploaded files @access public More...
 

Data Fields

const IMPORT_NAME = 'ilias_adv_md_record'
 

Private Member Functions

 init ()
 init function: create import directory, delete old files More...
 

Private Attributes

string $import_dir = ''
 

Detailed Description

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Todo:
use filesystem service

Definition at line 25 of file class.ilAdvancedMDRecordImportFiles.php.

Constructor & Destructor Documentation

◆ __construct()

ilAdvancedMDRecordImportFiles::__construct ( )

Definition at line 31 of file class.ilAdvancedMDRecordImportFiles.php.

32 {
33 $this->import_dir = ilFileUtils::getDataDir() . '/ilAdvancedMetaData/import';
34 $this->init();
35 }
init()
init function: create import directory, delete old files
static getDataDir()
get data directory (outside webspace)

References ilFileUtils\getDataDir(), and init().

+ Here is the call graph for this function:

Member Function Documentation

◆ deleteFileByCreationDate()

ilAdvancedMDRecordImportFiles::deleteFileByCreationDate ( int  $a_unix_time)

Delete a file.

Parameters
intcreation date (unix time)

Definition at line 57 of file class.ilAdvancedMDRecordImportFiles.php.

57 : bool
58 {
59 $unix_time = $a_unix_time;
60 return unlink($this->getImportDirectory() . '/' . self::IMPORT_NAME . '_' . $unix_time . '.xml');
61 }

References getImportDirectory().

+ Here is the call graph for this function:

◆ getImportDirectory()

ilAdvancedMDRecordImportFiles::getImportDirectory ( )

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

References $import_dir.

Referenced by deleteFileByCreationDate(), getImportFileByCreationDate(), and moveUploadedFile().

+ Here is the caller graph for this function:

◆ getImportFileByCreationDate()

ilAdvancedMDRecordImportFiles::getImportFileByCreationDate ( int  $a_unix_time)

Get import file by creation date.

Parameters
intcreation date (unix time)
Returns
string absolute path

Definition at line 47 of file class.ilAdvancedMDRecordImportFiles.php.

47 : string
48 {
49 $unix_time = $a_unix_time;
50 return $this->getImportDirectory() . '/' . self::IMPORT_NAME . '_' . $unix_time . '.xml';
51 }

References getImportDirectory().

+ Here is the call graph for this function:

◆ init()

ilAdvancedMDRecordImportFiles::init ( )
private

init function: create import directory, delete old files

Definition at line 83 of file class.ilAdvancedMDRecordImportFiles.php.

83 : void
84 {
85 if (!is_dir($this->import_dir)) {
86 ilFileUtils::makeDirParents($this->import_dir);
87 }
88 }
static makeDirParents(string $a_dir)
Create a new directory and all parent directories.

References ilFileUtils\makeDirParents().

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ moveUploadedFile()

ilAdvancedMDRecordImportFiles::moveUploadedFile ( string  $a_temp_name)

move uploaded files @access public

Parameters
stringtmp name
Returns
int creation time of newly created file. 0 on error

Definition at line 69 of file class.ilAdvancedMDRecordImportFiles.php.

69 : int
70 {
71 $creation_time = time();
72 $file_name = $this->getImportDirectory() . '/' . self::IMPORT_NAME . '_' . $creation_time . '.xml';
73
74 if (!ilFileUtils::moveUploadedFile($a_temp_name, '', $file_name, false)) {
75 return 0;
76 }
77 return $creation_time;
78 }
static moveUploadedFile(string $a_file, string $a_name, string $a_target, bool $a_raise_errors=true, string $a_mode="move_uploaded")
move uploaded file

References getImportDirectory(), and ilFileUtils\moveUploadedFile().

+ Here is the call graph for this function:

Field Documentation

◆ $import_dir

string ilAdvancedMDRecordImportFiles::$import_dir = ''
private

Definition at line 29 of file class.ilAdvancedMDRecordImportFiles.php.

Referenced by getImportDirectory().

◆ IMPORT_NAME

const ilAdvancedMDRecordImportFiles::IMPORT_NAME = 'ilias_adv_md_record'

Definition at line 27 of file class.ilAdvancedMDRecordImportFiles.php.


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