4 require_once
"classes/class.ilObject.php";
5 require_once
"Services/MetaData/classes/class.ilMDLanguageItem.php";
6 require_once(
"classes/class.ilNestedSetXML.php");
41 $this->
ilObject($a_id,$a_call_by_reference);
43 $this->mob_ids = array();
44 $this->file_ids = array();
45 $this->q_ids = array();
67 if (is_object($ilUser))
84 global $rbacadmin, $rbacreview;
107 return $roles ? $roles : array();
117 # echo "Content<br>\n";
120 $this->lm_tree->setTableNames(
'lm_tree',
'lm_data');
121 $this->lm_tree->setTreeTablePK(
"lm_id");
173 $this->import_id = $a_id;
183 $this->layout_per_page = $a_val;
193 return $this->layout_per_page;
246 $this->lm_tree->setTreeTablePK(
"lm_id");
247 $this->lm_tree->setTableNames(
'lm_tree',
'lm_data');
248 $this->lm_tree->addTree($this->
getId(), 1);
269 if(!is_writable($lm_data_dir))
271 $this->ilias->raiseError(
"Content object Data Directory (".$lm_data_dir
272 .
") not writeable.",$this->ilias->error_obj->FATAL);
276 $lm_dir = $lm_data_dir.
"/lm_".$this->
getId();
278 if(!@is_dir($lm_dir))
280 $this->ilias->raiseError(
"Creation of Learning Module Directory failed.",$this->ilias->error_obj->FATAL);
288 $this->ilias->raiseError(
"Creation of Import Directory failed.",$this->ilias->error_obj->FATAL);
298 "/lm_".$this->getId();
306 if(strlen($this->import_dir))
312 "/lm_".$this->getId().
"/import";
331 $this->import_dir = $a_import_dir;
343 if(!is_writable($lm_data_dir))
345 $this->ilias->raiseError(
"Content object Data Directory (".$lm_data_dir
346 .
") not writeable.",$this->ilias->error_obj->FATAL);
349 $lm_dir = $lm_data_dir.
"/lm_".$this->
getId();
351 if(!@is_dir($lm_dir))
353 $this->ilias->raiseError(
"Creation of Learning Module Directory failed.",$this->ilias->error_obj->FATAL);
360 $export_dir = $lm_dir.
"/export_html";
365 $export_dir = $lm_dir.
"/export_scorm";
369 $export_dir = $lm_dir.
"/export";
374 if(!@is_dir($export_dir))
376 $this->ilias->raiseError(
"Creation of Export Directory failed.",$this->ilias->error_obj->FATAL);
420 if (!parent::delete())
426 include_once(
"./Modules/LearningModule/classes/class.ilLMObject.php");
434 $nested->init($this->
getId(),
"bib");
435 $nested->deleteAllDBData();
439 $this->lm_tree->removeTree($this->lm_tree->getTreeId());
445 $q =
"DELETE FROM content_object WHERE id = ".
446 $ilDB->quote($this->
getId(),
"integer");
447 $ilDB->manipulate($q);
450 $q =
"DELETE FROM lm_menu WHERE lm_id = ".
451 $ilDB->quote($this->
getId(),
"integer");
452 $ilDB->manipulate($q);
475 $this->layout = $a_layout;
491 $this->style_id = $a_style_id;
501 $q =
"UPDATE content_object SET ".
502 " stylesheet = ".$ilDB->quote((
int) $a_style_id,
"integer").
503 " WHERE id = ".$ilDB->quote($this->
getId(),
"integer");
504 $ilDB->manipulate($q);
506 $this->style_id = $a_style_id;
516 if ($a_from_style < 0)
518 $q =
"SELECT stylesheet FROM content_object, style_data ".
519 " WHERE content_object.stylesheet = style_data.id ".
520 " AND style_data.standard = ".$ilDB->quote(0,
"integer").
521 " AND content_object.stylesheet > ".$ilDB->quote(0,
"integer");
522 $style_set = $ilDB->query($q);
523 while($style_rec = $ilDB->fetchAssoc($style_set))
526 $q =
"UPDATE content_object SET ".
527 " stylesheet = ".$ilDB->quote((
int) $a_to_style,
"integer").
528 " WHERE stylesheet = ".$ilDB->quote($style_rec[
"stylesheet"],
"integer");
529 $ilDB->manipulate($q);
532 $style_obj =& $ilias->obj_factory->getInstanceByObjId($style_rec[
"stylesheet"]);
533 $style_obj->delete();
538 $q =
"UPDATE content_object SET ".
539 " stylesheet = ".$ilDB->quote((
int) $a_to_style,
"integer").
540 " WHERE stylesheet = ".$ilDB->quote($a_from_style,
"integer");
541 $ilDB->manipulate($q);
552 $q =
"SELECT stylesheet FROM content_object ".
553 " WHERE id = ".$ilDB->quote($a_cont_obj_id,
"integer");
554 $res = $ilDB->query($q);
555 $sheet = $ilDB->fetchAssoc(
$res);
557 return $sheet[
"stylesheet"];
567 $q =
"SELECT id FROM content_object ".
568 " WHERE stylesheet = ".$ilDB->quote($a_style_id,
"integer");
569 $res = $ilDB->query($q);
571 while($cont = $ilDB->fetchAssoc(
$res))
573 $obj_ids[] = $cont[
"id"];
587 $q =
"SELECT count(*) as cnt FROM content_object ".
588 " WHERE stylesheet = ".$ilDB->quote($a_style_id,
"integer");
589 $cset = $ilDB->query($q);
590 $crow = $ilDB->fetchAssoc($cset);
592 return (
int) $crow[
"cnt"];
604 $q =
"SELECT count(*) as cnt FROM content_object, style_data ".
605 " WHERE stylesheet = style_data.id ".
606 " AND standard = ".$ilDB->quote(0,
"integer");
607 $cset = $ilDB->query($q);
608 $crow = $ilDB->fetchAssoc($cset);
610 return (
int) $crow[
"cnt"];
620 $q =
"SELECT count(*) as cnt FROM content_object ".
621 " WHERE stylesheet = ".$ilDB->quote(0,
"integer");
622 $cset = $ilDB->query($q);
623 $crow = $ilDB->fetchAssoc($cset);
625 return (
int) $crow[
"cnt"];
637 $q =
"UPDATE content_object SET ".
638 " stylesheet = ".$ilDB->quote(0,
"integer").
639 " WHERE stylesheet = ".$ilDB->quote((
int) $this->
getId($a_style_id),
"integer");
641 $ilDB->manipulate($q);
659 $this->pg_header = $a_pg_header;
667 return $this->toc_mode;
675 return $this->public_access_mode;
685 $this->toc_mode = $a_toc_mode;
690 $this->online = $a_online;
700 $this->lm_menu_active = $a_act_lm_menu;
705 return $this->lm_menu_active;
710 $this->toc_active = $a_toc;
715 return $this->toc_active;
720 $this->numbering = $a_num;
725 return $this->numbering;
730 $this->print_view_active = $a_print;
735 return $this->print_view_active;
740 $this->prevent_glossary_appendix_active = $a_print;
745 return $this->prevent_glossary_appendix_active;
750 $this->downloads_active = $a_down;
755 return $this->downloads_active;
760 $this->downloads_public_active = $a_down;
765 return $this->downloads_public_active;
770 $this->pub_notes = $a_pub_notes;
775 return $this->pub_notes;
780 $this->clean_frames = $a_clean;
785 return $this->clean_frames;
790 $this->user_comments = $a_comm;
795 $this->public_access_mode = $a_mode;
800 return $this->user_comments;
805 $this->header_page = $a_pg;
810 return $this->header_page;
815 $this->footer_page = $a_pg;
820 return $this->footer_page;
830 $q =
"SELECT * FROM content_object WHERE id = ".
831 $ilDB->quote($this->
getId(),
"integer");
832 $lm_set = $ilDB->query($q);
833 $lm_rec = $ilDB->fetchAssoc($lm_set);
834 $this->
setLayout($lm_rec[
"default_layout"]);
871 $q =
"UPDATE content_object SET ".
872 " default_layout = ".$ilDB->quote($this->
getLayout(),
"text").
", ".
873 " stylesheet = ".$ilDB->quote($this->
getStyleSheetId(),
"integer").
",".
874 " page_header = ".$ilDB->quote($this->
getPageHeader(),
"text").
",".
875 " toc_mode = ".$ilDB->quote($this->
getTOCMode(),
"text").
",".
890 " header_page = ".$ilDB->quote($this->
getHeaderPage(),
"integer").
",".
891 " footer_page = ".$ilDB->quote($this->
getFooterPage(),
"integer").
",".
893 " layout_per_page = ".$ilDB->quote($this->
getLayoutPerPage(),
"integer").
" ".
894 " WHERE id = ".$ilDB->quote($this->
getId(),
"integer");
895 $ilDB->manipulate($q);
905 $q =
"INSERT INTO content_object (id) VALUES (".$ilDB->quote($this->
getId(),
"integer").
")";
906 $ilDB->manipulate($q);
919 $q =
"SELECT is_online FROM content_object WHERE id = ".$ilDB->quote($a_id,
"integer");
920 $lm_set = $ilDB->query($q);
921 $lm_rec = $ilDB->fetchAssoc($lm_set);
934 $dir = opendir(
"./Modules/LearningModule/layouts/lm");
943 if (@is_dir(
"./Modules/LearningModule/layouts/lm/".
$file))
961 $lm_tree->setTableNames(
'lm_tree',
'lm_data');
967 foreach (
$path as $node)
969 if ($node[
"type"] ==
"st")
988 $lm_tree->setTableNames(
'lm_tree',
'lm_data');
996 foreach (
$path as $node)
998 if ($node[
"type"] ==
"st")
1002 foreach ($tconds as $tcond)
1023 $lm_tree->setTableNames(
'lm_tree',
'lm_data');
1031 foreach (
$path as $node)
1033 if ($node[
"type"] ==
"st")
1037 foreach ($tconds as $tcond)
1042 return $node[
"child"];
1062 function notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params = 0)
1102 if ($a_node_id==
$_GET[
"ref_id"])
1104 $parent_obj =& $this->ilias->obj_factory->getInstanceByRefId($a_node_id);
1105 $parent_type = $parent_obj->getType();
1106 if($parent_type == $this->
getType())
1108 $a_node_id = (int) $tree->getParentId($a_node_id);
1112 parent::notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params);
1121 $tree =
new ilTree($a_cont_obj_id);
1122 $tree->setTableNames(
'lm_tree',
'lm_data');
1123 $tree->setTreeTablePK(
"lm_id");
1124 if ($tree->isInTree($a_page_id))
1126 $succ = $tree->fetchSuccessorNode($a_page_id,
"pg");
1139 $tree->setTableNames(
'lm_tree',
'lm_data');
1140 $tree->setTreeTablePK(
"lm_id");
1142 $tree->checkTreeChilds();
1156 $nodes = $tree->getSubtree($tree->getNodeData($tree->getRootId()));
1157 foreach ($nodes as $node)
1159 $q =
"SELECT * FROM lm_data WHERE obj_id = ".
1160 $ilDB->quote($node[
"child"],
"integer");
1161 $obj_set = $ilDB->query($q);
1162 $obj_rec = $ilDB->fetchAssoc($obj_set);
1165 $node_data = $tree->getNodeData($node[
"child"]);
1166 $tree->deleteTree($node_data);
1171 $nodes = $tree->getSubtree($tree->getNodeData($tree->getRootId()));
1172 foreach ($nodes as $node)
1174 $q =
"SELECT * FROM lm_data WHERE obj_id = ".
1175 $ilDB->quote($node[
"parent"],
"integer");
1176 $obj_set = $ilDB->query($q);
1177 $obj_rec = $ilDB->fetchAssoc($obj_set);
1178 if ($obj_rec[
"type"] ==
"pg")
1180 $node_data = $tree->getNodeData($node[
"child"]);
1181 if ($tree->isInTree($node[
"child"]))
1183 $tree->deleteTree($node_data);
1197 function exportXML(&$a_xml_writer, $a_inst, $a_target_dir, &$expLog)
1205 $attrs[
"Type"] =
"LearningModule";
1209 $attrs[
"Type"] =
"LibObject";
1212 $a_xml_writer->xmlStartTag(
"ContentObject", $attrs);
1219 $expLog->write(date(
"[y-m-d H:i:s] ").
"Start Export Structure Objects");
1220 $ilBench->start(
"ContentObjectExport",
"exportStructureObjects");
1222 $ilBench->stop(
"ContentObjectExport",
"exportStructureObjects");
1223 $expLog->write(date(
"[y-m-d H:i:s] ").
"Finished Export Structure Objects");
1226 $expLog->write(date(
"[y-m-d H:i:s] ").
"Start Export Page Objects");
1227 $ilBench->start(
"ContentObjectExport",
"exportPageObjects");
1229 $ilBench->stop(
"ContentObjectExport",
"exportPageObjects");
1230 $expLog->write(date(
"[y-m-d H:i:s] ").
"Finished Export Page Objects");
1233 $expLog->write(date(
"[y-m-d H:i:s] ").
"Start Export Media Objects");
1234 $ilBench->start(
"ContentObjectExport",
"exportMediaObjects");
1236 $ilBench->stop(
"ContentObjectExport",
"exportMediaObjects");
1237 $expLog->write(date(
"[y-m-d H:i:s] ").
"Finished Export Media Objects");
1240 $expLog->write(date(
"[y-m-d H:i:s] ").
"Start Export File Items");
1241 $ilBench->start(
"ContentObjectExport",
"exportFileItems");
1243 $ilBench->stop(
"ContentObjectExport",
"exportFileItems");
1244 $expLog->write(date(
"[y-m-d H:i:s] ").
"Finished Export File Items");
1247 if (count($this->q_ids) > 0)
1249 $qti_file = fopen($a_target_dir.
"/qti.xml",
"w");
1250 include_once(
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php");
1252 fwrite($qti_file, $pool->toXML($this->q_ids));
1258 $expLog->write(date(
"[y-m-d H:i:s] ").
"Start Export Properties");
1260 $expLog->write(date(
"[y-m-d H:i:s] ").
"Finished Export Properties");
1262 $a_xml_writer->xmlEndTag(
"ContentObject");
1273 include_once(
"Services/MetaData/classes/class.ilMD2XML.php");
1275 $md2xml->setExportMode(
true);
1276 $md2xml->startExport();
1277 $a_xml_writer->appendXML($md2xml->getXML());
1288 include_once
'./Modules/LearningModule/classes/class.ilStructureObject.php';
1290 $childs = $this->lm_tree->getChilds($this->lm_tree->getRootId());
1291 foreach ($childs as $child)
1293 if($child[
"type"] !=
"st")
1299 $structure_obj->exportXML($a_xml_writer, $a_inst, $expLog);
1300 unset($structure_obj);
1315 include_once
"./Modules/LearningModule/classes/class.ilLMPageObject.php";
1318 foreach ($pages as $page)
1322 $expLog->write(date(
"[y-m-d H:i:s] ").
"Page Object ".$page[
"obj_id"]);
1326 $page_obj->exportXML($a_xml_writer,
"normal", $a_inst);
1329 $mob_ids = $page_obj->getMediaObjectIDs();
1330 foreach($mob_ids as $mob_id)
1332 $this->mob_ids[$mob_id] = $mob_id;
1336 $file_ids = $page_obj->getFileItemIds();
1337 foreach($file_ids as $file_id)
1339 $this->file_ids[$file_id] = $file_id;
1343 $q_ids = $page_obj->getQuestionIds();
1344 foreach($q_ids as $q_id)
1346 $this->q_ids[$q_id] = $q_id;
1362 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
1364 $linked_mobs = array();
1367 foreach ($this->mob_ids as $mob_id)
1371 $expLog->write(date(
"[y-m-d H:i:s] ").
"Media Object ".$mob_id);
1373 $media_obj->exportXML($a_xml_writer, $a_inst);
1374 $media_obj->exportFiles($a_target_dir);
1376 $lmobs = $media_obj->getLinkedMediaObjects($this->mob_ids);
1377 $linked_mobs = array_merge($linked_mobs, $lmobs);
1384 foreach ($linked_mobs as $mob_id)
1388 $expLog->write(date(
"[y-m-d H:i:s] ").
"Media Object ".$mob_id);
1390 $media_obj->exportXML($a_xml_writer, $a_inst);
1391 $media_obj->exportFiles($a_target_dir);
1404 include_once(
"./Modules/File/classes/class.ilObjFile.php");
1406 foreach ($this->file_ids as $file_id)
1408 $expLog->write(date(
"[y-m-d H:i:s] ").
"File Item ".$file_id);
1409 $file_obj =
new ilObjFile($file_id,
false);
1410 $file_obj->export($a_target_dir);
1422 $a_xml_writer->xmlStartTag(
"Properties", $attrs);
1425 $attrs = array(
"Name" =>
"Layout",
"Value" => $this->
getLayout());
1426 $a_xml_writer->xmlElement(
"Property", $attrs);
1429 $attrs = array(
"Name" =>
"PageHeader",
"Value" => $this->
getPageHeader());
1430 $a_xml_writer->xmlElement(
"Property", $attrs);
1433 $attrs = array(
"Name" =>
"TOCMode",
"Value" => $this->
getTOCMode());
1434 $a_xml_writer->xmlElement(
"Property", $attrs);
1437 $attrs = array(
"Name" =>
"ActiveLMMenu",
"Value" =>
1439 $a_xml_writer->xmlElement(
"Property", $attrs);
1442 $attrs = array(
"Name" =>
"ActiveNumbering",
"Value" =>
1444 $a_xml_writer->xmlElement(
"Property", $attrs);
1447 $attrs = array(
"Name" =>
"ActiveTOC",
"Value" =>
1449 $a_xml_writer->xmlElement(
"Property", $attrs);
1452 $attrs = array(
"Name" =>
"ActivePrintView",
"Value" =>
1454 $a_xml_writer->xmlElement(
"Property", $attrs);
1460 $attrs = array(
"Name" =>
"CleanFrames",
"Value" =>
1462 $a_xml_writer->xmlElement(
"Property", $attrs);
1465 $attrs = array(
"Name" =>
"PublicNotes",
"Value" =>
1467 $a_xml_writer->xmlElement(
"Property", $attrs);
1470 $attrs = array(
"Name" =>
"HistoryUserComments",
"Value" =>
1472 $a_xml_writer->xmlElement(
"Property", $attrs);
1477 $attrs = array(
"Name" =>
"HeaderPage",
"Value" =>
1478 "il_".IL_INST_ID.
"_pg_".$this->getHeaderPage());
1479 $a_xml_writer->xmlElement(
"Property", $attrs);
1485 $attrs = array(
"Name" =>
"FooterPage",
"Value" =>
1486 "il_".IL_INST_ID.
"_pg_".$this->getFooterPage());
1487 $a_xml_writer->xmlElement(
"Property", $attrs);
1490 $a_xml_writer->xmlEndTag(
"Properties");
1500 $types = array(
"xml",
"html",
"scorm");
1502 foreach ($types as
$type)
1506 if (!@is_dir(
$dir) or
1507 !is_writeable(
$dir))
1518 while ($entry = $cdir->read())
1520 if ($entry !=
"." and
1522 substr($entry, -4) ==
".zip" and
1523 ereg(
"^[0-9]{10}_{2}[0-9]+_{2}(lm_)*[0-9]+\.zip\$", $entry))
1525 $file[$entry.$type] = array(
"type" => $type,
"file" => $entry,
1526 "size" => filesize(
$dir.
"/".$entry));
1548 $this->public_export_file[$a_type] = $a_file;
1560 return $this->public_export_file[$a_type];
1569 if (!@is_dir(
$dir) or
1570 !is_writeable(
$dir))
1582 while ($entry =
$dir->read())
1584 if ($entry !=
"." and
1586 substr($entry, -4) ==
".pdf" and
1587 ereg(
"^[0-9]{10}_{2}[0-9]+_{2}(lm_)*[0-9]+\.pdf\$", $entry))
1616 include(
"./Modules/LearningModule/classes/class.ilContObjectManifestBuilder.php");
1618 $man_builder->buildManifest();
1619 $man_builder->dump($a_target_dir);
1622 copy(
"Modules/LearningModule/scorm_xsd/adlcp_rootv1p2.xsd", $a_target_dir.
"/adlcp_rootv1p2.xsd");
1623 copy(
"Modules/LearningModule/scorm_xsd/imscp_rootv1p1p2.xsd", $a_target_dir.
"/imscp_rootv1p1p2.xsd");
1624 copy(
"Modules/LearningModule/scorm_xsd/imsmd_rootv1p2p1.xsd", $a_target_dir.
"/imsmd_rootv1p2p1.xsd");
1625 copy(
"Modules/LearningModule/scorm_xsd/ims_xml.xsd", $a_target_dir.
"/ims_xml.xsd");
1629 $zip_file = $a_target_dir.
"/".$date.
"__".IL_INST_ID.
"__".
1633 $a_target_dir.
"/imsmanifest.xml",
1634 $a_target_dir.
"/adlcp_rootv1p2.xsd",
1635 $a_target_dir.
"/imscp_rootv1p1p2.xsd",
1636 $a_target_dir.
"/ims_xml.xsd",
1637 $a_target_dir.
"/imsmd_rootv1p2p1.xsd")
1643 rename($zip_file, $dest_file);
1652 function exportHTML($a_target_dir,
$log, $a_zip_file =
true, $a_export_format =
"html")
1659 $mob_dir = $a_target_dir.
"/mobs";
1661 $file_dir = $a_target_dir.
"/files";
1663 $teximg_dir = $a_target_dir.
"/teximg";
1665 $style_dir = $a_target_dir.
"/style";
1667 $style_img_dir = $a_target_dir.
"/style/images";
1669 $content_style_dir = $a_target_dir.
"/content_style";
1671 $content_style_img_dir = $a_target_dir.
"/content_style/images";
1677 $style_name = $ilUser->prefs[
"style"].
".css";
1678 copy($location_stylesheet, $style_dir.
"/".$style_name);
1679 $fh = fopen($location_stylesheet,
"r");
1680 $css = fread($fh, filesize($location_stylesheet));
1681 preg_match_all(
"/url\(([^\)]*)\)/",$css,
$files);
1682 foreach (array_unique(
$files[1]) as $fileref)
1684 $fileref = dirname($location_stylesheet).
"/".$fileref;
1685 if (is_file($fileref))
1687 copy($fileref, $style_img_dir.
"/".basename($fileref));
1694 $ilBench->start(
"ExportHTML",
"exportContentStyle");
1697 $cont_stylesheet =
"./Services/COPage/css/content.css";
1699 $css = fread(fopen($cont_stylesheet,
'r'),filesize($cont_stylesheet));
1700 preg_match_all(
"/url\(([^\)]*)\)/",$css,
$files);
1701 foreach (array_unique(
$files[1]) as $fileref)
1703 if (is_file(str_replace(
"..",
".", $fileref)))
1705 copy(str_replace(
"..",
".", $fileref), $content_style_img_dir.
"/".basename($fileref));
1707 $css = str_replace($fileref,
"images/".basename($fileref),$css);
1709 fwrite(fopen($content_style_dir.
"/content.css",
'w'),$css);
1714 $style->writeCSSFile($content_style_dir.
"/content.css",
"images");
1715 $style->copyImagesToDir($content_style_img_dir);
1717 $ilBench->stop(
"ExportHTML",
"exportContentStyle");
1721 copy($syn_stylesheet, $a_target_dir.
"/syntaxhighlight.css");
1724 include_once(
"./Modules/LearningModule/classes/class.ilLMPresentationGUI.php");
1725 $_GET[
"cmd"] =
"nop";
1727 $lm_gui->setOfflineMode(
true);
1728 $lm_gui->setOfflineDirectory($a_target_dir);
1729 $lm_gui->setExportFormat($a_export_format);
1732 $ilBench->start(
"ExportHTML",
"exportHTMLPages");
1734 $ilBench->stop(
"ExportHTML",
"exportHTMLPages");
1737 $ilBench->start(
"ExportHTML",
"exportHTMLGlossaryTerms");
1739 $ilBench->stop(
"ExportHTML",
"exportHTMLGlossaryTerms");
1742 $ilBench->start(
"ExportHTML",
"exportHTMLMediaObjects");
1743 $linked_mobs = array();
1744 foreach ($this->offline_mobs as $mob)
1748 $this->
exportHTMLMOB($a_target_dir, $lm_gui, $mob,
"_blank", $linked_mobs);
1751 $linked_mobs2 = array();
1752 foreach ($linked_mobs as $mob)
1756 $this->
exportHTMLMOB($a_target_dir, $lm_gui, $mob,
"_blank", $linked_mobs2);
1759 $_GET[
"obj_type"] =
"MediaObject";
1760 $_GET[
"obj_id"] = $a_mob_id;
1762 $ilBench->stop(
"ExportHTML",
"exportHTMLMediaObjects");
1765 $ilBench->start(
"ExportHTML",
"exportHTMLFileObjects");
1766 foreach ($this->offline_files as
$file)
1770 $ilBench->stop(
"ExportHTML",
"exportHTMLFileObjects");
1773 $ilBench->start(
"ExportHTML",
"exportHTMLTOC");
1774 $ilLocator->clearItems();
1777 $tpl =
new ilTemplate(
"tpl.main.html",
true,
true);
1779 $content =& $lm_gui->showTableOfContents();
1780 $file = $a_target_dir.
"/table_of_contents.html";
1783 if (!($fp = @fopen($file,
"w+")))
1785 die (
"<b>Error</b>: Could not open \"".$file.
"\" for writing".
1786 " in <b>".__FILE__.
"</b> on line <b>".__LINE__.
"</b><br />");
1789 fwrite($fp, $content);
1792 $ilBench->stop(
"ExportHTML",
"exportHTMLTOC");
1795 $ilBench->start(
"ExportHTML",
"exportHTMLImages");
1796 $image_dir = $a_target_dir.
"/images";
1800 $image_dir.
"/enlarge.gif");
1802 $image_dir.
"/browser/plus.gif");
1804 $image_dir.
"/browser/minus.gif");
1806 $image_dir.
"/browser/blank.gif");
1808 $image_dir.
"/spacer.gif");
1810 $image_dir.
"/icon_st.gif");
1812 $image_dir.
"/icon_pg.gif");
1814 $image_dir.
"/icon_st_s.gif");
1816 $image_dir.
"/icon_pg_s.gif");
1818 $image_dir.
"/icon_lm.gif");
1820 $image_dir.
"/icon_lm_s.gif");
1822 $image_dir.
"/nav_arr_L.gif");
1824 $image_dir.
"/nav_arr_R.gif");
1826 $image_dir.
"/browser/forceexp.gif");
1829 $image_dir.
"/download.gif");
1830 $ilBench->stop(
"ExportHTML",
"exportHTMLImages");
1833 $services_dir = $a_target_dir.
"/Services";
1835 $media_service_dir = $services_dir.
"/MediaObjects";
1837 $flv_dir = $media_service_dir.
"/flash_flv_player";
1839 $mp3_dir = $media_service_dir.
"/flash_mp3_player";
1841 copy(
"./Services/MediaObjects/flash_flv_player/flvplayer.swf",
1842 $flv_dir.
"/flvplayer.swf");
1843 copy(
"./Services/MediaObjects/flash_mp3_player/mp3player.swf",
1844 $mp3_dir.
"/mp3player.swf");
1850 include_once(
"./Services/YUI/classes/class.ilYuiUtil.php");
1851 foreach (self::getSupplyingExportFiles($a_target_dir) as $f)
1853 copy($f[
"source"], $f[
"target"]);
1857 $tpl =
new ilTemplate(
"tpl.main.html",
true,
true);
1858 $tpl->setVariable(
"LOCATION_STYLESHEET",$location_stylesheet);
1859 $tpl->addBlockFile(
"CONTENT",
"content",
"tpl.adm_content.html");
1862 $ilBench->start(
"ExportHTML",
"zip");
1875 $ilBench->stop(
"ExportHTML",
"zip");
1887 include_once(
"./Services/YUI/classes/class.ilYuiUtil.php");
1890 "target" => $a_target_dir.
'/js/yahoo/yahoo-min.js',
1893 "target" => $a_target_dir.
'/js/yahoo/yahoo-dom-event.js',
1896 "target" => $a_target_dir.
'/js/yahoo/animation-min.js',
1898 array(
"source" =>
'./Services/JavaScript/js/Basic.js',
1899 "target" => $a_target_dir.
'/js/Basic.js',
1901 array(
"source" =>
'./Services/Accordion/js/accordion.js',
1902 "target" => $a_target_dir.
'/js/accordion.js',
1904 array(
"source" =>
'./Services/Accordion/css/accordion.css',
1905 "target" => $a_target_dir.
'/css/accordion.css',
1907 array(
"source" =>
'./Modules/Scorm2004/scripts/questions/jquery.js',
1908 "target" => $a_target_dir.
'/js/jquery.js',
1910 array(
"source" =>
'./Modules/Scorm2004/scripts/questions/jquery-ui-min.js',
1911 "target" => $a_target_dir.
'/js/jquery-ui-min.js',
1913 array(
"source" =>
'./Modules/Scorm2004/scripts/questions/pure.js',
1914 "target" => $a_target_dir.
'/js/pure.js',
1916 array(
"source" =>
'./Modules/Scorm2004/scripts/questions/question_handling.js',
1917 "target" => $a_target_dir.
'/js/question_handling.js',
1927 $file_dir = $a_target_dir.
"/files/file_".$a_file_id;
1929 include_once(
"./Modules/File/classes/class.ilObjFile.php");
1930 $file_obj =
new ilObjFile($a_file_id,
false);
1931 $source_file = $file_obj->getDirectory($file_obj->getVersion()).
"/".$file_obj->getFileName();
1932 if (!is_file($source_file))
1934 $source_file = $file_obj->getDirectory().
"/".$file_obj->getFileName();
1936 if (is_file($source_file))
1938 copy($source_file, $file_dir.
"/".$file_obj->getFileName());
1945 function exportHTMLMOB($a_target_dir, &$a_lm_gui, $a_mob_id, $a_frame, &$a_linked_mobs)
1949 $mob_dir = $a_target_dir.
"/mobs";
1952 if (@is_dir($source_dir))
1958 $tpl =
new ilTemplate(
"tpl.main.html",
true,
true);
1959 $tpl->addBlockFile(
"CONTENT",
"content",
"tpl.adm_content.html");
1960 $_GET[
"obj_type"] =
"MediaObject";
1961 $_GET[
"mob_id"] = $a_mob_id;
1962 $_GET[
"frame"] = $a_frame;
1964 $content =& $a_lm_gui->media();
1965 $file = $a_target_dir.
"/media_".$a_mob_id.
".html";
1968 if (!($fp = @fopen(
$file,
"w+")))
1970 die (
"<b>Error</b>: Could not open \"".
$file.
"\" for writing".
1971 " in <b>".__FILE__.
"</b> on line <b>".__LINE__.
"</b><br />");
1974 fwrite($fp, $content);
1978 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
1980 if ($mob_obj->hasFullscreenItem())
1982 $tpl =
new ilTemplate(
"tpl.main.html",
true,
true);
1983 $tpl->addBlockFile(
"CONTENT",
"content",
"tpl.adm_content.html");
1984 $_GET[
"obj_type"] =
"";
1985 $_GET[
"frame"] =
"";
1986 $_GET[
"mob_id"] = $a_mob_id;
1987 $_GET[
"cmd"] =
"fullscreen";
1988 $content =& $a_lm_gui->fullscreen();
1989 $file = $a_target_dir.
"/fullscreen_".$a_mob_id.
".html";
1992 if (!($fp = @fopen(
$file,
"w+")))
1994 die (
"<b>Error</b>: Could not open \"".
$file.
"\" for writing".
1995 " in <b>".__FILE__.
"</b> on line <b>".__LINE__.
"</b><br />");
1998 fwrite($fp, $content);
2001 $linked_mobs = $mob_obj->getLinkedMediaObjects();
2002 $a_linked_mobs = array_merge($a_linked_mobs, $linked_mobs);
2012 foreach($this->offline_int_links as $int_link)
2014 $ilLocator->clearItems();
2015 if ($int_link[
"type"] ==
"git")
2018 $tpl->addBlockFile(
"CONTENT",
"content",
"tpl.adm_content.html");
2020 $_GET[
"obj_id"] = $int_link[
"id"];
2021 $_GET[
"frame"] =
"_blank";
2022 $content =& $a_lm_gui->glossary();
2023 $file = $a_target_dir.
"/term_".$int_link[
"id"].
".html";
2026 if (!($fp = @fopen(
$file,
"w+")))
2028 die (
"<b>Error</b>: Could not open \"".
$file.
"\" for writing".
2029 " in <b>".__FILE__.
"</b> on line <b>".__LINE__.
"</b><br />");
2032 fwrite($fp, $content);
2036 include_once(
"./Modules/Glossary/classes/class.ilGlossaryDefinition.php");
2038 foreach($defs as $def)
2041 foreach($def_mobs as $def_mob)
2043 $this->offline_mobs[$def_mob] = $def_mob;
2048 $this->offline_files = array_merge($this->offline_files, $def_files);
2067 $this->first_page_id = $first_page[
"child"];
2071 $int_links = array();
2072 $this->offline_files = array();
2074 include_once(
"./Services/COPage/classes/class.ilPageContentUsage.php");
2075 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
2077 foreach ($pages as $page)
2081 $ilLocator->clearItems();
2082 $ilBench->start(
"ExportHTML",
"exportHTMLPage");
2083 $ilBench->start(
"ExportHTML",
"exportPageHTML");
2084 $this->
exportPageHTML($a_lm_gui, $a_target_dir, $page[
"obj_id"]);
2085 $ilBench->stop(
"ExportHTML",
"exportPageHTML");
2089 foreach ($pcs as $pc)
2091 if ($pc[
"type"] ==
"incl")
2094 foreach($incl_mobs as $incl_mob)
2096 $mobs[$incl_mob] = $incl_mob;
2103 foreach($pg_mobs as $pg_mob)
2105 $mobs[$pg_mob] = $pg_mob;
2110 $int_links = array_merge($int_links, $pg_links);
2113 include_once(
"./Modules/File/classes/class.ilObjFile.php");
2115 $this->offline_files = array_merge($this->offline_files, $pg_files);
2117 $ilBench->stop(
"ExportHTML",
"exportHTMLPage");
2120 $this->offline_mobs =
$mobs;
2121 $this->offline_int_links = $int_links;
2137 $tpl =
new ilTemplate(
"tpl.main.html",
true,
true);
2138 $tpl->addBlockFile(
"CONTENT",
"content",
"tpl.adm_content.html");
2140 $_GET[
"obj_id"] = $a_lm_page_id;
2141 $_GET[
"frame"] = $a_frame;
2147 $file = $a_target_dir.
"/lm_pg_".$nid.
".html";
2151 $file = $a_target_dir.
"/lm_pg_".$a_lm_page_id.
".html";
2156 if ($a_frame !=
"toc")
2158 $file = $a_target_dir.
"/frame_".$a_lm_page_id.
"_".$a_frame.
".html";
2162 $file = $a_target_dir.
"/frame_".$a_frame.
".html";
2167 if (@is_file(
$file))
2172 $ilBench->start(
"ExportHTML",
"layout");
2173 $ilBench->start(
"ExportHTML",
"layout_".$a_frame);
2174 $content =& $a_lm_gui->layout(
"main.xml",
false);
2175 $ilBench->stop(
"ExportHTML",
"layout_".$a_frame);
2176 $ilBench->stop(
"ExportHTML",
"layout");
2179 if (!($fp = @fopen(
$file,
"w+")))
2181 die (
"<b>Error</b>: Could not open \"".
$file.
"\" for writing".
2182 " in <b>".__FILE__.
"</b> on line <b>".__LINE__.
"</b><br />");
2189 fwrite($fp, $content);
2194 if ($this->first_page_id == $a_lm_page_id && $a_frame ==
"")
2196 copy(
$file, $a_target_dir.
"/index.html");
2200 $ilBench->start(
"ExportHTML",
"getCurrentFrameSet");
2201 $frameset = $a_lm_gui->getCurrentFrameSet();
2202 $ilBench->stop(
"ExportHTML",
"getCurrentFrameSet");
2204 foreach ($frameset as $frame)
2206 $this->
exportPageHTML($a_lm_gui, $a_target_dir, $a_lm_page_id, $frame);
2223 $attrs[
"xmlns:fo"] =
"http://www.w3.org/1999/XSL/Format";
2224 $a_xml_writer->xmlStartTag(
"fo:root", $attrs);
2228 $a_xml_writer->xmlStartTag(
"fo:layout-master-set", $attrs);
2232 $attrs[
"master-name"] =
"DinA4";
2233 $attrs[
"page-height"] =
"29.7cm";
2234 $attrs[
"page-width"] =
"21cm";
2235 $attrs[
"margin-top"] =
"4cm";
2236 $attrs[
"margin-bottom"] =
"1cm";
2237 $attrs[
"margin-left"] =
"2.8cm";
2238 $attrs[
"margin-right"] =
"7.3cm";
2239 $a_xml_writer->xmlStartTag(
"fo:simple-page-master", $attrs);
2243 $attrs[
"margin-top"] =
"0cm";
2244 $attrs[
"margin-bottom"] =
"1.25cm";
2245 $a_xml_writer->xmlElement(
"fo:region-body", $attrs);
2249 $attrs[
"extent"] =
"1cm";
2250 $a_xml_writer->xmlElement(
"fo:region-before", $attrs);
2254 $attrs[
"extent"] =
"1cm";
2255 $a_xml_writer->xmlElement(
"fo:region-after", $attrs);
2258 $a_xml_writer->xmlEndTag(
"fo:simple-page-master");
2261 $a_xml_writer->xmlEndTag(
"fo:layout-master-set");
2265 $attrs[
"master-reference"] =
"DinA4";
2266 $a_xml_writer->xmlStartTag(
"fo:page-sequence", $attrs);
2270 $attrs[
"flow-name"] =
"xsl-region-body";
2271 $a_xml_writer->xmlStartTag(
"fo:flow", $attrs);
2276 $ilBench->start(
"ContentObjectExport",
"exportFOStructureObjects");
2278 $ilBench->stop(
"ContentObjectExport",
"exportFOStructureObjects");
2282 $a_xml_writer->xmlEndTag(
"fo:flow");
2285 $a_xml_writer->xmlEndTag(
"fo:page-sequence");
2288 $a_xml_writer->xmlEndTag(
"fo:root");
2299 $childs = $this->lm_tree->getChilds($this->lm_tree->getRootId());
2300 foreach ($childs as $child)
2302 if($child[
"type"] !=
"st")
2308 $structure_obj->exportFO($a_xml_writer, $expLog);
2309 unset($structure_obj);
2315 include_once(
"./Modules/LearningModule/classes/class.ilContObjectExport.php");
2319 $export_file = $cont_exp->buildExportFile();
2320 return $export_file;
2334 $lmtree->setTableNames(
'lm_tree',
'lm_data');
2335 $lmtree->setTreeTablePK(
"lm_id");
2338 $source_obj->setLMId($this->
getId());
2343 $target_obj->setLMId($this->
getId());
2344 $target_parent = $lmtree->getParentId(
$target_id);
2348 if ($source_obj->getType() ==
"pg")
2351 if ($lmtree->isInTree($source_obj->getId()))
2353 $node_data = $lmtree->getNodeData($source_obj->getId());
2356 if ($movecopy ==
"move")
2358 $parent_id = $lmtree->getParentId($source_obj->getId());
2359 $lmtree->deleteTree($node_data);
2362 require_once(
"classes/class.ilHistory.php");
2373 $new_page =& $source_obj->copy();
2374 $source_id = $new_page->getId();
2375 $source_obj =& $new_page;
2379 if(!$lmtree->isInTree($source_obj->getId()))
2386 else if ($as_subitem)
2390 $pg_childs =& $lmtree->getChildsByType($parent,
"pg");
2391 if (count($pg_childs) != 0)
2393 $target_pos = $pg_childs[count($pg_childs) - 1][
"obj_id"];
2399 $parent = $target_parent;
2403 $lmtree->insertNode($source_obj->getId(),
2404 $parent, $target_pos);
2407 if ($movecopy ==
"move")
2410 include_once(
"classes/class.ilHistory.php");
2424 if ($source_obj->getType() ==
"st")
2427 $source_node = $lmtree->getNodeData($source_id);
2428 $subnodes = $lmtree->getSubtree($source_node);
2431 foreach ($subnodes as $subnode)
2446 $pg_childs =& $lmtree->getChildsByType($target_parent,
"pg");
2447 if (count($pg_childs) != 0)
2449 $target_pos = $pg_childs[count($pg_childs) - 1][
"obj_id"];
2452 else if ($as_subitem)
2456 $childs =& $lmtree->getChilds($target_parent);
2457 if (count($childs) != 0)
2459 $target_pos = $childs[count($childs) - 1][
"obj_id"];
2484 if ($movecopy ==
"move")
2486 $lmtree->deleteTree($source_node);
2491 $new_chapter =& $source_obj->copy($lmtree, $target_parent, $target_pos);
2494 if (!$lmtree->isInTree($source_id))
2496 $lmtree->insertNode($source_id, $target_parent, $target_pos);
2499 if ($movecopy ==
"move")
2501 foreach ($subnodes as $node)
2503 if($node[
"obj_id"] != $source_id)
2505 $lmtree->insertNode($node[
"obj_id"], $node[
"parent"]);
2523 include_once
"./Modules/LearningModule/classes/class.ilLMPageObject.php";
2524 include_once
"./Services/COPage/classes/class.ilPageObject.php";
2529 foreach ($pages as $page)
2535 $error = @$cpage->validateDom();
2539 $this->lng->loadLanguageModule(
"content");
2543 $mess.= $this->lng->txt(
"obj_pg").
": ".
$title;
2544 $mess.=
'<div class="small">';
2545 foreach ($error as $e)
2547 $err_mess = implode($e,
" - ");
2548 if (!is_int(strpos($err_mess,
":0:")))
2550 $mess.= htmlentities($err_mess).
"<br />";
2576 $file = pathinfo($a_filename);
2580 $a_filename, $full_path);
2585 $subdir = basename(
$file[
"basename"],
".".
$file[
"extension"]);
2608 $subdir = basename($a_directory);
2609 $xml_file = $a_directory.
"/".$subdir.
".xml";
2612 if (!is_dir($a_directory))
2614 return sprintf($lng->txt(
"cont_no_subdir_in_zip"), $subdir);
2618 if (!is_file($xml_file))
2620 return sprintf($lng->txt(
"cont_zip_file_invalid"), $subdir.
"/".$subdir.
".xml");
2624 $qti_file = $a_directory.
"/qti.xml";
2626 if (is_file($qti_file))
2628 include_once
"./Services/QTI/classes/class.ilQTIParser.php";
2629 include_once(
"./Modules/Test/classes/class.ilObjTest.php");
2632 $result = $qtiParser->startParsing ();
2633 $founditems = & $qtiParser->getFoundItems ();
2635 if (count($founditems) > 0)
2638 $qtiParser->setTestObject($testObj);
2639 $result = $qtiParser->startParsing();
2640 $qtis = array_merge($qtis, $qtiParser->getImportMapping());
2644 include_once (
"./Modules/LearningModule/classes/class.ilContObjParser.php");
2645 $contParser =
new ilContObjParser($this, $xml_file, $subdir, $qmapping);
2646 $contParser->setQuestionMapping($qtis);
2647 $contParser->startParsing();
2652 $style_file = $a_directory.
"/style.xml";
2653 $style_zip_file = $a_directory.
"/style.zip";
2654 if (is_file($style_zip_file))
2656 require_once(
"./Services/Style/classes/class.ilObjStyleSheet.php");
2658 $style->import($style_zip_file);
2661 else if (is_file($style_file))
2663 require_once(
"./Services/Style/classes/class.ilObjStyleSheet.php");
2665 $style->import($style_file);
2678 include_once(
"./Services/COPage/classes/class.ilPageObject.php");