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).
" ";
101 $res = $ilDB->query($query);
102 return $res->numRows() ?
false :
true;
116 $query =
"SELECT MAX(copy_id) as latest FROM copy_wizard_options ";
117 $res = $ilDB->query($query);
120 $query =
"INSERT INTO copy_wizard_options ".
121 "SET copy_id = ".$ilDB->quote($row->latest + 1);
122 $ilDB->query($query);
124 return $row->latest + 1;
136 $query =
"INSERT INTO copy_wizard_options ".
137 "SET copy_id = ".$this->db->quote($this->
getCopyId()).
", ".
138 "source_id = ".$this->db->quote(self::OWNER_KEY).
", ".
139 "options = ".$this->db->quote(serialize(array($a_user_id))).
"";
140 $this->db->query($query);
153 $query =
"INSERT INTO copy_wizard_options ".
154 "SET copy_id = ".$this->db->quote($this->
getCopyId()).
", ".
155 "source_id = ".$this->db->quote(self::ROOT_NODE).
", ".
156 "options = ".$this->db->quote(serialize(array($a_root))).
"";
157 $this->db->query($query);
171 return in_array($a_root,$this->
getOptions(self::ROOT_NODE));
184 $query =
"INSERT INTO copy_wizard_options ".
185 "SET copy_id = ".$this->db->quote($this->
getCopyId()).
", ".
186 "source_id = ".$this->db->quote(self::DISABLE_SOAP).
", ".
187 "options = ".$this->db->quote(serialize(array(1))).
"";
188 $this->db->query($query);
199 if(isset($this->options[self::DISABLE_SOAP]) and $this->options[self::DISABLE_SOAP])
217 return in_array($a_user_id,$this->
getOptions(self::OWNER_KEY));
244 $mapping_source = $tree->getParentId($a_source_id);
262 $a_tree_structure = $this->tmp_tree;
264 $query =
"UPDATE copy_wizard_options ".
265 "SET options = ".$this->db->quote(serialize($a_tree_structure)).
" ".
266 "WHERE copy_id = ".$this->db->quote($this->copy_id).
" ".
267 "AND source_id = 0 ";
268 $res = $this->db->query($query);
270 $query =
"INSERT INTO copy_wizard_options ".
271 "SET options = ".$this->db->quote(serialize($a_tree_structure)).
", ".
272 "copy_id = ".$this->db->quote($this->copy_id).
", ".
274 $res = $this->db->query($query);
287 if(isset($tree[0]) and is_array($tree[0]))
325 if(!isset($this->options[$a_id]) or !is_array($this->options[$a_id]))
330 $this->options[$a_id] = array_slice($this->options[$a_id],1);
331 $query =
"UPDATE copy_wizard_options ".
332 "SET options = ".$this->db->quote(serialize($this->options[$a_id])).
" ".
333 "WHERE copy_id = ".$this->db->quote($this->copy_id).
" ".
334 "AND source_id = ".$this->db->quote($a_id).
" ";
336 $this->db->query($query);
343 if($node[
'type'] ==
'rolf')
381 if(isset($this->options[$a_source_id]) and is_array($this->options[$a_source_id]))
383 return $this->options[$a_source_id];
398 if(!is_array($a_options))
403 $query =
"DELETE FROM copy_wizard_options ".
404 "WHERE copy_id = ".$this->db->quote($this->copy_id).
" ".
405 "AND source_id = ".$this->db->quote($a_source_id);
406 $this->db->query($query);
408 $query =
"INSERT INTO copy_wizard_options ".
409 "SET copy_id = ".$this->db->quote($this->copy_id).
", ".
410 "source_id = ".$this->db->quote($a_source_id).
", ".
411 "options = ".$this->db->quote(serialize($a_options)).
" ";
412 $res = $this->db->query($query);
426 $query =
"SELECT * FROM copy_wizard_options ".
427 "WHERE copy_id = ".$this->db->quote($this->copy_id).
" ".
428 "AND source_id = -2 ";
429 $res = $this->db->query($query);
433 $mappings = unserialize($row->options);
435 $mappings[$a_source_id] = $a_target_id;
437 $query =
"REPLACE INTO copy_wizard_options ".
438 "SET copy_id = ".$this->db->quote($this->copy_id).
", ".
440 "options = ".$this->db->quote(serialize($mappings)).
"";
441 $this->db->query($query);
453 if(isset($this->options[-2]) and is_array($this->options[-2]))
455 return $this->options[-2];
468 $query =
"DELETE FROM copy_wizard_options ".
469 "WHERE copy_id = ".$this->db->quote($this->copy_id);
470 $this->db->query($query);
482 $query =
"SELECT * FROM copy_wizard_options ".
483 "WHERE copy_id = ".$this->db->quote($this->copy_id);
484 $res = $this->db->query($query);
486 $this->options = array();
489 $this->options[$row->source_id] = unserialize($row->options);
506 $this->tmp_tree[] = $tree->getNodeData($a_source_id);
509 foreach($tree->getChilds($a_source_id) as $sub_nodes)
511 $sub_node_ref_id = $sub_nodes[
'child'];
513 $options = $this->options[$sub_node_ref_id];
514 if(
$options[
'type'] == self::COPY_WIZARD_COPY or
515 $options[
'type'] == self::COPY_WIZARD_LINK)