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"];
110 return parent::getTitle();
118 parent::setTitle($a_title);
129 return parent::getDescription();
137 parent::setDescription($a_description);
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").
313 parent::putInTree($a_parent);
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];
748 return self::_lookup($a_obj_id,
"restrict_forw_nav");
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))
1261 $lm_tree =
new ilTree($cont_obj_id);
1262 $lm_tree->setTableNames(
'lm_tree',
'lm_data');
1263 $lm_tree->setTreeTablePK(
"lm_id");
1265 if ($lm_tree->isInTree($page_id))
1267 $path = $lm_tree->getPathFull($page_id, $lm_tree->readRootId());
1268 foreach (
$path as $node)
1270 if ($node[
"type"] ==
"st")
1288 $lm_tree =
new ilTree($cont_obj_id);
1289 $lm_tree->setTableNames(
'lm_tree',
'lm_data');
1290 $lm_tree->setTreeTablePK(
"lm_id");
1293 if ($lm_tree->isInTree($page_id))
1296 $path = $lm_tree->getPathFull($page_id, $lm_tree->readRootId());
1297 foreach (
$path as $node)
1299 if ($node[
"type"] ==
"st")
1303 foreach ($tconds as $tcond)
1323 $lm_tree =
new ilTree($cont_obj_id);
1324 $lm_tree->setTableNames(
'lm_tree',
'lm_data');
1325 $lm_tree->setTreeTablePK(
"lm_id");
1328 if ($lm_tree->isInTree($page_id))
1331 $path = $lm_tree->getPathFull($page_id, $lm_tree->readRootId());
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);
2565 $first_page = $lm_tree->fetchSuccessorNode($lm_tree->getRootId(),
"pg");
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");
3254 $new_obj = parent::cloneObject($a_target_id,$a_copy_id);
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");
3295 if ($style_id > 0 &&
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;
getHideHeaderFooterPrint()
Get hide header footer in print mode.
_getTargetsOfSource($a_source_type, $a_source_id, $a_source_lang="-")
Get all targets of a source object (e.g., a page)
static makeDirParents($a_dir)
Create a new directory and all parent directories.
static tf2yn($a_tf)
convert true/false to "y"/"n"
static _lookupDisableDefaultFeedback($a_id)
Lookup disable default feedback.
exportHTMLGlossaryTerms(&$a_lm_gui, $a_target_dir)
export glossary terms
static updateInternalLinks($a_copied_nodes, $a_parent_type="lm")
Update internal links, after multiple pages have been copied.
read()
read data of content object
Class NestedSetXML functions for storing XML-Data into nested-set-database-strcture.
getStyleSheetId()
get ID of assigned style sheet object
_checkPreconditionsOfPage($cont_ref_id, $cont_obj_id, $page_id)
checks wether the preconditions of a page are fulfilled or not
getExportDirectory($a_type="xml")
get export directory of lm
create($a_no_meta_data=false)
create content object
setPublicExportFile($a_type, $a_file)
specify public export file for type
static _getQuestionIdsForPage($a_parent_type, $a_page_id, $a_lang="-")
Get all questions of a page.
static _getConditionsOfTarget($a_target_ref_id, $a_target_obj_id, $a_target_type="")
get all conditions of target object
setTOCMode($a_toc_mode="chapters")
set toc mode
exportFO(&$a_xml_writer, $a_target_dir)
export object to fo
setPublicNotes($a_pub_notes)
getDefinitionList($a_term_id)
static
validatePages()
Validate all pages.
exportFileItems($a_target_dir, &$expLog)
export files of file itmes
setImportDirectory($a_import_dir)
Set import directory for further use in ilContObjParser.
static rCopy($a_sdir, $a_tdir, $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
exportHTML($a_target_dir, $log, $a_zip_file=true, $a_export_format="html", $a_lang="")
export html package
_lookupStyleSheetId($a_cont_obj_id)
lookup style sheet ID
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data
copyPlayerFilesToTargetDirectory($a_target_dir)
Copy css files to target dir.
isActiveHistoryUserComments()
exportXMLPageObjects(&$a_xml_writer, $a_inst, &$expLog)
export page objects to xml (see ilias_co.dtd)
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user
isActivePreventGlossaryAppendix()
getInstance(&$a_content_obj, $a_id=0, $a_halt=true)
getLayout()
get default page layout of content object (see directory layouts/)
getLocalMediaElementCssPath()
Get local path of jQuery file.
getStoreTries()
Get store tries.
updateMetaData()
update meta data entry
if(strpos($jquery_path, './')===0) else if(strpos($jquery_path, '.')===0) $mathJaxSetting
Class ilObject Basic functions for all objects.
createLMTree()
create content object tree (that stores structure object hierarchie)
executeDragDrop($source_id, $target_id, $first_child, $as_subitem=false, $movecopy="move")
Execute Drag Drop Action.
getImportDirectory()
get import directory of lm
getExportFiles()
get export files
ilObjContentObject($a_id=0, $a_call_by_reference=true)
Constructor public.
setActiveNumbering($a_num)
setLayoutPerPage($a_val)
Set layout per page.
createMetaData()
create meta data entry
static pasteTree($a_target_lm, $a_item_id, $a_parent_id, $a_target, $a_insert_time, &$a_copied_nodes, $a_as_copy=false, $a_source_lm=null)
Paste item (tree) from clipboard to current lm.
static unzip($a_file, $overwrite=false, $a_flat=false)
unzip file
getOfflineFiles($dir)
get offline files
static getAllPages($a_parent_type, $a_parent_id, $a_lang="-")
Get all pages for parent object.
_lookupContObjIdByStyleId($a_style_id)
lookup style sheet ID
static getDir($a_dir, $a_rec=false, $a_sub_dir="")
get directory
getPublicExportFile($a_type)
get public export file
Export class for content objects.
exportHTMLFile($a_target_dir, $a_file_id)
export file object
isActiveDownloadsPublic()
setDisableDefaultFeedback($a_val)
Set disable default feedback for questions.
setStyleSheetId($a_style_id)
set ID of assigned style sheet object
getAvailableLayouts()
get all available lm layouts
getAutoGlossaries()
Get auto glossaries.
removeAutoGlossary($a_glo_id)
Remove auto glossary.
hasSuccessorPage($a_cont_obj_id, $a_page_id)
checks if page has a successor page
static _lookupTitle($a_obj_id)
Lookup title.
_getFilesOfObject($a_type, $a_id, $a_usage_hist_nr=0, $a_usage_lang="-")
get all files of an object
getSyntaxStylePath()
get syntax style path
writeStyleSheetId($a_style_id)
write ID of assigned style sheet object to db
getPublicAccessMode()
get public access mode ("complete" | "selected")
getLocalMediaElementJsPath()
Get local path of jQuery file.
ilObject($a_id=0, $a_reference=true)
Constructor public.
static getLocalJsTreeJsPath()
Get local path of jsTree js.
exportXMLMetaData(&$a_xml_writer)
export content objects meta data to xml (see ilias_co.dtd)
exportFOStructureObjects(&$a_xml_writer)
export structure objects to fo
setActiveLMMenu($a_act_lm_menu)
setActiveDownloadsPublic($a_down)
_checkAllConditionsOfTarget($a_target_ref_id, $a_target_id, $a_target_type="", $a_usr_id=0)
checks wether all conditions of a target object are fulfilled
getUsagesOfPage($a_usage_id, $a_usage_type, $a_hist_nr=0, $a_all_hist_nrs=false, $a_lang="-")
Get page content usages for page.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
Class ilLMPresentationGUI.
exportXMLMediaObjects(&$a_xml_writer, $a_inst, $a_target_dir, &$expLog)
export media objects to xml (see ilias_co.dtd)
cloneObject($a_target_id, $a_copy_id=0)
Clone learning module.
static autoLinkGlossariesPage($a_page, $a_terms)
Auto link glossary of whole page.
setTitle($a_title)
set title of content object
createExportDirectory($a_type="xml")
creates data directory for export files (data_dir/lm_data/lm_<id>/export, depending on data directory...
addFirstChapterAndPage()
Add first chapter and page.
getLayoutPerPage()
Get layout per page.
setRestrictForwardNavigation($a_val)
Set restrict forward navigation.
_createEntry($a_obj_id, $a_action, $a_info_params="", $a_obj_type="", $a_user_comment="", $a_update_last=false)
Creates a new history entry for an object.
getLocaljQueryPath()
Get local path of jQuery file.
static _getInstance($a_copy_id)
Get instance of copy wizard options.
update()
update complete object (meta data and properties)
getProgressIcons()
Get progress icons.
static createHTMLExportDirs($a_target_dir)
Create html export directories.
_moveLMStyles($a_from_style, $a_to_style)
move learning modules from one style to another
_getMissingPreconditionsOfPage($cont_ref_id, $cont_obj_id, $page_id)
gets all missing preconditions of page
_writeImportId($a_obj_id, $a_import_id)
write import id to db (static)
if(!is_array($argv)) $options
importFromDirectory($a_directory, $a_validate=true)
Import lm from directory.
getPageHeader()
get page header mode (IL_CHAPTER_TITLE | IL_PAGE_TITLE | IL_NO_HEADER)
static _exists($a_parent_type, $a_id, $a_lang="")
Checks whether page exists.
getId()
get object id public
exportHTMLMOB($a_target_dir, &$a_lm_gui, $a_mob_id, $a_frame, &$a_linked_mobs)
export media object to html
setActivePrintView($a_print)
updateAutoGlossaries()
Update auto glossaries.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
setActiveDownloads($a_down)
static getTermList($a_glo_id, $searchterm="", $a_first_letter="", $a_def="", $a_tax_node=0, $a_add_amet_fields=false, array $a_amet_filter=null)
Get all terms for given set of glossary ids.
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
exportXMLStructureObjects(&$a_xml_writer, $a_inst, &$expLog)
export structure objects to xml (see ilias_co.dtd)
exportXMLProperties($a_xml_writer, &$expLog)
export properties of content object
readProperties()
read content object properties
static _lookupObjId($a_id)
static getLocalExplorerJsPath()
Get local path of explorer js.
getLocalMaphilightPath()
Get local path of maphilight file.
getTOCMode()
get toc mode ("chapters" | "pages")
special template class to simplify handling of ITX/PEAR
updateProperties()
Update content object properties.
setPageHeader($a_pg_header=IL_CHAPTER_TITLE)
set page header mode
static putInTree($a_obj, $a_parent_id="", $a_target_node_id="")
put this object into content object tree
& getLMTree()
get content object tree
_deleteStyleAssignments($a_style_id)
delete all style references to style
_getNrLMsIndividualStyles()
get number of learning modules with individual styles
static getFlashVideoPlayerDirectory()
Get flash video player directory.
putInTree($a_parent)
put content object in main tree
getPageList($lm_id)
static
redirection script todo: (a better solution should control the processing via a xml file) ...
cloneMetaData($target_obj)
Copy meta data.
setProgressIcons($a_val)
Set progress icons.
setPublicAccessMode($a_mode)
exportSCORM($a_target_dir, $log)
export scorm package
static getExportId($a_lm_id, $a_lmobj_id, $a_type="pg")
Get export ID.
static _handleImportRepositoryLinks($a_rep_import_id, $a_rep_type, $a_rep_ref_id)
Change targest of repository links.
getDisableDefaultFeedback()
Get disable default feedback for questions.
getDataDirectory()
get data directory
static zip($a_dir, $a_file, $compress_content=false)
zips given directory/file into given zip.file
getType()
get object type public
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
static _lookupType($a_id, $a_reference=false)
lookup object type
createImportDirectory()
creates data directory for import files (data_dir/lm_data/lm_<id>/import, depending on data directory...
static getSupplyingExportFiles($a_target_dir=".")
Get supplying export files.
static _lookup($a_obj_id, $a_field)
Lookup property.
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
static isOnlineHelpModule($a_id, $a_as_obj_id=false)
Is module an online module.
copyAllPagesAndChapters($a_target_obj, $a_copy_id=0)
Copy all pages and chapters.
_lookupOnline($a_id)
check wether content object is online
static getLocalPath($a_name="")
Get local path of a YUI js file.
static resetInitialState()
Reset initial state (for exports)
_lookupStandard($a_id)
Lookup standard flag.
exportPageHTML(&$a_lm_gui, $a_target_dir, $a_lm_page_id, $a_frame="", $a_exp_id_map=array())
export page html
static commentsActivated($a_rep_obj_id, $a_obj_id, $a_obj_type)
Are comments activated for object?
_checkCondition($a_id, $a_usr_id=0)
checks wether a single condition is fulfilled every trigger object type must implement a static metho...
static getDataDir()
get data directory (outside webspace)
getRestrictForwardNavigation()
Get restrict forward navigation.
importFromZipFile($a_tmp_file, $a_filename, $a_validate=true, $a_import_into_help_module=0)
Import lm from zip file.
static activateComments($a_rep_obj_id, $a_obj_id, $a_obj_type, $a_activate=true)
Activate notes feature.
static _lookupRestrictForwardNavigation($a_obj_id)
Lookup forward restriction navigation.
static _lookupStoreTries($a_id)
Lookup disable default feedback.
setLayout($a_layout)
set default page layout
setActivePreventGlossaryAppendix($a_print)
autoLinkGlossaryTerms($a_glo_id)
Auto link glossary terms.
static getInstance($a_obj_id)
Get instance.
setHideHeaderFooterPrint($a_val)
Set hide header footer in print mode.
getObjectList($lm_id, $type="")
static
_getMissingPreconditionsTopChapter($cont_obj_ref_id, $cont_obj_id, $page_id)
get top chapter of page for that any precondition is missing
getTitle()
get title of content object
notify($a_event, $a_ref_id, $a_parent_non_rbac_id, $a_node_id, $a_params=0)
notifys an object about an event occured Based on the event happend, each object may decide how it re...
getRefId()
get reference id public
deleteMetaData()
delete meta data entry
getLocaljQueryUIPath()
Get local path of jQuery UI file.
Class ilObjContentObject.
static yn2tf($a_yn)
convert "y"/"n" to true/false
setAutoGlossaries($a_val)
Set auto glossaries.
_getNrLMsNoStyle()
get number of learning modules assigned no style
setDescription($a_description)
set description of content object
exportXML(&$a_xml_writer, $a_inst, $a_target_dir, &$expLog)
export object to xml (see ilias_co.dtd)
_deleteAllObjectData(&$a_cobj)
delete all objects of content object (digi book / learning module)
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
getDescription()
get description of content object
static getWebspaceDir($mode="filesystem")
get webspace directory
createProperties()
create new properties record
setStoreTries($a_val)
Set store tries.
Content Object (ILIAS native learning module / digilib book) Manifest export class.
_getNrOfAssignedLMs($a_style_id)
gets the number of learning modules assigned to a content style
Extension of ilPageObject for learning modules.
setHistoryUserComments($a_comm)
exportHTMLPages(&$a_lm_gui, $a_target_dir, $a_lang="")
export all pages of learning module to html file
lookupAutoGlossaries($a_lm_id)
Lookup auto glossaries.
MDUpdateListener($a_element)
Meta data update listener.