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

Export options. More...

+ Collaboration diagram for ilExportOptions:

Public Member Functions

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

Static Public Member Functions

static getInstance ()
 Get singelton instance. More...
 
static newInstance ($a_export_id)
 Create new instance. More...
 
static allocateExportId ()
 Allocate a new export id. More...
 

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
 

Private Member Functions

 __construct ($a_export_id)
 Singleton constructor. More...
 

Private Attributes

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

Static Private Attributes

static $instance = null
 

Detailed Description

Export options.

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

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

Constructor & Destructor Documentation

◆ __construct()

ilExportOptions::__construct (   $a_export_id)
private

Singleton constructor.

Returns

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

References read().

35  {
36  $this->export_id = $a_export_id;
37  $this->read();
38  }
+ Here is the call graph for this function:

Member Function Documentation

◆ addOption()

ilExportOptions::addOption (   $a_keyword,
  $a_ref_id,
  $a_obj_id,
  $a_value 
)

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

References $ilDB, $query, $res, $row, ilDBConstants\FETCHMODE_OBJECT, and getExportId().

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

◆ allocateExportId()

static ilExportOptions::allocateExportId ( )
static

Allocate a new export id.

Returns

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

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

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

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

◆ delete()

ilExportOptions::delete ( )

Delete by export id.

Returns

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

References $ilDB, $query, and getExportId().

193  {
194  global $ilDB;
195 
196  $query = "DELETE FROM export_options " .
197  "WHERE export_id = " . $ilDB->quote($this->getExportId(), 'integer');
198  $ilDB->manipulate($query);
199  return true;
200  }
getExportId()
Get export id.
$query
global $ilDB
+ Here is the call graph for this function:

◆ getExportId()

ilExportOptions::getExportId ( )

Get export id.

Returns

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

References $export_id.

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

127  {
128  return $this->export_id;
129  }
+ Here is the caller graph for this function:

◆ getInstance()

static ilExportOptions::getInstance ( )
static

Get singelton instance.

Returns
object ilExportOptions

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

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

45  {
46  if (self::$instance) {
47  return self::$instance;
48  }
49  }
+ Here is the caller graph for this function:

◆ getOption()

ilExportOptions::getOption (   $a_keyword)

Get option.

Parameters
object$a_keyword
Returns

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

162  {
163  return isset($this->options[$a_keyword]) ? $this->options[$a_keyword] : null;
164  }

◆ getOptionByObjId()

ilExportOptions::getOptionByObjId (   $a_obj_id,
  $a_keyword 
)

Get option by.

Parameters
object$a_obj_id
object$a_keyword
Returns

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

173  {
174  return isset($this->obj_options[$a_keyword][$a_obj_id]) ? $this->obj_options[$a_keyword][$a_obj_id] : null;
175  }

◆ getOptionByRefId()

ilExportOptions::getOptionByRefId (   $a_ref_id,
  $a_keyword 
)

Get option by.

Parameters
object$a_obj_id
object$a_keyword
Returns

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

184  {
185  return isset($this->ref_options[$a_keyword][$a_ref_id]) ? $this->ref_options[$a_keyword][$a_ref_id] : null;
186  }

◆ getSubitemsForCreation()

ilExportOptions::getSubitemsForCreation (   $a_source_id)

Get all subitems with mode ilExportOptions::EXPORT_BUILD

Parameters
intref_id of source
Returns

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

References array.

96  {
97  $refs = array();
98 
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  }
Create styles array
The data for the language used.

◆ getSubitemsForExport()

ilExportOptions::getSubitemsForExport ( )

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

Returns
array ref ids

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

References array.

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[] = $ref_id;
117  }
118  }
119  return $refs;
120  }
Create styles array
The data for the language used.

◆ newInstance()

static ilExportOptions::newInstance (   $a_export_id)
static

Create new instance.

Parameters
object$a_export_id
Returns
object ilExportOptions

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

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

57  {
58  return self::$instance = new ilExportOptions($a_export_id);
59  }
+ Here is the caller graph for this function:

◆ read()

ilExportOptions::read ( )

Read entries.

Returns

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

References $ilDB, $query, $res, $row, array, ilDBConstants\FETCHMODE_OBJECT, and getExportId().

Referenced by __construct().

207  {
208  global $ilDB;
209 
210  $this->options = array();
211  $this->obj_options = array();
212  $this->ref_options = array();
213 
214  $query = "SELECT * FROM export_options " .
215  "WHERE export_id = " . $ilDB->quote($this->getExportId(), 'integer') . ' ' .
216  "ORDER BY pos";
217  $res = $ilDB->query($query);
218  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
219  if ($row->ref_id) {
220  $this->ref_options[$row->keyword][$row->ref_id] = $row->value;
221  }
222  if ($row->obj_id) {
223  $this->obj_options[$row->keyword][$row->obj_id] = $row->value;
224  }
225  if (!$row->ref_id and !$row->obj_id) {
226  $this->options[$row->keyword] = $row->value;
227  }
228  }
229  return true;
230  }
getExportId()
Get export id.
foreach($_POST as $key=> $value) $res
$query
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $export_id

ilExportOptions::$export_id = 0
private

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

Referenced by getExportId().

◆ $instance

ilExportOptions::$instance = null
staticprivate

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

◆ $obj_options

ilExportOptions::$obj_options = array()
private

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

◆ $options

ilExportOptions::$options = array()
private

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

◆ $ref_options

ilExportOptions::$ref_options = array()
private

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

◆ EXPORT_BUILD

const ilExportOptions::EXPORT_BUILD = 2

◆ EXPORT_EXISTING

const ilExportOptions::EXPORT_EXISTING = 1

Definition at line 17 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 21 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: