4 require_once
"classes/class.ilObject.php";
5 require_once
"Services/MetaData/classes/class.ilMDLanguageItem.php";
6 require_once(
"classes/class.ilNestedSetXML.php");
39 $this->
ilObject($a_id,$a_call_by_reference);
41 $this->mob_ids = array();
42 $this->file_ids = array();
64 if (is_object($ilUser))
81 global $rbacadmin, $rbacreview;
104 return $roles ? $roles : array();
114 # echo "Content<br>\n";
117 $this->lm_tree->setTableNames(
'lm_tree',
'lm_data');
118 $this->lm_tree->setTreeTablePK(
"lm_id");
170 $this->import_id = $a_id;
180 $this->layout_per_page = $a_val;
190 return $this->layout_per_page;
243 $this->lm_tree->setTreeTablePK(
"lm_id");
244 $this->lm_tree->setTableNames(
'lm_tree',
'lm_data');
245 $this->lm_tree->addTree($this->
getId(), 1);
266 if(!is_writable($lm_data_dir))
268 $this->ilias->raiseError(
"Content object Data Directory (".$lm_data_dir
269 .
") not writeable.",$this->ilias->error_obj->FATAL);
273 $lm_dir = $lm_data_dir.
"/lm_".$this->
getId();
275 if(!@is_dir($lm_dir))
277 $this->ilias->raiseError(
"Creation of Learning Module Directory failed.",$this->ilias->error_obj->FATAL);
281 $import_dir = $lm_dir.
"/import";
283 if(!@is_dir($import_dir))
285 $this->ilias->raiseError(
"Creation of Import Directory failed.",$this->ilias->error_obj->FATAL);
295 "/lm_".$this->getId();
304 "/lm_".$this->getId().
"/import";
305 if(@is_dir($import_dir))
324 if(!is_writable($lm_data_dir))
326 $this->ilias->raiseError(
"Content object Data Directory (".$lm_data_dir
327 .
") not writeable.",$this->ilias->error_obj->FATAL);
330 $lm_dir = $lm_data_dir.
"/lm_".$this->
getId();
332 if(!@is_dir($lm_dir))
334 $this->ilias->raiseError(
"Creation of Learning Module Directory failed.",$this->ilias->error_obj->FATAL);
341 $export_dir = $lm_dir.
"/export_html";
346 $export_dir = $lm_dir.
"/export_scorm";
350 $export_dir = $lm_dir.
"/export";
355 if(!@is_dir($export_dir))
357 $this->ilias->raiseError(
"Creation of Export Directory failed.",$this->ilias->error_obj->FATAL);
401 if (!parent::delete())
407 include_once(
"./Modules/LearningModule/classes/class.ilLMObject.php");
415 $nested->init($this->
getId(),
"bib");
416 $nested->deleteAllDBData();
420 $this->lm_tree->removeTree($this->lm_tree->getTreeId());
426 $q =
"DELETE FROM content_object WHERE id = ".
427 $ilDB->quote($this->
getId(),
"integer");
428 $ilDB->manipulate(
$q);
431 $q =
"DELETE FROM lm_menu WHERE lm_id = ".
432 $ilDB->quote($this->
getId(),
"integer");
433 $ilDB->manipulate(
$q);
456 $this->layout = $a_layout;
472 $this->style_id = $a_style_id;
482 $q =
"UPDATE content_object SET ".
483 " stylesheet = ".$ilDB->quote((
int) $a_style_id,
"integer").
484 " WHERE id = ".$ilDB->quote($this->
getId(),
"integer");
485 $ilDB->manipulate(
$q);
487 $this->style_id = $a_style_id;
497 if ($a_from_style < 0)
499 $q =
"SELECT stylesheet FROM content_object, style_data ".
500 " WHERE content_object.stylesheet = style_data.id ".
501 " AND style_data.standard = ".$ilDB->quote(0,
"integer").
502 " AND content_object.stylesheet > ".$ilDB->quote(0,
"integer");
503 $style_set = $ilDB->query(
$q);
504 while($style_rec = $ilDB->fetchAssoc($style_set))
507 $q =
"UPDATE content_object SET ".
508 " stylesheet = ".$ilDB->quote((
int) $a_to_style,
"integer").
509 " WHERE stylesheet = ".$ilDB->quote($style_rec[
"stylesheet"],
"integer");
510 $ilDB->manipulate(
$q);
513 $style_obj =& $ilias->obj_factory->getInstanceByObjId($style_rec[
"stylesheet"]);
514 $style_obj->delete();
519 $q =
"UPDATE content_object SET ".
520 " stylesheet = ".$ilDB->quote((
int) $a_to_style,
"integer").
521 " WHERE stylesheet = ".$ilDB->quote($a_from_style,
"integer");
522 $ilDB->manipulate(
$q);
533 $q =
"SELECT stylesheet FROM content_object ".
534 " WHERE id = ".$ilDB->quote($a_cont_obj_id,
"integer");
536 $sheet = $ilDB->fetchAssoc(
$res);
538 return $sheet[
"stylesheet"];
548 $q =
"SELECT id FROM content_object ".
549 " WHERE stylesheet = ".$ilDB->quote($a_style_id,
"integer");
552 while($cont = $ilDB->fetchAssoc(
$res))
554 $obj_ids[] = $cont[
"id"];
568 $q =
"SELECT count(*) as cnt FROM content_object ".
569 " WHERE stylesheet = ".$ilDB->quote($a_style_id,
"integer");
570 $cset = $ilDB->query(
$q);
571 $crow = $ilDB->fetchAssoc($cset);
573 return (
int) $crow[
"cnt"];
585 $q =
"SELECT count(*) as cnt FROM content_object, style_data ".
586 " WHERE stylesheet = style_data.id ".
587 " AND standard = ".$ilDB->quote(0,
"integer");
588 $cset = $ilDB->query(
$q);
589 $crow = $ilDB->fetchAssoc($cset);
591 return (
int) $crow[
"cnt"];
601 $q =
"SELECT count(*) as cnt FROM content_object ".
602 " WHERE stylesheet = ".$ilDB->quote(0,
"integer");
603 $cset = $ilDB->query(
$q);
604 $crow = $ilDB->fetchAssoc($cset);
606 return (
int) $crow[
"cnt"];
618 $q =
"UPDATE content_object SET ".
619 " stylesheet = ".$ilDB->quote(0,
"integer").
620 " WHERE stylesheet = ".$ilDB->quote((
int) $this->
getId($a_style_id),
"integer");
622 $ilDB->manipulate(
$q);
640 $this->pg_header = $a_pg_header;
648 return $this->toc_mode;
656 return $this->public_access_mode;
666 $this->toc_mode = $a_toc_mode;
671 $this->online = $a_online;
681 $this->lm_menu_active = $a_act_lm_menu;
686 return $this->lm_menu_active;
691 $this->toc_active = $a_toc;
696 return $this->toc_active;
701 $this->numbering = $a_num;
706 return $this->numbering;
711 $this->print_view_active = $a_print;
716 return $this->print_view_active;
721 $this->prevent_glossary_appendix_active = $a_print;
726 return $this->prevent_glossary_appendix_active;
731 $this->downloads_active = $a_down;
736 return $this->downloads_active;
741 $this->downloads_public_active = $a_down;
746 return $this->downloads_public_active;
751 $this->pub_notes = $a_pub_notes;
756 return $this->pub_notes;
761 $this->clean_frames = $a_clean;
766 return $this->clean_frames;
771 $this->user_comments = $a_comm;
776 $this->public_access_mode = $a_mode;
781 return $this->user_comments;
786 $this->header_page = $a_pg;
791 return $this->header_page;
796 $this->footer_page = $a_pg;
801 return $this->footer_page;
811 $q =
"SELECT * FROM content_object WHERE id = ".
812 $ilDB->quote($this->
getId(),
"integer");
813 $lm_set = $ilDB->query(
$q);
814 $lm_rec = $ilDB->fetchAssoc($lm_set);
815 $this->
setLayout($lm_rec[
"default_layout"]);
851 $q =
"UPDATE content_object SET ".
852 " default_layout = ".$ilDB->quote($this->
getLayout(),
"text").
", ".
853 " stylesheet = ".$ilDB->quote($this->
getStyleSheetId(),
"integer").
",".
854 " page_header = ".$ilDB->quote($this->
getPageHeader(),
"text").
",".
855 " toc_mode = ".$ilDB->quote($this->
getTOCMode(),
"text").
",".
869 " header_page = ".$ilDB->quote($this->
getHeaderPage(),
"integer").
",".
870 " footer_page = ".$ilDB->quote($this->
getFooterPage(),
"integer").
",".
872 " layout_per_page = ".$ilDB->quote($this->
getLayoutPerPage(),
"integer").
" ".
873 " WHERE id = ".$ilDB->quote($this->
getId(),
"integer");
874 $ilDB->manipulate(
$q);
884 $q =
"INSERT INTO content_object (id) VALUES (".$ilDB->quote($this->
getId(),
"integer").
")";
885 $ilDB->manipulate(
$q);
898 $q =
"SELECT is_online FROM content_object WHERE id = ".$ilDB->quote($a_id,
"integer");
899 $lm_set = $ilDB->query(
$q);
900 $lm_rec = $ilDB->fetchAssoc($lm_set);
913 $dir = opendir(
"./Modules/LearningModule/layouts/lm");
922 if (@is_dir(
"./Modules/LearningModule/layouts/lm/".
$file))
940 $lm_tree->setTableNames(
'lm_tree',
'lm_data');
946 foreach ($path as $node)
948 if ($node[
"type"] ==
"st")
967 $lm_tree->setTableNames(
'lm_tree',
'lm_data');
975 foreach ($path as $node)
977 if ($node[
"type"] ==
"st")
981 foreach ($tconds as $tcond)
1002 $lm_tree->setTableNames(
'lm_tree',
'lm_data');
1010 foreach ($path as $node)
1012 if ($node[
"type"] ==
"st")
1016 foreach ($tconds as $tcond)
1021 return $node[
"child"];
1041 function notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params = 0)
1081 if ($a_node_id==
$_GET[
"ref_id"])
1083 $parent_obj =& $this->ilias->obj_factory->getInstanceByRefId($a_node_id);
1084 $parent_type = $parent_obj->getType();
1085 if($parent_type == $this->
getType())
1087 $a_node_id = (int) $tree->getParentId($a_node_id);
1091 parent::notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params);
1100 $tree =
new ilTree($a_cont_obj_id);
1101 $tree->setTableNames(
'lm_tree',
'lm_data');
1102 $tree->setTreeTablePK(
"lm_id");
1103 if ($tree->isInTree($a_page_id))
1105 $succ = $tree->fetchSuccessorNode($a_page_id,
"pg");
1118 $tree->setTableNames(
'lm_tree',
'lm_data');
1119 $tree->setTreeTablePK(
"lm_id");
1121 $tree->checkTreeChilds();
1135 $nodes = $tree->getSubtree($tree->getNodeData($tree->getRootId()));
1136 foreach ($nodes as $node)
1138 $q =
"SELECT * FROM lm_data WHERE obj_id = ".
1139 $ilDB->quote($node[
"child"],
"integer");
1140 $obj_set = $ilDB->query(
$q);
1141 $obj_rec = $ilDB->fetchAssoc($obj_set);
1144 $node_data = $tree->getNodeData($node[
"child"]);
1145 $tree->deleteTree($node_data);
1150 $nodes = $tree->getSubtree($tree->getNodeData($tree->getRootId()));
1151 foreach ($nodes as $node)
1153 $q =
"SELECT * FROM lm_data WHERE obj_id = ".
1154 $ilDB->quote($node[
"parent"],
"integer");
1155 $obj_set = $ilDB->query(
$q);
1156 $obj_rec = $ilDB->fetchAssoc($obj_set);
1157 if ($obj_rec[
"type"] ==
"pg")
1159 $node_data = $tree->getNodeData($node[
"child"]);
1160 if ($tree->isInTree($node[
"child"]))
1162 $tree->deleteTree($node_data);
1176 function exportXML(&$a_xml_writer, $a_inst, $a_target_dir, &$expLog)
1184 $attrs[
"Type"] =
"LearningModule";
1188 $attrs[
"Type"] =
"LibObject";
1191 $a_xml_writer->xmlStartTag(
"ContentObject", $attrs);
1198 $expLog->write(date(
"[y-m-d H:i:s] ").
"Start Export Structure Objects");
1199 $ilBench->start(
"ContentObjectExport",
"exportStructureObjects");
1201 $ilBench->stop(
"ContentObjectExport",
"exportStructureObjects");
1202 $expLog->write(date(
"[y-m-d H:i:s] ").
"Finished Export Structure Objects");
1205 $expLog->write(date(
"[y-m-d H:i:s] ").
"Start Export Page Objects");
1206 $ilBench->start(
"ContentObjectExport",
"exportPageObjects");
1208 $ilBench->stop(
"ContentObjectExport",
"exportPageObjects");
1209 $expLog->write(date(
"[y-m-d H:i:s] ").
"Finished Export Page Objects");
1212 $expLog->write(date(
"[y-m-d H:i:s] ").
"Start Export Media Objects");
1213 $ilBench->start(
"ContentObjectExport",
"exportMediaObjects");
1215 $ilBench->stop(
"ContentObjectExport",
"exportMediaObjects");
1216 $expLog->write(date(
"[y-m-d H:i:s] ").
"Finished Export Media Objects");
1219 $expLog->write(date(
"[y-m-d H:i:s] ").
"Start Export File Items");
1220 $ilBench->start(
"ContentObjectExport",
"exportFileItems");
1222 $ilBench->stop(
"ContentObjectExport",
"exportFileItems");
1223 $expLog->write(date(
"[y-m-d H:i:s] ").
"Finished Export File Items");
1227 $expLog->write(date(
"[y-m-d H:i:s] ").
"Start Export Properties");
1229 $expLog->write(date(
"[y-m-d H:i:s] ").
"Finished Export Properties");
1240 $a_xml_writer->xmlEndTag(
"ContentObject");
1251 include_once(
"Services/MetaData/classes/class.ilMD2XML.php");
1253 $md2xml->setExportMode(
true);
1254 $md2xml->startExport();
1255 $a_xml_writer->appendXML($md2xml->getXML());
1266 include_once
'./Modules/LearningModule/classes/class.ilStructureObject.php';
1268 $childs = $this->lm_tree->getChilds($this->lm_tree->getRootId());
1269 foreach ($childs as $child)
1271 if($child[
"type"] !=
"st")
1277 $structure_obj->exportXML($a_xml_writer, $a_inst, $expLog);
1278 unset($structure_obj);
1293 include_once
"./Modules/LearningModule/classes/class.ilLMPageObject.php";
1296 foreach ($pages as $page)
1300 $ilBench->start(
"ContentObjectExport",
"exportPageObject");
1301 $expLog->write(date(
"[y-m-d H:i:s] ").
"Page Object ".$page[
"obj_id"]);
1304 $ilBench->start(
"ContentObjectExport",
"exportPageObject_getLMPageObject");
1306 $ilBench->stop(
"ContentObjectExport",
"exportPageObject_getLMPageObject");
1307 $ilBench->start(
"ContentObjectExport",
"exportPageObject_XML");
1308 $page_obj->exportXML($a_xml_writer,
"normal", $a_inst);
1309 $ilBench->stop(
"ContentObjectExport",
"exportPageObject_XML");
1312 $ilBench->start(
"ContentObjectExport",
"exportPageObject_CollectMedia");
1313 $mob_ids = $page_obj->getMediaObjectIDs();
1314 foreach($mob_ids as $mob_id)
1316 $this->mob_ids[$mob_id] = $mob_id;
1318 $ilBench->stop(
"ContentObjectExport",
"exportPageObject_CollectMedia");
1321 $ilBench->start(
"ContentObjectExport",
"exportPageObject_CollectFileItems");
1322 $file_ids = $page_obj->getFileItemIds();
1323 foreach($file_ids as $file_id)
1325 $this->file_ids[$file_id] = $file_id;
1327 $ilBench->stop(
"ContentObjectExport",
"exportPageObject_CollectFileItems");
1331 $ilBench->stop(
"ContentObjectExport",
"exportPageObject");
1344 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
1346 $linked_mobs = array();
1349 foreach ($this->mob_ids as $mob_id)
1353 $expLog->write(date(
"[y-m-d H:i:s] ").
"Media Object ".$mob_id);
1355 $media_obj->exportXML($a_xml_writer, $a_inst);
1356 $media_obj->exportFiles($a_target_dir);
1358 $lmobs = $media_obj->getLinkedMediaObjects($this->mob_ids);
1359 $linked_mobs = array_merge($linked_mobs, $lmobs);
1366 foreach ($linked_mobs as $mob_id)
1370 $expLog->write(date(
"[y-m-d H:i:s] ").
"Media Object ".$mob_id);
1372 $media_obj->exportXML($a_xml_writer, $a_inst);
1373 $media_obj->exportFiles($a_target_dir);
1386 include_once(
"./Modules/File/classes/class.ilObjFile.php");
1388 foreach ($this->file_ids as $file_id)
1390 $expLog->write(date(
"[y-m-d H:i:s] ").
"File Item ".$file_id);
1391 $file_obj =
new ilObjFile($file_id,
false);
1392 $file_obj->export($a_target_dir);
1404 $a_xml_writer->xmlStartTag(
"Properties", $attrs);
1407 $attrs = array(
"Name" =>
"Layout",
"Value" => $this->
getLayout());
1408 $a_xml_writer->xmlElement(
"Property", $attrs);
1411 $attrs = array(
"Name" =>
"PageHeader",
"Value" => $this->
getPageHeader());
1412 $a_xml_writer->xmlElement(
"Property", $attrs);
1415 $attrs = array(
"Name" =>
"TOCMode",
"Value" => $this->
getTOCMode());
1416 $a_xml_writer->xmlElement(
"Property", $attrs);
1419 $attrs = array(
"Name" =>
"ActiveLMMenu",
"Value" =>
1421 $a_xml_writer->xmlElement(
"Property", $attrs);
1424 $attrs = array(
"Name" =>
"ActiveNumbering",
"Value" =>
1426 $a_xml_writer->xmlElement(
"Property", $attrs);
1429 $attrs = array(
"Name" =>
"ActiveTOC",
"Value" =>
1431 $a_xml_writer->xmlElement(
"Property", $attrs);
1434 $attrs = array(
"Name" =>
"ActivePrintView",
"Value" =>
1436 $a_xml_writer->xmlElement(
"Property", $attrs);
1442 $attrs = array(
"Name" =>
"CleanFrames",
"Value" =>
1444 $a_xml_writer->xmlElement(
"Property", $attrs);
1447 $attrs = array(
"Name" =>
"PublicNotes",
"Value" =>
1449 $a_xml_writer->xmlElement(
"Property", $attrs);
1452 $attrs = array(
"Name" =>
"HistoryUserComments",
"Value" =>
1454 $a_xml_writer->xmlElement(
"Property", $attrs);
1459 $attrs = array(
"Name" =>
"HeaderPage",
"Value" =>
1460 "il_".IL_INST_ID.
"_pg_".$this->getHeaderPage());
1461 $a_xml_writer->xmlElement(
"Property", $attrs);
1467 $attrs = array(
"Name" =>
"FooterPage",
"Value" =>
1468 "il_".IL_INST_ID.
"_pg_".$this->getFooterPage());
1469 $a_xml_writer->xmlElement(
"Property", $attrs);
1472 $a_xml_writer->xmlEndTag(
"Properties");
1482 $types = array(
"xml",
"html",
"scorm");
1484 foreach ($types as
$type)
1488 if (!@is_dir(
$dir) or
1489 !is_writeable(
$dir))
1500 while ($entry = $cdir->read())
1502 if ($entry !=
"." and
1504 substr($entry, -4) ==
".zip" and
1505 ereg(
"^[0-9]{10}_{2}[0-9]+_{2}(lm_)*[0-9]+\.zip\$", $entry))
1507 $file[$entry.$type] = array(
"type" => $type,
"file" => $entry,
1508 "size" => filesize(
$dir.
"/".$entry));
1530 $this->public_export_file[$a_type] = $a_file;
1542 return $this->public_export_file[$a_type];
1551 if (!@is_dir(
$dir) or
1552 !is_writeable(
$dir))
1564 while ($entry =
$dir->read())
1566 if ($entry !=
"." and
1568 substr($entry, -4) ==
".pdf" and
1569 ereg(
"^[0-9]{10}_{2}[0-9]+_{2}(lm_)*[0-9]+\.pdf\$", $entry))
1598 include(
"./Modules/LearningModule/classes/class.ilContObjectManifestBuilder.php");
1600 $man_builder->buildManifest();
1601 $man_builder->dump($a_target_dir);
1604 copy(
"Modules/LearningModule/scorm_xsd/adlcp_rootv1p2.xsd", $a_target_dir.
"/adlcp_rootv1p2.xsd");
1605 copy(
"Modules/LearningModule/scorm_xsd/imscp_rootv1p1p2.xsd", $a_target_dir.
"/imscp_rootv1p1p2.xsd");
1606 copy(
"Modules/LearningModule/scorm_xsd/imsmd_rootv1p2p1.xsd", $a_target_dir.
"/imsmd_rootv1p2p1.xsd");
1607 copy(
"Modules/LearningModule/scorm_xsd/ims_xml.xsd", $a_target_dir.
"/ims_xml.xsd");
1611 $zip_file = $a_target_dir.
"/".$date.
"__".IL_INST_ID.
"__".
1615 $a_target_dir.
"/imsmanifest.xml",
1616 $a_target_dir.
"/adlcp_rootv1p2.xsd",
1617 $a_target_dir.
"/imscp_rootv1p1p2.xsd",
1618 $a_target_dir.
"/ims_xml.xsd",
1619 $a_target_dir.
"/imsmd_rootv1p2p1.xsd")
1625 rename($zip_file, $dest_file);
1634 function exportHTML($a_target_dir,
$log, $a_zip_file =
true, $a_export_format =
"html")
1641 $mob_dir = $a_target_dir.
"/mobs";
1643 $file_dir = $a_target_dir.
"/files";
1645 $teximg_dir = $a_target_dir.
"/teximg";
1647 $style_dir = $a_target_dir.
"/style";
1649 $style_img_dir = $a_target_dir.
"/style/images";
1651 $content_style_dir = $a_target_dir.
"/content_style";
1653 $content_style_img_dir = $a_target_dir.
"/content_style/images";
1659 $style_name = $ilUser->prefs[
"style"].
".css";
1660 copy($location_stylesheet, $style_dir.
"/".$style_name);
1661 $fh = fopen($location_stylesheet,
"r");
1662 $css = fread($fh, filesize($location_stylesheet));
1663 preg_match_all(
"/url\(([^\)]*)\)/",$css,
$files);
1664 foreach (array_unique(
$files[1]) as $fileref)
1666 $fileref = dirname($location_stylesheet).
"/".$fileref;
1667 if (is_file($fileref))
1669 copy($fileref, $style_img_dir.
"/".basename($fileref));
1676 $ilBench->start(
"ExportHTML",
"exportContentStyle");
1679 $cont_stylesheet =
"./Services/COPage/css/content.css";
1681 $css = fread(fopen($cont_stylesheet,
'r'),filesize($cont_stylesheet));
1682 preg_match_all(
"/url\(([^\)]*)\)/",$css,
$files);
1683 foreach (array_unique(
$files[1]) as $fileref)
1685 if (is_file(str_replace(
"..",
".", $fileref)))
1687 copy(str_replace(
"..",
".", $fileref), $content_style_img_dir.
"/".basename($fileref));
1689 $css = str_replace($fileref,
"images/".basename($fileref),$css);
1691 fwrite(fopen($content_style_dir.
"/content.css",
'w'),$css);
1696 $style->writeCSSFile($content_style_dir.
"/content.css",
"images");
1697 $style->copyImagesToDir($content_style_img_dir);
1699 $ilBench->stop(
"ExportHTML",
"exportContentStyle");
1703 copy($syn_stylesheet, $a_target_dir.
"/syntaxhighlight.css");
1706 include_once(
"./Modules/LearningModule/classes/class.ilLMPresentationGUI.php");
1707 $_GET[
"cmd"] =
"nop";
1709 $lm_gui->setOfflineMode(
true);
1710 $lm_gui->setOfflineDirectory($a_target_dir);
1711 $lm_gui->setExportFormat($a_export_format);
1714 $ilBench->start(
"ExportHTML",
"exportHTMLPages");
1716 $ilBench->stop(
"ExportHTML",
"exportHTMLPages");
1719 $ilBench->start(
"ExportHTML",
"exportHTMLGlossaryTerms");
1721 $ilBench->stop(
"ExportHTML",
"exportHTMLGlossaryTerms");
1724 $ilBench->start(
"ExportHTML",
"exportHTMLMediaObjects");
1725 $linked_mobs = array();
1726 foreach ($this->offline_mobs as $mob)
1730 $this->
exportHTMLMOB($a_target_dir, $lm_gui, $mob,
"_blank", $linked_mobs);
1733 $linked_mobs2 = array();
1734 foreach ($linked_mobs as $mob)
1738 $this->
exportHTMLMOB($a_target_dir, $lm_gui, $mob,
"_blank", $linked_mobs2);
1741 $_GET[
"obj_type"] =
"MediaObject";
1742 $_GET[
"obj_id"] = $a_mob_id;
1744 $ilBench->stop(
"ExportHTML",
"exportHTMLMediaObjects");
1747 $ilBench->start(
"ExportHTML",
"exportHTMLFileObjects");
1748 foreach ($this->offline_files as
$file)
1752 $ilBench->stop(
"ExportHTML",
"exportHTMLFileObjects");
1755 $ilBench->start(
"ExportHTML",
"exportHTMLTOC");
1756 $ilLocator->clearItems();
1759 $tpl =
new ilTemplate(
"tpl.main.html",
true,
true);
1761 $content =& $lm_gui->showTableOfContents();
1762 $file = $a_target_dir.
"/table_of_contents.html";
1765 if (!($fp = @fopen($file,
"w+")))
1767 die (
"<b>Error</b>: Could not open \"".$file.
"\" for writing".
1768 " in <b>".__FILE__.
"</b> on line <b>".__LINE__.
"</b><br />");
1771 fwrite($fp, $content);
1774 $ilBench->stop(
"ExportHTML",
"exportHTMLTOC");
1777 $ilBench->start(
"ExportHTML",
"exportHTMLImages");
1778 $image_dir = $a_target_dir.
"/images";
1782 $image_dir.
"/enlarge.gif");
1784 $image_dir.
"/browser/plus.gif");
1786 $image_dir.
"/browser/minus.gif");
1788 $image_dir.
"/browser/blank.gif");
1790 $image_dir.
"/spacer.gif");
1792 $image_dir.
"/icon_st.gif");
1794 $image_dir.
"/icon_pg.gif");
1796 $image_dir.
"/icon_st_s.gif");
1798 $image_dir.
"/icon_pg_s.gif");
1800 $image_dir.
"/icon_lm.gif");
1802 $image_dir.
"/icon_lm_s.gif");
1804 $image_dir.
"/nav_arr_L.gif");
1806 $image_dir.
"/nav_arr_R.gif");
1808 $image_dir.
"/browser/forceexp.gif");
1811 $image_dir.
"/download.gif");
1812 $ilBench->stop(
"ExportHTML",
"exportHTMLImages");
1815 $services_dir = $a_target_dir.
"/Services";
1817 $media_service_dir = $services_dir.
"/MediaObjects";
1819 $flv_dir = $media_service_dir.
"/flash_flv_player";
1821 $mp3_dir = $media_service_dir.
"/flash_mp3_player";
1823 copy(
"./Services/MediaObjects/flash_flv_player/flvplayer.swf",
1824 $flv_dir.
"/flvplayer.swf");
1825 copy(
"./Services/MediaObjects/flash_mp3_player/mp3player.swf",
1826 $mp3_dir.
"/mp3player.swf");
1832 include_once(
"./Services/YUI/classes/class.ilYuiUtil.php");
1834 copy(
ilYuiUtil::getLocalPath(
'yahoo-dom-event/yahoo-dom-event.js'), $a_target_dir.
'/js/yahoo/yahoo-dom-event.js');
1836 copy(
'./Services/Accordion/js/accordion.js',$a_target_dir.
'/js/accordion.js');
1837 copy(
'./Services/Accordion/css/accordion.css',$a_target_dir.
'/css/accordion.css');
1840 $tpl =
new ilTemplate(
"tpl.main.html",
true,
true);
1841 $tpl->setVariable(
"LOCATION_STYLESHEET",$location_stylesheet);
1842 $tpl->addBlockFile(
"CONTENT",
"content",
"tpl.adm_content.html");
1845 $ilBench->start(
"ExportHTML",
"zip");
1858 $ilBench->stop(
"ExportHTML",
"zip");
1867 $file_dir = $a_target_dir.
"/files/file_".$a_file_id;
1869 include_once(
"./Modules/File/classes/class.ilObjFile.php");
1870 $file_obj =
new ilObjFile($a_file_id,
false);
1871 $source_file = $file_obj->getDirectory($file_obj->getVersion()).
"/".$file_obj->getFileName();
1872 if (!is_file($source_file))
1874 $source_file = $file_obj->getDirectory().
"/".$file_obj->getFileName();
1876 if (is_file($source_file))
1878 copy($source_file, $file_dir.
"/".$file_obj->getFileName());
1885 function exportHTMLMOB($a_target_dir, &$a_lm_gui, $a_mob_id, $a_frame, &$a_linked_mobs)
1889 $mob_dir = $a_target_dir.
"/mobs";
1892 if (@is_dir($source_dir))
1898 $tpl =
new ilTemplate(
"tpl.main.html",
true,
true);
1899 $tpl->addBlockFile(
"CONTENT",
"content",
"tpl.adm_content.html");
1900 $_GET[
"obj_type"] =
"MediaObject";
1901 $_GET[
"mob_id"] = $a_mob_id;
1902 $_GET[
"frame"] = $a_frame;
1904 $content =& $a_lm_gui->media();
1905 $file = $a_target_dir.
"/media_".$a_mob_id.
".html";
1908 if (!($fp = @fopen(
$file,
"w+")))
1910 die (
"<b>Error</b>: Could not open \"".
$file.
"\" for writing".
1911 " in <b>".__FILE__.
"</b> on line <b>".__LINE__.
"</b><br />");
1914 fwrite($fp, $content);
1918 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
1920 if ($mob_obj->hasFullscreenItem())
1922 $tpl =
new ilTemplate(
"tpl.main.html",
true,
true);
1923 $tpl->addBlockFile(
"CONTENT",
"content",
"tpl.adm_content.html");
1924 $_GET[
"obj_type"] =
"";
1925 $_GET[
"frame"] =
"";
1926 $_GET[
"mob_id"] = $a_mob_id;
1927 $_GET[
"cmd"] =
"fullscreen";
1928 $content =& $a_lm_gui->fullscreen();
1929 $file = $a_target_dir.
"/fullscreen_".$a_mob_id.
".html";
1932 if (!($fp = @fopen(
$file,
"w+")))
1934 die (
"<b>Error</b>: Could not open \"".
$file.
"\" for writing".
1935 " in <b>".__FILE__.
"</b> on line <b>".__LINE__.
"</b><br />");
1938 fwrite($fp, $content);
1941 $linked_mobs = $mob_obj->getLinkedMediaObjects();
1942 $a_linked_mobs = array_merge($a_linked_mobs, $linked_mobs);
1952 foreach($this->offline_int_links as $int_link)
1954 $ilLocator->clearItems();
1955 if ($int_link[
"type"] ==
"git")
1958 $tpl->addBlockFile(
"CONTENT",
"content",
"tpl.adm_content.html");
1960 $_GET[
"obj_id"] = $int_link[
"id"];
1961 $_GET[
"frame"] =
"_blank";
1962 $content =& $a_lm_gui->glossary();
1963 $file = $a_target_dir.
"/term_".$int_link[
"id"].
".html";
1966 if (!($fp = @fopen(
$file,
"w+")))
1968 die (
"<b>Error</b>: Could not open \"".
$file.
"\" for writing".
1969 " in <b>".__FILE__.
"</b> on line <b>".__LINE__.
"</b><br />");
1972 fwrite($fp, $content);
1976 include_once(
"./Modules/Glossary/classes/class.ilGlossaryDefinition.php");
1978 foreach($defs as $def)
1981 foreach($def_mobs as $def_mob)
1983 $this->offline_mobs[$def_mob] = $def_mob;
1988 $this->offline_files = array_merge($this->offline_files, $def_files);
2007 $this->first_page_id = $first_page[
"child"];
2011 $int_links = array();
2012 $this->offline_files = array();
2014 include_once(
"./Services/COPage/classes/class.ilPageContentUsage.php");
2015 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
2017 foreach ($pages as $page)
2021 $ilLocator->clearItems();
2022 $ilBench->start(
"ExportHTML",
"exportHTMLPage");
2023 $ilBench->start(
"ExportHTML",
"exportPageHTML");
2024 $this->
exportPageHTML($a_lm_gui, $a_target_dir, $page[
"obj_id"]);
2025 $ilBench->stop(
"ExportHTML",
"exportPageHTML");
2029 foreach ($pcs as $pc)
2031 if ($pc[
"type"] ==
"incl")
2034 foreach($incl_mobs as $incl_mob)
2036 $mobs[$incl_mob] = $incl_mob;
2043 foreach($pg_mobs as $pg_mob)
2045 $mobs[$pg_mob] = $pg_mob;
2050 $int_links = array_merge($int_links, $pg_links);
2053 include_once(
"./Modules/File/classes/class.ilObjFile.php");
2055 $this->offline_files = array_merge($this->offline_files, $pg_files);
2057 $ilBench->stop(
"ExportHTML",
"exportHTMLPage");
2060 $this->offline_mobs =
$mobs;
2061 $this->offline_int_links = $int_links;
2077 $tpl =
new ilTemplate(
"tpl.main.html",
true,
true);
2078 $tpl->addBlockFile(
"CONTENT",
"content",
"tpl.adm_content.html");
2080 $_GET[
"obj_id"] = $a_lm_page_id;
2081 $_GET[
"frame"] = $a_frame;
2087 $file = $a_target_dir.
"/lm_pg_".$nid.
".html";
2091 $file = $a_target_dir.
"/lm_pg_".$a_lm_page_id.
".html";
2096 if ($a_frame !=
"toc")
2098 $file = $a_target_dir.
"/frame_".$a_lm_page_id.
"_".$a_frame.
".html";
2102 $file = $a_target_dir.
"/frame_".$a_frame.
".html";
2107 if (@is_file(
$file))
2112 $ilBench->start(
"ExportHTML",
"layout");
2113 $ilBench->start(
"ExportHTML",
"layout_".$a_frame);
2114 $content =& $a_lm_gui->layout(
"main.xml",
false);
2115 $ilBench->stop(
"ExportHTML",
"layout_".$a_frame);
2116 $ilBench->stop(
"ExportHTML",
"layout");
2119 if (!($fp = @fopen(
$file,
"w+")))
2121 die (
"<b>Error</b>: Could not open \"".
$file.
"\" for writing".
2122 " in <b>".__FILE__.
"</b> on line <b>".__LINE__.
"</b><br />");
2129 fwrite($fp, $content);
2134 if ($this->first_page_id == $a_lm_page_id && $a_frame ==
"")
2136 copy(
$file, $a_target_dir.
"/index.html");
2140 $ilBench->start(
"ExportHTML",
"getCurrentFrameSet");
2141 $frameset = $a_lm_gui->getCurrentFrameSet();
2142 $ilBench->stop(
"ExportHTML",
"getCurrentFrameSet");
2144 foreach ($frameset as $frame)
2146 $this->
exportPageHTML($a_lm_gui, $a_target_dir, $a_lm_page_id, $frame);
2163 $attrs[
"xmlns:fo"] =
"http://www.w3.org/1999/XSL/Format";
2164 $a_xml_writer->xmlStartTag(
"fo:root", $attrs);
2168 $a_xml_writer->xmlStartTag(
"fo:layout-master-set", $attrs);
2172 $attrs[
"master-name"] =
"DinA4";
2173 $attrs[
"page-height"] =
"29.7cm";
2174 $attrs[
"page-width"] =
"21cm";
2175 $attrs[
"margin-top"] =
"4cm";
2176 $attrs[
"margin-bottom"] =
"1cm";
2177 $attrs[
"margin-left"] =
"2.8cm";
2178 $attrs[
"margin-right"] =
"7.3cm";
2179 $a_xml_writer->xmlStartTag(
"fo:simple-page-master", $attrs);
2183 $attrs[
"margin-top"] =
"0cm";
2184 $attrs[
"margin-bottom"] =
"1.25cm";
2185 $a_xml_writer->xmlElement(
"fo:region-body", $attrs);
2189 $attrs[
"extent"] =
"1cm";
2190 $a_xml_writer->xmlElement(
"fo:region-before", $attrs);
2194 $attrs[
"extent"] =
"1cm";
2195 $a_xml_writer->xmlElement(
"fo:region-after", $attrs);
2198 $a_xml_writer->xmlEndTag(
"fo:simple-page-master");
2201 $a_xml_writer->xmlEndTag(
"fo:layout-master-set");
2205 $attrs[
"master-reference"] =
"DinA4";
2206 $a_xml_writer->xmlStartTag(
"fo:page-sequence", $attrs);
2210 $attrs[
"flow-name"] =
"xsl-region-body";
2211 $a_xml_writer->xmlStartTag(
"fo:flow", $attrs);
2216 $ilBench->start(
"ContentObjectExport",
"exportFOStructureObjects");
2218 $ilBench->stop(
"ContentObjectExport",
"exportFOStructureObjects");
2222 $a_xml_writer->xmlEndTag(
"fo:flow");
2225 $a_xml_writer->xmlEndTag(
"fo:page-sequence");
2228 $a_xml_writer->xmlEndTag(
"fo:root");
2239 $childs = $this->lm_tree->getChilds($this->lm_tree->getRootId());
2240 foreach ($childs as $child)
2242 if($child[
"type"] !=
"st")
2248 $structure_obj->exportFO($a_xml_writer, $expLog);
2249 unset($structure_obj);
2255 include_once(
"./Modules/LearningModule/classes/class.ilContObjectExport.php");
2259 $export_file = $cont_exp->buildExportFile();
2260 return $export_file;
2274 $lmtree->setTableNames(
'lm_tree',
'lm_data');
2275 $lmtree->setTreeTablePK(
"lm_id");
2278 $source_obj->setLMId($this->
getId());
2283 $target_obj->setLMId($this->
getId());
2284 $target_parent = $lmtree->getParentId(
$target_id);
2288 if ($source_obj->getType() ==
"pg")
2291 if ($lmtree->isInTree($source_obj->getId()))
2293 $node_data = $lmtree->getNodeData($source_obj->getId());
2296 if ($movecopy ==
"move")
2298 $parent_id = $lmtree->getParentId($source_obj->getId());
2299 $lmtree->deleteTree($node_data);
2302 require_once(
"classes/class.ilHistory.php");
2313 $new_page =& $source_obj->copy();
2314 $source_id = $new_page->getId();
2315 $source_obj =& $new_page;
2319 if(!$lmtree->isInTree($source_obj->getId()))
2326 else if ($as_subitem)
2330 $pg_childs =& $lmtree->getChildsByType($parent,
"pg");
2331 if (count($pg_childs) != 0)
2333 $target_pos = $pg_childs[count($pg_childs) - 1][
"obj_id"];
2339 $parent = $target_parent;
2343 $lmtree->insertNode($source_obj->getId(),
2344 $parent, $target_pos);
2347 if ($movecopy ==
"move")
2350 include_once(
"classes/class.ilHistory.php");
2364 if ($source_obj->getType() ==
"st")
2367 $source_node = $lmtree->getNodeData($source_id);
2368 $subnodes = $lmtree->getSubtree($source_node);
2371 foreach ($subnodes as $subnode)
2386 $pg_childs =& $lmtree->getChildsByType($target_parent,
"pg");
2387 if (count($pg_childs) != 0)
2389 $target_pos = $pg_childs[count($pg_childs) - 1][
"obj_id"];
2392 else if ($as_subitem)
2396 $childs =& $lmtree->getChilds($target_parent);
2397 if (count($childs) != 0)
2399 $target_pos = $childs[count($childs) - 1][
"obj_id"];
2424 if ($movecopy ==
"move")
2426 $lmtree->deleteTree($source_node);
2431 $new_chapter =& $source_obj->copy($lmtree, $target_parent, $target_pos);
2434 if (!$lmtree->isInTree($source_id))
2436 $lmtree->insertNode($source_id, $target_parent, $target_pos);
2439 if ($movecopy ==
"move")
2441 foreach ($subnodes as $node)
2443 if($node[
"obj_id"] != $source_id)
2445 $lmtree->insertNode($node[
"obj_id"], $node[
"parent"]);
2463 include_once
"./Modules/LearningModule/classes/class.ilLMPageObject.php";
2464 include_once
"./Services/COPage/classes/class.ilPageObject.php";
2469 foreach ($pages as $page)
2475 $error = @$cpage->validateDom();
2479 $this->lng->loadLanguageModule(
"content");
2483 $mess.= $this->lng->txt(
"obj_pg").
": ".
$title;
2484 $mess.=
'<div class="small">';
2487 $err_mess = implode($e,
" - ");
2488 if (!is_int(strpos($err_mess,
":0:")))
2490 $mess.= htmlentities($err_mess).
"<br />";