ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
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
 getSubitemsForExport ()
 Get all subitems with mode != self::EXPORT_OMIT.
 getExportId ()
 Get export id.
 addOption ($a_keyword, $a_ref_id, $a_obj_id, $a_value)
 getOption ($a_keyword)
 Get option.
 getOptionByObjId ($a_obj_id, $a_keyword)
 Get option by.
 getOptionByRefId ($a_ref_id, $a_keyword)
 Get option by.
 delete ()
 Delete by export id.
 read ()
 Read entries.

Static Public Member Functions

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

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.

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

ilExportOptions::__construct (   $a_export_id)
private

Singleton constructor.

Returns

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

References read().

{
$this->export_id = $a_export_id;
$this->read();
}

+ Here is the call graph for this function:

Member Function Documentation

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

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

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

{
global $ilDB;
$query = "SELECT MAX(pos) position FROM export_options";
$res = $ilDB->query($query);
$pos = 0;
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$pos = $row->position;
}
$pos++;
$query = 'INSERT INTO export_options (export_id,keyword,ref_id,obj_id,value,pos) '.
'VALUES( '.
$ilDB->quote($this->getExportId(),'integer').', '.
$ilDB->quote($a_keyword,'integer').', '.
$ilDB->quote($a_ref_id,'integer').', '.
$ilDB->quote($a_obj_id,'integer').', '.
$ilDB->quote($a_value,'integer').', '.
$ilDB->quote($pos,'integer').' '.
')';
$ilDB->manipulate($query);
}

+ Here is the call graph for this function:

static ilExportOptions::allocateExportId ( )
static

Allocate a new export id.

Returns

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

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

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

{
global $ilDB;
// get last export id
$query = 'SELECT MAX(export_id) exp FROM export_options '.
'GROUP BY export_id ';
$res = $ilDB->query($query);
$exp_id = 1;
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$exp_id = $row->exp + 1;
}
$query = 'INSERT INTO export_options (export_id,keyword,ref_id,obj_id,value) '.
'VALUES( '.
$ilDB->quote($exp_id,'integer').', '.
$ilDB->quote(self::KEY_INIT,'integer').', '.
$ilDB->quote(0,'integer').', '.
$ilDB->quote(0,'integer').', '.
$ilDB->quote(0,'integer').' '.
')';
$ilDB->manipulate($query);
return $exp_id;
}

+ Here is the caller graph for this function:

ilExportOptions::delete ( )

Delete by export id.

Returns

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

References $query, and getExportId().

{
global $ilDB;
$query = "DELETE FROM export_options ".
"WHERE export_id = ".$ilDB->quote($this->getExportId(),'integer');
$ilDB->manipulate($query);
return true;
}

+ Here is the call graph for this function:

ilExportOptions::getExportId ( )

Get export id.

Returns

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

References $export_id.

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

{
}

+ Here is the caller graph for this function:

ilExportOptions::getOption (   $a_keyword)

Get option.

Parameters
object$a_keyword
Returns

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

{
return isset($this->options[$a_keyword]) ? $this->options[$a_keyword] : null;
}
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.

{
return isset($this->obj_options[$a_keyword][$a_obj_id]) ? $this->obj_options[$a_keyword][$a_obj_id] : null;
}
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.

{
return isset($this->ref_options[$a_keyword][$a_ref_id]) ? $this->ref_options[$a_keyword][$a_ref_id] : null;
}
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.

References $ref_id.

{
$refs = array();
foreach((array) $this->ref_options[self::KEY_ITEM_MODE] as $ref_id => $mode)
{
if($mode == self::EXPORT_BUILD)
{
$refs[] = $ref_id;
}
}
return $refs;
}
ilExportOptions::getSubitemsForExport ( )

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

Returns
array ref ids

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

References $ref_id.

{
$refs = array();
foreach((array) $this->ref_options[self::KEY_ITEM_MODE] as $ref_id => $mode)
{
if($mode != self::EXPORT_OMIT)
{
$refs[] = $ref_id;
}
}
return $refs;
}
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.

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

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

+ Here is the caller graph for this function:

ilExportOptions::read ( )

Read entries.

Returns

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

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

Referenced by __construct().

{
global $ilDB;
$this->options = array();
$this->obj_options = array();
$this->ref_options = array();
$query = "SELECT * FROM export_options ".
"WHERE export_id = ".$ilDB->quote($this->getExportId(),'integer').' '.
"ORDER BY pos";
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
if($row->ref_id)
{
$this->ref_options[$row->keyword][$row->ref_id] = $row->value;
}
if($row->obj_id)
{
$this->obj_options[$row->keyword][$row->obj_id] = $row->value;
}
if(!$row->ref_id and !$row->obj_id)
{
$this->options[$row->keyword] = $row->value;
}
}
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

ilExportOptions::$export_id = 0
private

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

Referenced by getExportId().

ilExportOptions::$instance = null
staticprivate

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

Referenced by getInstance().

ilExportOptions::$obj_options = array()
private

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

ilExportOptions::$options = array()
private

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

ilExportOptions::$ref_options = array()
private

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

const ilExportOptions::EXPORT_BUILD = 2
const ilExportOptions::EXPORT_EXISTING = 1

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

Referenced by ilExportSelectionTableGUI\fillRow().

const ilExportOptions::EXPORT_OMIT = 3
const ilExportOptions::KEY_INIT = 1

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

const ilExportOptions::KEY_ITEM_MODE = 2

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