ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilExportFileInfo Class Reference

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

+ Collaboration diagram for ilExportFileInfo:

Public Member Functions

 __construct ($a_obj_id, $a_export_type='', $a_filename='')
 ilExportFileInfo constructor. More...
 
 setExportType ($a_type)
 set export type More...
 
 getExportType ()
 get export type More...
 
 setFilename ($a_name)
 set filename More...
 
 getFilename ()
 get filename More...
 
 getBasename ($a_ext='.zip')
 
 setObjId ($a_id)
 Set obj id. More...
 
 getObjId ()
 Get obj id. More...
 
 setVersion ($a_version)
 set version More...
 
 getVersion ()
 get version More...
 
 getCreationDate ()
 get creation date More...
 
 setCreationDate (ilDateTime $dt=null)
 set creation date More...
 
 create ()
 Create new export entry. More...
 
 delete ()
 Delete one export entry. More...
 

Static Public Member Functions

static lookupLastExport ($a_obj_id, $a_type, $a_version='')
 Lookup last export. More...
 
static deleteByObjId ($a_obj_id)
 Delete all export entries by obj_id. More...
 

Data Fields

const CURRENT_VERSION = "4.1.0"
 

Protected Member Functions

 read ()
 Read. More...
 

Private Attributes

 $obj_id = 0
 
 $version = self::CURRENT_VERSION
 
 $export_type = ''
 
 $file_name = ''
 
 $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
Version
$Id$

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

Constructor & Destructor Documentation

◆ __construct()

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

ilExportFileInfo constructor.

Parameters
int$a_obj_id
string$a_export_type
string$a_filename

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

31 {
32 $this->obj_id = $a_obj_id;
33 $this->export_type = $a_export_type;
34 $this->file_name = $a_filename;
35 if ($this->getObjId() and $this->getExportType() and $this->getFilename()) {
36 $this->read();
37 }
38 }
getExportType()
get export type

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

+ Here is the call graph for this function:

Member Function Documentation

◆ create()

ilExportFileInfo::create ( )

Create new export entry.

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

187 {
188 global $DIC;
189
190 $db = $DIC->database();
191
192 $exists_query = 'select * from export_file_info ' .
193 'where obj_id = ' . $db->quote($this->obj_id, 'integer') . ' ' .
194 'and export_type = ' . $db->quote($this->getExportType(), 'text') . ' ' .
195 'and filename = ' . $db->quote($this->getFilename(), 'text');
196 $exists_res = $db->query($exists_query);
197
198 if (!$exists_res->numRows()) {
199 $query = "INSERT INTO export_file_info (obj_id, export_type, filename, version, create_date) " .
200 "VALUES ( " .
201 $db->quote($this->getObjId(), 'integer') . ', ' .
202 $db->quote($this->getExportType(), 'text') . ', ' .
203 $db->quote($this->getFilename(), 'text') . ', ' .
204 $db->quote($this->getVersion(), 'text') . ', ' .
205 $db->quote($this->getCreationDate()->get(IL_CAL_DATETIME, '', ilTimeZone::UTC), 'timestamp') . ' ' .
206 ")";
207 $db->manipulate($query);
208 }
209 }
const IL_CAL_DATETIME
getCreationDate()
get creation date
$query
$DIC
Definition: xapitoken.php:46

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

+ Here is the call graph for this function:

◆ delete()

ilExportFileInfo::delete ( )

Delete one export entry.

Returns

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

216 {
217 global $DIC;
218
219 $ilDB = $DIC['ilDB'];
220
221 $ilDB->manipulate(
222 'DELETE FROM export_file_info ' .
223 'WHERE obj_id = ' . $ilDB->quote($this->getObjId(), 'integer') . ' ' .
224 'AND filename = ' . $ilDB->quote($this->getFilename(), 'text')
225 );
226 return true;
227 }
global $ilDB

References $DIC, $ilDB, and getFilename().

+ Here is the call graph for this function:

◆ deleteByObjId()

static ilExportFileInfo::deleteByObjId (   $a_obj_id)
static

Delete all export entries by obj_id.

Parameters
object$a_obj_id
Returns

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

73 {
74 global $DIC;
75
76 $ilDB = $DIC['ilDB'];
77
78 $ilDB->manipulate("DELETE FROM export_file_info WHERE obj_id = " . $ilDB->quote($a_obj_id));
79 return true;
80 }

References $DIC, and $ilDB.

◆ getBasename()

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

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

123 {
124 return basename($this->getFilename(), $a_ext);
125 }

References getFilename().

+ Here is the call graph for this function:

◆ getCreationDate()

