ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilExportFileInfo Class Reference

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

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.

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

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
+ Here is the call graph for this function:

Member Function Documentation

◆ create()

ilExportFileInfo::create ( )

Create new export entry.

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

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

183  {
184  global $DIC;
185 
186  $db = $DIC->database();
187 
188  $exists_query = 'select * from export_file_info ' .
189  'where obj_id = ' . $db->quote($this->obj_id, 'integer') . ' ' .
190  'and export_type = ' . $db->quote($this->getExportType(), 'text') . ' ' .
191  'and filename = ' . $db->quote($this->getFilename(), 'text');
192  $exists_res = $db->query($exists_query);
193 
194  if (!$exists_res->numRows()) {
195  $query = "INSERT INTO export_file_info (obj_id, export_type, filename, version, create_date) " .
196  "VALUES ( " .
197  $db->quote($this->getObjId(), 'integer') . ', ' .
198  $db->quote($this->getExportType(), 'text') . ', ' .
199  $db->quote($this->getFilename(), 'text') . ', ' .
200  $db->quote($this->getVersion(), 'text') . ', ' .
201  $db->quote($this->getCreationDate()->get(IL_CAL_DATETIME, '', ilTimeZone::UTC), 'timestamp') . ' ' .
202  ")";
203  $db->manipulate($query);
204  }
205  }
const IL_CAL_DATETIME
global $DIC
Definition: saml.php:7
getExportType()
get export type
$query
getCreationDate()
get creation date
+ Here is the call graph for this function:

◆ delete()

ilExportFileInfo::delete ( )

Delete one export entry.

Returns

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

References $ilDB.

212  {
213  global $ilDB;
214 
215  $ilDB->manipulate(
216  'DELETE FROM export_file_info ' .
217  'WHERE obj_id = ' . $ilDB->quote($this->getObjId(), 'integer') . ' ' .
218  'AND filename = ' . $ilDB->quote($this->getFilename(), 'text')
219  );
220  return true;
221  }
global $ilDB

◆ 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.

References $ilDB.

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  }
global $ilDB

◆ getBasename()

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

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

References getFilename().

119  {
120  return basename($this->getFilename(), $a_ext);
121  }
+ 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.

References IL_CAL_UNIX, and time.

Referenced by create().

165  {
166  return $this->create_date instanceof ilDateTime ? $this->create_date : new ilDateTime(time(), IL_CAL_UNIX);
167  }
const IL_CAL_UNIX
Date and time handling
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
+ 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().

95  {
96  return $this->export_type;
97  }
+ Here is the caller graph for this function:

◆ getFilename()

ilExportFileInfo::getFilename ( )

get filename

Returns

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

References $file_name.

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

114  {
115  return $this->file_name;
116  }
+ Here is the caller graph for this function:

◆ getObjId()

ilExportFileInfo::getObjId ( )

Get obj id.

Returns

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

References $obj_id.

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

138  {
139  return $this->obj_id;
140  }
+ Here is the caller graph for this function:

◆ getVersion()

ilExportFileInfo::getVersion ( )

get version

Returns

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

References $version.

Referenced by create().

156  {
157  return $this->version;
158  }
+ 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.

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

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

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

◆ read()

ilExportFileInfo::read ( )
protected

Read.

Returns

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

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

Referenced by __construct().

228  {
229  global $ilDB;
230 
231  $query = "SELECT * FROM export_file_info " .
232  "WHERE obj_id = " . $ilDB->quote($this->getObjId(), 'integer') . ' ' .
233  "AND export_type = " . $ilDB->quote($this->getExportType(), 'text') . ' ' .
234  "AND filename = " . $ilDB->quote($this->getFilename(), 'text');
235 
236  $res = $ilDB->query($query);
237  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
238  $this->setVersion($row->version);
239  $this->setCreationDate(new ilDateTime($row->create_date, IL_CAL_DATETIME, ilTimeZone::UTC));
240  }
241  return true;
242  }
const IL_CAL_DATETIME
getExportType()
get export type
foreach($_POST as $key=> $value) $res
Date and time handling
$query
global $ilDB
setCreationDate(ilDateTime $dt=null)
set creation date
setVersion($a_version)
set version
+ 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.

Referenced by read().

175  {
176  $this->create_date = $dt;
177  }
+ 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.

References $a_type.

86  {
87  $this->export_type = $a_type;
88  }
$a_type
Definition: workflow.php:92

◆ 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.

Referenced by read().

147  {
148  $this->version = $a_version;
149  }
+ 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: