Example #1
0
 function resolveIntLinks()
 {
     // resolve normal internal links
     $xpc = xpath_new_context($this->dom);
     $path = "//IntLink";
     $res =& xpath_eval($xpc, $path);
     for ($i = 0; $i < count($res->nodeset); $i++) {
         $target = $res->nodeset[$i]->get_attribute("Target");
         $type = $res->nodeset[$i]->get_attribute("Type");
         $new_target = ilInternalLink::_getIdForImportId($type, $target);
         if ($new_target !== false) {
             $res->nodeset[$i]->set_attribute("Target", $new_target);
         } else {
             if (ilInternalLink::_extractInstOfTarget($target) == IL_INST_ID && IL_INST_ID > 0 && $type != "RepositoryItem") {
                 $new_target = ilInternalLink::_removeInstFromTarget($target);
                 if (ilInternalLink::_exists($type, $new_target)) {
                     $res->nodeset[$i]->set_attribute("Target", $new_target);
                 }
             }
         }
     }
     unset($xpc);
     // resolve internal links in map areas
     $xpc = xpath_new_context($this->dom);
     $path = "//MediaAlias";
     $res =& xpath_eval($xpc, $path);
     //echo "<br><b>page::resolve</b><br>";
     //echo "Content:".htmlentities($this->getXMLFromDOM()).":<br>";
     for ($i = 0; $i < count($res->nodeset); $i++) {
         $orig_id = $res->nodeset[$i]->get_attribute("OriginId");
         $id_arr = explode("_", $orig_id);
         $mob_id = $id_arr[count($id_arr) - 1];
         ilMediaItem::_resolveMapAreaLinks($mob_id);
     }
 }