/**
  * Insert content includes
  */
 function insertContentIncludes($a_html)
 {
     global $ilCtrl, $lng;
     $c_pos = 0;
     $start = strpos($a_html, "{{{{{ContentInclude;");
     if (is_int($start)) {
         $end = strpos($a_html, "}}}}}", $start);
     }
     $i = 1;
     while ($end > 0) {
         $param = substr($a_html, $start + 20, $end - $start - 20);
         $param = explode(";", $param);
         if ($param[0] == "mep" && is_numeric($param[1]) && $param[2] <= 0) {
             include_once "./Modules/MediaPool/classes/class.ilMediaPoolPageGUI.php";
             if (ilMediaPoolPage::_exists($param[1])) {
                 $page_gui = new ilMediaPoolPageGUI($param[1], 0, true, "-");
                 if ($this->getOutputMode() != "offline") {
                     $page_gui->setFileDownloadLink($this->determineFileDownloadLink());
                     $page_gui->setFullscreenLink($this->determineFullscreenLink());
                     $page_gui->setSourceCodeDownloadScript($this->determineSourcecodeDownloadScript());
                 } else {
                     $page_gui->setOutputMode(IL_PAGE_OFFLINE);
                 }
                 $html = $page_gui->getRawContent();
             } else {
                 if ($this->getOutputMode() == "edit") {
                     $html = "// " . $lng->txt("cont_missing_snippet") . " //";
                 }
             }
             $h2 = substr($a_html, 0, $start) . $html . substr($a_html, $end + 5);
             $a_html = $h2;
             $i++;
         }
         $start = strpos($a_html, "{{{{{ContentInclude;", $start + 5);
         $end = 0;
         if (is_int($start)) {
             $end = strpos($a_html, "}}}}}", $start);
         }
     }
     return $a_html;
 }
 /**
  * Delete a child of media tree 
  * @param	int		mep_item id
  */
 function deleteChild($obj_id)
 {
     $fid = ilMediaPoolItem::lookupForeignId($obj_id);
     $type = ilMediaPoolItem::lookupType($obj_id);
     $title = ilMediaPoolItem::lookupTitle($obj_id);
     $node_data = $this->tree->getNodeData($obj_id);
     $subtree = $this->tree->getSubtree($node_data);
     // delete tree
     if ($this->tree->isInTree($obj_id)) {
         $this->tree->deleteTree($node_data);
     }
     // delete objects
     foreach ($subtree as $node) {
         $fid = ilMediaPoolItem::lookupForeignId($node["child"]);
         if ($node["type"] == "mob") {
             if (ilObject::_lookupType($fid) == "mob") {
                 $obj =& new ilObjMediaObject($fid);
                 $obj->delete();
             }
         }
         if ($node["type"] == "fold") {
             if ($fid > 0 && ilObject::_lookupType($fid) == "fold") {
                 $obj = new ilObjFolder($fid, false);
                 $obj->delete();
             }
         }
         if ($node["type"] == "pg") {
             include_once "./Modules/MediaPool/classes/class.ilMediaPoolPage.php";
             if (ilMediaPoolPage::_exists($node["child"])) {
                 $pg = new ilMediaPoolPage($node["child"]);
                 $pg->delete();
             }
         }
         include_once "./Modules/MediaPool/classes/class.ilMediaPoolItem.php";
         $item = new ilMediaPoolItem($node["child"]);
         $item->delete();
     }
 }