コード例 #1
0
 /**
  * Initialisation
  */
 function __construct($a_exp_dir)
 {
     $this->exp_dir = $a_exp_dir;
     $this->mobs_dir = $a_exp_dir . "/mobs";
     $this->files_dir = $a_exp_dir . "/files";
     $this->tex_dir = $a_exp_dir . "/teximg";
     $this->content_style_dir = $a_exp_dir . "/content_style";
     $this->content_style_img_dir = $a_exp_dir . "/content_style/images";
     include_once "./Services/MediaObjects/classes/class.ilPlayerUtil.php";
     $this->services_dir = $a_exp_dir . "/Services";
     $this->media_service_dir = $this->services_dir . "/MediaObjects";
     $this->flv_dir = $a_exp_dir . "/" . ilPlayerUtil::getFlashVideoPlayerDirectory();
     $this->mp3_dir = $this->media_service_dir . "/flash_mp3_player";
     $this->js_dir = $a_exp_dir . '/js';
     $this->js_yahoo_dir = $a_exp_dir . '/js/yahoo';
     $this->css_dir = $a_exp_dir . '/css';
     $GLOBALS["teximgcnt"] = 0;
 }
コード例 #2
0
 /**
  * export html package
  */
 function exportHTML($a_target_dir, $log, $a_zip_file = true, $a_export_format = "html")
 {
     global $tpl, $ilBench, $ilLocator, $ilUser;
     // initialize temporary target directory
     ilUtil::delDir($a_target_dir);
     ilUtil::makeDir($a_target_dir);
     $mob_dir = $a_target_dir . "/mobs";
     ilUtil::makeDir($mob_dir);
     $file_dir = $a_target_dir . "/files";
     ilUtil::makeDir($file_dir);
     $teximg_dir = $a_target_dir . "/teximg";
     ilUtil::makeDir($teximg_dir);
     $style_dir = $a_target_dir . "/style";
     ilUtil::makeDir($style_dir);
     $style_img_dir = $a_target_dir . "/style/images";
     ilUtil::makeDir($style_img_dir);
     $content_style_dir = $a_target_dir . "/content_style";
     ilUtil::makeDir($content_style_dir);
     $content_style_img_dir = $a_target_dir . "/content_style/images";
     ilUtil::makeDir($content_style_img_dir);
     $GLOBALS["teximgcnt"] = 0;
     // export system style sheet
     $location_stylesheet = ilUtil::getStyleSheetLocation("filesystem");
     $style_name = $ilUser->prefs["style"] . ".css";
     copy($location_stylesheet, $style_dir . "/" . $style_name);
     $fh = fopen($location_stylesheet, "r");
     $css = fread($fh, filesize($location_stylesheet));
     preg_match_all("/url\\(([^\\)]*)\\)/", $css, $files);
     foreach (array_unique($files[1]) as $fileref) {
         $fileref = dirname($location_stylesheet) . "/" . $fileref;
         if (is_file($fileref)) {
             copy($fileref, $style_img_dir . "/" . basename($fileref));
         }
     }
     fclose($fh);
     $location_stylesheet = ilUtil::getStyleSheetLocation();
     // export content style sheet
     $ilBench->start("ExportHTML", "exportContentStyle");
     if ($this->getStyleSheetId() < 1) {
         $cont_stylesheet = "./Services/COPage/css/content.css";
         $css = fread(fopen($cont_stylesheet, 'r'), filesize($cont_stylesheet));
         preg_match_all("/url\\(([^\\)]*)\\)/", $css, $files);
         foreach (array_unique($files[1]) as $fileref) {
             if (is_file(str_replace("..", ".", $fileref))) {
                 copy(str_replace("..", ".", $fileref), $content_style_img_dir . "/" . basename($fileref));
             }
             $css = str_replace($fileref, "images/" . basename($fileref), $css);
         }
         fwrite(fopen($content_style_dir . "/content.css", 'w'), $css);
     } else {
         $style = new ilObjStyleSheet($this->getStyleSheetId());
         $style->writeCSSFile($content_style_dir . "/content.css", "images");
         $style->copyImagesToDir($content_style_img_dir);
     }
     $ilBench->stop("ExportHTML", "exportContentStyle");
     // export syntax highlighting style
     $syn_stylesheet = ilObjStyleSheet::getSyntaxStylePath();
     copy($syn_stylesheet, $a_target_dir . "/syntaxhighlight.css");
     // get learning module presentation gui class
     include_once "./Modules/LearningModule/classes/class.ilLMPresentationGUI.php";
     $_GET["cmd"] = "nop";
     $lm_gui =& new ilLMPresentationGUI();
     $lm_gui->setOfflineMode(true);
     $lm_gui->setOfflineDirectory($a_target_dir);
     $lm_gui->setExportFormat($a_export_format);
     // export pages
     $ilBench->start("ExportHTML", "exportHTMLPages");
     $this->exportHTMLPages($lm_gui, $a_target_dir);
     $ilBench->stop("ExportHTML", "exportHTMLPages");
     // export glossary terms
     $ilBench->start("ExportHTML", "exportHTMLGlossaryTerms");
     $this->exportHTMLGlossaryTerms($lm_gui, $a_target_dir);
     $ilBench->stop("ExportHTML", "exportHTMLGlossaryTerms");
     // export all media objects
     $ilBench->start("ExportHTML", "exportHTMLMediaObjects");
     $linked_mobs = array();
     foreach ($this->offline_mobs as $mob) {
         if (ilObject::_exists($mob) && ilObject::_lookupType($mob) == "mob") {
             $this->exportHTMLMOB($a_target_dir, $lm_gui, $mob, "_blank", $linked_mobs);
         }
     }
     $linked_mobs2 = array();
     // mobs linked in link areas
     foreach ($linked_mobs as $mob) {
         if (ilObject::_exists($mob)) {
             $this->exportHTMLMOB($a_target_dir, $lm_gui, $mob, "_blank", $linked_mobs2);
         }
     }
     $_GET["obj_type"] = "MediaObject";
     $_GET["obj_id"] = $a_mob_id;
     $_GET["cmd"] = "";
     $ilBench->stop("ExportHTML", "exportHTMLMediaObjects");
     // export all file objects
     $ilBench->start("ExportHTML", "exportHTMLFileObjects");
     foreach ($this->offline_files as $file) {
         $this->exportHTMLFile($a_target_dir, $file);
     }
     $ilBench->stop("ExportHTML", "exportHTMLFileObjects");
     // export table of contents
     $ilBench->start("ExportHTML", "exportHTMLTOC");
     $ilLocator->clearItems();
     if ($this->isActiveTOC()) {
         $tpl = new ilTemplate("tpl.main.html", true, true);
         //$tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html");
         $content =& $lm_gui->showTableOfContents();
         $file = $a_target_dir . "/table_of_contents.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);
     }
     $ilBench->stop("ExportHTML", "exportHTMLTOC");
     // export images
     $ilBench->start("ExportHTML", "exportHTMLImages");
     $image_dir = $a_target_dir . "/images";
     ilUtil::makeDir($image_dir);
     ilUtil::makeDir($image_dir . "/browser");
     copy(ilUtil::getImagePath("enlarge.png", false, "filesystem"), $image_dir . "/enlarge.png");
     copy(ilUtil::getImagePath("browser/blank.png", false, "filesystem"), $image_dir . "/browser/plus.png");
     copy(ilUtil::getImagePath("browser/blank.png", false, "filesystem"), $image_dir . "/browser/minus.png");
     copy(ilUtil::getImagePath("browser/blank.png", false, "filesystem"), $image_dir . "/browser/blank.png");
     copy(ilUtil::getImagePath("spacer.png", false, "filesystem"), $image_dir . "/spacer.png");
     copy(ilUtil::getImagePath("icon_st.png", false, "filesystem"), $image_dir . "/icon_st.png");
     copy(ilUtil::getImagePath("icon_pg.png", false, "filesystem"), $image_dir . "/icon_pg.png");
     copy(ilUtil::getImagePath("icon_st_s.png", false, "filesystem"), $image_dir . "/icon_st_s.png");
     copy(ilUtil::getImagePath("icon_pg_s.png", false, "filesystem"), $image_dir . "/icon_pg_s.png");
     copy(ilUtil::getImagePath("icon_lm.png", false, "filesystem"), $image_dir . "/icon_lm.png");
     copy(ilUtil::getImagePath("icon_lm_s.png", false, "filesystem"), $image_dir . "/icon_lm_s.png");
     copy(ilUtil::getImagePath("nav_arr_L.png", false, "filesystem"), $image_dir . "/nav_arr_L.png");
     copy(ilUtil::getImagePath("nav_arr_R.png", false, "filesystem"), $image_dir . "/nav_arr_R.png");
     copy(ilUtil::getImagePath("browser/forceexp.png", false, "filesystem"), $image_dir . "/browser/forceexp.png");
     copy(ilUtil::getImagePath("download.png", false, "filesystem"), $image_dir . "/download.png");
     $ilBench->stop("ExportHTML", "exportHTMLImages");
     // export flv/mp3 player
     $services_dir = $a_target_dir . "/Services";
     ilUtil::makeDir($services_dir);
     $media_service_dir = $services_dir . "/MediaObjects";
     ilUtil::makeDir($media_service_dir);
     include_once "./Services/MediaObjects/classes/class.ilPlayerUtil.php";
     $flv_dir = $a_target_dir . "/" . ilPlayerUtil::getFlashVideoPlayerDirectory();
     ilUtil::makeDir($flv_dir);
     $mp3_dir = $media_service_dir . "/flash_mp3_player";
     ilUtil::makeDir($mp3_dir);
     //		copy(ilPlayerUtil::getFlashVideoPlayerFilename(true),
     //			$flv_dir."/".ilPlayerUtil::getFlashVideoPlayerFilename());
     ilPlayerUtil::copyPlayerFilesToTargetDirectory($flv_dir);
     // js files
     ilUtil::makeDir($a_target_dir . '/js');
     ilUtil::makeDir($a_target_dir . '/js/yahoo');
     ilUtil::makeDir($a_target_dir . '/css');
     include_once "./Services/YUI/classes/class.ilYuiUtil.php";
     foreach (self::getSupplyingExportFiles($a_target_dir) as $f) {
         if ($f["source"] != "") {
             copy($f["source"], $f["target"]);
         }
     }
     // template workaround: reset of template
     $tpl = new ilTemplate("tpl.main.html", true, true);
     $tpl->setVariable("LOCATION_STYLESHEET", $location_stylesheet);
     $tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html");
     // zip everything
     $ilBench->start("ExportHTML", "zip");
     if (true) {
         if ($a_zip_file) {
             // zip it all
             $date = time();
             $zip_file = $this->getExportDirectory("html") . "/" . $date . "__" . IL_INST_ID . "__" . $this->getType() . "_" . $this->getId() . ".zip";
             ilUtil::zip($a_target_dir, $zip_file);
             ilUtil::delDir($a_target_dir);
         }
     }
     $ilBench->stop("ExportHTML", "zip");
 }
