ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 133 of file class.ilExportOptions.php.

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

134  {
135  global $DIC;
136 
137  $ilDB = $DIC['ilDB'];
138 
139  $query = "SELECT MAX(pos) position FROM export_options";
140  $res = $ilDB->query($query);
141 
142  $pos = 0;
143  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
144  $pos = $row->position;
145  }
146  $pos++;
147 
148  $query = 'INSERT INTO export_options (export_id,keyword,ref_id,obj_id,value,pos) ' .
149  'VALUES( ' .
150  $ilDB->quote($this->getExportId(), 'integer') . ', ' .
151  $ilDB->quote($a_keyword, 'integer') . ', ' .
152  $ilDB->quote($a_ref_id, 'integer') . ', ' .
153  $ilDB->quote($a_obj_id, 'integer') . ', ' .
154  $ilDB->quote($a_value, 'integer') . ', ' .
155  $ilDB->quote($pos, 'integer') . ' ' .
156  ')';
157  $ilDB->manipulate($query);
158  }
getExportId()
Get export id.
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query
$row
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 $DIC, $ilDB, $query, $res, $row, and ilDBConstants\FETCHMODE_OBJECT.

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

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

◆ delete()

ilExportOptions::delete ( )

Delete by export id.

Returns

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

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

197  {
198  global $DIC;
199 
200  $ilDB = $DIC['ilDB'];
201 
202  $query = "DELETE FROM export_options " .
203  "WHERE export_id = " . $ilDB->quote($this->getExportId(), 'integer');
204  $ilDB->manipulate($query);
205  return true;
206  }
getExportId()
Get export id.
global $DIC
Definition: saml.php:7
$query
global $ilDB
+ Here is the call graph for this function:

◆ getExportId()

ilExportOptions::getExportId ( )

Get export id.

Returns

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

References $export_id.

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

129  {
130  return $this->export_id;
131  }
+ 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 165 of file class.ilExportOptions.php.

166  {
167  return isset($this->options[$a_keyword]) ? $this->options[$a_keyword] : null;
168  }

◆ getOptionByObjId()

ilExportOptions::getOptionByObjId (   $a_obj_id,
  $a_keyword 
)

Get option by.

Parameters
object$a_obj_id
object$a_keyword
Returns

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

177  {
178  return isset($this->obj_options[$a_keyword][$a_obj_id]) ? $this->obj_options[$a_keyword][$a_obj_id] : null;
179  }

◆ getOptionByRefId()

ilExportOptions::getOptionByRefId (   $a_ref_id,
  $a_keyword 
)

Get option by.

Parameters
object$a_obj_id
object$a_keyword
Returns

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

188  {
189  return isset($this->ref_options[$a_keyword][$a_ref_id]) ? $this->ref_options[$a_keyword][$a_ref_id] : null;
190  }

◆ getSubitemsForCreation()

ilExportOptions::getSubitemsForCreation (   $a_source_id)

Get all subitems with mode ilExportOptions::EXPORT_BUILD

Parameters
intref_id of source
Returns

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

98  {
99  $refs = array();
100 
101  foreach ((array) $this->ref_options[self::KEY_ITEM_MODE] as $ref_id => $mode) {
102  if ($mode == self::EXPORT_BUILD) {
103  $refs[] = $ref_id;
104  }
105  }
106  return $refs;
107  }

◆ getSubitemsForExport()

ilExportOptions::getSubitemsForExport ( )

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

Returns
array ref ids

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

114  {
115  $refs = array();
116  foreach ((array) $this->ref_options[self::KEY_ITEM_MODE] as $ref_id => $mode) {
117  if ($mode != self::EXPORT_OMIT) {
118  $refs[] = $ref_id;
119  }
120  }
121  return $refs;
122  }

◆ 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 212 of file class.ilExportOptions.php.

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

Referenced by __construct().

213  {
214  global $DIC;
215 
216  $ilDB = $DIC['ilDB'];
217 
218  $this->options = array();
219  $this->obj_options = array();
220  $this->ref_options = array();
221 
222  $query = "SELECT * FROM export_options " .
223  "WHERE export_id = " . $ilDB->quote($this->getExportId(), 'integer') . ' ' .
224  "ORDER BY pos";
225  $res = $ilDB->query($query);
226  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
227  if ($row->ref_id) {
228  $this->ref_options[$row->keyword][$row->ref_id] = $row->value;
229  }
230  if ($row->obj_id) {
231  $this->obj_options[$row->keyword][$row->obj_id] = $row->value;
232  }
233  if (!$row->ref_id and !$row->obj_id) {
234  $this->options[$row->keyword] = $row->value;
235  }
236  }
237  return true;
238  }
getExportId()
Get export id.
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query
$row
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: