ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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='')
 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 = '' 
)

Constructor.

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

28 {
29 $this->obj_id = $a_obj_id;
30 $this->export_type = $a_export_type;
31 $this->file_name = $a_filename;
32 if($this->getObjId() and $this->getExportType() and $this->getFilename())
33 {
34 $this->read();
35 }
36 }
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.

Returns

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

184 {
185 global $ilDB;
186
187 $query = "INSERT INTO export_file_info (obj_id, export_type, filename, version, create_date) ".
188 "VALUES ( ".
189 $ilDB->quote($this->getObjId(),'integer').', '.
190 $ilDB->quote($this->getExportType(),'text').', '.
191 $ilDB->quote($this->getFilename(),'text').', '.
192 $ilDB->quote($this->getVersion(),'text').', '.
193 $ilDB->quote($this->getCreationDate()->get(IL_CAL_DATETIME,'',ilTimeZone::UTC),'timestamp').' '.
194 ")";
195 $ilDB->manipulate($query);
196 }
const IL_CAL_DATETIME
getCreationDate()
get creation date
global $ilDB

References $ilDB, $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 202 of file class.ilExportFileInfo.php.

203 {
204 global $ilDB;
205
206 $ilDB->manipulate('DELETE FROM export_file_info '.
207 'WHERE obj_id = '.$ilDB->quote($this->getObjId(),'integer').' '.
208 'AND filename = '.$ilDB->quote($this->getFilename(),'text')
209 );
210 return true;
211 }

References $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 70 of file class.ilExportFileInfo.php.

71 {
72 global $ilDB;
73
74 $ilDB->manipulate("DELETE FROM export_file_info WHERE obj_id = ".$ilDB->quote($a_obj_id));
75 return true;
76 }

References $ilDB.

◆ getBasename()

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

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

119 {
120 return basename($this->getFilename(),$a_ext);
121 }

References getFilename().

+ Here is the call graph for this function:

◆ getCreationDate()

ilExportFileInfo::getCreationDate ( )

get creation date

Returns
ilDateTime $date

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

165 {
166 return $this->create_date instanceof ilDateTime ? $this->create_date : new ilDateTime(time(),IL_CAL_UNIX);
167 }
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 94 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 113 of file class.ilExportFileInfo.php.

114 {
115 return $this->file_name;
116 }

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 137 of file class.ilExportFileInfo.php.

138 {
139 return $this->obj_id;
140 }

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 155 of file class.ilExportFileInfo.php.

156 {
157 return $this->version;
158 }

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 45 of file class.ilExportFileInfo.php.

46 {
47 global $ilDB;
48
49 $query = "SELECT * FROM export_file_info ".
50 "WHERE obj_id = ".$ilDB->quote($a_obj_id,'integer').' '.
51 "AND export_type = ".$ilDB->quote($a_type,'text').' '.
52 "ORDER BY create_date DESC";
53 $res = $ilDB->query($query);
54 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
55 {
56 if(!$a_version or $row->version == $a_version)
57 {
58 return new ilExportFileInfo($row->obj_id,$row->export_type,$row->filename);
59 }
60 }
61 return null;
62 }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
@classDescription Stores information of creation date and versions of export files

References $ilDB, $query, $res, $row, and DB_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 217 of file class.ilExportFileInfo.php.

218 {
219 global $ilDB;
220
221 $query = "SELECT * FROM export_file_info ".
222 "WHERE obj_id = ".$ilDB->quote($this->getObjId(),'integer').' '.
223 "AND export_type = ".$ilDB->quote($this->getExportType(),'text').' '.
224 "AND filename = ".$ilDB->quote($this->getFilename(),'text');
225
226 $res = $ilDB->query($query);
227 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
228 {
229 $this->setVersion($row->version);
231 }
232 return true;
233 }
setCreationDate(ilDateTime $dt=null)
set creation date
setVersion($a_version)
set version

References $ilDB, $query, $res, $row, DB_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 174 of file class.ilExportFileInfo.php.

175 {
176 $this->create_date = $dt;
177 }

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 85 of file class.ilExportFileInfo.php.

86 {
87 $this->export_type = $a_type;
88 }

◆ setFilename()

ilExportFileInfo::setFilename (   $a_name)

set filename

Parameters
string$a_name
Returns

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

105 {
106 $this->file_name = $a_name;
107 }

◆ setObjId()

ilExportFileInfo::setObjId (   $a_id)

Set obj id.

Parameters
object$a_id
Returns

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

129 {
130 $this->obj_id = $a_id;
131 }

◆ setVersion()

ilExportFileInfo::setVersion (   $a_version)

set version

Returns

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

147 {
148 $this->version = $a_version;
149 }

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: