4 require_once(
"./Services/COPage/classes/class.ilPageContent.php");
35 parent::setNode($a_node);
36 $this->res_node = $a_node->first_child();
45 public function create(&$a_pg_obj, $a_hier_id, $a_pc_id =
"")
49 $this->res_node = $this->dom->create_element(
"Resources");
50 $this->res_node = $this->node->append_child($this->res_node);
61 $children = $this->res_node->child_nodes();
62 for (
$i=0;
$i<count($children);
$i++) {
63 $this->res_node->remove_child($children[
$i]);
65 $list_node = $this->dom->create_element(
"ResourceList");
66 $list_node = $this->res_node->append_child($list_node);
67 $list_node->set_attribute(
"Type",
$a_type);
78 if (!empty($a_ref_id)) {
79 $children = $this->res_node->child_nodes();
80 for (
$i=0;
$i<count($children);
$i++) {
81 $this->res_node->remove_child($children[
$i]);
83 $list_node = $this->dom->create_element(
"ItemGroup");
84 $list_node = $this->res_node->append_child($list_node);
85 $list_node->set_attribute(
"RefId", $a_ref_id);
96 if (is_object($this->res_node)) {
97 $children = $this->res_node->child_nodes();
98 if (is_object($children[0]) && $children[0]->node_name() ==
"ResourceList") {
99 return $children[0]->get_attribute(
"Type");
112 if (is_object($this->res_node)) {
113 $children = $this->res_node->child_nodes();
114 if (is_object($children[0]) && $children[0]->node_name() ==
"ItemGroup") {
115 return (
int) $children[0]->get_attribute(
"RefId");
128 if (is_object($this->res_node)) {
129 $children = $this->res_node->child_nodes();
130 if (is_object($children[0])) {
131 return $children[0]->node_name();
145 $dom = $a_page->getDom();
152 $igs = $xpath_temp->query(
"//Resources/ItemGroup");
155 foreach ($igs as $ig_node) {
156 $ref_id = $ig_node->getAttribute(
"RefId");
157 if ($mappings[$ref_id] > 0) {
158 $ig_node->setAttribute(
"RefId", $mappings[$ref_id]);
171 return array(
"pc_res");
181 return self::modifyItemGroupRefIdsByMapping($page, $ref_mappings);
init()
Init page content component.
static modifyItemGroupRefIdsByMapping($a_page, $mappings)
Modify ref ids by mapping.
setType($a_type)
Set Type.
getResourceListType()
Get Resource Lis Type.
getMainType()
Get main type.
static getLangVars()
Get lang vars needed for editing.
setNode($a_node)
Set node.
create(&$a_pg_obj, $a_hier_id, $a_pc_id="")
Create resources node in xml.
setResourceListType($a_type)
Set Type of Resource List (currently only one)
setItemGroupRefId($a_ref_id)
Set Item Group Ref Id.
Create styles array
The data for the language used.
createPageContentNode($a_set_this_node=true)
Create page content node (always use this method first when adding a new element) ...
getItemGroupRefId()
Get item group ref id.
static resolveResources(ilPageObject $page, $ref_mappings)
Resolve resources.