ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilExportFileInfo Class Reference

@classDescription Stores information of creation date and versions of export files More...

+ Collaboration diagram for ilExportFileInfo:

Public Member Functions

 __construct (int $a_obj_id, string $a_export_type='', string $a_filename='')
 
 setExportType (string $a_type)
 
 getExportType ()
 
 setFilename (string $a_name)
 
 getFilename ()
 
 getBasename (string $a_ext='.zip')
 
 setObjId (int $a_id)
 
 getObjId ()
 
 setVersion (string $a_version)
 
 getVersion ()
 
 getCreationDate ()
 
 setCreationDate (?ilDateTime $dt=null)
 
 create ()
 
 delete ()
 

Static Public Member Functions

static lookupLastExport (int $a_obj_id, string $a_type, string $a_version='')
 Lookup last export. More...
 
static deleteByObjId ($a_obj_id)
 

Protected Member Functions

 read ()
 

Protected Attributes

const CURRENT_VERSION = "4.1.0"
 
ilDBInterface $db
 

Private Attributes

int $obj_id = 0
 
string $version = self::CURRENT_VERSION
 
string $export_type = ''
 
string $file_name = ''
 
ilDateTime $create_date = null
 

Detailed Description

@classDescription Stores information of creation date and versions of export files

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om

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

Constructor & Destructor Documentation

◆ __construct()

ilExportFileInfo::__construct ( int  $a_obj_id,
string  $a_export_type = '',
string  $a_filename = '' 
)

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

38 {
39 global $DIC;
40
41 $this->db = $DIC->database();
42 $this->obj_id = $a_obj_id;
43 $this->export_type = $a_export_type;
44 $this->file_name = $a_filename;
45 if ($this->getObjId() and $this->getExportType() and $this->getFilename()) {
46 $this->read();
47 }
48 }
global $DIC
Definition: shib_login.php:26

References $DIC, getExportType(), getFilename(), getObjId(), and read().

+ Here is the call graph for this function:

Member Function Documentation

◆ create()

ilExportFileInfo::create ( )

Definition at line 139 of file class.ilExportFileInfo.php.

139 : void
140 {
141 $exists_query = 'select * from export_file_info ' .
142 'where obj_id = ' . $this->db->quote($this->obj_id, 'integer') . ' ' .
143 'and export_type = ' . $this->db->quote($this->getExportType(), 'text') . ' ' .
144 'and filename = ' . $this->db->quote($this->getFilename(), 'text');
145 $exists_res = $this->db->query($exists_query);
146
147 if (!$exists_res->numRows()) {
148 $query = "INSERT INTO export_file_info (obj_id, export_type, filename, version, create_date) " .
149 "VALUES ( " .
150 $this->db->quote($this->getObjId(), 'integer') . ', ' .
151 $this->db->quote($this->getExportType(), 'text') . ', ' .
152 $this->db->quote($this->getFilename(), 'text') . ', ' .
153 $this->db->quote($this->getVersion(), 'text') . ', ' .
154 $this->db->quote(
156 'timestamp'
157 ) . ' ' .
158 ")";
159 $this->db->manipulate($query);
160 }
161 }
const IL_CAL_DATETIME

References getCreationDate(), getExportType(), getFilename(), getObjId(), getVersion(), IL_CAL_DATETIME, and ilTimeZone\UTC.

+ Here is the call graph for this function:

◆ delete()

ilExportFileInfo::delete ( )

Definition at line 163 of file class.ilExportFileInfo.php.

163 : void
164 {
165 $this->db->manipulate(
166 'DELETE FROM export_file_info ' .
167 'WHERE obj_id = ' . $this->db->quote($this->getObjId(), 'integer') . ' ' .
168 'AND filename = ' . $this->db->quote($this->getFilename(), 'text')
169 );
170 }

References getFilename().

+ Here is the call graph for this function:

◆ deleteByObjId()

static ilExportFileInfo::deleteByObjId (   $a_obj_id)
static

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

73 {
74 global $DIC;
75
76 $ilDB = $DIC->database();
77 $ilDB->manipulate("DELETE FROM export_file_info WHERE obj_id = " . $ilDB->quote(
78 $a_obj_id,
80 ));
81 return true;
82 }

References $DIC, $ilDB, and ilDBConstants\T_INTEGER.

◆ getBasename()

ilExportFileInfo::getBasename ( string  $a_ext = '.zip')

Definition at line 104 of file class.ilExportFileInfo.php.

104 : string
105 {
106 return basename($this->getFilename(), $a_ext);
107 }

References getFilename().

+ Here is the call graph for this function:

◆ getCreationDate()

ilExportFileInfo::getCreationDate ( )

Definition at line 129 of file class.ilExportFileInfo.php.

129 : ilDateTime
130 {
131 return $this->create_date instanceof ilDateTime ? $this->create_date : new ilDateTime(time(), IL_CAL_UNIX);
132 }
const IL_CAL_UNIX
@classDescription Date and time handling

References IL_CAL_UNIX.

Referenced by create().

+ Here is the caller graph for this function:

◆ getExportType()

