ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilCopyWizardOptions Class Reference
+ Collaboration diagram for ilCopyWizardOptions:

Public Member Functions

 saveOwner ($a_user_id)
 Save owner for copy.
 saveRoot ($a_root)
 Save root node id.
 isRootNode ($a_root)
 Is root node.
 disableSOAP ()
 Disable soap calls.
 isSOAPEnabled ()
 Check if SOAP calls are disabled.
 checkOwner ($a_user_id)
 check owner
 getCopyId ()
 Get copy id.
 initContainer ($a_source_id, $a_target_id)
 Init container Add copy entry.
 storeTree ($a_source_id)
 Save tree Stores two copies of the tree structure: id 0 is used for recursive call of cloneObject() id -1 is used for recursive call of cloneDependencies()
 fetchFirstNode ()
 Fetch first node for cloneObject.
 fetchFirstDependenciesNode ()
 Fetch first dependencies node.
 dropFirstNodeById ($a_id)
 Drop first node by id.
 dropFirstNode ()
 Drop first node (for cloneObject())
 dropFirstDependenciesNode ()
 Drop first node (for cloneDependencies())
 getOptions ($a_source_id)
 Get entry by source.
 addEntry ($a_source_id, $a_options)
 Add new entry.
 appendMapping ($a_source_id, $a_target_id)
 Add mapping of source -> target.
 getMappings ()
 Get Mappings.
 deleteAll ()
 Delete all entries.
 read ()
 public

Static Public Member Functions

static _getInstance ($a_copy_id)
 Get instance of copy wizard options.
static _isFinished ($a_copy_id)
 check if copy is finished
static _allocateCopyId ()
 Allocate a copy for further entries.

Data Fields

const COPY_WIZARD_OMIT = 1
const COPY_WIZARD_COPY = 2
const COPY_WIZARD_LINK = 3
const OWNER_KEY = -3
const DISABLE_SOAP = -4
const ROOT_NODE = -5

Private Member Functions

 __construct ($a_copy_id=0)
 Private Constructor (Singleton class)
 fetchFirstNodeById ($a_id)
 Get first node of stored tree.
 readTree ($a_source_id)
 Purge ommitted node recursively.

Private Attributes

 $db
 $copy_id
 $source_id
 $options = array()

Static Private Attributes

static $instances = null

Detailed Description

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

Constructor & Destructor Documentation

ilCopyWizardOptions::__construct (   $a_copy_id = 0)
private

Private Constructor (Singleton class)

private

Parameters
intcopy_id

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

References read().

{
global $ilDB;
$this->db = $ilDB;
$this->copy_id = $a_copy_id;
if($this->copy_id)
{
$this->read();
}
}

+ Here is the call graph for this function:

Member Function Documentation

static ilCopyWizardOptions::_allocateCopyId ( )
static

Allocate a copy for further entries.

public

Definition at line 112 of file class.ilCopyWizardOptions.php.

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

Referenced by ilContainer\cloneAllObject(), ilObjectGUI\cloneAllObject(), ilObjectCopyGUI\copyMultipleNonContainer(), ilSoapObjectAdministration\copyObject(), ilObjectCopyGUI\copySingleObject(), and ilObjWorkspaceFolderGUI\performPasteIntoMultipleObjects().

{
global $ilDB;
$query = "SELECT MAX(copy_id) latest FROM copy_wizard_options ";
$res = $ilDB->query($query);
$ilDB->insert("copy_wizard_options", array(
"copy_id" => array("integer", $row->latest + 1),
"source_id" => array("integer", 0)
));
return $row->latest + 1;
}

+ Here is the caller graph for this function:

static ilCopyWizardOptions::_isFinished (   $a_copy_id)
static

check if copy is finished

public

Parameters
intcopy id

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

References $query, and $res.

Referenced by ilContainer\cloneAllObject().

{
global $ilDB;
$query = "SELECT * FROM copy_wizard_options ".
"WHERE copy_id = ".$ilDB->quote($a_copy_id ,'integer')." ";
$res = $ilDB->query($query);
return $res->numRows() ? false : true;
}