ilExportFileInfo::getCreationDate ( )

get creation date

Returns
ilDateTime $date

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

169 {
170 return $this->create_date instanceof ilDateTime ? $this->create_date : new ilDateTime(time(), IL_CAL_UNIX);
171 }
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 ( )

get export type

Returns
string export type

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

References $export_type.

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

+ Here is the caller graph for this function:

◆ getFilename()

ilExportFileInfo::getFilename ( )

get filename

Returns

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

118 {
119 return $this->file_name;
120 }

References $file_name.

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

+ Here is the caller graph for this function:

◆ getObjId()

ilExportFileInfo::getObjId ( )

Get obj id.

Returns

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

142 {
143 return $this->obj_id;
144 }

References $obj_id.

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

+ Here is the caller graph for this function:

◆ getVersion()

ilExportFileInfo::getVersion ( )

get version

Returns

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

160 {
161 return $this->version;
162 }

References $version.

Referenced by create().

+ Here is the caller graph for this function:

◆ lookupLastExport()

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

Lookup last export.

Parameters
object$a_obj_id
stringtype xml | html | scorm2004...
stringversion
Returns
object ilExportFileInfo

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

48 {
49 global $DIC;
50
51 $ilDB = $DIC['ilDB'];
52
53 $query = "SELECT * FROM export_file_info " .
54 "WHERE obj_id = " . $ilDB->quote($a_obj_id, 'integer') . ' ' .
55 "AND export_type = " . $ilDB->quote($a_type, 'text') . ' ' .
56 "ORDER BY create_date DESC";
57 $res = $ilDB->query($query);
58 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
59 if (!$a_version or $row->version == $a_version) {
60 return new ilExportFileInfo($row->obj_id, $row->export_type, $row->filename);
61 }
62 }
63 return null;
64 }
@classDescription Stores information of creation date and versions of export files
foreach($_POST as $key=> $value) $res
$a_type
Definition: workflow.php:92

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

Referenced by ilExportContainer\addSubitems(), and ilExportSelectionTableGUI\parseContainer().

+ Here is the caller graph for this function:

◆ read()

ilExportFileInfo::read ( )
protected

Read.

Returns

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

234 {
235 global $DIC;
236
237 $ilDB = $DIC['ilDB'];
238
239 $query = "SELECT * FROM export_file_info " .
240 "WHERE obj_id = " . $ilDB->quote($this->getObjId(), 'integer') . ' ' .
241 "AND export_type = " . $ilDB->quote($this->getExportType(), 'text') . ' ' .
242 "AND filename = " . $ilDB->quote($this->getFilename(), 'text');
243
244 $res = $ilDB->query($query);
245 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
246 $this->setVersion($row->version);
247 $this->setCreationDate(new ilDateTime($row->create_date, IL_CAL_DATETIME, ilTimeZone::UTC));
248 }
249 return true;
250 }
setCreationDate(ilDateTime $dt=null)
set creation date
setVersion($a_version)
set version

References $DIC, $ilDB, $query, $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)

set creation date

Parameters
ilDateTime$dt[optional]
Returns

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

179 {
180 $this->create_date = $dt;
181 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setExportType()

ilExportFileInfo::setExportType (   $a_type)

set export type

Parameters
string$a_typexml | html ...
Returns

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

90 {
91 $this->export_type = $a_type;
92 }

References $a_type.

◆ setFilename()

ilExportFileInfo::setFilename (   $a_name)

set filename

Parameters
string$a_name
Returns

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

109 {
110 $this->file_name = $a_name;
111 }

◆ setObjId()

ilExportFileInfo::setObjId (   $a_id)

Set obj id.

Parameters
object$a_id
Returns

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

133 {
134 $this->obj_id = $a_id;
135 }

◆ setVersion()

ilExportFileInfo::setVersion (   $a_version)

set version

Returns

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

151 {
152 $this->version = $a_version;
153 }

Referenced by read().

+ Here is the caller graph for this function:

Field Documentation

◆ $create_date

ilExportFileInfo::$create_date = null
private

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

◆ $export_type

ilExportFileInfo::$export_type = ''
private

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

Referenced by getExportType().

◆ $file_name

ilExportFileInfo::$file_name = ''
private

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

Referenced by getFilename().

◆ $obj_id

ilExportFileInfo::$obj_id = 0
private

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

Referenced by getObjId().

◆ $version

ilExportFileInfo::$version = self::CURRENT_VERSION
private

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

Referenced by getVersion().

◆ CURRENT_VERSION

const ilExportFileInfo::CURRENT_VERSION = "4.1.0"

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


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