ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilExportFileInfo Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. 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

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning 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.

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

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

Member Function Documentation

◆ create()

ilExportFileInfo::create ( )

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

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

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(
155  $this->getCreationDate()->get(IL_CAL_DATETIME, '', ilTimeZone::UTC),
156  'timestamp'
157  ) . ' ' .
158  ")";
159  $this->db->manipulate($query);
160  }
161  }
const IL_CAL_DATETIME
$query
+ Here is the call graph for this function:

◆ delete()

ilExportFileInfo::delete ( )

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

Referenced by ilExportGUI\delete().

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

◆ deleteByObjId()

static ilExportFileInfo::deleteByObjId (   $a_obj_id)
static

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

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

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  }
global $DIC
Definition: feed.php:28

◆ getBasename()

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

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

References getFilename().

104  : string
105  {
106  return basename($this->getFilename(), $a_ext);
107  }
+ Here is the call graph for this function:

◆ getCreationDate()

ilExportFileInfo::getCreationDate ( )

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

References IL_CAL_UNIX.

Referenced by create().

129  : ilDateTime
130  {
131  return $this->create_date instanceof ilDateTime ? $this->create_date : new ilDateTime(time(), IL_CAL_UNIX);
132  }
const IL_CAL_UNIX
+ Here is the caller graph for this function:

◆ getExportType()

ilExportFileInfo::getExportType ( )

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

References $export_type.

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

89  : string
90  {
91  return $this->export_type;
92  }
+ Here is the caller graph for this function:

◆ getFilename()

ilExportFileInfo::getFilename ( )

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

References $file_name.

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

99  : string
100  {
101  return $this->file_name;
102  }
+ Here is the caller graph for this function:

◆ getObjId()

ilExportFileInfo::getObjId ( )

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

References $obj_id.

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

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

◆ getVersion()

ilExportFileInfo::getVersion ( )

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

References $version.

Referenced by create().

124  : string
125  {
126  return $this->version;
127  }
+ 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.

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

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

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  }
$res
Definition: ltiservices.php:69
global $DIC
Definition: feed.php:28
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$query
+ Here is the caller graph for this function:

◆ read()

ilExportFileInfo::read ( )
protected

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

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

Referenced by __construct().

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)
$res
Definition: ltiservices.php:69
const IL_CAL_DATETIME
setCreationDate(?ilDateTime $dt=null)
$query
+ 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.

Referenced by read().

135  {
136  $this->create_date = $dt;
137  }
+ 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.

Referenced by read().

119  : void
120  {
121  $this->version = $a_version;
122  }
+ 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: