63 $this->copy_id = $a_copy_id;
81 if(is_array(self::$instances)
and isset(self::$instances[$a_copy_id]))
83 return self::$instances[$a_copy_id];
95 return count($this->options[0]) + count($this->options[-1]);
111 $query =
"SELECT * FROM copy_wizard_options ".
112 "WHERE copy_id = ".$ilDB->quote($a_copy_id ,
'integer').
" ";
114 return $res->numRows() ? false :
true;
128 $query =
"SELECT MAX(copy_id) latest FROM copy_wizard_options ";
132 $ilDB->insert(
"copy_wizard_options",
array(
133 "copy_id" =>
array(
"integer", ((
int)
$row->latest) + 1),
134 "source_id" =>
array(
"integer", 0)
136 return ((
int)
$row->latest) + 1;
150 $ilDB->insert(
"copy_wizard_options",
array(
152 "source_id" =>
array(
"integer", self::OWNER_KEY),
153 "options" =>
array(
'clob',serialize(
array($a_user_id)))
170 $ilDB->insert(
"copy_wizard_options",
array(
172 "source_id" =>
array(
"integer", self::ROOT_NODE),
173 "options" =>
array(
'clob',serialize(
array($a_root)))
189 return in_array($a_root,$this->
getOptions(self::ROOT_NODE));
203 $this->options[self::DISABLE_SOAP] = 1;
205 $ilDB->insert(
"copy_wizard_options",
array(
207 "source_id" =>
array(
"integer", self::DISABLE_SOAP),
208 "options" =>
array(
'clob',serialize(
array(1)))
221 $this->options[self::DISABLE_TREE_COPY] = 1;
223 $ilDB->insert(
"copy_wizard_options",
array(
225 "source_id" =>
array(
"integer", self::DISABLE_TREE_COPY),
226 "options" =>
array(
'clob',serialize(
array(1)))
236 if(isset($this->options[self::DISABLE_TREE_COPY])
and $this->options[self::DISABLE_TREE_COPY])
252 if(isset($this->options[self::DISABLE_SOAP])
and $this->options[self::DISABLE_SOAP])
270 return in_array($a_user_id,$this->
getOptions(self::OWNER_KEY));
297 $mapping_source = $tree->getParentId($a_source_id);
316 $this->tmp_tree =
array();
318 $a_tree_structure = $this->tmp_tree;
320 $ilDB->update(
"copy_wizard_options",
array(
321 "options" =>
array(
'clob',serialize($a_tree_structure))
324 "source_id" =>
array(
'integer',0
327 $ilDB->insert(
'copy_wizard_options',
array(
329 'source_id' =>
array(
'integer',-1),
330 'options' =>
array(
'clob',serialize($a_tree_structure))
345 if(isset($tree[0])
and is_array($tree[0]))
385 if(!isset($this->options[$a_id])
or !is_array($this->options[$a_id]))
390 $this->options[$a_id] = array_slice($this->options[$a_id],1);
392 $ilDB->update(
'copy_wizard_options',
array(
393 'options' =>
array(
'clob',serialize($this->options[$a_id]))
396 'source_id' =>
array(
'integer',$a_id)));
404 if($node[
'type'] ==
'rolf')
442 if(isset($this->options[$a_source_id])
and is_array($this->options[$a_source_id]))
444 return $this->options[$a_source_id];
461 if(!is_array($a_options))
466 $query =
"DELETE FROM copy_wizard_options ".
467 "WHERE copy_id = ".$this->db->quote($this->copy_id ,
'integer').
" ".
468 "AND source_id = ".$this->db->quote($a_source_id ,
'integer');
471 $ilDB->insert(
'copy_wizard_options',
array(
472 'copy_id' =>
array(
'integer',$this->copy_id),
473 'source_id' =>
array(
'integer',$a_source_id),
474 'options' =>
array(
'clob',serialize($a_options))
491 $query =
"SELECT * FROM copy_wizard_options ".
492 "WHERE copy_id = ".$this->db->quote($this->copy_id ,
'integer').
" ".
493 "AND source_id = -2 ";
498 $mappings = unserialize(
$row->options);
500 $mappings[$a_source_id] = $a_target_id;
502 $query =
"DELETE FROM copy_wizard_options ".
503 "WHERE copy_id = ".$ilDB->quote($this->
getCopyId(),
'integer').
" ".
504 "AND source_id = -2 ";
508 $ilDB->insert(
'copy_wizard_options',
array(
510 'source_id' =>
array(
'integer',-2),
511 'options' =>
array(
'clob',serialize($mappings))
525 if(isset($this->options[-2])
and is_array($this->options[-2]))
527 return $this->options[-2];
542 $query =
"DELETE FROM copy_wizard_options ".
543 "WHERE copy_id = ".$this->db->quote($this->copy_id ,
'integer');
558 $query =
"SELECT * FROM copy_wizard_options ".
559 "WHERE copy_id = ".$this->db->quote($this->copy_id ,
'integer');
562 $this->options =
array();
565 $this->options[
$row->source_id] = unserialize(
$row->options);
582 $this->tmp_tree[] = $tree->getNodeData($a_source_id);
585 foreach($tree->getChilds($a_source_id) as $sub_nodes)
587 $sub_node_ref_id = $sub_nodes[
'child'];
589 $options = $this->options[$sub_node_ref_id];
590 if(
$options[
'type'] == self::COPY_WIZARD_COPY
or 591 $options[
'type'] == self::COPY_WIZARD_LINK)
fetchFirstNodeById($a_id)
Get first node of stored tree.
storeTree($a_source_id)
Save tree Stores two copies of the tree structure: id 0 is used for recursive call of cloneObject() i...
readTree($a_source_id)
Purge ommitted node recursively.
saveOwner($a_user_id)
Save owner for copy.
getRequiredSteps()
Get required steps.
fetchFirstNode()
Fetch first node for cloneObject.
disableSOAP()
Disable soap calls.
checkOwner($a_user_id)
check owner
fetchFirstDependenciesNode()
Fetch first dependencies node.
addEntry($a_source_id, $a_options)
Add new entry.
__construct($a_copy_id=0)
Private Constructor (Singleton class)
saveRoot($a_root)
Save root node id.
isSOAPEnabled()
Check if SOAP calls are disabled.
static _isFinished($a_copy_id)
check if copy is finished
static _getInstance($a_copy_id)
Get instance of copy wizard options.
appendMapping($a_source_id, $a_target_id)
Add mapping of source -> target.
isTreeCopyDisabled()
Check if tree copy is enabled.
disableTreeCopy()
Disable copying of tree.
static _allocateCopyId()
Allocate a copy for further entries.
initContainer($a_source_id, $a_target_id)
Init container Add copy entry.
isRootNode($a_root)
Is root node.
Create styles array
The data for the language used.
dropFirstDependenciesNode()
Drop first node (for cloneDependencies())
dropFirstNodeById($a_id)
Drop first node by id.
getOptions($a_source_id)
Get entry by source.
getMappings()
Get Mappings.
deleteAll()
Delete all entries.
dropFirstNode()
Drop first node (for cloneObject())