コード例 #3
0
 function exportMediaFullscreen($a_target_dir, $pg_obj)
 {
     $subdir = "il_" . IL_INST_ID . "_mob_" . $this->getId();
     $a_target_dir = $a_target_dir . "/objects/" . $subdir;
     ilUtil::makeDir($a_target_dir);
     $tpl = new ilTemplate("tpl.fullscreen.html", true, true, "Modules/LearningModule");
     $tpl->setCurrentBlock("ilMedia");
     //$int_links = $page_object->getInternalLinks();
     $med_links = ilMediaItem::_getMapAreasIntLinks($this->getId());
     // @todo
     //$link_xml = $this->getLinkXML($med_links, $this->getLayoutLinkTargets());
     require_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
     //$media_obj = new ilObjMediaObject($_GET["mob_id"]);
     require_once "./Services/COPage/classes/class.ilPageObject.php";
     $xml = "<dummy>";
     // todo: we get always the first alias now (problem if mob is used multiple
     // times in page)
     $xml .= $pg_obj->getMediaAliasElement($this->getId());
     $xml .= $this->getXML(IL_MODE_OUTPUT);
     //$xml.= $link_xml;
     $xml .= "</dummy>";
     //die(htmlspecialchars($xml));
     $xsl = file_get_contents("./Services/COPage/xsl/page.xsl");
     $args = array('/_xml' => $xml, '/_xsl' => $xsl);
     $xh = xslt_create();
     //echo "<b>XML:</b>".htmlentities($xml);
     // determine target frames for internal links
     $wb_path = "";
     $enlarge_path = "";
     $params = array('mode' => "fullscreen", 'enlarge_path' => $enlarge_path, 'link_params' => "ref_id=" . $_GET["ref_id"], 'fullscreen_link' => "", 'ref_id' => $_GET["ref_id"], 'webspace_path' => $wb_path);
     $output = xslt_process($xh, "arg:/_xml", "arg:/_xsl", NULL, $args, $params);
     //echo xslt_error($xh);
     xslt_free($xh);
     // unmask user html
     include_once "./Services/MediaObjects/classes/class.ilPlayerUtil.php";
     $tpl->setVariable("LOCATION_CONTENT_STYLESHEET", "../../css/style.css");
     $tpl->setVariable("LOCATION_STYLESHEET", "../../css/system.css");
     $tpl->setVariable("MEDIA_CONTENT", $output);
     $output = $tpl->get();
     //$output = preg_replace("/\/mobs\/mm_(\d+)\/([^\"]+)/i","$2",$output);
     $output = preg_replace("/mobs\\/mm_(\\d+)\\/([^\"]+)/i", "\$2", $output);
     $output = preg_replace("/\\.\\/Services\\/MediaObjects\\/flash_mp3_player/i", "../../players", $output);
     $output = preg_replace("/\\.\\/" . str_replace("/", "\\/", ilPlayerUtil::getFlashVideoPlayerDirectory()) . "/i", "../../players", $output);
     $output = preg_replace("/file=..\\/..\\/..\\//i", "file=../objects/" . $subdir . "/", $output);
     //die(htmlspecialchars($output));
     fwrite(fopen($a_target_dir . '/fullscreen.html', 'w'), $output);
 }
 /**
  * Prepare HTML exporter
  *
  * @param
  * @return
  */
 function prepareHTMLExporter($a_target_dir)
 {
     // system style html exporter
     include_once "./Services/Style/classes/class.ilSystemStyleHTMLExport.php";
     $this->sys_style_html_export = new ilSystemStyleHTMLExport($a_target_dir);
     $this->sys_style_html_export->export();
     // init co page html exporter
     include_once "./Services/COPage/classes/class.ilCOPageHTMLExport.php";
     $this->co_page_html_export = new ilCOPageHTMLExport($a_target_dir);
     $this->co_page_html_export->setContentStyleId($this->getStyleSheetId());
     $this->co_page_html_export->createDirectories();
     $this->co_page_html_export->exportStyles();
     $this->co_page_html_export->exportSupportScripts();
     include_once "./Services/MediaObjects/classes/class.ilPlayerUtil.php";
     $this->flv_dir = $a_target_dir . "/" . ilPlayerUtil::getFlashVideoPlayerDirectory();
     ilUtil::makeDir($a_target_dir . '/css/yahoo');
     ilUtil::makeDir($a_target_dir . '/objects');
     ilUtil::makeDir($a_target_dir . '/players');
     ilUtil::makeDir($this->flv_dir);
     include_once "./Services/MediaObjects/classes/class.ilPlayerUtil.php";
     //		copy(ilPlayerUtil::getFlashVideoPlayerFilename(true),
     //			$a_target_dir.'/js/'.ilPlayerUtil::getFlashVideoPlayerFilename());
     ilPlayerUtil::copyPlayerFilesToTargetDirectory($this->flv_dir);
     copy('./Services/MediaObjects/flash_mp3_player/mp3player.swf', $a_target_dir . '/players/mp3player.swf');
     copy('./Modules/Scorm2004/scripts/scorm_2004.js', $a_target_dir . '/js/scorm.js');
     copy('./Modules/Scorm2004/scripts/pager.js', $a_target_dir . '/js/pager.js');
     copy('./Modules/Scorm2004/scripts/questions/pure.js', $a_target_dir . '/js/pure.js');
     copy('./Modules/Scorm2004/scripts/questions/question_handling.js', $a_target_dir . '/js/question_handling.js');
 }