/** * Get a content object of the page * * @param string hier ID * @param string PC ID * * @return object page content object */ function getContentObject($a_hier_id, $a_pc_id = "") { $cont_node = $this->getContentNode($a_hier_id, $a_pc_id); if (!is_object($cont_node)) { return false; } include_once "./Services/COPage/classes/class.ilCOPagePCDef.php"; $node_name = $cont_node->node_name(); if ($node_name == "PageObject") { return null; } if ($node_name == "PageContent") { $child_node = $cont_node->first_child(); $node_name = $child_node->node_name(); } // table extra handling (@todo: get rid of it) if ($node_name == "Table") { if ($child_node->get_attribute("DataTable") == "y") { require_once "./Services/COPage/classes/class.ilPCDataTable.php"; $tab = new ilPCDataTable($this); $tab->setNode($cont_node); $tab->setHierId($a_hier_id); } else { require_once "./Services/COPage/classes/class.ilPCTable.php"; $tab = new ilPCTable($this); $tab->setNode($cont_node); $tab->setHierId($a_hier_id); } $tab->setPcId($a_pc_id); return $tab; } // media extra handling (@todo: get rid of it) if ($node_name == "MediaObject") { if ($_GET["pgEdMediaMode"] != "") { echo "ilPageObject::error media"; exit; } //require_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php"); require_once "./Services/COPage/classes/class.ilPCMediaObject.php"; $mal_node =& $child_node->first_child(); //echo "ilPageObject::getContentObject:nodename:".$mal_node->node_name().":<br>"; $id_arr = explode("_", $mal_node->get_attribute("OriginId")); $mob_id = $id_arr[count($id_arr) - 1]; // allow deletion of non-existing media objects if (!ilObject::_exists($mob_id) && in_array("delete", $_POST)) { $mob_id = 0; } //$mob =& new ilObjMediaObject($mob_id); $mob = new ilPCMediaObject($this); $mob->readMediaObject($mob_id); //$mob->setDom($this->dom); $mob->setNode($cont_node); $mob->setHierId($a_hier_id); $mob->setPcId($a_pc_id); return $mob; } // // generic procedure // $pc_def = ilCOPagePCDef::getPCDefinitionByName($node_name); // check if pc definition has been found if (!is_array($pc_def)) { include_once "./Services/COPage/exceptions/class.ilCOPageUnknownPCTypeException.php"; throw new ilCOPageUnknownPCTypeException('Unknown PC Name "' . $node_name . '".'); } $pc_class = "ilPC" . $pc_def["name"]; $pc_path = "./" . $pc_def["component"] . "/" . $pc_def["directory"] . "/class." . $pc_class . ".php"; require_once $pc_path; $pc = new $pc_class($this); $pc->setNode($cont_node); $pc->setHierId($a_hier_id); $pc->setPcId($a_pc_id); return $pc; }