ilExportFileInfo::getExportType ( )

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

89 : string
90 {
91 return $this->export_type;
92 }

References $export_type.

Referenced by __construct(), create(), and read().

+ Here is the caller graph for this function:

◆ getFilename()

ilExportFileInfo::getFilename ( )

Definition at line 99 of file class.ilExportFileInfo.php.

99 : string
100 {
101 return $this->file_name;
102 }

References $file_name.

Referenced by __construct(), create(), delete(), getBasename(), and read().

+ Here is the caller graph for this function:

◆ getObjId()

ilExportFileInfo::getObjId ( )

Definition at line 114 of file class.ilExportFileInfo.php.

114 : int
115 {
116 return $this->obj_id;
117 }

References $obj_id.

Referenced by __construct(), create(), and read().

+ Here is the caller graph for this function:

◆ getVersion()

ilExportFileInfo::getVersion ( )

Definition at line 124 of file class.ilExportFileInfo.php.

124 : string
125 {
126 return $this->version;
127 }

References $version.

Referenced by create().

+ Here is the caller graph for this function:

◆ lookupLastExport()

static ilExportFileInfo::lookupLastExport ( int  $a_obj_id,
string  $a_type,
string  $a_version = '' 
)
static

Lookup last export.

Definition at line 53 of file class.ilExportFileInfo.php.

54 {
55 global $DIC;
56
57 $ilDB = $DIC->database();
58
59 $query = "SELECT * FROM export_file_info " .
60 "WHERE obj_id = " . $ilDB->quote($a_obj_id, 'integer') . ' ' .
61 "AND export_type = " . $ilDB->quote($a_type, 'text') . ' ' .
62 "ORDER BY create_date DESC";
63 $res = $ilDB->query($query);
64 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
65 if (!$a_version || $row->version == $a_version) {
66 return new ilExportFileInfo((int) $row->obj_id, $row->export_type, $row->filename);
67 }
68 }
69 return null;
70 }
@classDescription Stores information of creation date and versions of export files
$res
Definition: ltiservices.php:69

References $DIC, $ilDB, $res, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilExportContainer\addSubitems().

+ Here is the caller graph for this function:

◆ read()

ilExportFileInfo::read ( )
protected

Definition at line 172 of file class.ilExportFileInfo.php.

172 : void
173 {
174 $query = "SELECT * FROM export_file_info " .
175 "WHERE obj_id = " . $this->db->quote($this->getObjId(), 'integer') . ' ' .
176 "AND export_type = " . $this->db->quote($this->getExportType(), 'text') . ' ' .
177 "AND filename = " . $this->db->quote($this->getFilename(), 'text');
178
179 $res = $this->db->query($query);
180 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
181 $this->setVersion($row->version);
182 $this->setCreationDate(new ilDateTime($row->create_date, IL_CAL_DATETIME, ilTimeZone::UTC));
183 }
184 }
setVersion(string $a_version)
setCreationDate(?ilDateTime $dt=null)

References $res, ilDBConstants\FETCHMODE_OBJECT, getExportType(), getFilename(), getObjId(), IL_CAL_DATETIME, setCreationDate(), setVersion(), and ilTimeZone\UTC.

Referenced by __construct().

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

◆ setCreationDate()

ilExportFileInfo::setCreationDate ( ?ilDateTime  $dt = null)

Definition at line 134 of file class.ilExportFileInfo.php.

135 {
136 $this->create_date = $dt;
137 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setExportType()

ilExportFileInfo::setExportType ( string  $a_type)

Definition at line 84 of file class.ilExportFileInfo.php.

84 : void
85 {
86 $this->export_type = $a_type;
87 }

◆ setFilename()

ilExportFileInfo::setFilename ( string  $a_name)

Definition at line 94 of file class.ilExportFileInfo.php.

94 : void
95 {
96 $this->file_name = $a_name;
97 }

◆ setObjId()

ilExportFileInfo::setObjId ( int  $a_id)

Definition at line 109 of file class.ilExportFileInfo.php.

109 : void
110 {
111 $this->obj_id = $a_id;
112 }

◆ setVersion()

ilExportFileInfo::setVersion ( string  $a_version)

Definition at line 119 of file class.ilExportFileInfo.php.

119 : void
120 {
121 $this->version = $a_version;
122 }

Referenced by read().

+ Here is the caller graph for this function:

Field Documentation

◆ $create_date

ilDateTime ilExportFileInfo::$create_date = null
private

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

◆ $db

ilDBInterface ilExportFileInfo::$db
protected

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

◆ $export_type

string ilExportFileInfo::$export_type = ''
private

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

Referenced by getExportType().

◆ $file_name

string ilExportFileInfo::$file_name = ''
private

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

Referenced by getFilename().

◆ $obj_id

int ilExportFileInfo::$obj_id = 0
private

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

Referenced by getObjId().

◆ $version

string ilExportFileInfo::$version = self::CURRENT_VERSION
private

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

Referenced by getVersion().

◆ CURRENT_VERSION

const ilExportFileInfo::CURRENT_VERSION = "4.1.0"
protected

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


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