ILIAS  release_8 Revision v8.23
ilExportOptions 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 ilExportOptions:

Public Member Functions

 getSubitemsForCreation (int $a_source_id)
 Get all subitems with mode ilExportOptions::EXPORT_BUILD More...
 
 getSubitemsForExport ()
 Get all subitems with mode != self::EXPORT_OMIT. More...
 
 getExportId ()
 
 addOption (int $a_keyword, int $a_ref_id, int $a_obj_id, $a_value)
 
 getOption (int $a_keyword)
 
 getOptionByObjId (int $a_obj_id, int $a_keyword)
 Get option by. More...
 
 getOptionByRefId (int $a_ref_id, int $a_keyword)
 Get option by. More...
 
 delete ()
 
 read ()
 

Static Public Member Functions

static getInstance ()
 
static newInstance (int $a_export_id)
 
static allocateExportId ()
 

Data Fields

const EXPORT_EXISTING = 1
 
const EXPORT_BUILD = 2
 
const EXPORT_OMIT = 3
 
const KEY_INIT = 1
 
const KEY_ITEM_MODE = 2
 
const KEY_ROOT = 3
 

Protected Attributes

ilDBInterface $db
 

Private Member Functions

 __construct (int $a_export_id)
 

Private Attributes

int $export_id = 0
 
array $ref_options = array()
 
array $obj_options = array()
 
array $options = array()
 

Static Private Attributes

static ilExportOptions $instance = 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 Export options

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

Definition at line 24 of file class.ilExportOptions.php.

Constructor & Destructor Documentation

◆ __construct()

ilExportOptions::__construct ( int  $a_export_id)
private

Definition at line 43 of file class.ilExportOptions.php.

References $DIC, and read().

44  {
45  global $DIC;
46 
47  $this->db = $DIC->database();
48  $this->export_id = $a_export_id;
49  if ($this->export_id) {
50  $this->read();
51  }
52  }
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

Member Function Documentation

◆ addOption()

ilExportOptions::addOption ( int  $a_keyword,
int  $a_ref_id,
int  $a_obj_id,
  $a_value 
)
Parameters
int$a_keyword
int$a_ref_id
int$a_obj_id
string | int$a_value

Definition at line 133 of file class.ilExportOptions.php.

References $query, $res, ilDBConstants\FETCHMODE_OBJECT, getExportId(), and ILIAS\Repository\int().

133  : void
134  {
135  $query = "SELECT MAX(pos) position FROM export_options";
136  $res = $this->db->query($query);
137 
138  $pos = 0;
139  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
140  $pos = (int) $row->position;
141  }
142  $pos++;
143 
144  $query = 'INSERT INTO export_options (export_id,keyword,ref_id,obj_id,value,pos) ' .
145  'VALUES( ' .
146  $this->db->quote($this->getExportId(), 'integer') . ', ' .
147  $this->db->quote($a_keyword, 'integer') . ', ' .
148  $this->db->quote($a_ref_id, 'integer') . ', ' .
149  $this->db->quote($a_obj_id, 'integer') . ', ' .
150  $this->db->quote($a_value, 'integer') . ', ' .
151  $this->db->quote($pos, 'integer') . ' ' .
152  ')';
153  $this->db->manipulate($query);
154  }
$res
Definition: ltiservices.php:69
$query
+ Here is the call graph for this function:

◆ allocateExportId()

static ilExportOptions::allocateExportId ( )
static

Definition at line 67 of file class.ilExportOptions.php.

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

Referenced by ilObjRoleGUI\executeCommand(), and ilExportGUI\saveItemSelection().

67  : int
68  {
69  global $DIC;
70 
71  $ilDB = $DIC->database();
72 
73  // get last export id
74  $query = 'SELECT MAX(export_id) exp FROM export_options ' .
75  'GROUP BY export_id ';
76  $res = $ilDB->query($query);
77  $exp_id = 1;
78  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
79  $exp_id = $row->exp + 1;
80  }
81  $query = 'INSERT INTO export_options (export_id,keyword,ref_id,obj_id,value) ' .
82  'VALUES( ' .
83  $ilDB->quote($exp_id, 'integer') . ', ' .
84  $ilDB->quote(self::KEY_INIT, 'integer') . ', ' .
85  $ilDB->quote(0, 'integer') . ', ' .
86  $ilDB->quote(0, 'integer') . ', ' .
87  $ilDB->quote(0, 'integer') . ' ' .
88  ')';
89  $ilDB->manipulate($query);
90  return (int) $exp_id;
91  }
$res
Definition: ltiservices.php:69
global $DIC
Definition: feed.php:28
$query
+ Here is the caller graph for this function:

◆ delete()

ilExportOptions::delete ( )

Definition at line 187 of file class.ilExportOptions.php.

References $query, and getExportId().

187  : void
188  {
189  $query = "DELETE FROM export_options " .
190  "WHERE export_id = " . $this->db->quote($this->getExportId(), 'integer');
191  $this->db->manipulate($query);
192  }
$query
+ Here is the call graph for this function:

◆ getExportId()

ilExportOptions::getExportId ( )

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

References $export_id.

Referenced by addOption(), delete(), and read().

122  : int
123  {
124  return $this->export_id;
125  }
+ Here is the caller graph for this function:

◆ getInstance()

static ilExportOptions::getInstance ( )
static

Definition at line 54 of file class.ilExportOptions.php.

