25 require_once
"classes/class.ilObject.php";
26 require_once
"Services/MetaData/classes/class.ilMDLanguageItem.php";
27 require_once(
"classes/class.ilNestedSetXML.php");
60 $this->
ilObject($a_id,$a_call_by_reference);
62 $this->mob_ids = array();
63 $this->file_ids = array();
85 if (is_object($ilUser))
102 global $rbacadmin, $rbacreview;
125 return $roles ? $roles : array();
135 # echo "Content<br>\n";
138 $this->lm_tree->setTableNames(
'lm_tree',
'lm_data');
139 $this->lm_tree->setTreeTablePK(
"lm_id");
191 $this->import_id = $a_id;
244 $this->lm_tree->setTreeTablePK(
"lm_id");
245 $this->lm_tree->setTableNames(
'lm_tree',
'lm_data');
246 $this->lm_tree->addTree($this->
getId(), 1);
267 if(!is_writable($lm_data_dir))
269 $this->ilias->raiseError(
"Content object Data Directory (".$lm_data_dir
270 .
") not writeable.",$this->ilias->error_obj->FATAL);
274 $lm_dir = $lm_data_dir.
"/lm_".$this->
getId();
276 if(!@is_dir($lm_dir))
278 $this->ilias->raiseError(
"Creation of Learning Module Directory failed.",$this->ilias->error_obj->FATAL);
282 $import_dir = $lm_dir.
"/import";
284 if(!@is_dir($import_dir))
286 $this->ilias->raiseError(
"Creation of Import Directory failed.",$this->ilias->error_obj->FATAL);
296 "/lm_".$this->getId();
305 "/lm_".$this->getId().
"/import";
306 if(@is_dir($import_dir))
325 if(!is_writable($lm_data_dir))
327 $this->ilias->raiseError(
"Content object Data Directory (".$lm_data_dir
328 .
") not writeable.",$this->ilias->error_obj->FATAL);
331 $lm_dir = $lm_data_dir.
"/lm_".$this->
getId();
333 if(!@is_dir($lm_dir))
335 $this->ilias->raiseError(
"Creation of Learning Module Directory failed.",$this->ilias->error_obj->FATAL);
342 $export_dir = $lm_dir.
"/export_html";
347 $export_dir = $lm_dir.
"/export_scorm";
351 $export_dir = $lm_dir.
"/export";
356 if(!@is_dir($export_dir))
358 $this->ilias->raiseError(
"Creation of Export Directory failed.",$this->ilias->error_obj->FATAL);
402 if (!parent::delete())
408 include_once(
"./Modules/LearningModule/classes/class.ilLMObject.php");
416 $nested->init($this->
getId(),
"bib");
417 $nested->deleteAllDBData();
421 $this->lm_tree->removeTree($this->lm_tree->getTreeId());
427 $q =
"DELETE FROM content_object WHERE id = ".$ilDB->quote($this->
getId());
428 $this->ilias->db->query($q);
431 $q =
"DELETE FROM lm_menu WHERE lm_id = ".$ilDB->quote($this->
getId());
432 $this->ilias->db->query($q);
455 $this->layout = $a_layout;
471 $this->style_id = $a_style_id;
481 $q =
"UPDATE content_object SET ".
482 " stylesheet = ".$ilDB->quote($a_style_id).
483 " WHERE id = ".$ilDB->quote($this->
getId());
486 $this->style_id = $a_style_id;
496 if ($a_from_style < 0)
498 $q =
"SELECT stylesheet FROM content_object, style_data ".
499 " WHERE content_object.stylesheet = style_data.id ".
500 " AND style_data.standard = 0 ".
501 " AND content_object.stylesheet > 0";
502 $style_set = $ilDB->query($q);
506 $q =
"UPDATE content_object SET ".
507 " stylesheet = ".$ilDB->quote($a_to_style).
508 " WHERE stylesheet = ".$ilDB->quote($style_rec[
"stylesheet"]);
512 $style_obj =& $ilias->obj_factory->getInstanceByObjId($style_rec[
"stylesheet"]);
513 $style_obj->delete();
518 $q =
"UPDATE content_object SET ".
519 " stylesheet = ".$ilDB->quote($a_to_style).
520 " WHERE stylesheet = ".$ilDB->quote($a_from_style);
532 $q =
"SELECT stylesheet FROM content_object ".
533 " WHERE id = ".$ilDB->quote($a_cont_obj_id);
534 $res = $ilDB->query($q);
537 return $sheet[
"stylesheet"];
547 $q =
"SELECT id FROM content_object ".
548 " WHERE stylesheet = ".$ilDB->quote($a_style_id);
549 $res = $ilDB->query($q);
553 $obj_ids[] = $cont[
"id"];
567 $q =
"SELECT count(*) as cnt FROM content_object ".
568 " WHERE stylesheet = ".$ilDB->quote($a_style_id);
569 $cset = $ilDB->query($q);
572 return (
int) $crow[
"cnt"];
584 $q =
"SELECT count(*) as cnt FROM content_object, style_data ".
585 " WHERE stylesheet = style_data.id ".
587 $cset = $ilDB->query($q);
590 return (
int) $crow[
"cnt"];
600 $q =
"SELECT count(*) as cnt FROM content_object ".
601 " WHERE stylesheet = 0";
602 $cset = $ilDB->query($q);
605 return (
int) $crow[
"cnt"];
617 $q =
"UPDATE content_object SET ".
618 " stylesheet = ".$ilDB->quote(
"0").
619 " WHERE stylesheet = ".$ilDB->quote($this->
getId($a_style_id));
639 $this->pg_header = $a_pg_header;
647 return $this->toc_mode;
655 return $this->public_access_mode;
665 $this->toc_mode = $a_toc_mode;
670 $this->online = $a_online;
680 $this->lm_menu_active = $a_act_lm_menu;
685 return $this->lm_menu_active;
690 $this->toc_active = $a_toc;
695 return $this->toc_active;
700 $this->numbering = $a_num;
705 return $this->numbering;
710 $this->print_view_active = $a_print;
715 return $this->print_view_active;
720 $this->prevent_glossary_appendix_active = $a_print;
725 return $this->prevent_glossary_appendix_active;
730 $this->downloads_active = $a_down;
735 return $this->downloads_active;
740 $this->downloads_public_active = $a_down;
745 return $this->downloads_public_active;
750 $this->pub_notes = $a_pub_notes;
755 return $this->pub_notes;
760 $this->clean_frames = $a_clean;
765 return $this->clean_frames;
770 $this->user_comments = $a_comm;
775 $this->public_access_mode = $a_mode;
780 return $this->user_comments;
785 $this->header_page = $a_pg;
790 return $this->header_page;
795 $this->footer_page = $a_pg;
800 return $this->footer_page;
810 $q =
"SELECT * FROM content_object WHERE id = ".$ilDB->quote($this->
getId());
811 $lm_set = $this->ilias->db->query($q);
813 $this->
setLayout($lm_rec[
"default_layout"]);
842 $q =
"UPDATE content_object SET ".
843 " default_layout = ".$ilDB->quote($this->
getLayout()).
", ".
846 " toc_mode = ".$ilDB->quote($this->
getTOCMode()).
",".
863 " WHERE id = ".$ilDB->quote($this->
getId());
864 $this->ilias->db->query($q);
874 $q =
"INSERT INTO content_object (id) VALUES (".$ilDB->quote($this->
getId()).
")";
875 $this->ilias->db->query($q);
888 $q =
"SELECT * FROM content_object WHERE id = ".$ilDB->quote($a_id);
889 $lm_set = $this->ilias->db->query($q);
903 $dir = opendir(
"./Modules/LearningModule/layouts/lm");
912 if (@is_dir(
"./Modules/LearningModule/layouts/lm/".
$file))
930 $lm_tree->setTableNames(
'lm_tree',
'lm_data');
936 foreach ($path as $node)
938 if ($node[
"type"] ==
"st")
957 $lm_tree->setTableNames(
'lm_tree',
'lm_data');
965 foreach ($path as $node)
967 if ($node[
"type"] ==
"st")
971 foreach ($tconds as $tcond)
992 $lm_tree->setTableNames(
'lm_tree',
'lm_data');
1000 foreach ($path as $node)
1002 if ($node[
"type"] ==
"st")
1006 foreach ($tconds as $tcond)
1011 return $node[
"child"];
1031 function notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params = 0)
1071 if ($a_node_id==
$_GET[
"ref_id"])
1073 $parent_obj =& $this->ilias->obj_factory->getInstanceByRefId($a_node_id);
1074 $parent_type = $parent_obj->getType();
1075 if($parent_type == $this->
getType())
1077 $a_node_id = (int) $tree->getParentId($a_node_id);
1081 parent::notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params);
1095 switch($a_search_in)
1099 $in = $search_obj->getInStatement(
"r.ref_id");
1100 $where = $search_obj->getWhereCondition(
"fulltext",array(
"xv.tag_value"));
1112 $query1 =
"SELECT DISTINCT(r.ref_id) FROM object_reference AS r,object_data AS o, ".
1113 "xmlnestedset AS xm,xmlvalue AS xv ".
1116 "AND r.obj_id=o.obj_id AND ( ".
1117 "(o.obj_id=xm.ns_book_fk AND xm.ns_type IN ('lm','bib'))) ".
1118 "AND xm.ns_tag_fk=xv.tag_fk ".
1122 $query1 =
"SELECT DISTINCT(r.ref_id) as ref_id FROM xmlvalue AS xv ".
1123 "LEFT JOIN xmlnestedset AS xm ON xm.ns_tag_fk=xv.tag_fk ".
1124 "LEFT JOIN object_data AS o ON o.obj_id = xm.ns_book_fk ".
1125 "LEFT JOIN object_reference AS r ON o.obj_id = r.obj_id ".
1128 " AND o.type = 'lm' AND xm.ns_type IN ('lm','bib')";
1130 $query2 =
"SELECT DISTINCT(r.ref_id) FROM object_reference AS r,object_data AS o, ".
1131 "lm_data AS l,xmlnestedset AS xm,xmlvalue AS xv ".
1134 "AND r.obj_id=o.obj_id AND ((o.obj_id=l.lm_id AND xm.ns_book_fk=l.obj_id)".
1136 "AND xm.ns_tag_fk=xv.tag_fk ".
1139 $query2 =
"SELECT DISTINCT(r.ref_id) as ref_id FROM xmlvalue AS xv ".
1140 "LEFT JOIN xmlnestedset AS xm ON xm.ns_tag_fk = xv.tag_fk ".
1141 "LEFT JOIN lm_data AS l ON l.obj_id = xm.ns_book_fk ".
1142 "LEFT JOIN object_data AS o ON o.obj_id = l.lm_id ".
1143 "LEFT JOIN object_reference AS r ON r.obj_id = o.obj_id ".
1146 "AND o.type = 'lm'";
1148 $ilBench->start(
"Search",
"ilObjContentObject_search_meta");
1149 $res1 = $search_obj->ilias->db->query($query1);
1150 $res2 = $search_obj->ilias->db->query($query2);
1151 $ilBench->stop(
"Search",
"ilObjContentObject_search_meta");
1157 $ids[] = $row->ref_id;
1158 $result[$counter][
"id"] = $row->ref_id;
1163 if(in_array($row->ref_id,$ids))
1167 $result[$counter][
"id"] = $row->ref_id;
1173 $in = $search_obj->getInStatement(
"r.ref_id");
1174 $where = $search_obj->getWhereCondition(
"fulltext",array(
"pg.content"));
1184 $query =
"SELECT DISTINCT(r.ref_id) AS ref_id ,pg.page_id AS page_id FROM page_object AS pg ".
1185 ", object_reference AS r ".
1187 " AND pg.parent_id = r.obj_id ".
1189 " AND pg.parent_type = 'lm' ";
1191 $query =
"SELECT DISTINCT(r.ref_id) AS ref_id ,pg.page_id AS page_id FROM page_object AS pg ".
1192 "LEFT JOIN object_data AS o ON o.obj_id = pg.parent_id ".
1193 "LEFT JOIN object_reference AS r ON o.obj_id = r.obj_id ".
1196 " AND pg.parent_type = 'lm'";
1198 $ilBench->start(
"Search",
"ilObjContentObject_search_content");
1199 $res = $search_obj->ilias->db->query($query);
1200 $ilBench->stop(
"Search",
"ilObjContentObject_search_content");
1205 $result[$counter][
"id"] = $row->ref_id;
1206 $result[$counter][
"page_id"] = $row->page_id;
1219 $tree =
new ilTree($a_cont_obj_id);
1220 $tree->setTableNames(
'lm_tree',
'lm_data');
1221 $tree->setTreeTablePK(
"lm_id");
1222 if ($tree->isInTree($a_page_id))
1224 $succ = $tree->fetchSuccessorNode($a_page_id,
"pg");
1237 $tree->setTableNames(
'lm_tree',
'lm_data');
1238 $tree->setTreeTablePK(
"lm_id");
1240 $tree->checkTreeChilds();
1254 $nodes = $tree->getSubtree($tree->getNodeData($tree->getRootId()));
1255 foreach ($nodes as $node)
1257 $q =
"SELECT * FROM lm_data WHERE obj_id = ".$ilDB->quote($node[
"child"]);
1258 $obj_set = $ilDB->query($q);
1262 $node_data = $tree->getNodeData($node[
"child"]);
1263 $tree->deleteTree($node_data);
1268 $nodes = $tree->getSubtree($tree->getNodeData($tree->getRootId()));
1269 foreach ($nodes as $node)
1271 $q =
"SELECT * FROM lm_data WHERE obj_id = ".$ilDB->quote($node[
"parent"]);
1272 $obj_set = $ilDB->query($q);
1274 if ($obj_rec[
"type"] ==
"pg")
1276 $node_data = $tree->getNodeData($node[
"child"]);
1277 if ($tree->isInTree($node[
"child"]))
1279 $tree->deleteTree($node_data);
1293 function exportXML(&$a_xml_writer, $a_inst, $a_target_dir, &$expLog)
1301 $attrs[
"Type"] =
"LearningModule";
1305 $attrs[
"Type"] =
"LibObject";
1308 $a_xml_writer->xmlStartTag(
"ContentObject", $attrs);
1315 $expLog->write(date(
"[y-m-d H:i:s] ").
"Start Export Structure Objects");
1316 $ilBench->start(
"ContentObjectExport",
"exportStructureObjects");
1318 $ilBench->stop(
"ContentObjectExport",
"exportStructureObjects");
1319 $expLog->write(date(
"[y-m-d H:i:s] ").
"Finished Export Structure Objects");
1322 $expLog->write(date(
"[y-m-d H:i:s] ").
"Start Export Page Objects");
1323 $ilBench->start(
"ContentObjectExport",
"exportPageObjects");
1325 $ilBench->stop(
"ContentObjectExport",
"exportPageObjects");
1326 $expLog->write(date(
"[y-m-d H:i:s] ").
"Finished Export Page Objects");
1329 $expLog->write(date(
"[y-m-d H:i:s] ").
"Start Export Media Objects");
1330 $ilBench->start(
"ContentObjectExport",
"exportMediaObjects");
1332 $ilBench->stop(
"ContentObjectExport",
"exportMediaObjects");
1333 $expLog->write(date(
"[y-m-d H:i:s] ").
"Finished Export Media Objects");
1336 $expLog->write(date(
"[y-m-d H:i:s] ").
"Start Export File Items");
1337 $ilBench->start(
"ContentObjectExport",
"exportFileItems");
1339 $ilBench->stop(
"ContentObjectExport",
"exportFileItems");
1340 $expLog->write(date(
"[y-m-d H:i:s] ").
"Finished Export File Items");
1344 $expLog->write(date(
"[y-m-d H:i:s] ").
"Start Export Properties");
1346 $expLog->write(date(
"[y-m-d H:i:s] ").
"Finished Export Properties");
1357 $a_xml_writer->xmlEndTag(
"ContentObject");
1368 include_once(
"Services/MetaData/classes/class.ilMD2XML.php");
1370 $md2xml->setExportMode(
true);
1371 $md2xml->startExport();
1372 $a_xml_writer->appendXML($md2xml->getXML());
1383 include_once
'./Modules/LearningModule/classes/class.ilStructureObject.php';
1385 $childs = $this->lm_tree->getChilds($this->lm_tree->getRootId());
1386 foreach ($childs as $child)
1388 if($child[
"type"] !=
"st")
1394 $structure_obj->exportXML($a_xml_writer, $a_inst, $expLog);
1395 unset($structure_obj);
1410 include_once
"./Modules/LearningModule/classes/class.ilLMPageObject.php";
1413 foreach ($pages as $page)
1417 $ilBench->start(
"ContentObjectExport",
"exportPageObject");
1418 $expLog->write(date(
"[y-m-d H:i:s] ").
"Page Object ".$page[
"obj_id"]);
1421 $ilBench->start(
"ContentObjectExport",
"exportPageObject_getLMPageObject");
1423 $ilBench->stop(
"ContentObjectExport",
"exportPageObject_getLMPageObject");
1424 $ilBench->start(
"ContentObjectExport",
"exportPageObject_XML");
1425 $page_obj->exportXML($a_xml_writer,
"normal", $a_inst);
1426 $ilBench->stop(
"ContentObjectExport",
"exportPageObject_XML");
1429 $ilBench->start(
"ContentObjectExport",
"exportPageObject_CollectMedia");
1430 $mob_ids = $page_obj->getMediaObjectIDs();
1431 foreach($mob_ids as $mob_id)
1433 $this->mob_ids[$mob_id] = $mob_id;
1435 $ilBench->stop(
"ContentObjectExport",
"exportPageObject_CollectMedia");
1438 $ilBench->start(
"ContentObjectExport",
"exportPageObject_CollectFileItems");
1439 $file_ids = $page_obj->getFileItemIds();
1440 foreach($file_ids as $file_id)
1442 $this->file_ids[$file_id] = $file_id;
1444 $ilBench->stop(
"ContentObjectExport",
"exportPageObject_CollectFileItems");
1448 $ilBench->stop(
"ContentObjectExport",
"exportPageObject");
1461 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
1463 $linked_mobs = array();
1466 foreach ($this->mob_ids as $mob_id)
1470 $expLog->write(date(
"[y-m-d H:i:s] ").
"Media Object ".$mob_id);
1472 $media_obj->exportXML($a_xml_writer, $a_inst);
1473 $media_obj->exportFiles($a_target_dir);
1475 $lmobs = $media_obj->getLinkedMediaObjects($this->mob_ids);
1476 $linked_mobs = array_merge($linked_mobs, $lmobs);
1483 foreach ($linked_mobs as $mob_id)
1487 $expLog->write(date(
"[y-m-d H:i:s] ").
"Media Object ".$mob_id);
1489 $media_obj->exportXML($a_xml_writer, $a_inst);
1490 $media_obj->exportFiles($a_target_dir);
1503 include_once(
"./Modules/File/classes/class.ilObjFile.php");
1505 foreach ($this->file_ids as $file_id)
1507 $expLog->write(date(
"[y-m-d H:i:s] ").
"File Item ".$file_id);
1508 $file_obj =
new ilObjFile($file_id,
false);
1509 $file_obj->export($a_target_dir);
1521 $a_xml_writer->xmlStartTag(
"Properties", $attrs);
1524 $attrs = array(
"Name" =>
"Layout",
"Value" => $this->
getLayout());
1525 $a_xml_writer->xmlElement(
"Property", $attrs);
1528 $attrs = array(
"Name" =>
"PageHeader",
"Value" => $this->
getPageHeader());
1529 $a_xml_writer->xmlElement(
"Property", $attrs);
1532 $attrs = array(
"Name" =>
"TOCMode",
"Value" => $this->
getTOCMode());
1533 $a_xml_writer->xmlElement(
"Property", $attrs);
1536 $attrs = array(
"Name" =>
"ActiveLMMenu",
"Value" =>
1538 $a_xml_writer->xmlElement(
"Property", $attrs);
1541 $attrs = array(
"Name" =>
"ActiveNumbering",
"Value" =>
1543 $a_xml_writer->xmlElement(
"Property", $attrs);
1546 $attrs = array(
"Name" =>
"ActiveTOC",
"Value" =>
1548 $a_xml_writer->xmlElement(
"Property", $attrs);
1551 $attrs = array(
"Name" =>
"ActivePrintView",
"Value" =>
1553 $a_xml_writer->xmlElement(
"Property", $attrs);
1559 $attrs = array(
"Name" =>
"CleanFrames",
"Value" =>
1561 $a_xml_writer->xmlElement(
"Property", $attrs);
1564 $attrs = array(
"Name" =>
"PublicNotes",
"Value" =>
1566 $a_xml_writer->xmlElement(
"Property", $attrs);
1569 $attrs = array(
"Name" =>
"HistoryUserComments",
"Value" =>
1571 $a_xml_writer->xmlElement(
"Property", $attrs);
1576 $attrs = array(
"Name" =>
"HeaderPage",
"Value" =>
1577 "il_".IL_INST_ID.
"_pg_".$this->getHeaderPage());
1578 $a_xml_writer->xmlElement(
"Property", $attrs);
1584 $attrs = array(
"Name" =>
"FooterPage",
"Value" =>
1585 "il_".IL_INST_ID.
"_pg_".$this->getFooterPage());
1586 $a_xml_writer->xmlElement(
"Property", $attrs);
1589 $a_xml_writer->xmlEndTag(
"Properties");
1599 $types = array(
"xml",
"html",
"scorm");
1601 foreach ($types as
$type)
1605 if (!@is_dir(
$dir) or
1606 !is_writeable(
$dir))
1617 while ($entry = $cdir->read())
1619 if ($entry !=
"." and
1621 substr($entry, -4) ==
".zip" and
1622 ereg(
"^[0-9]{10}_{2}[0-9]+_{2}(lm_)*[0-9]+\.zip\$", $entry))
1624 $file[$entry.$type] = array(
"type" => $type,
"file" => $entry,
1625 "size" => filesize(
$dir.
"/".$entry));
1647 $this->public_export_file[$a_type] = $a_file;
1659 return $this->public_export_file[$a_type];
1668 if (!@is_dir(
$dir) or
1669 !is_writeable(
$dir))
1681 while ($entry =
$dir->read())
1683 if ($entry !=
"." and
1685 substr($entry, -4) ==
".pdf" and
1686 ereg(
"^[0-9]{10}_{2}[0-9]+_{2}(lm_)*[0-9]+\.pdf\$", $entry))
1715 include(
"./Modules/LearningModule/classes/class.ilContObjectManifestBuilder.php");
1717 $man_builder->buildManifest();
1718 $man_builder->dump($a_target_dir);
1721 copy(
"Modules/LearningModule/scorm_xsd/adlcp_rootv1p2.xsd", $a_target_dir.
"/adlcp_rootv1p2.xsd");
1722 copy(
"Modules/LearningModule/scorm_xsd/imscp_rootv1p1p2.xsd", $a_target_dir.
"/imscp_rootv1p1p2.xsd");
1723 copy(
"Modules/LearningModule/scorm_xsd/imsmd_rootv1p2p1.xsd", $a_target_dir.
"/imsmd_rootv1p2p1.xsd");
1724 copy(
"Modules/LearningModule/scorm_xsd/ims_xml.xsd", $a_target_dir.
"/ims_xml.xsd");
1728 $zip_file = $a_target_dir.
"/".$date.
"__".IL_INST_ID.
"__".
1732 $a_target_dir.
"/imsmanifest.xml",
1733 $a_target_dir.
"/adlcp_rootv1p2.xsd",
1734 $a_target_dir.
"/imscp_rootv1p1p2.xsd",
1735 $a_target_dir.
"/ims_xml.xsd",
1736 $a_target_dir.
"/imsmd_rootv1p2p1.xsd")
1742 rename($zip_file, $dest_file);
1751 function exportHTML($a_target_dir,
$log, $a_zip_file =
true, $a_export_format =
"html")
1758 $mob_dir = $a_target_dir.
"/mobs";
1760 $file_dir = $a_target_dir.
"/files";
1762 $teximg_dir = $a_target_dir.
"/teximg";
1768 $style_name = $ilias->account->prefs[
"style"].
".css";
1769 copy($location_stylesheet, $a_target_dir.
"/".$style_name);
1773 $ilBench->start(
"ExportHTML",
"exportContentStyle");
1776 $cont_stylesheet =
"./Services/COPage/css/content.css";
1777 copy($cont_stylesheet, $a_target_dir.
"/content.css");
1782 $style->writeCSSFile($a_target_dir.
"/content.css");
1784 $ilBench->stop(
"ExportHTML",
"exportContentStyle");
1788 copy($syn_stylesheet, $a_target_dir.
"/syntaxhighlight.css");
1791 include_once(
"./Modules/LearningModule/classes/class.ilLMPresentationGUI.php");
1792 $_GET[
"cmd"] =
"nop";
1794 $lm_gui->setOfflineMode(
true);
1795 $lm_gui->setOfflineDirectory($a_target_dir);
1796 $lm_gui->setExportFormat($a_export_format);
1799 $ilBench->start(
"ExportHTML",
"exportHTMLPages");
1801 $ilBench->stop(
"ExportHTML",
"exportHTMLPages");
1804 $ilBench->start(
"ExportHTML",
"exportHTMLGlossaryTerms");
1806 $ilBench->stop(
"ExportHTML",
"exportHTMLGlossaryTerms");
1809 $ilBench->start(
"ExportHTML",
"exportHTMLMediaObjects");
1810 $linked_mobs = array();
1811 foreach ($this->offline_mobs as $mob)
1815 $this->
exportHTMLMOB($a_target_dir, $lm_gui, $mob,
"_blank", $linked_mobs);
1818 $linked_mobs2 = array();
1819 foreach ($linked_mobs as $mob)
1823 $this->
exportHTMLMOB($a_target_dir, $lm_gui, $mob,
"_blank", $linked_mobs2);
1826 $_GET[
"obj_type"] =
"MediaObject";
1827 $_GET[
"obj_id"] = $a_mob_id;
1829 $ilBench->stop(
"ExportHTML",
"exportHTMLMediaObjects");
1832 $ilBench->start(
"ExportHTML",
"exportHTMLFileObjects");
1833 foreach ($this->offline_files as
$file)
1837 $ilBench->stop(
"ExportHTML",
"exportHTMLFileObjects");
1840 $ilBench->start(
"ExportHTML",
"exportHTMLTOC");
1841 $ilLocator->clearItems();
1844 $tpl =
new ilTemplate(
"tpl.main.html",
true,
true);
1846 $content =& $lm_gui->showTableOfContents();
1847 $file = $a_target_dir.
"/table_of_contents.html";
1850 if (!($fp = @fopen($file,
"w+")))
1852 die (
"<b>Error</b>: Could not open \"".$file.
"\" for writing".
1853 " in <b>".__FILE__.
"</b> on line <b>".__LINE__.
"</b><br />");
1856 fwrite($fp, $content);
1859 $ilBench->stop(
"ExportHTML",
"exportHTMLTOC");
1862 $ilBench->start(
"ExportHTML",
"exportHTMLImages");
1863 $image_dir = $a_target_dir.
"/images";
1867 $image_dir.
"/enlarge.gif");
1869 $image_dir.
"/browser/plus.gif");
1871 $image_dir.
"/browser/minus.gif");
1873 $image_dir.
"/browser/blank.gif");
1875 $image_dir.
"/icon_st.gif");
1877 $image_dir.
"/icon_pg.gif");
1879 $image_dir.
"/icon_st_s.gif");
1881 $image_dir.
"/icon_pg_s.gif");
1883 $image_dir.
"/icon_lm.gif");
1885 $image_dir.
"/icon_lm_s.gif");
1887 $image_dir.
"/nav_arr_L.gif");
1889 $image_dir.
"/nav_arr_R.gif");
1892 $image_dir.
"/download.gif");
1893 $ilBench->stop(
"ExportHTML",
"exportHTMLImages");
1896 $tpl =
new ilTemplate(
"tpl.main.html",
true,
true);
1897 $tpl->setVariable(
"LOCATION_STYLESHEET",$location_stylesheet);
1898 $tpl->addBlockFile(
"CONTENT",
"content",
"tpl.adm_content.html");
1901 $ilBench->start(
"ExportHTML",
"zip");
1914 $ilBench->stop(
"ExportHTML",
"zip");
1923 $file_dir = $a_target_dir.
"/files/file_".$a_file_id;
1925 include_once(
"./Modules/File/classes/class.ilObjFile.php");
1926 $file_obj =
new ilObjFile($a_file_id,
false);
1927 $source_file = $file_obj->getDirectory($file_obj->getVersion()).
"/".$file_obj->getFileName();
1928 if (!is_file($source_file))
1930 $source_file = $file_obj->getDirectory().
"/".$file_obj->getFileName();
1932 if (is_file($source_file))
1934 copy($source_file, $file_dir.
"/".$file_obj->getFileName());
1941 function exportHTMLMOB($a_target_dir, &$a_lm_gui, $a_mob_id, $a_frame, &$a_linked_mobs)
1945 $mob_dir = $a_target_dir.
"/mobs";
1948 if (@is_dir($source_dir))
1954 $tpl =
new ilTemplate(
"tpl.main.html",
true,
true);
1955 $tpl->addBlockFile(
"CONTENT",
"content",
"tpl.adm_content.html");
1956 $_GET[
"obj_type"] =
"MediaObject";
1957 $_GET[
"mob_id"] = $a_mob_id;
1958 $_GET[
"frame"] = $a_frame;
1960 $content =& $a_lm_gui->media();
1961 $file = $a_target_dir.
"/media_".$a_mob_id.
".html";
1964 if (!($fp = @fopen(
$file,
"w+")))
1966 die (
"<b>Error</b>: Could not open \"".
$file.
"\" for writing".
1967 " in <b>".__FILE__.
"</b> on line <b>".__LINE__.
"</b><br />");
1970 fwrite($fp, $content);
1974 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
1976 if ($mob_obj->hasFullscreenItem())
1978 $tpl =
new ilTemplate(
"tpl.main.html",
true,
true);
1979 $tpl->addBlockFile(
"CONTENT",
"content",
"tpl.adm_content.html");
1980 $_GET[
"obj_type"] =
"";
1981 $_GET[
"frame"] =
"";
1982 $_GET[
"mob_id"] = $a_mob_id;
1983 $_GET[
"cmd"] =
"fullscreen";
1984 $content =& $a_lm_gui->fullscreen();
1985 $file = $a_target_dir.
"/fullscreen_".$a_mob_id.
".html";
1988 if (!($fp = @fopen(
$file,
"w+")))
1990 die (
"<b>Error</b>: Could not open \"".
$file.
"\" for writing".
1991 " in <b>".__FILE__.
"</b> on line <b>".__LINE__.
"</b><br />");
1994 fwrite($fp, $content);
1997 $linked_mobs = $mob_obj->getLinkedMediaObjects();
1998 $a_linked_mobs = array_merge($a_linked_mobs, $linked_mobs);
2008 foreach($this->offline_int_links as $int_link)
2010 $ilLocator->clearItems();
2011 if ($int_link[
"type"] ==
"git")
2014 $tpl->addBlockFile(
"CONTENT",
"content",
"tpl.adm_content.html");
2016 $_GET[
"obj_id"] = $int_link[
"id"];
2017 $_GET[
"frame"] =
"_blank";
2018 $content =& $a_lm_gui->glossary();
2019 $file = $a_target_dir.
"/term_".$int_link[
"id"].
".html";
2022 if (!($fp = @fopen(
$file,
"w+")))
2024 die (
"<b>Error</b>: Could not open \"".
$file.
"\" for writing".
2025 " in <b>".__FILE__.
"</b> on line <b>".__LINE__.
"</b><br />");
2028 fwrite($fp, $content);
2032 include_once(
"./Modules/Glossary/classes/class.ilGlossaryDefinition.php");
2034 foreach($defs as $def)
2037 foreach($def_mobs as $def_mob)
2039 $this->offline_mobs[$def_mob] = $def_mob;
2044 $this->offline_files = array_merge($this->offline_files, $def_files);
2063 $this->first_page_id = $first_page[
"child"];
2067 $int_links = array();
2068 $this->offline_files = array();
2070 foreach ($pages as $page)
2074 $ilLocator->clearItems();
2075 $ilBench->start(
"ExportHTML",
"exportHTMLPage");
2076 $ilBench->start(
"ExportHTML",
"exportPageHTML");
2077 $this->
exportPageHTML($a_lm_gui, $a_target_dir, $page[
"obj_id"]);
2078 $ilBench->stop(
"ExportHTML",
"exportPageHTML");
2081 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
2083 foreach($pg_mobs as $pg_mob)
2085 $mobs[$pg_mob] = $pg_mob;
2090 $int_links = array_merge($int_links, $pg_links);
2093 include_once(
"./Modules/File/classes/class.ilObjFile.php");
2095 $this->offline_files = array_merge($this->offline_files, $pg_files);
2097 $ilBench->stop(
"ExportHTML",
"exportHTMLPage");
2100 $this->offline_mobs =
$mobs;
2101 $this->offline_int_links = $int_links;
2115 $tpl =
new ilTemplate(
"tpl.main.html",
true,
true);
2116 $tpl->addBlockFile(
"CONTENT",
"content",
"tpl.adm_content.html");
2118 $_GET[
"obj_id"] = $a_lm_page_id;
2119 $_GET[
"frame"] = $a_frame;
2125 $file = $a_target_dir.
"/lm_pg_".$nid.
".html";
2129 $file = $a_target_dir.
"/lm_pg_".$a_lm_page_id.
".html";
2134 if ($a_frame !=
"toc")
2136 $file = $a_target_dir.
"/frame_".$a_lm_page_id.
"_".$a_frame.
".html";
2140 $file = $a_target_dir.
"/frame_".$a_frame.
".html";
2145 if (@is_file(
$file))
2150 $ilBench->start(
"ExportHTML",
"layout");
2151 $ilBench->start(
"ExportHTML",
"layout_".$a_frame);
2152 $content =& $a_lm_gui->layout(
"main.xml",
false);
2153 $ilBench->stop(
"ExportHTML",
"layout_".$a_frame);
2154 $ilBench->stop(
"ExportHTML",
"layout");
2157 if (!($fp = @fopen(
$file,
"w+")))
2159 die (
"<b>Error</b>: Could not open \"".
$file.
"\" for writing".
2160 " in <b>".__FILE__.
"</b> on line <b>".__LINE__.
"</b><br />");
2167 fwrite($fp, $content);
2172 if ($this->first_page_id == $a_lm_page_id && $a_frame ==
"")
2174 copy(
$file, $a_target_dir.
"/index.html");
2178 $ilBench->start(
"ExportHTML",
"getCurrentFrameSet");
2179 $frameset = $a_lm_gui->getCurrentFrameSet();
2180 $ilBench->stop(
"ExportHTML",
"getCurrentFrameSet");
2182 foreach ($frameset as $frame)
2184 $this->
exportPageHTML($a_lm_gui, $a_target_dir, $a_lm_page_id, $frame);
2201 $attrs[
"xmlns:fo"] =
"http://www.w3.org/1999/XSL/Format";
2202 $a_xml_writer->xmlStartTag(
"fo:root", $attrs);
2206 $a_xml_writer->xmlStartTag(
"fo:layout-master-set", $attrs);
2210 $attrs[
"master-name"] =
"DinA4";
2211 $attrs[
"page-height"] =
"29.7cm";
2212 $attrs[
"page-width"] =
"21cm";
2213 $attrs[
"margin-top"] =
"4cm";
2214 $attrs[
"margin-bottom"] =
"1cm";
2215 $attrs[
"margin-left"] =
"2.8cm";
2216 $attrs[
"margin-right"] =
"7.3cm";
2217 $a_xml_writer->xmlStartTag(
"fo:simple-page-master", $attrs);
2221 $attrs[
"margin-top"] =
"0cm";
2222 $attrs[
"margin-bottom"] =
"1.25cm";
2223 $a_xml_writer->xmlElement(
"fo:region-body", $attrs);
2227 $attrs[
"extent"] =
"1cm";
2228 $a_xml_writer->xmlElement(
"fo:region-before", $attrs);
2232 $attrs[
"extent"] =
"1cm";
2233 $a_xml_writer->xmlElement(
"fo:region-after", $attrs);
2236 $a_xml_writer->xmlEndTag(
"fo:simple-page-master");
2239 $a_xml_writer->xmlEndTag(
"fo:layout-master-set");
2243 $attrs[
"master-reference"] =
"DinA4";
2244 $a_xml_writer->xmlStartTag(
"fo:page-sequence", $attrs);
2248 $attrs[
"flow-name"] =
"xsl-region-body";
2249 $a_xml_writer->xmlStartTag(
"fo:flow", $attrs);
2254 $ilBench->start(
"ContentObjectExport",
"exportFOStructureObjects");
2256 $ilBench->stop(
"ContentObjectExport",
"exportFOStructureObjects");
2260 $a_xml_writer->xmlEndTag(
"fo:flow");
2263 $a_xml_writer->xmlEndTag(
"fo:page-sequence");
2266 $a_xml_writer->xmlEndTag(
"fo:root");
2277 $childs = $this->lm_tree->getChilds($this->lm_tree->getRootId());
2278 foreach ($childs as $child)
2280 if($child[
"type"] !=
"st")
2286 $structure_obj->exportFO($a_xml_writer, $expLog);
2287 unset($structure_obj);
2293 include_once(
"./Modules/LearningModule/classes/class.ilContObjectExport.php");
2297 $export_file = $cont_exp->buildExportFile();
2298 return $export_file;
2312 $lmtree->setTableNames(
'lm_tree',
'lm_data');
2313 $lmtree->setTreeTablePK(
"lm_id");
2316 $source_obj->setLMId($this->
getId());
2321 $target_obj->setLMId($this->
getId());
2322 $target_parent = $lmtree->getParentId(
$target_id);
2326 if ($source_obj->getType() ==
"pg")
2329 if ($lmtree->isInTree($source_obj->getId()))
2331 $node_data = $lmtree->getNodeData($source_obj->getId());
2334 if ($movecopy ==
"move")
2336 $parent_id = $lmtree->getParentId($source_obj->getId());
2337 $lmtree->deleteTree($node_data);
2340 require_once(
"classes/class.ilHistory.php");
2351 $new_page =& $source_obj->copy();
2352 $source_id = $new_page->getId();
2353 $source_obj =& $new_page;
2357 if(!$lmtree->isInTree($source_obj->getId()))
2364 else if ($as_subitem)
2368 $pg_childs =& $lmtree->getChildsByType($parent,
"pg");
2369 if (count($pg_childs) != 0)
2371 $target_pos = $pg_childs[count($pg_childs) - 1][
"obj_id"];
2377 $parent = $target_parent;
2381 $lmtree->insertNode($source_obj->getId(),
2382 $parent, $target_pos);
2385 if ($movecopy ==
"move")
2388 include_once(
"classes/class.ilHistory.php");
2402 if ($source_obj->getType() ==
"st")
2405 $source_node = $lmtree->getNodeData($source_id);
2406 $subnodes = $lmtree->getSubtree($source_node);
2409 foreach ($subnodes as $subnode)
2424 $pg_childs =& $lmtree->getChildsByType($target_parent,
"pg");
2425 if (count($pg_childs) != 0)
2427 $target_pos = $pg_childs[count($pg_childs) - 1][
"obj_id"];
2430 else if ($as_subitem)
2434 $childs =& $lmtree->getChilds($target_parent);
2435 if (count($childs) != 0)
2437 $target_pos = $childs[count($childs) - 1][
"obj_id"];
2462 if ($movecopy ==
"move")
2464 $lmtree->deleteTree($source_node);
2469 $new_chapter =& $source_obj->copy($lmtree, $target_parent, $target_pos);
2472 if (!$lmtree->isInTree($source_id))
2474 $lmtree->insertNode($source_id, $target_parent, $target_pos);
2477 if ($movecopy ==
"move")
2479 foreach ($subnodes as $node)
2481 if($node[
"obj_id"] != $source_id)
2483 $lmtree->insertNode($node[
"obj_id"], $node[
"parent"]);