+ Here is the caller graph for this function:

ilCopyWizardOptions::addEntry (   $a_source_id,
  $a_options 
)

Add new entry.

public

Parameters
intref_id of source
arrayarray of options

Definition at line 412 of file class.ilCopyWizardOptions.php.

References $query, and $res.

Referenced by initContainer().

{
global $ilDB;
if(!is_array($a_options))
{
return false;
}
$query = "DELETE FROM copy_wizard_options ".
"WHERE copy_id = ".$this->db->quote($this->copy_id ,'integer')." ".
"AND source_id = ".$this->db->quote($a_source_id ,'integer');
$res = $ilDB->manipulate($query);
$ilDB->insert('copy_wizard_options',array(
'copy_id' => array('integer',$this->copy_id),
'source_id' => array('integer',$a_source_id),
'options' => array('clob',serialize($a_options))
));
return true;
}

+ Here is the caller graph for this function:

ilCopyWizardOptions::appendMapping (   $a_source_id,
  $a_target_id 
)

Add mapping of source -> target.

public

Parameters
intsource ref_id
inttarget ref_id

Definition at line 442 of file class.ilCopyWizardOptions.php.

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

Referenced by initContainer().

{
global $ilDB;
$query = "SELECT * FROM copy_wizard_options ".
"WHERE copy_id = ".$this->db->quote($this->copy_id ,'integer')." ".
"AND source_id = -2 ";
$res = $this->db->query($query);
$mappings = array();
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$mappings = unserialize($row->options);
}
$mappings[$a_source_id] = $a_target_id;
$query = "DELETE FROM copy_wizard_options ".
"WHERE copy_id = ".$ilDB->quote($this->getCopyId(),'integer')." ".
"AND source_id = -2 ";
$res = $ilDB->manipulate($query);
$ilDB->insert('copy_wizard_options', array(
'copy_id' => array('integer',$this->getCopyId()),
'source_id' => array('integer',-2),
'options' => array('clob',serialize($mappings))
));
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCopyWizardOptions::checkOwner (   $a_user_id)

check owner

public

Parameters
intuser_id

Definition at line 224 of file class.ilCopyWizardOptions.php.

References getOptions().

{
return in_array($a_user_id,$this->getOptions(self::OWNER_KEY));
}

+ Here is the call graph for this function:

ilCopyWizardOptions::deleteAll ( )

Delete all entries.

public

Definition at line 493 of file class.ilCopyWizardOptions.php.

References $query, and $res.

{
global $ilDB;
$query = "DELETE FROM copy_wizard_options ".
"WHERE copy_id = ".$this->db->quote($this->copy_id ,'integer');
$res = $ilDB->manipulate($query);
}
ilCopyWizardOptions::disableSOAP ( )

Disable soap calls.

Recursive call of ilClone and ilCloneDependencies

public

Parameters

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

References DISABLE_SOAP, and getCopyId().

{
global $ilDB;
$this->options[self::DISABLE_SOAP] = 1;
$ilDB->insert("copy_wizard_options", array(
"copy_id" => array("integer", $this->getCopyId()),
"source_id" => array("integer", self::DISABLE_SOAP),
"options" => array('clob',serialize(array(1)))
));
}

+ Here is the call graph for this function:

ilCopyWizardOptions::dropFirstDependenciesNode ( )

Drop first node (for cloneDependencies())

public

Definition at line 383 of file class.ilCopyWizardOptions.php.

References dropFirstNodeById().

{
return $this->dropFirstNodeById(-1);
}

+ Here is the call graph for this function:

ilCopyWizardOptions::dropFirstNode ( )

Drop first node (for cloneObject())

public

Definition at line 372 of file class.ilCopyWizardOptions.php.

References dropFirstNodeById().

{
return $this->dropFirstNodeById(0);
}

+ Here is the call graph for this function:

ilCopyWizardOptions::dropFirstNodeById (   $a_id)

Drop first node by id.

private

Definition at line 336 of file class.ilCopyWizardOptions.php.

References fetchFirstNodeById(), getCopyId(), and read().

