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];
99 $query =
"SELECT * FROM copy_wizard_options ".
100 "WHERE copy_id = ".$ilDB->quote($a_copy_id ,
'integer').
" ";
102 return $res->numRows() ? false :
true;
116 $query =
"SELECT MAX(copy_id) latest FROM copy_wizard_options ";
120 $ilDB->insert(
"copy_wizard_options", array(
121 "copy_id" => array(
"integer",
$row->latest + 1),
122 "source_id" => array(
"integer", 0)
124 return $row->latest + 1;
138 $ilDB->insert(
"copy_wizard_options", array(
139 "copy_id" => array(
"integer", $this->
getCopyId()),
140 "source_id" => array(
"integer", self::OWNER_KEY),
141 "options" => array(
'clob',serialize(array($a_user_id)))
158 $ilDB->insert(
"copy_wizard_options", array(
159 "copy_id" => array(
"integer", $this->
getCopyId()),
160 "source_id" => array(
"integer", self::ROOT_NODE),
161 "options" => array(
'clob',serialize(array($a_root)))
177 return in_array($a_root,$this->
getOptions(self::ROOT_NODE));
191 $this->options[self::DISABLE_SOAP] = 1;
193 $ilDB->insert(
"copy_wizard_options", array(
194 "copy_id" => array(
"integer", $this->
getCopyId()),
195 "source_id" => array(
"integer", self::DISABLE_SOAP),
196 "options" => array(
'clob',serialize(array(1)))
208 if(isset($this->options[self::DISABLE_SOAP]) and $this->options[self::DISABLE_SOAP])
226 return in_array($a_user_id,$this->
getOptions(self::OWNER_KEY));
253 $mapping_source = $tree->getParentId($a_source_id);
273 $a_tree_structure = $this->tmp_tree;
275 $ilDB->update(
"copy_wizard_options", array(
276 "options" => array(
'clob',serialize($a_tree_structure))
278 "copy_id" => array(
'integer',$this->
getCopyId()),
279 "source_id" => array(
'integer',0
282 $ilDB->insert(
'copy_wizard_options',array(
283 'copy_id' => array(
'integer',$this->
getCopyId()),
284 'source_id' => array(
'integer',-1),
285 'options' => array(
'clob',serialize($a_tree_structure))
300 if(isset($tree[0]) and is_array($tree[0]))
340 if(!isset($this->options[$a_id]) or !is_array($this->options[$a_id]))
345 $this->options[$a_id] = array_slice($this->options[$a_id],1);
347 $ilDB->update(
'copy_wizard_options',array(
348 'options' => array(
'clob',serialize($this->options[$a_id]))
350 'copy_id' => array(
'integer',$this->
getCopyId()),
351 'source_id' => array(
'integer',$a_id)));
359 if($node[
'type'] ==
'rolf')
397 if(isset($this->options[$a_source_id]) and is_array($this->options[$a_source_id]))
399 return $this->options[$a_source_id];
416 if(!is_array($a_options))
421 $query =
"DELETE FROM copy_wizard_options ".
422 "WHERE copy_id = ".$this->db->quote($this->copy_id ,
'integer').
" ".
423 "AND source_id = ".$this->db->quote($a_source_id ,
'integer');
426 $ilDB->insert(
'copy_wizard_options',array(
427 'copy_id' => array(
'integer',$this->copy_id),
428 'source_id' => array(
'integer',$a_source_id),
429 'options' => array(
'clob',serialize($a_options))
446 $query =
"SELECT * FROM copy_wizard_options ".
447 "WHERE copy_id = ".$this->db->quote($this->copy_id ,
'integer').
" ".
448 "AND source_id = -2 ";
453 $mappings = unserialize(
$row->options);
455 $mappings[$a_source_id] = $a_target_id;
457 $query =
"DELETE FROM copy_wizard_options ".
458 "WHERE copy_id = ".$ilDB->quote($this->
getCopyId(),
'integer').
" ".
459 "AND source_id = -2 ";
463 $ilDB->insert(
'copy_wizard_options', array(
464 'copy_id' => array(
'integer',$this->
getCopyId()),
465 'source_id' => array(
'integer',-2),
466 'options' => array(
'clob',serialize($mappings))
480 if(isset($this->options[-2]) and is_array($this->options[-2]))
482 return $this->options[-2];
497 $query =
"DELETE FROM copy_wizard_options ".
498 "WHERE copy_id = ".$this->db->quote($this->copy_id ,
'integer');
513 $query =
"SELECT * FROM copy_wizard_options ".
514 "WHERE copy_id = ".$this->db->quote($this->copy_id ,
'integer');
517 $this->options = array();
520 $this->options[
$row->source_id] = unserialize(
$row->options);
537 $this->tmp_tree[] = $tree->getNodeData($a_source_id);
540 foreach($tree->getChilds($a_source_id) as $sub_nodes)
542 $sub_node_ref_id = $sub_nodes[
'child'];
544 $options = $this->options[$sub_node_ref_id];
545 if(
$options[
'type'] == self::COPY_WIZARD_COPY or
546 $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.
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())