Referenced by ilContainerXmlWriter\__construct(), ilContainerReferenceExporter\getXmlExportHeadDependencies(), ilAccessControlExporter\getXmlRepresentation(), and ilExportOptionsTest\testConstruct().

55  {
56  if (self::$instance) {
57  return self::$instance;
58  }
59  return null;
60  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the caller graph for this function:

◆ getOption()

ilExportOptions::getOption ( int  $a_keyword)
Parameters
$a_keyword
Returns
mixed|null

Definition at line 160 of file class.ilExportOptions.php.

161  {
162  return $this->options[$a_keyword] ?? null;
163  }

◆ getOptionByObjId()

ilExportOptions::getOptionByObjId ( int  $a_obj_id,
int  $a_keyword 
)

Get option by.

Parameters
int$a_obj_id
int$a_keyword
Returns
mixed|null

Definition at line 171 of file class.ilExportOptions.php.

172  {
173  return $this->obj_options[$a_keyword][$a_obj_id] ?? null;
174  }

◆ getOptionByRefId()

ilExportOptions::getOptionByRefId ( int  $a_ref_id,
int  $a_keyword 
)

Get option by.

Parameters
int$a_obj_id
int$a_keyword
Returns
mixed|null

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

183  {
184  return $this->ref_options[$a_keyword][$a_ref_id] ?? null;
185  }

◆ getSubitemsForCreation()

ilExportOptions::getSubitemsForCreation ( int  $a_source_id)

Get all subitems with mode ilExportOptions::EXPORT_BUILD

Definition at line 96 of file class.ilExportOptions.php.

References $ref_id.

96  : array
97  {
98  $refs = array();
99  foreach ((array) $this->ref_options[self::KEY_ITEM_MODE] as $ref_id => $mode) {
100  if ($mode == self::EXPORT_BUILD) {
101  $refs[] = $ref_id;
102  }
103  }
104  return $refs;
105  }
$ref_id
Definition: ltiauth.php:67

◆ getSubitemsForExport()

ilExportOptions::getSubitemsForExport ( )

Get all subitems with mode != self::EXPORT_OMIT.

Returns
int[] ref ids

Definition at line 111 of file class.ilExportOptions.php.

References $ref_id, and ILIAS\Repository\int().

112  {
113  $refs = array();
114  foreach ((array) $this->ref_options[self::KEY_ITEM_MODE] as $ref_id => $mode) {
115  if ($mode != self::EXPORT_OMIT) {
116  $refs[] = (int) $ref_id;
117  }
118  }
119  return $refs;
120  }
$ref_id
Definition: ltiauth.php:67
+ Here is the call graph for this function:

◆ newInstance()

static ilExportOptions::newInstance ( int  $a_export_id)
static

Definition at line 62 of file class.ilExportOptions.php.

Referenced by ilObjRoleGUI\executeCommand(), ilExportGUI\saveItemSelection(), and ilExportOptionsTest\testConstruct().

63  {
64  return self::$instance = new ilExportOptions($a_export_id);
65  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the caller graph for this function:

◆ read()

ilExportOptions::read ( )

Definition at line 194 of file class.ilExportOptions.php.

References $query, $res, ilDBConstants\FETCHMODE_OBJECT, getExportId(), and ILIAS\Repository\int().

Referenced by __construct().

194  : void
195  {
196  $this->options = array();
197  $this->obj_options = array();
198  $this->ref_options = array();
199 
200  $query = "SELECT * FROM export_options " .
201  "WHERE export_id = " . $this->db->quote($this->getExportId(), 'integer') . ' ' .
202  "ORDER BY pos";
203  $res = $this->db->query($query);
204  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
205  if ($row->ref_id) {
206  $this->ref_options[(int) $row->keyword][(int) $row->ref_id] = $row->value;
207  }
208  if ($row->obj_id) {
209  $this->obj_options[(int) $row->keyword][(int) $row->obj_id] = $row->value;
210  }
211  if (!$row->ref_id and !$row->obj_id) {
212  $this->options[(int) $row->keyword] = $row->value;
213  }
214  }
215  }
$res
Definition: ltiservices.php:69
$query
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $db

ilDBInterface ilExportOptions::$db
protected

Definition at line 41 of file class.ilExportOptions.php.

◆ $export_id

int ilExportOptions::$export_id = 0
private

Definition at line 36 of file class.ilExportOptions.php.

Referenced by getExportId().

◆ $instance

ilExportOptions ilExportOptions::$instance = null
staticprivate

Definition at line 26 of file class.ilExportOptions.php.

◆ $obj_options

array ilExportOptions::$obj_options = array()
private

Definition at line 38 of file class.ilExportOptions.php.

◆ $options

array ilExportOptions::$options = array()
private

Definition at line 39 of file class.ilExportOptions.php.

◆ $ref_options

array ilExportOptions::$ref_options = array()
private

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

◆ EXPORT_BUILD

const ilExportOptions::EXPORT_BUILD = 2

◆ EXPORT_EXISTING

const ilExportOptions::EXPORT_EXISTING = 1

Definition at line 28 of file class.ilExportOptions.php.

Referenced by ilExportSelectionTableGUI\fillRow().

◆ EXPORT_OMIT

const ilExportOptions::EXPORT_OMIT = 3

◆ KEY_INIT

const ilExportOptions::KEY_INIT = 1

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

◆ KEY_ITEM_MODE

const ilExportOptions::KEY_ITEM_MODE = 2

◆ KEY_ROOT


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