Referenced by dropFirstDependenciesNode(), and dropFirstNode().

{
global $ilDB;
if(!isset($this->options[$a_id]) or !is_array($this->options[$a_id]))
{
return false;
}
$this->options[$a_id] = array_slice($this->options[$a_id],1);
$ilDB->update('copy_wizard_options',array(
'options' => array('clob',serialize($this->options[$a_id]))
),array(
'copy_id' => array('integer',$this->getCopyId()),
'source_id' => array('integer',$a_id)));
$this->read();
// check for role_folder
if(($node = $this->fetchFirstNodeById($a_id)) === false)
{
return true;
}
if($node['type'] == 'rolf')
{
$this->dropFirstNodeById($a_id);
}
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCopyWizardOptions::fetchFirstDependenciesNode ( )

Fetch first dependencies node.

public

Definition at line 325 of file class.ilCopyWizardOptions.php.

References fetchFirstNodeById().

{
return $this->fetchFirstNodeById(-1);
}

+ Here is the call graph for this function:

ilCopyWizardOptions::fetchFirstNode ( )

Fetch first node for cloneObject.

public

Parameters

Definition at line 314 of file class.ilCopyWizardOptions.php.

References fetchFirstNodeById().

{
return $this->fetchFirstNodeById(0);
}

+ Here is the call graph for this function:

ilCopyWizardOptions::fetchFirstNodeById (   $a_id)
private

Get first node of stored tree.

private

Definition at line 297 of file class.ilCopyWizardOptions.php.

References getOptions().

Referenced by dropFirstNodeById(), fetchFirstDependenciesNode(), and fetchFirstNode().

{
$tree = $this->getOptions($a_id);
if(isset($tree[0]) and is_array($tree[0]))
{
return $tree[0];
}
return false;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCopyWizardOptions::getCopyId ( )

Get copy id.

public

Definition at line 235 of file class.ilCopyWizardOptions.php.

References $copy_id.

Referenced by appendMapping(), disableSOAP(), dropFirstNodeById(), saveOwner(), saveRoot(), and storeTree().

{
}

+ Here is the caller graph for this function:

ilCopyWizardOptions::getMappings ( )

Get Mappings.

public

Definition at line 478 of file class.ilCopyWizardOptions.php.

{
if(isset($this->options[-2]) and is_array($this->options[-2]))
{
return $this->options[-2];
}
return array();
}
ilCopyWizardOptions::getOptions (   $a_source_id)

Get entry by source.

public

Parameters
intsource ref_id

Definition at line 395 of file class.ilCopyWizardOptions.php.

Referenced by checkOwner(), fetchFirstNodeById(), and isRootNode().

{
if(isset($this->options[$a_source_id]) and is_array($this->options[$a_source_id]))
{
return $this->options[$a_source_id];
}
return array();
}

+ Here is the caller graph for this function:

ilCopyWizardOptions::initContainer (   $a_source_id,
  $a_target_id 
)

Init container Add copy entry.

public

Parameters

Definition at line 249 of file class.ilCopyWizardOptions.php.

References addEntry(), appendMapping(), and COPY_WIZARD_COPY.

{
global $tree;
$mapping_source = $tree->getParentId($a_source_id);
$this->addEntry($a_source_id,array('type' => ilCopyWizardOptions::COPY_WIZARD_COPY));
$this->appendMapping($mapping_source,$a_target_id);
}

+ Here is the call graph for this function:

ilCopyWizardOptions::isRootNode (   $a_root)

Is root node.

public

Parameters
intref_id of copy

Definition at line 175 of file class.ilCopyWizardOptions.php.

References getOptions().

{
return in_array($a_root,$this->getOptions(self::ROOT_NODE));
}

+ Here is the call graph for this function:

ilCopyWizardOptions::isSOAPEnabled ( )

Check if SOAP calls are disabled.

public

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

{
if(isset($this->options[self::DISABLE_SOAP]) and $this->options[self::DISABLE_SOAP])
{
return false;
}
return true;
}
ilCopyWizardOptions::read ( )

public

Parameters

Definition at line 509 of file class.ilCopyWizardOptions.php.

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

Referenced by __construct(), and dropFirstNodeById().

{
global $ilDB;
$query = "SELECT * FROM copy_wizard_options ".
"WHERE copy_id = ".$this->db->quote($this->copy_id ,'integer');
$res = $this->db->query($query);
$this->options = array();
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$this->options[$row->source_id] = unserialize($row->options);
}
return true;
}

+ Here is the caller graph for this function:

ilCopyWizardOptions::readTree (   $a_source_id)
private

Purge ommitted node recursively.

private

Parameters
arraycurrent node

Definition at line 533 of file class.ilCopyWizardOptions.php.

References $options.

Referenced by storeTree().

{
global $tree;
$this->tmp_tree[] = $tree->getNodeData($a_source_id);
foreach($tree->getChilds($a_source_id) as $sub_nodes)
{
$sub_node_ref_id = $sub_nodes['child'];
// check ommited, linked ...
$options = $this->options[$sub_node_ref_id];
if($options['type'] == self::COPY_WIZARD_COPY or
$options['type'] == self::COPY_WIZARD_LINK)
{
$this->readTree($sub_node_ref_id);
}
}
}

+ Here is the caller graph for this function:

ilCopyWizardOptions::saveOwner (   $a_user_id)

Save owner for copy.

It will be checked against this user id in all soap calls

public

Parameters

Definition at line 134 of file class.ilCopyWizardOptions.php.

References getCopyId().

{
global $ilDB;
$ilDB->insert("copy_wizard_options", array(
"copy_id" => array("integer", $this->getCopyId()),
"source_id" => array("integer", self::OWNER_KEY),
"options" => array('clob',serialize(array($a_user_id)))
));
return true;
}

+ Here is the call graph for this function:

ilCopyWizardOptions::saveRoot (   $a_root)

Save root node id.

public

Parameters
intref_id of copy source

Definition at line 154 of file class.ilCopyWizardOptions.php.

References getCopyId().

{
global $ilDB;
$ilDB->insert("copy_wizard_options", array(
"copy_id" => array("integer", $this->getCopyId()),
"source_id" => array("integer", self::ROOT_NODE),
"options" => array('clob',serialize(array($a_root)))
));
return true;
}

+ Here is the call graph for this function:

ilCopyWizardOptions::storeTree (   $a_source_id)

Save tree Stores two copies of the tree structure: id 0 is used for recursive call of cloneObject() id -1 is used for recursive call of cloneDependencies()

public

Parameters
intsource id

Definition at line 268 of file class.ilCopyWizardOptions.php.

References getCopyId(), and readTree().

{
global $ilDB;
$this->readTree($a_source_id);
$a_tree_structure = $this->tmp_tree;
$ilDB->update("copy_wizard_options", array(
"options" => array('clob',serialize($a_tree_structure))
), array(
"copy_id" => array('integer',$this->getCopyId()),
"source_id" => array('integer',0
)));
$ilDB->insert('copy_wizard_options',array(
'copy_id' => array('integer',$this->getCopyId()),
'source_id' => array('integer',-1),
'options' => array('clob',serialize($a_tree_structure))
));
return true;
}

+ Here is the call graph for this function:

Field Documentation

ilCopyWizardOptions::$copy_id
private

Definition at line 46 of file class.ilCopyWizardOptions.php.

Referenced by getCopyId().

ilCopyWizardOptions::$db
private

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

ilCopyWizardOptions::$instances = null
staticprivate

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

ilCopyWizardOptions::$options = array()
private

Definition at line 48 of file class.ilCopyWizardOptions.php.

Referenced by readTree().

ilCopyWizardOptions::$source_id
private

Definition at line 47 of file class.ilCopyWizardOptions.php.

const ilCopyWizardOptions::DISABLE_SOAP = -4

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

Referenced by disableSOAP().

const ilCopyWizardOptions::OWNER_KEY = -3

Definition at line 40 of file class.ilCopyWizardOptions.php.

const ilCopyWizardOptions::ROOT_NODE = -5

Definition at line 42 of file class.ilCopyWizardOptions.php.


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