示例#1
0
 /**
  * export files of file itmes
  *
  */
 function exportFileItems($a_target_dir, &$expLog)
 {
     include_once "./Modules/File/classes/class.ilObjFile.php";
     if (is_array($this->file_ids)) {
         foreach ($this->file_ids as $file_id) {
             $expLog->write(date("[y-m-d H:i:s] ") . "File Item " . $file_id);
             if (ilObject::_lookupType($file_id) == "file") {
                 $file_obj = new ilObjFile($file_id, false);
                 $file_obj->export($a_target_dir);
                 unset($file_obj);
             } else {
                 $expLog->write(date("[y-m-d H:i:s] ") . "File Item not found, ID: " . $file_id);
             }
         }
     }
     include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
     $linked_mobs = array();
     if (is_array($this->mob_ids)) {
         // mobs directly embedded into pages
         foreach ($this->mob_ids as $mob_id) {
             if ($mob_id > 0 && ilObject::_exists($mob_id)) {
                 $expLog->write(date("[y-m-d H:i:s] ") . "Media Object " . $mob_id);
                 $media_obj = new ilObjMediaObject($mob_id);
                 $media_obj->exportFiles($a_target_dir, $expLog);
                 $lmobs = $media_obj->getLinkedMediaObjects($this->mob_ids);
                 $linked_mobs = array_merge($linked_mobs, $lmobs);
                 unset($media_obj);
             }
         }
         // linked mobs (in map areas)
         foreach ($linked_mobs as $mob_id) {
             if ($mob_id > 0 && ilObject::_exists($mob_id)) {
                 $expLog->write(date("[y-m-d H:i:s] ") . "Media Object " . $mob_id);
                 $media_obj = new ilObjMediaObject($mob_id);
                 $media_obj->exportFiles($a_target_dir);
                 unset($media_obj);
             }
         }
     }
     //media files in questions
     foreach ($this->q_media as $media) {
         if ($media != "") {
             error_log($media);
             copy($media, $a_target_dir . "/objects/" . basename($media));
         }
     }
 }
 /**
  * Export media object to html
  */
 function exportHTMLMOB($a_mob_id, &$a_linked_mobs)
 {
     global $tpl;
     $source_dir = ilUtil::getWebspaceDir() . "/mobs/mm_" . $a_mob_id;
     if (@is_dir($source_dir)) {
         ilUtil::makeDir($this->mobs_dir . "/mm_" . $a_mob_id);
         ilUtil::rCopy($source_dir, $this->mobs_dir . "/mm_" . $a_mob_id);
     }
     // fullscreen
     include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
     $mob_obj = new ilObjMediaObject($a_mob_id);
     if ($mob_obj->hasFullscreenItem()) {
         $tpl = new ilTemplate("tpl.main.html", true, true);
         $tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html");
         $file = $this->exp_dir . "/fullscreen_" . $a_mob_id . ".html";
         // open file
         if (!($fp = @fopen($file, "w+"))) {
             die("<b>Error</b>: Could not open \"" . $file . "\" for writing" . " in <b>" . __FILE__ . "</b> on line <b>" . __LINE__ . "</b><br />");
         }
         chmod($file, 0770);
         fwrite($fp, $content);
         fclose($fp);
     }
     $linked_mobs = $mob_obj->getLinkedMediaObjects();
     $a_linked_mobs = array_merge($a_linked_mobs, $linked_mobs);
 }
 /**
  * Export media object to html
  */
 function exportHTMLMOB($a_mob_id, &$a_linked_mobs)
 {
     global $tpl;
     $source_dir = ilUtil::getWebspaceDir() . "/mobs/mm_" . $a_mob_id;
     if (@is_dir($source_dir)) {
         ilUtil::makeDir($this->mobs_dir . "/mm_" . $a_mob_id);
         ilUtil::rCopy($source_dir, $this->mobs_dir . "/mm_" . $a_mob_id);
     }
     // #12930 - fullscreen
     include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
     $mob_obj = new ilObjMediaObject($a_mob_id);
     if ($mob_obj->hasFullscreenItem()) {
         // render media object html
         $xh = xslt_create();
         $output = xslt_process($xh, "arg:/_xml", "arg:/_xsl", NULL, array("/_xml" => "<dummy>" . $mob_obj->getXML(IL_MODE_ALIAS) . $mob_obj->getXML(IL_MODE_OUTPUT) . "</dummy>", "/_xsl" => file_get_contents("./Services/COPage/xsl/page.xsl")), array("mode" => "fullscreen"));
         xslt_free($xh);
         unset($xh);
         // render fullscreen html
         $tpl = new ilTemplate("tpl.fullscreen.html", true, true, "Services/COPage");
         $tpl = $this->getPreparedMainTemplate($tpl);
         // adds js/css
         $tpl->setCurrentBlock("ilMedia");
         $tpl->setVariable("MEDIA_CONTENT", $output);
         $output = $tpl->get();
         unset($tpl);
         // write file
         $file = $this->exp_dir . "/fullscreen_" . $a_mob_id . ".html";
         if (!($fp = @fopen($file, "w+"))) {
             die("<b>Error</b>: Could not open \"" . $file . "\" for writing" . " in <b>" . __FILE__ . "</b> on line <b>" . __LINE__ . "</b><br />");
         }
         chmod($file, 0770);
         fwrite($fp, $output);
         fclose($fp);
         unset($fp);
         unset($output);
     }
     $linked_mobs = $mob_obj->getLinkedMediaObjects();
     $a_linked_mobs = array_merge($a_linked_mobs, $linked_mobs);
 }