62 $this->copy_id = $a_copy_id;
80 if(is_array(self::$instances) and isset(self::$instances[$a_copy_id]))
82 return self::$instances[$a_copy_id];
94 return count($this->options[0]) + count($this->options[-1]);
110 $query =
"SELECT * FROM copy_wizard_options ".
111 "WHERE copy_id = ".$ilDB->quote($a_copy_id ,
'integer').
" ";
113 return $res->numRows() ? false :
true;
127 $query =
"SELECT MAX(copy_id) latest FROM copy_wizard_options ";
131 $ilDB->insert(
"copy_wizard_options", array(
132 "copy_id" => array(
"integer", ((
int)
$row->latest) + 1),
133 "source_id" => array(
"integer", 0)
135 return ((
int)
$row->latest) + 1;
149 $ilDB->insert(
"copy_wizard_options", array(
150 "copy_id" => array(
"integer", $this->
getCopyId()),
151 "source_id" => array(
"integer", self::OWNER_KEY),
152 "options" => array(
'clob',serialize(array($a_user_id)))
169 $ilDB->insert(
"copy_wizard_options", array(
170 "copy_id" => array(
"integer", $this->
getCopyId()),
171 "source_id" => array(
"integer", self::ROOT_NODE),
172 "options" => array(
'clob',serialize(array($a_root)))
188 return in_array($a_root,$this->
getOptions(self::ROOT_NODE));
202 $this->options[self::DISABLE_SOAP] = 1;
204 $ilDB->insert(
"copy_wizard_options", array(
205 "copy_id" => array(
"integer", $this->
getCopyId()),
206 "source_id" => array(
"integer", self::DISABLE_SOAP),
207 "options" => array(
'clob',serialize(array(1)))
219 if(isset($this->options[self::DISABLE_SOAP]) and $this->options[self::DISABLE_SOAP])
237 return in_array($a_user_id,$this->
getOptions(self::OWNER_KEY));
264 $mapping_source = $tree->getParentId($a_source_id);
283 $this->tmp_tree = array();
285 $a_tree_structure = $this->tmp_tree;
287 $ilDB->update(
"copy_wizard_options", array(
288 "options" => array(
'clob',serialize($a_tree_structure))
290 "copy_id" => array(
'integer',$this->
getCopyId()),
291 "source_id" => array(
'integer',0
294 $ilDB->insert(
'copy_wizard_options',array(
295 'copy_id' => array(
'integer',$this->
getCopyId()),
296 'source_id' => array(
'integer',-1),
297 'options' => array(
'clob',serialize($a_tree_structure))
312 if(isset($tree[0]) and is_array($tree[0]))
352 if(!isset($this->options[$a_id]) or !is_array($this->options[$a_id]))
357 $this->options[$a_id] = array_slice($this->options[$a_id],1);
359 $ilDB->update(
'copy_wizard_options',array(
360 'options' => array(
'clob',serialize($this->options[$a_id]))
362 'copy_id' => array(
'integer',$this->
getCopyId()),
363 'source_id' => array(
'integer',$a_id)));
371 if($node[
'type'] ==
'rolf')
409 if(isset($this->options[$a_source_id]) and is_array($this->options[$a_source_id]))
411 return $this->options[$a_source_id];
428 if(!is_array($a_options))
433 $query =
"DELETE FROM copy_wizard_options ".
434 "WHERE copy_id = ".$this->db->quote($this->copy_id ,
'integer').
" ".
435 "AND source_id = ".$this->db->quote($a_source_id ,
'integer');
438 $ilDB->insert(
'copy_wizard_options',array(
439 'copy_id' => array(
'integer',$this->copy_id),
440 'source_id' => array(
'integer',$a_source_id),
441 'options' => array(
'clob',serialize($a_options))
458 $query =
"SELECT * FROM copy_wizard_options ".
459 "WHERE copy_id = ".$this->db->quote($this->copy_id ,
'integer').
" ".
460 "AND source_id = -2 ";
465 $mappings = unserialize(
$row->options);
467 $mappings[$a_source_id] = $a_target_id;
469 $query =
"DELETE FROM copy_wizard_options ".
470 "WHERE copy_id = ".$ilDB->quote($this->
getCopyId(),
'integer').
" ".
471 "AND source_id = -2 ";
475 $ilDB->insert(
'copy_wizard_options', array(
476 'copy_id' => array(
'integer',$this->
getCopyId()),
477 'source_id' => array(
'integer',-2),
478 'options' => array(
'clob',serialize($mappings))
492 if(isset($this->options[-2]) and is_array($this->options[-2]))
494 return $this->options[-2];
509 $query =
"DELETE FROM copy_wizard_options ".
510 "WHERE copy_id = ".$this->db->quote($this->copy_id ,
'integer');
525 $query =
"SELECT * FROM copy_wizard_options ".
526 "WHERE copy_id = ".$this->db->quote($this->copy_id ,
'integer');
529 $this->options = array();
532 $this->options[
$row->source_id] = unserialize(
$row->options);
549 $this->tmp_tree[] = $tree->getNodeData($a_source_id);
552 foreach($tree->getChilds($a_source_id) as $sub_nodes)
554 $sub_node_ref_id = $sub_nodes[
'child'];
556 $options = $this->options[$sub_node_ref_id];
557 if(
$options[
'type'] == self::COPY_WIZARD_COPY or
558 $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)
const DB_FETCHMODE_OBJECT
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.
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.
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())