ILIAS  Release_3_10_x_branch Revision 61812
 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 $res, and DB_FETCHMODE_OBJECT.

Referenced by ilContainer\cloneAllObject(), ilObjectGUI\cloneAllObject(), and ilSoapObjectAdministration\copyObject().

{
global $ilDB;
$query = "SELECT MAX(copy_id) as latest FROM copy_wizard_options ";
$res = $ilDB->query($query);
$row = $res->fetchRow(DB_FETCHMODE_OBJECT);
$query = "INSERT INTO copy_wizard_options ".
"SET copy_id = ".$ilDB->quote($row->latest + 1);
$ilDB->query($query);
return $row->latest + 1;
}

+ Here is the caller graph for this function:

static ilCopyWizardOptions::_getInstance (   $a_copy_id)
static

Get instance of copy wizard options.

public

Parameters
intcopy id

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

Referenced by ilObject\appendCopyInfo(), ilContainer\cloneAllObject(), ilObjectGUI\cloneAllObject(), ilLPCollections\cloneCollections(), ilCourseObjectiveMaterials\cloneDependencies(), ilCourseItems\cloneDependencies(), ilCourseObjectiveQuestion\cloneDependencies(), ilCourseStart\cloneDependencies(), ilEventItems\cloneItems(), ilObjForum\cloneObject(), ilObjTest\cloneObject(), ilSoapObjectAdministration\copyObject(), ilSoapUtils\ilClone(), and ilSoapUtils\ilCloneDependencies().

{
if(is_array(self::$instances) and isset(self::$instances[$a_copy_id]))
{
return self::$instances[$a_copy_id];
}
return self::$instances[$a_copy_id] = new ilCopyWizardOptions($a_copy_id);
}

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

Referenced by ilContainer\cloneAllObject().

{
global $ilDB;
$query = "SELECT * FROM copy_wizard_options ".
" WHERE copy_id = ".$ilDB->quote($a_copy_id)." ";
$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 396 of file class.ilCopyWizardOptions.php.

References $res.

Referenced by initContainer().

{
if(!is_array($a_options))
{
return false;
}
$query = "DELETE FROM copy_wizard_options ".
"WHERE copy_id = ".$this->db->quote($this->copy_id)." ".
"AND source_id = ".$this->db->quote($a_source_id);
$this->db->query($query);
$query = "INSERT INTO copy_wizard_options ".
"SET copy_id = ".$this->db->quote($this->copy_id).", ".
"source_id = ".$this->db->quote($a_source_id).", ".
"options = ".$this->db->quote(serialize($a_options))." ";
$res = $this->db->query($query);
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 424 of file class.ilCopyWizardOptions.php.

References $res, and DB_FETCHMODE_OBJECT.

Referenced by initContainer().

{
$query = "SELECT * FROM copy_wizard_options ".
"WHERE copy_id = ".$this->db->quote($this->copy_id)." ".
"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 = "REPLACE INTO copy_wizard_options ".
"SET copy_id = ".$this->db->quote($this->copy_id).", ".
"source_id = -2, ".
"options = ".$this->db->quote(serialize($mappings))."";
$this->db->query($query);
return true;
}

+ Here is the caller graph for this function:

ilCopyWizardOptions::checkOwner (   $a_user_id)

check owner

public

Parameters
intuser_id

Definition at line 215 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 466 of file class.ilCopyWizardOptions.php.

{
$query = "DELETE FROM copy_wizard_options ".
"WHERE copy_id = ".$this->db->quote($this->copy_id);
$this->db->query($query);
}
ilCopyWizardOptions::disableSOAP ( )

Disable soap calls.

Recursive call of ilClone and ilCloneDependencies

public

Parameters

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

References DISABLE_SOAP, and getCopyId().

{
$this->options[self::DISABLE_SOAP] = 1;
$query = "INSERT INTO copy_wizard_options ".
"SET copy_id = ".$this->db->quote($this->getCopyId()).", ".
"source_id = ".$this->db->quote(self::DISABLE_SOAP).", ".
"options = ".$this->db->quote(serialize(array(1)))."";
$this->db->query($query);
}

+ Here is the call graph for this function:

ilCopyWizardOptions::dropFirstDependenciesNode ( )

Drop first node (for cloneDependencies())

public

Definition at line 367 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 356 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 323 of file class.ilCopyWizardOptions.php.

References fetchFirstNodeById(), and read().

Referenced by dropFirstDependenciesNode(), and dropFirstNode().

{
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);
$query = "UPDATE copy_wizard_options ".
"SET options = ".$this->db->quote(serialize($this->options[$a_id]))." ".
"WHERE copy_id = ".$this->db->quote($this->copy_id)." ".
"AND source_id = ".$this->db->quote($a_id)." ";
;
$this->db->query($query);
$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 312 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 301 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 284 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 226 of file class.ilCopyWizardOptions.php.

References $copy_id.

Referenced by disableSOAP(), saveOwner(), and saveRoot().

{
}

+ Here is the caller graph for this function:

ilCopyWizardOptions::getMappings ( )

Get Mappings.

public

Definition at line 451 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 379 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 240 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 169 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 197 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 480 of file class.ilCopyWizardOptions.php.

References $res, and DB_FETCHMODE_OBJECT.

Referenced by __construct(), and dropFirstNodeById().

{
$query = "SELECT * FROM copy_wizard_options ".
"WHERE copy_id = ".$this->db->quote($this->copy_id);
$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 502 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().

{
$query = "INSERT INTO copy_wizard_options ".
"SET copy_id = ".$this->db->quote($this->getCopyId()).", ".
"source_id = ".$this->db->quote(self::OWNER_KEY).", ".
"options = ".$this->db->quote(serialize(array($a_user_id)))."";
$this->db->query($query);
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 151 of file class.ilCopyWizardOptions.php.

References getCopyId().

{
$query = "INSERT INTO copy_wizard_options ".
"SET copy_id = ".$this->db->quote($this->getCopyId()).", ".
"source_id = ".$this->db->quote(self::ROOT_NODE).", ".
"options = ".$this->db->quote(serialize(array($a_root)))."";
$this->db->query($query);
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 259 of file class.ilCopyWizardOptions.php.

References $res, and readTree().

{
$this->readTree($a_source_id);
$a_tree_structure = $this->tmp_tree;
$query = "UPDATE copy_wizard_options ".
"SET options = ".$this->db->quote(serialize($a_tree_structure))." ".
"WHERE copy_id = ".$this->db->quote($this->copy_id)." ".
"AND source_id = 0 ";
$res = $this->db->query($query);
$query = "INSERT INTO copy_wizard_options ".
"SET options = ".$this->db->quote(serialize($a_tree_structure)).", ".
"copy_id = ".$this->db->quote($this->copy_id).", ".
"source_id = -1 ";
$res = $this->db->query($query);
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: