Ejemplo n.º 1
0
 function _resolveInternalLink($internal_link)
 {
     if (preg_match("/il_(\\d+)_(\\w+)_(\\d+)/", $internal_link, $matches)) {
         include_once "./Services/Link/classes/class.ilInternalLink.php";
         include_once "./Modules/LearningModule/classes/class.ilLMObject.php";
         include_once "./Modules/Glossary/classes/class.ilGlossaryTerm.php";
         switch ($matches[2]) {
             case "lm":
                 $resolved_link = ilLMObject::_getIdForImportId($internal_link);
                 break;
             case "pg":
                 $resolved_link = ilInternalLink::_getIdForImportId("PageObject", $internal_link);
                 break;
             case "st":
                 $resolved_link = ilInternalLink::_getIdForImportId("StructureObject", $internal_link);
                 break;
             case "git":
                 $resolved_link = ilInternalLink::_getIdForImportId("GlossaryItem", $internal_link);
                 break;
             case "mob":
                 $resolved_link = ilInternalLink::_getIdForImportId("MediaObject", $internal_link);
                 break;
         }
         if (strcmp($resolved_link, "") == 0) {
             $resolved_link = $internal_link;
         }
     } else {
         $resolved_link = $internal_link;
     }
     return $resolved_link;
 }
Ejemplo n.º 2
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);
     }
 }
Ejemplo n.º 3
0
 /**
  * resolve internal links of an item id
  */
 function _resolveIntLinks($a_item_id)
 {
     global $ilDB;
     //echo "maparea::resolve<br>";
     $q = "SELECT * FROM map_area WHERE item_id = " . $ilDB->quote($a_item_id, "integer");
     $area_set = $ilDB->query($q);
     while ($area_rec = $ilDB->fetchAssoc($area_set)) {
         $target = $area_rec["target"];
         $type = $area_rec["type"];
         $item_id = $area_rec["item_id"];
         $nr = $area_rec["nr"];
         if ($area_rec["link_type"] == IL_INT_LINK && !is_int(strpos($target, "__"))) {
             $new_target = ilInternalLink::_getIdForImportId($type, $target);
             if ($new_target !== false) {
                 $query = "UPDATE map_area SET " . "target = " . $ilDB->quote($new_target, "text") . " " . "WHERE item_id = " . $ilDB->quote($item_id, "integer") . " AND nr = " . $ilDB->quote($nr, "integer");
                 $ilDB->manipulate($query);
             }
         }
     }
 }