5 require_once(
"./Services/COPage/classes/class.ilPageContent.php");
42 function create($a_pg_obj, $a_hier_id, $a_pc_id, $a_page_templ)
44 $source_id = explode(
":", $a_page_templ);
46 $source_page->buildDom();
47 $source_page->addHierIds();
48 $hier_ids = $source_page->getHierIds();
54 if (!is_int(strpos($hier_id,
"_")))
56 if ($hier_id !=
"pg" && $hier_id >= $a_hid)
65 $pos = explode(
"_", $a_pos);
67 $parent_pos = implode($pos,
"_");
70 $target_parent = $a_pg_obj->getContentNode($parent_pos);
74 $target_parent = $a_pg_obj->getNode();
79 $curr_node = $a_pg_obj->getContentNode($a_hier_id, $a_pcid);
81 foreach ($copy_ids as $copy_id)
83 $source_node = $source_page->getContentNode($copy_id);
84 $new_node = $source_node->clone_node(
true);
85 $new_node->unlink_node($new_node);
87 if ($succ_node = $curr_node->next_sibling())
89 $succ_node->insert_before($new_node, $succ_node);
94 $target_parent->append_child($new_node);
98 $xpath =
new DOMXpath($a_pg_obj->getDomDoc());
101 if ($new_node->get_attribute(
"PCID") !=
"")
103 $new_node->set_attribute(
"PCID",
"");
105 $els = $xpath->query(
".//*[@PCID]", $new_node->myDOMNode);
106 foreach ($els as $el)
108 $el->setAttribute(
"PCID",
"");
110 $curr_node = $new_node;