4 require_once
"./Services/Object/classes/class.ilObject.php";
5 require_once
"Services/MetaData/classes/class.ilMDLanguageItem.php";
6 require_once(
"./Services/Xml/classes/class.ilNestedSetXML.php");
44 $this->
ilObject($a_id,$a_call_by_reference);
46 $this->mob_ids = array();
47 $this->file_ids = array();
48 $this->q_ids = array();
54 function create($a_no_meta_data =
false)
81 # echo "Content<br>\n";
84 $this->lm_tree->setTableNames(
'lm_tree',
'lm_data');
85 $this->lm_tree->setTreeTablePK(
"lm_id");
90 $set = $ilDB->query(
"SELECT * FROM lm_glossaries ".
91 " WHERE lm_id = ".$ilDB->quote($this->getId(),
"integer")
94 while ($rec = $ilDB->fetchAssoc($set))
96 $glos[] = $rec[
"glo_id"];
149 $this->import_id = $a_id;
159 $this->layout_per_page = $a_val;
169 return $this->layout_per_page;
179 $this->disable_def_feedback = $a_val;
189 return $this->disable_def_feedback;
199 $this->progr_icons = $a_val;
209 return $this->progr_icons;
219 $this->store_tries = $a_val;
229 return $this->store_tries;
239 $this->restrict_forw_nav = $a_val;
249 return $this->restrict_forw_nav;
280 $ilDB->manipulate(
"DELETE FROM lm_glossaries WHERE ".
281 " lm_id = ".$ilDB->quote($this->getId(),
"integer")
285 $ilDB->manipulate(
"INSERT INTO lm_glossaries ".
286 "(lm_id, glo_id) VALUES (".
287 $ilDB->quote($this->getId(),
"integer").
",".
288 $ilDB->quote($glo_id,
"integer").
328 $this->lm_tree->setTreeTablePK(
"lm_id");
329 $this->lm_tree->setTableNames(
'lm_tree',
'lm_data');
330 $this->lm_tree->addTree($this->
getId(), 1);
340 $this->auto_glossaries = array();
341 if (is_array($a_val))
343 foreach ($a_val as $v)
347 !in_array($v, $this->auto_glossaries))
349 $this->auto_glossaries[] = $v;
392 include_once(
"./Modules/LearningModule/classes/class.ilLMObject.php");
393 include_once(
"./Modules/LearningModule/classes/class.ilStructureObject.php");
394 include_once(
"./Modules/LearningModule/classes/class.ilLMPageObject.php");
396 $root_id = $this->lm_tree->getRootId();
400 $chap->setType(
"st");
401 $chap->setTitle($lng->txt(
"cont_new_chap"));
402 $chap->setLMId($this->
getId());
408 $page->setType(
"pg");
409 $page->setTitle($lng->txt(
"cont_new_page"));
410 $page->setLMId($this->
getId());
433 if(!is_writable($lm_data_dir))
435 $this->ilias->raiseError(
"Content object Data Directory (".$lm_data_dir
436 .
") not writeable.",$this->ilias->error_obj->FATAL);
440 $lm_dir = $lm_data_dir.
"/lm_".$this->
getId();
442 if(!@is_dir($lm_dir))
444 $this->ilias->raiseError(
"Creation of Learning Module Directory failed.",$this->ilias->error_obj->FATAL);
452 $this->ilias->raiseError(
"Creation of Import Directory failed.",$this->ilias->error_obj->FATAL);
462 "/lm_".$this->getId();
470 if(strlen($this->import_dir))
476 "/lm_".$this->getId().
"/import";
495 $this->import_dir = $a_import_dir;
507 if(!is_writable($lm_data_dir))
509 $this->ilias->raiseError(
"Content object Data Directory (".$lm_data_dir
510 .
") not writeable.",$this->ilias->error_obj->FATAL);
513 $lm_dir = $lm_data_dir.
"/lm_".$this->
getId();
515 if(!@is_dir($lm_dir))
517 $this->ilias->raiseError(
"Creation of Learning Module Directory failed.",$this->ilias->error_obj->FATAL);
524 $export_dir = $lm_dir.
"/export_scorm";
528 if (substr($a_type, 0, 4) ==
"html")
530 $export_dir = $lm_dir.
"/export_".$a_type;
534 $export_dir = $lm_dir.
"/export";
540 if(!@is_dir($export_dir))
542 $this->ilias->raiseError(
"Creation of Export Directory failed.",$this->ilias->error_obj->FATAL);
558 if (substr($a_type, 0, 4) ==
"html")
560 $export_dir =
ilUtil::getDataDir().
"/lm_data".
"/lm_".$this->getId().
"/export_".$a_type;
589 if (!parent::delete())
595 include_once(
"./Modules/LearningModule/classes/class.ilLMObject.php");
603 $nested->init($this->
getId(),
"bib");
604 $nested->deleteAllDBData();
608 $this->lm_tree->removeTree($this->lm_tree->getTreeId());
614 $q =
"DELETE FROM content_object WHERE id = ".
615 $ilDB->quote($this->
getId(),
"integer");
616 $ilDB->manipulate($q);
619 $q =
"DELETE FROM lm_menu WHERE lm_id = ".
620 $ilDB->quote($this->
getId(),
"integer");
621 $ilDB->manipulate($q);
624 $ilDB->manipulate(
"DELETE FROM lm_glossaries WHERE ".
625 " lm_id = ".$ilDB->quote($this->getId(),
"integer")
650 $this->layout = $a_layout;
666 $this->style_id = $a_style_id;
676 $q =
"UPDATE content_object SET ".
677 " stylesheet = ".$ilDB->quote((
int) $a_style_id,
"integer").
678 " WHERE id = ".$ilDB->quote($this->
getId(),
"integer");
679 $ilDB->manipulate($q);
681 $this->style_id = $a_style_id;
691 if ($a_from_style < 0)
693 $q =
"SELECT stylesheet FROM content_object, style_data ".
694 " WHERE content_object.stylesheet = style_data.id ".
695 " AND style_data.standard = ".$ilDB->quote(0,
"integer").
696 " AND content_object.stylesheet > ".$ilDB->quote(0,
"integer");
697 $style_set = $ilDB->query($q);
698 while($style_rec = $ilDB->fetchAssoc($style_set))
701 $q =
"UPDATE content_object SET ".
702 " stylesheet = ".$ilDB->quote((
int) $a_to_style,
"integer").
703 " WHERE stylesheet = ".$ilDB->quote($style_rec[
"stylesheet"],
"integer");
704 $ilDB->manipulate($q);
707 $style_obj =& $ilias->obj_factory->getInstanceByObjId($style_rec[
"stylesheet"]);
708 $style_obj->delete();
713 $q =
"UPDATE content_object SET ".
714 " stylesheet = ".$ilDB->quote((
int) $a_to_style,
"integer").
715 " WHERE stylesheet = ".$ilDB->quote($a_from_style,
"integer");
716 $ilDB->manipulate($q);
727 static protected function _lookup($a_obj_id, $a_field)
731 $q =
"SELECT ".$a_field.
" FROM content_object ".
732 " WHERE id = ".$ilDB->quote($a_obj_id,
"integer");
734 $res = $ilDB->query($q);
735 $rec = $ilDB->fetchAssoc(
$res);
737 return $rec[$a_field];
758 $q =
"SELECT stylesheet FROM content_object ".
759 " WHERE id = ".$ilDB->quote($a_cont_obj_id,
"integer");
760 $res = $ilDB->query($q);
761 $sheet = $ilDB->fetchAssoc(
$res);
763 return $sheet[
"stylesheet"];
773 $q =
"SELECT id FROM content_object ".
774 " WHERE stylesheet = ".$ilDB->quote($a_style_id,
"integer");
775 $res = $ilDB->query($q);
777 while($cont = $ilDB->fetchAssoc(
$res))
779 $obj_ids[] = $cont[
"id"];
791 $q =
"SELECT disable_def_feedback FROM content_object ".
792 " WHERE id = ".$ilDB->quote($a_id,
"integer");
793 $res = $ilDB->query($q);
794 $rec = $ilDB->fetchAssoc(
$res);
796 return $rec[
"disable_def_feedback"];
806 $q =
"SELECT store_tries FROM content_object ".
807 " WHERE id = ".$ilDB->quote($a_id,
"integer");
808 $res = $ilDB->query($q);
809 $rec = $ilDB->fetchAssoc(
$res);
811 return $rec[
"store_tries"];
824 $q =
"SELECT count(*) as cnt FROM content_object ".
825 " WHERE stylesheet = ".$ilDB->quote($a_style_id,
"integer");
826 $cset = $ilDB->query($q);
827 $crow = $ilDB->fetchAssoc($cset);
829 return (
int) $crow[
"cnt"];
841 $q =
"SELECT count(*) as cnt FROM content_object, style_data ".
842 " WHERE stylesheet = style_data.id ".
843 " AND standard = ".$ilDB->quote(0,
"integer");
844 $cset = $ilDB->query($q);
845 $crow = $ilDB->fetchAssoc($cset);
847 return (
int) $crow[
"cnt"];
857 $q =
"SELECT count(*) as cnt FROM content_object ".
858 " WHERE stylesheet = ".$ilDB->quote(0,
"integer");
859 $cset = $ilDB->query($q);
860 $crow = $ilDB->fetchAssoc($cset);
862 return (
int) $crow[
"cnt"];
874 $q =
"UPDATE content_object SET ".
875 " stylesheet = ".$ilDB->quote(0,
"integer").
876 " WHERE stylesheet = ".$ilDB->quote((
int) $this->
getId($a_style_id),
"integer");
878 $ilDB->manipulate($q);
896 $this->pg_header = $a_pg_header;
904 return $this->toc_mode;
912 return $this->public_access_mode;
922 $this->toc_mode = $a_toc_mode;
927 $this->online = $a_online;
937 $this->lm_menu_active = $a_act_lm_menu;
942 return $this->lm_menu_active;
947 $this->toc_active = $a_toc;
952 return $this->toc_active;
957 $this->numbering = $a_num;
962 return $this->numbering;
967 $this->print_view_active = $a_print;
972 return $this->print_view_active;
977 $this->prevent_glossary_appendix_active = $a_print;
982 return $this->prevent_glossary_appendix_active;
992 $this->hide_header_footer_print = $a_val;
1002 return $this->hide_header_footer_print;
1007 $this->downloads_active = $a_down;
1012 return $this->downloads_active;
1017 $this->downloads_public_active = $a_down;
1022 return $this->downloads_public_active;
1027 $this->pub_notes = $a_pub_notes;
1032 return $this->pub_notes;
1037 $this->clean_frames = $a_clean;
1042 return $this->clean_frames;
1047 $this->user_comments = $a_comm;
1052 $this->public_access_mode = $a_mode;
1057 return $this->user_comments;
1062 $this->header_page = $a_pg;
1067 return $this->header_page;
1072 $this->footer_page = $a_pg;
1077 return $this->footer_page;
1087 $q =
"SELECT * FROM content_object WHERE id = ".
1088 $ilDB->quote($this->
getId(),
"integer");
1090 $lm_rec = $ilDB->fetchAssoc(
$lm_set);
1091 $this->
setLayout($lm_rec[
"default_layout"]);
1121 include_once(
"./Services/Notes/classes/class.ilNote.php");
1138 $q =
"UPDATE content_object SET ".
1139 " default_layout = ".$ilDB->quote($this->
getLayout(),
"text").
", ".
1140 " stylesheet = ".$ilDB->quote($this->
getStyleSheetId(),
"integer").
",".
1141 " page_header = ".$ilDB->quote($this->
getPageHeader(),
"text").
",".
1142 " toc_mode = ".$ilDB->quote($this->
getTOCMode(),
"text").
",".
1157 " header_page = ".$ilDB->quote($this->
getHeaderPage(),
"integer").
",".
1158 " footer_page = ".$ilDB->quote($this->
getFooterPage(),
"integer").
",".
1160 " layout_per_page = ".$ilDB->quote($this->
getLayoutPerPage(),
"integer").
", ".
1161 " rating = ".$ilDB->quote($this->
hasRating(),
"integer").
", ".
1162 " rating_pages = ".$ilDB->quote($this->
hasRatingPages(),
"integer").
", ".
1165 " store_tries = ".$ilDB->quote($this->
getStoreTries(),
"integer").
", ".
1167 " WHERE id = ".$ilDB->quote($this->
getId(),
"integer");
1168 $ilDB->manipulate($q);
1171 include_once(
"./Services/Notes/classes/class.ilNote.php");
1182 $q =
"INSERT INTO content_object (id) VALUES (".$ilDB->quote($this->
getId(),
"integer").
")";
1183 $ilDB->manipulate($q);
1186 include_once(
"./Services/Notes/classes/class.ilNote.php");
1201 $q =
"SELECT is_online FROM content_object WHERE id = ".$ilDB->quote($a_id,
"integer");
1203 $lm_rec = $ilDB->fetchAssoc(
$lm_set);
1215 $dir = opendir(
"./Modules/LearningModule/layouts/lm");
1219 while(
$file = readdir($dir))
1224 if (@is_dir(
"./Modules/LearningModule/layouts/lm/".
$file))
1234 'toc2win' =>
'toc2win',
1235 'toc2windyn' =>
'toc2windyn',
1236 '1window' =>
'1window',
1237 '2window' =>
'2window',
1238 '3window' =>
'3window',
1239 'presentation' =>
'presentation',
1240 'fullscreen' =>
'fullscreen'
1243 foreach ($layouts as $l)
1245 if (!in_array($l,
$ret))
1262 $lm_tree->setTableNames(
'lm_tree',
'lm_data');
1268 foreach (
$path as $node)
1270 if ($node[
"type"] ==
"st")
1289 $lm_tree->setTableNames(
'lm_tree',
'lm_data');
1297 foreach (
$path as $node)
1299 if ($node[
"type"] ==
"st")
1303 foreach ($tconds as $tcond)
1324 $lm_tree->setTableNames(
'lm_tree',
'lm_data');
1332 foreach (
$path as $node)
1334 if ($node[
"type"] ==
"st")
1338 foreach ($tconds as $tcond)
1343 return $node[
"child"];
1363 function notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params = 0)
1403 if ($a_node_id==
$_GET[
"ref_id"])
1405 $parent_obj =& $this->ilias->obj_factory->getInstanceByRefId($a_node_id);
1406 $parent_type = $parent_obj->getType();
1407 if($parent_type == $this->
getType())
1409 $a_node_id = (int) $tree->getParentId($a_node_id);
1413 parent::notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params);
1422 $tree =
new ilTree($a_cont_obj_id);
1423 $tree->setTableNames(
'lm_tree',
'lm_data');
1424 $tree->setTreeTablePK(
"lm_id");
1425 if ($tree->isInTree($a_page_id))
1427 $succ = $tree->fetchSuccessorNode($a_page_id,
"pg");
1440 $tree->setTableNames(
'lm_tree',
'lm_data');
1441 $tree->setTreeTablePK(
"lm_id");
1443 $tree->checkTreeChilds();
1459 $set = $ilDB->query(
"SELECT DISTINCT l1.lm_id".
1461 " JOIN lm_tree l2 ON ( l1.child = l2.parent".
1462 " AND l1.lm_id = l2.lm_id )".
1463 " JOIN lm_data ON ( l1.child = lm_data.obj_id )".
1464 " WHERE (l2.lft < l1.lft".
1465 " OR l2.rgt > l1.rgt OR l2.lft > l1.rgt OR l2.rgt < l1.lft)".
1466 " AND l1.lm_id = ".$ilDB->quote($this->getId(),
"integer").
1467 " ORDER BY lm_data.create_date DESC"
1469 if ($rec = $ilDB->fetchAssoc($set))
1475 $nodes = $tree->getSubtree($tree->getNodeData($tree->getRootId()));
1476 foreach ($nodes as $node)
1478 $q =
"SELECT * FROM lm_data WHERE obj_id = ".
1479 $ilDB->quote($node[
"child"],
"integer");
1480 $obj_set = $ilDB->query($q);
1481 $obj_rec = $ilDB->fetchAssoc($obj_set);
1484 $node_data = $tree->getNodeData($node[
"child"]);
1485 $tree->deleteTree($node_data);
1490 $nodes = $tree->getSubtree($tree->getNodeData($tree->getRootId()));
1491 foreach ($nodes as $node)
1493 $q =
"SELECT * FROM lm_data WHERE obj_id = ".
1494 $ilDB->quote($node[
"parent"],
"integer");
1495 $obj_set = $ilDB->query($q);
1496 $obj_rec = $ilDB->fetchAssoc($obj_set);
1497 if ($obj_rec[
"type"] ==
"pg")
1499 $node_data = $tree->getNodeData($node[
"child"]);
1500 if ($tree->isInTree($node[
"child"]))
1502 $tree->deleteTree($node_data);
1509 $set = $ilDB->query(
"SELECT DISTINCT l1.lm_id".
1511 " JOIN lm_tree l2 ON ( l1.child = l2.child AND l1.lm_id <> l2.lm_id )".
1512 " JOIN lm_data ON (l1.child = lm_data.obj_id)".
1513 " WHERE l1.child <> 1".
1514 " AND l1.lm_id <> lm_data.lm_id".
1515 " AND l1.lm_id = ".$ilDB->quote($this->getId(),
"integer"));
1516 if ($rec = $ilDB->fetchAssoc($set))
1518 $set = $ilDB->query(
"SELECT DISTINCT l1.child ".
1520 " JOIN lm_tree l2 ON ( l1.child = l2.child AND l1.lm_id <> l2.lm_id )".
1521 " JOIN lm_data ON (l1.child = lm_data.obj_id)".
1522 " WHERE l1.child <> 1".
1523 " AND l1.lm_id <> lm_data.lm_id".
1524 " AND l1.lm_id = ".$ilDB->quote($this->getId(),
"integer"));
1525 include_once(
"./Modules/LearningModule/classes/class.ilLMObjectFactory.php");
1526 while ($rec = $ilDB->fetchAssoc($set))
1530 if (is_object($cobj))
1532 if ($cobj->getType() ==
"pg")
1535 $pg_copy = $cobj->copy($this);
1538 $ilDB->manipulate(
"UPDATE lm_tree SET ".
1539 " child = ".$ilDB->quote($pg_copy->getId(),
"integer").
1540 " WHERE child = ".$ilDB->quote($cobj->getId(),
"integer").
1541 " AND lm_id = ".$ilDB->quote($this->getId(),
"integer")
1544 else if ($cobj->getType() ==
"st")
1547 $st_copy = $cobj->copy($this);
1550 $ilDB->manipulate(
"UPDATE lm_tree SET ".
1551 " child = ".$ilDB->quote($st_copy->getId(),
"integer").
1552 " WHERE child = ".$ilDB->quote($cobj->getId(),
"integer").
1553 " AND lm_id = ".$ilDB->quote($this->getId(),
"integer")
1557 $ilDB->manipulate(
"UPDATE lm_tree SET ".
1558 " parent = ".$ilDB->quote($st_copy->getId(),
"integer").
1559 " WHERE parent = ".$ilDB->quote($cobj->getId(),
"integer").
1560 " AND lm_id = ".$ilDB->quote($this->getId(),
"integer")
1575 function exportXML(&$a_xml_writer, $a_inst, $a_target_dir, &$expLog)
1583 $attrs[
"Type"] =
"LearningModule";
1587 $attrs[
"Type"] =
"LibObject";
1590 $a_xml_writer->xmlStartTag(
"ContentObject", $attrs);
1597 $expLog->write(date(
"[y-m-d H:i:s] ").
"Start Export Structure Objects");
1598 $ilBench->start(
"ContentObjectExport",
"exportStructureObjects");
1600 $ilBench->stop(
"ContentObjectExport",
"exportStructureObjects");
1601 $expLog->write(date(
"[y-m-d H:i:s] ").
"Finished Export Structure Objects");
1604 $expLog->write(date(
"[y-m-d H:i:s] ").
"Start Export Page Objects");
1605 $ilBench->start(
"ContentObjectExport",
"exportPageObjects");
1607 $ilBench->stop(
"ContentObjectExport",
"exportPageObjects");
1608 $expLog->write(date(
"[y-m-d H:i:s] ").
"Finished Export Page Objects");
1611 $expLog->write(date(
"[y-m-d H:i:s] ").
"Start Export Media Objects");
1612 $ilBench->start(
"ContentObjectExport",
"exportMediaObjects");
1614 $ilBench->stop(
"ContentObjectExport",
"exportMediaObjects");
1615 $expLog->write(date(
"[y-m-d H:i:s] ").
"Finished Export Media Objects");
1618 $expLog->write(date(
"[y-m-d H:i:s] ").
"Start Export File Items");
1619 $ilBench->start(
"ContentObjectExport",
"exportFileItems");
1621 $ilBench->stop(
"ContentObjectExport",
"exportFileItems");
1622 $expLog->write(date(
"[y-m-d H:i:s] ").
"Finished Export File Items");
1625 if (count($this->q_ids) > 0)
1627 $qti_file = fopen($a_target_dir.
"/qti.xml",
"w");
1628 include_once(
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php");
1630 fwrite($qti_file, $pool->toXML($this->q_ids));
1636 $expLog->write(date(
"[y-m-d H:i:s] ").
"Start Export Properties");
1638 $expLog->write(date(
"[y-m-d H:i:s] ").
"Finished Export Properties");
1640 $a_xml_writer->xmlEndTag(
"ContentObject");
1651 include_once(
"Services/MetaData/classes/class.ilMD2XML.php");
1653 $md2xml->setExportMode(
true);
1654 $md2xml->startExport();
1655 $a_xml_writer->appendXML($md2xml->getXML());
1666 include_once
'./Modules/LearningModule/classes/class.ilStructureObject.php';
1668 $childs = $this->lm_tree->getChilds($this->lm_tree->getRootId());
1669 foreach ($childs as $child)
1671 if($child[
"type"] !=
"st")
1677 $structure_obj->exportXML($a_xml_writer, $a_inst, $expLog);
1678 unset($structure_obj);
1693 include_once
"./Modules/LearningModule/classes/class.ilLMPageObject.php";
1694 include_once
"./Modules/LearningModule/classes/class.ilLMPage.php";
1697 foreach ($pages as $page)
1701 $expLog->write(date(
"[y-m-d H:i:s] ").
"Page Object ".$page[
"obj_id"]);
1705 $page_obj->exportXML($a_xml_writer,
"normal", $a_inst);
1708 $mob_ids = $page_obj->getMediaObjectIDs();
1709 foreach($mob_ids as $mob_id)
1711 $this->mob_ids[$mob_id] = $mob_id;
1715 $file_ids = $page_obj->getFileItemIds();
1716 foreach($file_ids as $file_id)
1718 $this->file_ids[$file_id] = $file_id;
1722 $q_ids = $page_obj->getQuestionIds();
1723 foreach($q_ids as $q_id)
1725 $this->q_ids[$q_id] = $q_id;
1741 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
1743 $linked_mobs = array();
1746 foreach ($this->mob_ids as $mob_id)
1750 $expLog->write(date(
"[y-m-d H:i:s] ").
"Media Object ".$mob_id);
1752 $media_obj->exportXML($a_xml_writer, $a_inst);
1753 $media_obj->exportFiles($a_target_dir);
1755 $lmobs = $media_obj->getLinkedMediaObjects($this->mob_ids);
1756 $linked_mobs = array_merge($linked_mobs, $lmobs);
1763 foreach ($linked_mobs as $mob_id)
1767 $expLog->write(date(
"[y-m-d H:i:s] ").
"Media Object ".$mob_id);
1769 $media_obj->exportXML($a_xml_writer, $a_inst);
1770 $media_obj->exportFiles($a_target_dir);
1783 include_once(
"./Modules/File/classes/class.ilObjFile.php");
1785 foreach ($this->file_ids as $file_id)
1787 $expLog->write(date(
"[y-m-d H:i:s] ").
"File Item ".$file_id);
1788 $file_obj =
new ilObjFile($file_id,
false);
1789 $file_obj->export($a_target_dir);
1801 $a_xml_writer->xmlStartTag(
"Properties", $attrs);
1804 $attrs = array(
"Name" =>
"Layout",
"Value" => $this->
getLayout());
1805 $a_xml_writer->xmlElement(
"Property", $attrs);
1808 $attrs = array(
"Name" =>
"PageHeader",
"Value" => $this->
getPageHeader());
1809 $a_xml_writer->xmlElement(
"Property", $attrs);
1812 $attrs = array(
"Name" =>
"TOCMode",
"Value" => $this->
getTOCMode());
1813 $a_xml_writer->xmlElement(
"Property", $attrs);
1816 $attrs = array(
"Name" =>
"ActiveLMMenu",
"Value" =>
1818 $a_xml_writer->xmlElement(
"Property", $attrs);
1821 $attrs = array(
"Name" =>
"ActiveNumbering",
"Value" =>
1823 $a_xml_writer->xmlElement(
"Property", $attrs);
1826 $attrs = array(
"Name" =>
"ActiveTOC",
"Value" =>
1828 $a_xml_writer->xmlElement(
"Property", $attrs);
1831 $attrs = array(
"Name" =>
"ActivePrintView",
"Value" =>
1833 $a_xml_writer->xmlElement(
"Property", $attrs);
1839 $attrs = array(
"Name" =>
"CleanFrames",
"Value" =>
1841 $a_xml_writer->xmlElement(
"Property", $attrs);
1844 $attrs = array(
"Name" =>
"PublicNotes",
"Value" =>
1846 $a_xml_writer->xmlElement(
"Property", $attrs);
1849 $attrs = array(
"Name" =>
"HistoryUserComments",
"Value" =>
1851 $a_xml_writer->xmlElement(
"Property", $attrs);
1854 $attrs = array(
"Name" =>
"Rating",
"Value" =>
1856 $a_xml_writer->xmlElement(
"Property", $attrs);
1857 $attrs = array(
"Name" =>
"RatingPages",
"Value" =>
1859 $a_xml_writer->xmlElement(
"Property", $attrs);
1864 $attrs = array(
"Name" =>
"HeaderPage",
"Value" =>
1865 "il_".IL_INST_ID.
"_pg_".$this->getHeaderPage());
1866 $a_xml_writer->xmlElement(
"Property", $attrs);
1872 $attrs = array(
"Name" =>
"FooterPage",
"Value" =>
1873 "il_".IL_INST_ID.
"_pg_".$this->getFooterPage());
1874 $a_xml_writer->xmlElement(
"Property", $attrs);
1878 $attrs = array(
"Name" =>
"LayoutPerPage",
"Value" =>
1880 $a_xml_writer->xmlElement(
"Property", $attrs);
1883 $attrs = array(
"Name" =>
"ProgressIcons",
"Value" =>
1885 $a_xml_writer->xmlElement(
"Property", $attrs);
1888 $attrs = array(
"Name" =>
"StoreTries",
"Value" =>
1890 $a_xml_writer->xmlElement(
"Property", $attrs);
1893 $attrs = array(
"Name" =>
"RestrictForwardNavigation",
"Value" =>
1895 $a_xml_writer->xmlElement(
"Property", $attrs);
1898 $attrs = array(
"Name" =>
"DisableDefaultFeedback",
"Value" =>
1900 $a_xml_writer->xmlElement(
"Property", $attrs);
1902 $a_xml_writer->xmlEndTag(
"Properties");
1912 $types = array(
"xml",
"html",
"scorm");
1914 foreach ($types as
$type)
1918 if (!@is_dir($dir) or
1919 !is_writeable($dir))
1930 while ($entry = $cdir->read())
1932 if ($entry !=
"." and
1934 substr($entry, -4) ==
".zip" and
1935 ereg(
"^[0-9]{10}_{2}[0-9]+_{2}(lm_)*[0-9]+\.zip\$", $entry))
1937 $file[$entry.$type] = array(
"type" => $type,
"file" => $entry,
1938 "size" => filesize($dir.
"/".$entry));
1960 $this->public_export_file[$a_type] = $a_file;
1972 return $this->public_export_file[$a_type];
1981 if (!@is_dir($dir) or
1982 !is_writeable($dir))
1994 while ($entry = $dir->read())
1996 if ($entry !=
"." and
1998 substr($entry, -4) ==
".pdf" and
1999 ereg(
"^[0-9]{10}_{2}[0-9]+_{2}(lm_)*[0-9]+\.pdf\$", $entry))
2028 include(
"./Modules/LearningModule/classes/class.ilContObjectManifestBuilder.php");
2030 $man_builder->buildManifest();
2031 $man_builder->dump($a_target_dir);
2034 copy(
"Modules/LearningModule/scorm_xsd/adlcp_rootv1p2.xsd", $a_target_dir.
"/adlcp_rootv1p2.xsd");
2035 copy(
"Modules/LearningModule/scorm_xsd/imscp_rootv1p1p2.xsd", $a_target_dir.
"/imscp_rootv1p1p2.xsd");
2036 copy(
"Modules/LearningModule/scorm_xsd/imsmd_rootv1p2p1.xsd", $a_target_dir.
"/imsmd_rootv1p2p1.xsd");
2037 copy(
"Modules/LearningModule/scorm_xsd/ims_xml.xsd", $a_target_dir.
"/ims_xml.xsd");
2041 $zip_file = $a_target_dir.
"/".$date.
"__".IL_INST_ID.
"__".
2045 $a_target_dir.
"/imsmanifest.xml",
2046 $a_target_dir.
"/adlcp_rootv1p2.xsd",
2047 $a_target_dir.
"/imscp_rootv1p1p2.xsd",
2048 $a_target_dir.
"/ims_xml.xsd",
2049 $a_target_dir.
"/imsmd_rootv1p2p1.xsd")
2055 rename($zip_file, $dest_file);
2064 function exportHTML($a_target_dir,
$log, $a_zip_file =
true, $a_export_format =
"html", $a_lang =
"")
2068 $user_lang = $ilUser->getLanguage();
2071 $ilUser->setLanguage($a_lang);
2072 $ilUser->setCurrentLanguage($a_lang);
2073 $ilObjDataCache->deleteCachedEntry($this->
getId());
2079 $mob_dir = $a_target_dir.
"/mobs";
2081 $file_dir = $a_target_dir.
"/files";
2083 $teximg_dir = $a_target_dir.
"/teximg";
2085 $style_dir = $a_target_dir.
"/style";
2087 $style_img_dir = $a_target_dir.
"/style/images";
2089 $content_style_dir = $a_target_dir.
"/content_style";
2091 $content_style_img_dir = $a_target_dir.
"/content_style/images";
2097 $style_name = $ilUser->prefs[
"style"].
".css";
2098 copy($location_stylesheet, $style_dir.
"/".$style_name);
2099 $fh = fopen($location_stylesheet,
"r");
2100 $css = fread($fh, filesize($location_stylesheet));
2101 preg_match_all(
"/url\(([^\)]*)\)/",$css,$files);
2102 foreach (array_unique($files[1]) as $fileref)
2104 $css_fileref = str_replace(array(
"'",
'"'),
"", $fileref);
2105 $fileref = dirname($location_stylesheet).
"/".$css_fileref;
2106 if (is_file($fileref))
2111 copy($fileref, $style_dir.
"/".$css_fileref);
2118 $ilBench->start(
"ExportHTML",
"exportContentStyle");
2121 $cont_stylesheet =
"./Services/COPage/css/content.css";
2123 $css = fread(fopen($cont_stylesheet,
'r'),filesize($cont_stylesheet));
2124 preg_match_all(
"/url\(([^\)]*)\)/",$css,$files);
2125 foreach (array_unique($files[1]) as $fileref)
2127 if (is_file(str_replace(
"..",
".", $fileref)))
2129 copy(str_replace(
"..",
".", $fileref), $content_style_img_dir.
"/".basename($fileref));
2131 $css = str_replace($fileref,
"images/".basename($fileref),$css);
2133 fwrite(fopen($content_style_dir.
"/content.css",
'w'),$css);
2138 $style->writeCSSFile($content_style_dir.
"/content.css",
"images");
2139 $style->copyImagesToDir($content_style_img_dir);
2141 $ilBench->stop(
"ExportHTML",
"exportContentStyle");
2145 copy($syn_stylesheet, $a_target_dir.
"/syntaxhighlight.css");
2148 include_once(
"./Modules/LearningModule/classes/class.ilLMPresentationGUI.php");
2149 $_GET[
"cmd"] =
"nop";
2151 $lm_gui->setOfflineMode(
true);
2152 $lm_gui->setOfflineDirectory($a_target_dir);
2153 $lm_gui->setExportFormat($a_export_format);
2157 if ($a_lang == $ot->getMasterLanguage())
2163 $lm_gui->lang = $a_lang;
2168 $ilBench->start(
"ExportHTML",
"exportHTMLPages");
2170 $ilBench->stop(
"ExportHTML",
"exportHTMLPages");
2173 $ilBench->start(
"ExportHTML",
"exportHTMLGlossaryTerms");
2175 $ilBench->stop(
"ExportHTML",
"exportHTMLGlossaryTerms");
2178 $ilBench->start(
"ExportHTML",
"exportHTMLMediaObjects");
2179 $linked_mobs = array();
2180 foreach ($this->offline_mobs as $mob)
2184 $this->
exportHTMLMOB($a_target_dir, $lm_gui, $mob,
"_blank", $linked_mobs);
2187 $linked_mobs2 = array();
2188 foreach ($linked_mobs as $mob)
2192 $this->
exportHTMLMOB($a_target_dir, $lm_gui, $mob,
"_blank", $linked_mobs2);
2195 $_GET[
"obj_type"] =
"MediaObject";
2196 $_GET[
"obj_id"] = $a_mob_id;
2198 $ilBench->stop(
"ExportHTML",
"exportHTMLMediaObjects");
2201 $ilBench->start(
"ExportHTML",
"exportHTMLFileObjects");
2202 foreach ($this->offline_files as
$file)
2206 $ilBench->stop(
"ExportHTML",
"exportHTMLFileObjects");
2209 if (count($this->q_ids) > 0)
2211 foreach ($this->q_ids as $q_id)
2215 $a_target_dir.
"/assessment/0/".$q_id.
"/images");
2220 $ilBench->start(
"ExportHTML",
"exportHTMLTOC");
2221 $ilLocator->clearItems();
2224 $tpl =
new ilTemplate(
"tpl.main.html",
true,
true);
2226 $content =& $lm_gui->showTableOfContents();
2227 $file = $a_target_dir.
"/table_of_contents.html";
2230 if (!($fp = @fopen($file,
"w+")))
2232 die (
"<b>Error</b>: Could not open \"".$file.
"\" for writing".
2233 " in <b>".__FILE__.
"</b> on line <b>".__LINE__.
"</b><br />");
2236 fwrite($fp, $content);
2239 $ilBench->stop(
"ExportHTML",
"exportHTMLTOC");
2242 $ilBench->start(
"ExportHTML",
"exportHTMLImages");
2243 $image_dir = $a_target_dir.
"/images";
2247 $image_dir.
"/enlarge.svg");
2249 $image_dir.
"/browser/plus.png");
2251 $image_dir.
"/browser/minus.png");
2253 $image_dir.
"/browser/blank.png");
2255 $image_dir.
"/spacer.png");
2257 $image_dir.
"/icon_st.svg");
2259 $image_dir.
"/icon_pg.svg");
2261 $image_dir.
"/icon_lm.svg");
2263 $image_dir.
"/nav_arr_L.png");
2265 $image_dir.
"/nav_arr_R.png");
2267 $ilBench->stop(
"ExportHTML",
"exportHTMLImages");
2270 $services_dir = $a_target_dir.
"/Services";
2272 $media_service_dir = $services_dir.
"/MediaObjects";
2274 include_once(
"./Services/MediaObjects/classes/class.ilPlayerUtil.php");
2277 $mp3_dir = $media_service_dir.
"/flash_mp3_player";
2282 include_once(
"./Services/UIComponent/Explorer2/classes/class.ilExplorerBaseGUI.php");
2290 include_once(
"./Services/YUI/classes/class.ilYuiUtil.php");
2291 foreach (self::getSupplyingExportFiles($a_target_dir) as $f)
2293 if ($f[
"source"] !=
"")
2295 copy($f[
"source"], $f[
"target"]);
2300 $tpl =
new ilTemplate(
"tpl.main.html",
true,
true);
2301 $tpl->setVariable(
"LOCATION_STYLESHEET",$location_stylesheet);
2302 $tpl->addBlockFile(
"CONTENT",
"content",
"tpl.adm_content.html");
2306 $ilUser->setLanguage($user_lang);
2307 $ilUser->setCurrentLanguage($user_lang);
2325 $zip_file = $zip_target_dir.
"/".$date.
"__".IL_INST_ID.
"__".
2341 include_once(
"./Services/YUI/classes/class.ilYuiUtil.php");
2342 include_once(
"./Services/jQuery/classes/class.iljQueryUtil.php");
2343 include_once(
"./Services/MediaObjects/classes/class.ilPlayerUtil.php");
2344 include_once(
"./Services/UIComponent/Explorer2/classes/class.ilExplorerBaseGUI.php");
2347 "target" => $a_target_dir.
'/js/yahoo/yahoo-min.js',
2350 "target" => $a_target_dir.
'/js/yahoo/yahoo-dom-event.js',
2353 "target" => $a_target_dir.
'/js/yahoo/animation-min.js',
2355 array(
"source" =>
'./Services/JavaScript/js/Basic.js',
2356 "target" => $a_target_dir.
'/js/Basic.js',
2358 array(
"source" =>
'./Services/Accordion/js/accordion.js',
2359 "target" => $a_target_dir.
'/js/accordion.js',
2361 array(
"source" =>
'./Services/Accordion/css/accordion.css',
2362 "target" => $a_target_dir.
'/css/accordion.css',
2365 "target" => $a_target_dir.
'/js/jquery.js',
2368 "target" => $a_target_dir.
'/js/maphilight.js',
2371 "target" => $a_target_dir.
'/js/jquery-ui-min.js',
2373 array(
"source" =>
'./Services/COPage/js/ilCOPagePres.js',
2374 "target" => $a_target_dir.
'/js/ilCOPagePres.js',
2376 array(
"source" =>
'./Modules/Scorm2004/scripts/questions/pure.js',
2377 "target" => $a_target_dir.
'/js/pure.js',
2379 array(
"source" =>
'./Modules/Scorm2004/scripts/questions/question_handling.js',
2380 "target" => $a_target_dir.
'/js/question_handling.js',
2382 array(
"source" =>
'./Modules/TestQuestionPool/js/ilMatchingQuestion.js',
2383 "target" => $a_target_dir.
'/js/ilMatchingQuestion.js',
2385 array(
"source" =>
'./Modules/Scorm2004/templates/default/question_handling.css',
2386 "target" => $a_target_dir.
'/css/question_handling.css',
2388 array(
"source" =>
'./Modules/TestQuestionPool/templates/default/test_javascript.css',
2389 "target" => $a_target_dir.
'/css/test_javascript.css',
2403 array(
"source" =>
'./Modules/LearningModule/js/LearningModule.js',
2404 "target" => $a_target_dir.
'/js/LearningModule.js',
2412 $scripts[] = array(
"source" =>
"",
2426 $file_dir = $a_target_dir.
"/files/file_".$a_file_id;
2428 include_once(
"./Modules/File/classes/class.ilObjFile.php");
2429 $file_obj =
new ilObjFile($a_file_id,
false);
2430 $source_file = $file_obj->getDirectory($file_obj->getVersion()).
"/".$file_obj->getFileName();
2431 if (!is_file($source_file))
2433 $source_file = $file_obj->getDirectory().
"/".$file_obj->getFileName();
2435 if (is_file($source_file))
2437 copy($source_file, $file_dir.
"/".$file_obj->getFileName());
2444 function exportHTMLMOB($a_target_dir, &$a_lm_gui, $a_mob_id, $a_frame, &$a_linked_mobs)
2448 $mob_dir = $a_target_dir.
"/mobs";
2451 if (@is_dir($source_dir))
2457 $tpl =
new ilTemplate(
"tpl.main.html",
true,
true);
2458 $tpl->addBlockFile(
"CONTENT",
"content",
"tpl.adm_content.html");
2459 $_GET[
"obj_type"] =
"MediaObject";
2460 $_GET[
"mob_id"] = $a_mob_id;
2461 $_GET[
"frame"] = $a_frame;
2463 $content =& $a_lm_gui->media();
2464 $file = $a_target_dir.
"/media_".$a_mob_id.
".html";
2467 if (!($fp = @fopen(
$file,
"w+")))
2469 die (
"<b>Error</b>: Could not open \"".
$file.
"\" for writing".
2470 " in <b>".__FILE__.
"</b> on line <b>".__LINE__.
"</b><br />");
2473 fwrite($fp, $content);
2477 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
2479 if ($mob_obj->hasFullscreenItem())
2481 $tpl =
new ilTemplate(
"tpl.main.html",
true,
true);
2482 $tpl->addBlockFile(
"CONTENT",
"content",
"tpl.adm_content.html");
2483 $_GET[
"obj_type"] =
"";
2484 $_GET[
"frame"] =
"";
2485 $_GET[
"mob_id"] = $a_mob_id;
2486 $_GET[
"cmd"] =
"fullscreen";
2487 $content =& $a_lm_gui->fullscreen();
2488 $file = $a_target_dir.
"/fullscreen_".$a_mob_id.
".html";
2491 if (!($fp = @fopen(
$file,
"w+")))
2493 die (
"<b>Error</b>: Could not open \"".
$file.
"\" for writing".
2494 " in <b>".__FILE__.
"</b> on line <b>".__LINE__.
"</b><br />");
2497 fwrite($fp, $content);
2500 $linked_mobs = $mob_obj->getLinkedMediaObjects();
2501 $a_linked_mobs = array_merge($a_linked_mobs, $linked_mobs);
2511 foreach($this->offline_int_links as $int_link)
2513 $ilLocator->clearItems();
2514 if ($int_link[
"type"] ==
"git")
2517 $tpl->addBlockFile(
"CONTENT",
"content",
"tpl.adm_content.html");
2519 $_GET[
"obj_id"] = $int_link[
"id"];
2520 $_GET[
"frame"] =
"_blank";
2521 $content =& $a_lm_gui->glossary();
2522 $file = $a_target_dir.
"/term_".$int_link[
"id"].
".html";
2525 if (!($fp = @fopen(
$file,
"w+")))
2527 die (
"<b>Error</b>: Could not open \"".
$file.
"\" for writing".
2528 " in <b>".__FILE__.
"</b> on line <b>".__LINE__.
"</b><br />");
2531 fwrite($fp, $content);
2535 include_once(
"./Modules/Glossary/classes/class.ilGlossaryDefinition.php");
2537 foreach($defs as $def)
2540 foreach($def_mobs as $def_mob)
2542 $this->offline_mobs[$def_mob] = $def_mob;
2547 $this->offline_files = array_merge($this->offline_files, $def_files);
2566 $this->first_page_id = $first_page[
"child"];
2570 $int_links = array();
2571 $this->offline_files = array();
2573 include_once(
"./Services/COPage/classes/class.ilPageContentUsage.php");
2574 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
2578 $exp_id_map = array();
2580 if (
$lm_set->get(
"html_export_ids"))
2582 foreach ($pages as $page)
2585 if (trim($exp_id) !=
"")
2587 $exp_id_map[$page[
"obj_id"]] = trim($exp_id);
2598 foreach ($pages as $page)
2602 $ilLocator->clearItems();
2603 $ilBench->start(
"ExportHTML",
"exportHTMLPage");
2604 $ilBench->start(
"ExportHTML",
"exportPageHTML");
2607 $ilBench->stop(
"ExportHTML",
"exportPageHTML");
2611 foreach ($pcs as $pc)
2613 if ($pc[
"type"] ==
"incl")
2616 foreach($incl_mobs as $incl_mob)
2618 $mobs[$incl_mob] = $incl_mob;
2625 foreach($pg_mobs as $pg_mob)
2627 $mobs[$pg_mob] = $pg_mob;
2632 $int_links = array_merge($int_links, $pg_links);
2635 include_once(
"./Modules/File/classes/class.ilObjFile.php");
2637 $this->offline_files = array_merge($this->offline_files, $pg_files);
2640 include_once(
"./Services/COPage/classes/class.ilPCQuestion.php");
2642 foreach($q_ids as $q_id)
2644 $this->q_ids[$q_id] = $q_id;
2647 $ilBench->stop(
"ExportHTML",
"exportHTMLPage");
2650 $this->offline_mobs =
$mobs;
2651 $this->offline_int_links = $int_links;
2660 $a_exp_id_map = array())
2666 $tpl =
new ilTemplate(
"tpl.main.html",
true,
true);
2667 $tpl->addBlockFile(
"CONTENT",
"content",
"tpl.adm_content.html");
2669 include_once(
"./Services/COPage/classes/class.ilPCQuestion.php");
2672 $_GET[
"obj_id"] = $a_lm_page_id;
2673 $_GET[
"frame"] = $a_frame;
2678 if (is_array($a_exp_id_map) && isset($a_exp_id_map[$a_lm_page_id]))
2680 $file = $a_target_dir.
"/lm_pg_".$a_exp_id_map[$a_lm_page_id].
".html";
2684 $file = $a_target_dir.
"/lm_pg_".$a_lm_page_id.
".html";
2689 if ($a_frame !=
"toc")
2691 $file = $a_target_dir.
"/frame_".$a_lm_page_id.
"_".$a_frame.
".html";
2695 $file = $a_target_dir.
"/frame_".$a_frame.
".html";
2700 if (@is_file(
$file))
2705 $content =& $a_lm_gui->layout(
"main.xml",
false);
2708 if (!($fp = @fopen(
$file,
"w+")))
2710 die (
"<b>Error</b>: Could not open \"".
$file.
"\" for writing".
2711 " in <b>".__FILE__.
"</b> on line <b>".__LINE__.
"</b><br />");
2718 fwrite($fp, $content);
2723 if ($this->first_page_id == $a_lm_page_id && $a_frame ==
"")
2725 copy(
$file, $a_target_dir.
"/index.html");
2729 $frameset = $a_lm_gui->getCurrentFrameSet();
2731 foreach ($frameset as $frame)
2733 $this->
exportPageHTML($a_lm_gui, $a_target_dir, $a_lm_page_id, $frame);
2750 $attrs[
"xmlns:fo"] =
"http://www.w3.org/1999/XSL/Format";
2751 $a_xml_writer->xmlStartTag(
"fo:root", $attrs);
2755 $a_xml_writer->xmlStartTag(
"fo:layout-master-set", $attrs);
2759 $attrs[
"master-name"] =
"DinA4";
2760 $attrs[
"page-height"] =
"29.7cm";
2761 $attrs[
"page-width"] =
"21cm";
2762 $attrs[
"margin-top"] =
"4cm";
2763 $attrs[
"margin-bottom"] =
"1cm";
2764 $attrs[
"margin-left"] =
"2.8cm";
2765 $attrs[
"margin-right"] =
"7.3cm";
2766 $a_xml_writer->xmlStartTag(
"fo:simple-page-master", $attrs);
2770 $attrs[
"margin-top"] =
"0cm";
2771 $attrs[
"margin-bottom"] =
"1.25cm";
2772 $a_xml_writer->xmlElement(
"fo:region-body", $attrs);
2776 $attrs[
"extent"] =
"1cm";
2777 $a_xml_writer->xmlElement(
"fo:region-before", $attrs);
2781 $attrs[
"extent"] =
"1cm";
2782 $a_xml_writer->xmlElement(
"fo:region-after", $attrs);
2785 $a_xml_writer->xmlEndTag(
"fo:simple-page-master");
2788 $a_xml_writer->xmlEndTag(
"fo:layout-master-set");
2792 $attrs[
"master-reference"] =
"DinA4";
2793 $a_xml_writer->xmlStartTag(
"fo:page-sequence", $attrs);
2797 $attrs[
"flow-name"] =
"xsl-region-body";
2798 $a_xml_writer->xmlStartTag(
"fo:flow", $attrs);
2803 $ilBench->start(
"ContentObjectExport",
"exportFOStructureObjects");
2805 $ilBench->stop(
"ContentObjectExport",
"exportFOStructureObjects");
2809 $a_xml_writer->xmlEndTag(
"fo:flow");
2812 $a_xml_writer->xmlEndTag(
"fo:page-sequence");
2815 $a_xml_writer->xmlEndTag(
"fo:root");
2826 $childs = $this->lm_tree->getChilds($this->lm_tree->getRootId());
2827 foreach ($childs as $child)
2829 if($child[
"type"] !=
"st")
2835 $structure_obj->exportFO($a_xml_writer, $expLog);
2836 unset($structure_obj);
2842 include_once(
"./Modules/LearningModule/classes/class.ilContObjectExport.php");
2846 $export_file = $cont_exp->buildExportFile();
2847 return $export_file;
2861 $lmtree->setTableNames(
'lm_tree',
'lm_data');
2862 $lmtree->setTreeTablePK(
"lm_id");
2865 $source_obj->setLMId($this->
getId());
2870 $target_obj->setLMId($this->
getId());
2871 $target_parent = $lmtree->getParentId(
$target_id);
2875 if ($source_obj->getType() ==
"pg")
2878 if ($lmtree->isInTree($source_obj->getId()))
2880 $node_data = $lmtree->getNodeData($source_obj->getId());
2883 if ($movecopy ==
"move")
2885 $parent_id = $lmtree->getParentId($source_obj->getId());
2886 $lmtree->deleteTree($node_data);
2889 require_once(
"./Services/History/classes/class.ilHistory.php");
2900 $new_page =& $source_obj->copy();
2901 $source_id = $new_page->getId();
2902 $source_obj =& $new_page;
2906 if(!$lmtree->isInTree($source_obj->getId()))
2913 else if ($as_subitem)
2917 $pg_childs =& $lmtree->getChildsByType($parent,
"pg");
2918 if (count($pg_childs) != 0)
2920 $target_pos = $pg_childs[count($pg_childs) - 1][
"obj_id"];
2926 $parent = $target_parent;
2930 $lmtree->insertNode($source_obj->getId(),
2931 $parent, $target_pos);
2934 if ($movecopy ==
"move")
2937 include_once(
"./Services/History/classes/class.ilHistory.php");
2951 if ($source_obj->getType() ==
"st")
2954 $source_node = $lmtree->getNodeData($source_id);
2955 $subnodes = $lmtree->getSubtree($source_node);
2958 foreach ($subnodes as $subnode)
2973 $pg_childs =& $lmtree->getChildsByType($target_parent,
"pg");
2974 if (count($pg_childs) != 0)
2976 $target_pos = $pg_childs[count($pg_childs) - 1][
"obj_id"];
2979 else if ($as_subitem)
2983 $childs =& $lmtree->getChilds($target_parent);
2984 if (count($childs) != 0)
2986 $target_pos = $childs[count($childs) - 1][
"obj_id"];
3011 if ($movecopy ==
"move")
3013 $lmtree->deleteTree($source_node);
3018 $new_chapter =& $source_obj->copy($lmtree, $target_parent, $target_pos);
3021 if (!$lmtree->isInTree($source_id))
3023 $lmtree->insertNode($source_id, $target_parent, $target_pos);
3026 if ($movecopy ==
"move")
3028 foreach ($subnodes as $node)
3030 if($node[
"obj_id"] != $source_id)
3032 $lmtree->insertNode($node[
"obj_id"], $node[
"parent"]);
3050 include_once
"./Modules/LearningModule/classes/class.ilLMPageObject.php";
3051 include_once
"./Modules/LearningModule/classes/class.ilLMPage.php";
3056 foreach ($pages as $page)
3060 $cpage =
new ilLMPage($page[
"obj_id"]);
3062 $error = @$cpage->validateDom();
3066 $this->lng->loadLanguageModule(
"content");
3070 $mess.= $this->lng->txt(
"obj_pg").
": ".
$title;
3071 $mess.=
'<div class="small">';
3072 foreach ($error as $e)
3074 $err_mess = implode($e,
" - ");
3075 if (!is_int(strpos($err_mess,
":0:")))
3077 $mess.= htmlentities($err_mess).
"<br />";
3096 $a_import_into_help_module = 0)
3104 $file = pathinfo($a_filename);
3108 $a_filename, $full_path);
3113 $subdir = basename(
$file[
"basename"],
".".
$file[
"extension"]);
3119 if ($a_import_into_help_module > 0)
3124 foreach ($files as
$file)
3126 if (is_int(strpos($file[
"entry"],
"__help_")) &&
3127 is_int(strpos($file[
"entry"],
".zip")))
3129 include_once(
"./Services/Export/classes/class.ilImport.php");
3131 $imp->getMapping()->addMapping(
'Services/Help',
'help_module', 0, $a_import_into_help_module);
3132 include_once(
"./Modules/LearningModule/classes/class.ilLMObject.php");
3134 foreach ($chaps as $chap)
3136 $chap_arr = explode(
"_", $chap[
"import_id"]);
3137 $imp->getMapping()->addMapping(
'Services/Help',
'help_chap',
3138 $chap_arr[count($chap_arr) - 1], $chap[
"obj_id"]);
3140 $imp->importEntity($dir.
"/".$file[
"entry"], $file[
"entry"],
3141 "help",
"Services/Help",
true);
3164 $subdir = basename($a_directory);
3165 $xml_file = $a_directory.
"/".$subdir.
".xml";
3168 if (!is_dir($a_directory))
3170 return sprintf($lng->txt(
"cont_no_subdir_in_zip"), $subdir);
3174 if (!is_file($xml_file))
3176 return sprintf($lng->txt(
"cont_zip_file_invalid"), $subdir.
"/".$subdir.
".xml");
3180 $qti_file = $a_directory.
"/qti.xml";
3182 if (is_file($qti_file))
3184 include_once
"./Services/QTI/classes/class.ilQTIParser.php";
3185 include_once(
"./Modules/Test/classes/class.ilObjTest.php");
3188 $result = $qtiParser->startParsing ();
3189 $founditems = & $qtiParser->getFoundItems ();
3191 if (count($founditems) > 0)
3194 $qtiParser->setTestObject($testObj);
3195 $result = $qtiParser->startParsing();
3196 $qtis = array_merge($qtis, $qtiParser->getImportMapping());
3200 include_once (
"./Modules/LearningModule/classes/class.ilContObjParser.php");
3201 $contParser =
new ilContObjParser($this, $xml_file, $subdir, $qmapping);
3202 $contParser->setQuestionMapping($qtis);
3203 $contParser->startParsing();
3208 $style_file = $a_directory.
"/style.xml";
3209 $style_zip_file = $a_directory.
"/style.zip";
3210 if (is_file($style_zip_file))
3212 require_once(
"./Services/Style/classes/class.ilObjStyleSheet.php");
3214 $style->import($style_zip_file);
3217 else if (is_file($style_file))
3219 require_once(
"./Services/Style/classes/class.ilObjStyleSheet.php");
3221 $style->import($style_file);
3234 include_once(
"./Modules/LearningModule/classes/class.ilLMPage.php");
3261 if(!$cp_options->isRootNode($this->getRefId()))
3263 $new_obj->setOnline($this->
getOnline());
3266 $new_obj->setTitle($this->
getTitle());
3269 $new_obj->setLayout($this->
getLayout());
3283 $new_obj->setRating($this->
hasRating());
3290 $new_obj->createLMTree();
3293 include_once(
"./Services/Style/classes/class.ilObjStyleSheet.php");
3298 $style_obj = $ilias->obj_factory->getInstanceByObjId(
$style_id);
3299 $new_id = $style_obj->ilClone();
3300 $new_obj->setStyleSheetId($new_id);
3308 include_once(
'Services/Tracking/classes/class.ilLPObjSettings.php');
3310 $obj_settings->cloneSettings($new_obj->getId());
3311 unset($obj_settings);
3314 include_once(
"./Services/Object/classes/class.ilObjectTranslation.php");
3316 $ot->copy($new_obj->getId());
3328 $parent_id = $a_target_obj->lm_tree->readRootId();
3330 include_once(
"./Modules/LearningModule/classes/class.ilLMObject.php");
3331 include_once(
"./Modules/LearningModule/classes/class.ilLMPageObject.php");
3334 $chapters = $this->lm_tree->getChildsByType($this->lm_tree->readRootId(),
"st");
3335 $copied_nodes = array();
3337 foreach ($chapters as $chap)
3346 foreach ($pages as $p)
3348 if (!$this->lm_tree->isInTree($p[
"obj_id"]))
3351 $target_item = $item->copy($a_target_obj);
3352 $copied_nodes[$item->getId()] = $target_item->getId();
3357 include_once
'./Services/CopyWizard/classes/class.ilCopyWizardOptions.php';
3359 foreach($copied_nodes as $old_id => $new_id)
3363 $a_target_obj->getRefId().
'_'.$new_id
3369 $a_target_obj->checkTree();
3385 $set = $ilDB->query(
"SELECT * FROM lm_glossaries ".
3386 " WHERE lm_id = ".$ilDB->quote($a_lm_id,
"integer")
3389 while ($rec = $ilDB->fetchAssoc($set))
3391 $glos[] = $rec[
"glo_id"];
3405 include_once(
"./Modules/Glossary/classes/class.ilGlossaryTerm.php");
3409 include_once(
"./Modules/LearningModule/classes/class.ilLMPage.php");
3413 $found_pages = array();
3414 foreach ($pages as $p)
3417 $c = $pg->getXMLContent();
3418 foreach ($terms as
$t)
3420 if (is_int(stripos($c, $t[
"term"])))
3422 $found_pages[$p[
"id"]][
"terms"][] =
$t;
3423 if (!is_object($found_pages[$p[
"id"]][
"page"]))
3425 $found_pages[$p[
"id"]][
"page"] = $pg;
3433 include_once(
"./Services/COPage/classes/class.ilPCParagraph.php");
3434 foreach ($found_pages as
$id => $fp)
3454 if (!$a_as_obj_id && $a_id > 0 && $a_id == OH_REF_ID)
3467 $this->rating = (bool)$a_value;
3477 $this->rating_pages = (bool)$a_value;