ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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.

35 {
36 $this->export_id = $a_export_id;
37 $this->read();
38 }

References read().

+ 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 137 of file class.ilExportOptions.php.

138 {
139 global $ilDB;
140
141 $query = "SELECT MAX(pos) position FROM export_options";
142 $res = $ilDB->query($query);
143
144 $pos = 0;
145 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
146 {
147 $pos = $row->position;
148 }
149 $pos++;
150
151 $query = 'INSERT INTO export_options (export_id,keyword,ref_id,obj_id,value,pos) '.
152 'VALUES( '.
153 $ilDB->quote($this->getExportId(),'integer').', '.
154 $ilDB->quote($a_keyword,'integer').', '.
155 $ilDB->quote($a_ref_id,'integer').', '.
156 $ilDB->quote($a_obj_id,'integer').', '.
157 $ilDB->quote($a_value,'integer').', '.
158 $ilDB->quote($pos,'integer').' '.
159 ')';
160 $ilDB->manipulate($query);
161 }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
getExportId()
Get export id.
global $ilDB

References $ilDB, $query, $res, $row, DB_FETCHMODE_OBJECT, and getExportId().

+ Here is the call graph for this function:

◆ allocateExportId()

static ilExportOptions::allocateExportId ( )
static

Allocate a new export id.

Returns

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

67 {
68 global $ilDB;
69
70 // get last export id
71 $query = 'SELECT MAX(export_id) exp FROM export_options '.
72 'GROUP BY export_id ';
73 $res = $ilDB->query($query);
74 $exp_id = 1;
75 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
76 {
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 }

References $ilDB, $query, $res, $row, and DB_FETCHMODE_OBJECT.

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

+ Here is the caller graph for this function:

◆ delete()

ilExportOptions::delete ( )

Delete by export id.

Returns

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

200 {
201 global $ilDB;
202
203 $query = "DELETE FROM export_options ".
204 "WHERE export_id = ".$ilDB->quote($this->getExportId(),'integer');
205 $ilDB->manipulate($query);
206 return true;
207 }

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

+ Here is the call graph for this function:

◆ getExportId()

ilExportOptions::getExportId ( )

Get export id.

Returns

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

133 {
134 return $this->export_id;
135 }

References $export_id.

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

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

45 {
46 if(self::$instance)
47 {
48 return self::$instance;
49 }
50 }

References $instance.

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

+ Here is the caller graph for this function:

◆ getOption()

ilExportOptions::getOption (   $a_keyword)

Get option.

Parameters
object$a_keyword
Returns

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

169 {
170 return isset($this->options[$a_keyword]) ? $this->options[$a_keyword] : null;
171 }

◆ getOptionByObjId()

ilExportOptions::getOptionByObjId (   $a_obj_id,
  $a_keyword 
)

Get option by.

Parameters
object$a_obj_id
object$a_keyword
Returns

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

180 {
181 return isset($this->obj_options[$a_keyword][$a_obj_id]) ? $this->obj_options[$a_keyword][$a_obj_id] : null;
182 }

◆ getOptionByRefId()

ilExportOptions::getOptionByRefId (   $a_ref_id,
  $a_keyword 
)

Get option by.

Parameters
object$a_obj_id
object$a_keyword
Returns

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

191 {
192 return isset($this->ref_options[$a_keyword][$a_ref_id]) ? $this->ref_options[$a_keyword][$a_ref_id] : null;
193 }

◆ 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 {
103 if($mode == self::EXPORT_BUILD)
104 {
105 $refs[] = $ref_id;
106 }
107 }
108 return $refs;
109 }
$ref_id
Definition: sahs_server.php:39

References $ref_id.

◆ getSubitemsForExport()

ilExportOptions::getSubitemsForExport ( )

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

Returns
array ref ids

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

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

References $ref_id.

◆ newInstance()

static ilExportOptions::newInstance (   $a_export_id)
static

Create new instance.

Parameters
object$a_export_id
Returns
object ilExportOptions

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

58 {
59 return self::$instance = new ilExportOptions($a_export_id);
60 }

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

+ Here is the caller graph for this function:

◆ read()

ilExportOptions::read ( )

Read entries.

Returns

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

214 {
215 global $ilDB;
216
217 $this->options = array();
218 $this->obj_options = array();
219 $this->ref_options = array();
220
221 $query = "SELECT * FROM export_options ".
222 "WHERE export_id = ".$ilDB->quote($this->getExportId(),'integer').' '.
223 "ORDER BY pos";
224 $res = $ilDB->query($query);
225 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
226 {
227 if($row->ref_id)
228 {
229 $this->ref_options[$row->keyword][$row->ref_id] = $row->value;
230 }
231 if($row->obj_id)
232 {
233 $this->obj_options[$row->keyword][$row->obj_id] = $row->value;
234 }
235 if(!$row->ref_id and !$row->obj_id)
236 {
237 $this->options[$row->keyword] = $row->value;
238 }
239
240 }
241 return true;
242 }

References $ilDB, $query, $res, $row, DB_FETCHMODE_OBJECT, and getExportId().

Referenced by __construct().

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

Referenced by getInstance().

◆ $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: