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 global $rbacadmin, $rbacreview;
104 return $roles ? $roles : array();
116 # echo "Content<br>\n"; 119 $this->lm_tree->setTableNames(
'lm_tree',
'lm_data');
120 $this->lm_tree->setTreeTablePK(
"lm_id");
125 $set = $ilDB->query(
"SELECT * FROM lm_glossaries ".
126 " WHERE lm_id = ".$ilDB->quote($this->getId(),
"integer")
129 while ($rec = $ilDB->fetchAssoc($set))
131 $glos[] = $rec[
"glo_id"];
145 return parent::getTitle();
153 parent::setTitle($a_title);
164 return parent::getDescription();
172 parent::setDescription($a_description);
184 $this->import_id = $a_id;
194 $this->layout_per_page = $a_val;
204 return $this->layout_per_page;
214 $this->disable_def_feedback = $a_val;
224 return $this->disable_def_feedback;
254 $ilDB->manipulate(
"DELETE FROM lm_glossaries WHERE ".
255 " lm_id = ".$ilDB->quote($this->getId(),
"integer")
259 $ilDB->manipulate(
"INSERT INTO lm_glossaries ".
260 "(lm_id, glo_id) VALUES (".
261 $ilDB->quote($this->getId(),
"integer").
",".
262 $ilDB->quote($glo_id,
"integer").
287 parent::putInTree($a_parent);
302 $this->lm_tree->setTreeTablePK(
"lm_id");
303 $this->lm_tree->setTableNames(
'lm_tree',
'lm_data');
304 $this->lm_tree->addTree($this->
getId(), 1);
314 $this->auto_glossaries = array();
315 if (is_array($a_val))
317 foreach ($a_val as $v)
321 !in_array($v, $this->auto_glossaries))
323 $this->auto_glossaries[] = $v;
366 include_once(
"./Modules/LearningModule/classes/class.ilLMObject.php");
367 include_once(
"./Modules/LearningModule/classes/class.ilStructureObject.php");
368 include_once(
"./Modules/LearningModule/classes/class.ilLMPageObject.php");
370 $root_id = $this->lm_tree->getRootId();
374 $chap->setType(
"st");
375 $chap->setTitle($lng->txt(
"cont_new_chap"));
376 $chap->setLMId($this->
getId());
382 $page->setType(
"pg");
383 $page->setTitle($lng->txt(
"cont_new_page"));
384 $page->setLMId($this->
getId());
407 if(!is_writable($lm_data_dir))
409 $this->
ilias->raiseError(
"Content object Data Directory (".$lm_data_dir
410 .
") not writeable.",$this->
ilias->error_obj->FATAL);
414 $lm_dir = $lm_data_dir.
"/lm_".$this->
getId();
416 if(!@is_dir($lm_dir))
418 $this->
ilias->raiseError(
"Creation of Learning Module Directory failed.",$this->
ilias->error_obj->FATAL);
426 $this->
ilias->raiseError(
"Creation of Import Directory failed.",$this->
ilias->error_obj->FATAL);
436 "/lm_".$this->getId();
444 if(strlen($this->import_dir))
450 "/lm_".$this->getId().
"/import";
469 $this->import_dir = $a_import_dir;
481 if(!is_writable($lm_data_dir))
483 $this->
ilias->raiseError(
"Content object Data Directory (".$lm_data_dir
484 .
") not writeable.",$this->
ilias->error_obj->FATAL);
487 $lm_dir = $lm_data_dir.
"/lm_".$this->
getId();
489 if(!@is_dir($lm_dir))
491 $this->
ilias->raiseError(
"Creation of Learning Module Directory failed.",$this->
ilias->error_obj->FATAL);
498 $export_dir = $lm_dir.
"/export_scorm";
502 if (substr($a_type, 0, 4) ==
"html")
504 $export_dir = $lm_dir.
"/export_".$a_type;
508 $export_dir = $lm_dir.
"/export";
514 if(!@is_dir($export_dir))
516 $this->
ilias->raiseError(
"Creation of Export Directory failed.",$this->
ilias->error_obj->FATAL);
532 if (substr($a_type, 0, 4) ==
"html")
534 $export_dir =
ilUtil::getDataDir().
"/lm_data".
"/lm_".$this->getId().
"/export_".$a_type;
563 if (!parent::delete())
569 include_once(
"./Modules/LearningModule/classes/class.ilLMObject.php");
577 $nested->init($this->
getId(),
"bib");
578 $nested->deleteAllDBData();
582 $this->lm_tree->removeTree($this->lm_tree->getTreeId());
588 $q =
"DELETE FROM content_object WHERE id = ".
589 $ilDB->quote($this->
getId(),
"integer");
590 $ilDB->manipulate($q);
593 $q =
"DELETE FROM lm_menu WHERE lm_id = ".
594 $ilDB->quote($this->
getId(),
"integer");
595 $ilDB->manipulate($q);
598 $ilDB->manipulate(
"DELETE FROM lm_glossaries WHERE ".
599 " lm_id = ".$ilDB->quote($this->getId(),
"integer")
624 $this->layout = $a_layout;
640 $this->style_id = $a_style_id;
650 $q =
"UPDATE content_object SET ".
651 " stylesheet = ".$ilDB->quote((
int) $a_style_id,
"integer").
652 " WHERE id = ".$ilDB->quote($this->
getId(),
"integer");
653 $ilDB->manipulate($q);
655 $this->style_id = $a_style_id;
665 if ($a_from_style < 0)
667 $q =
"SELECT stylesheet FROM content_object, style_data ".
668 " WHERE content_object.stylesheet = style_data.id ".
669 " AND style_data.standard = ".$ilDB->quote(0,
"integer").
670 " AND content_object.stylesheet > ".$ilDB->quote(0,
"integer");
671 $style_set = $ilDB->query($q);
672 while($style_rec = $ilDB->fetchAssoc($style_set))
675 $q =
"UPDATE content_object SET ".
676 " stylesheet = ".$ilDB->quote((
int) $a_to_style,
"integer").
677 " WHERE stylesheet = ".$ilDB->quote($style_rec[
"stylesheet"],
"integer");
678 $ilDB->manipulate($q);
681 $style_obj =& $ilias->obj_factory->getInstanceByObjId($style_rec[
"stylesheet"]);
682 $style_obj->delete();
687 $q =
"UPDATE content_object SET ".
688 " stylesheet = ".$ilDB->quote((
int) $a_to_style,
"integer").
689 " WHERE stylesheet = ".$ilDB->quote($a_from_style,
"integer");
690 $ilDB->manipulate($q);
701 $q =
"SELECT stylesheet FROM content_object ".
702 " WHERE id = ".$ilDB->quote($a_cont_obj_id,
"integer");
703 $res = $ilDB->query($q);
704 $sheet = $ilDB->fetchAssoc(
$res);
706 return $sheet[
"stylesheet"];
716 $q =
"SELECT id FROM content_object ".
717 " WHERE stylesheet = ".$ilDB->quote($a_style_id,
"integer");
718 $res = $ilDB->query($q);
720 while($cont = $ilDB->fetchAssoc(
$res))
722 $obj_ids[] = $cont[
"id"];
734 $q =
"SELECT disable_def_feedback FROM content_object ".
735 " WHERE id = ".$ilDB->quote($a_id,
"integer");
736 $res = $ilDB->query($q);
737 $rec = $ilDB->fetchAssoc(
$res);
739 return $rec[
"disable_def_feedback"];
752 $q =
"SELECT count(*) as cnt FROM content_object ".
753 " WHERE stylesheet = ".$ilDB->quote($a_style_id,
"integer");
754 $cset = $ilDB->query($q);
755 $crow = $ilDB->fetchAssoc($cset);
757 return (
int) $crow[
"cnt"];
769 $q =
"SELECT count(*) as cnt FROM content_object, style_data ".
770 " WHERE stylesheet = style_data.id ".
771 " AND standard = ".$ilDB->quote(0,
"integer");
772 $cset = $ilDB->query($q);
773 $crow = $ilDB->fetchAssoc($cset);
775 return (
int) $crow[
"cnt"];
785 $q =
"SELECT count(*) as cnt FROM content_object ".
786 " WHERE stylesheet = ".$ilDB->quote(0,
"integer");
787 $cset = $ilDB->query($q);
788 $crow = $ilDB->fetchAssoc($cset);
790 return (
int) $crow[
"cnt"];
802 $q =
"UPDATE content_object SET ".
803 " stylesheet = ".$ilDB->quote(0,
"integer").
804 " WHERE stylesheet = ".$ilDB->quote((
int) $this->
getId($a_style_id),
"integer");
806 $ilDB->manipulate($q);
824 $this->pg_header = $a_pg_header;
832 return $this->toc_mode;
840 return $this->public_access_mode;
850 $this->toc_mode = $a_toc_mode;
855 $this->online = $a_online;
865 $this->lm_menu_active = $a_act_lm_menu;
870 return $this->lm_menu_active;
875 $this->toc_active = $a_toc;
880 return $this->toc_active;
885 $this->numbering = $a_num;
890 return $this->numbering;
895 $this->print_view_active = $a_print;
900 return $this->print_view_active;
905 $this->prevent_glossary_appendix_active = $a_print;
910 return $this->prevent_glossary_appendix_active;
920 $this->hide_header_footer_print = $a_val;
930 return $this->hide_header_footer_print;
935 $this->downloads_active = $a_down;
940 return $this->downloads_active;
945 $this->downloads_public_active = $a_down;
950 return $this->downloads_public_active;
955 $this->pub_notes = $a_pub_notes;
960 return $this->pub_notes;
965 $this->clean_frames = $a_clean;
970 return $this->clean_frames;
975 $this->user_comments = $a_comm;
980 $this->public_access_mode = $a_mode;
985 return $this->user_comments;
990 $this->header_page = $a_pg;
995 return $this->header_page;
1000 $this->footer_page = $a_pg;
1005 return $this->footer_page;
1015 $q =
"SELECT * FROM content_object WHERE id = ".
1016 $ilDB->quote($this->
getId(),
"integer");
1018 $lm_rec = $ilDB->fetchAssoc(
$lm_set);
1019 $this->
setLayout($lm_rec[
"default_layout"]);
1060 $q =
"UPDATE content_object SET ".
1061 " default_layout = ".$ilDB->quote($this->
getLayout(),
"text").
", ".
1062 " stylesheet = ".$ilDB->quote($this->
getStyleSheetId(),
"integer").
",".
1063 " page_header = ".$ilDB->quote($this->
getPageHeader(),
"text").
",".
1064 " toc_mode = ".$ilDB->quote($this->
getTOCMode(),
"text").
",".
1080 " header_page = ".$ilDB->quote($this->
getHeaderPage(),
"integer").
",".
1081 " footer_page = ".$ilDB->quote($this->
getFooterPage(),
"integer").
",".
1083 " layout_per_page = ".$ilDB->quote($this->
getLayoutPerPage(),
"integer").
", ".
1084 " rating = ".$ilDB->quote($this->
hasRating(),
"integer").
", ".
1085 " rating_pages = ".$ilDB->quote($this->
hasRatingPages(),
"integer").
", ".
1087 " WHERE id = ".$ilDB->quote($this->
getId(),
"integer");
1088 $ilDB->manipulate($q);
1098 $q =
"INSERT INTO content_object (id) VALUES (".$ilDB->quote($this->
getId(),
"integer").
")";
1099 $ilDB->manipulate($q);
1112 $q =
"SELECT is_online FROM content_object WHERE id = ".$ilDB->quote($a_id,
"integer");
1114 $lm_rec = $ilDB->fetchAssoc(
$lm_set);
1126 $dir = opendir(
"./Modules/LearningModule/layouts/lm");
1130 while(
$file = readdir($dir))
1135 if (@is_dir(
"./Modules/LearningModule/layouts/lm/".
$file))
1145 'toc2win' =>
'toc2win',
1146 'toc2windyn' =>
'toc2windyn',
1147 '1window' =>
'1window',
1148 '2window' =>
'2window',
1149 '3window' =>
'3window',
1150 'presentation' =>
'presentation',
1151 'fullscreen' =>
'fullscreen' 1154 foreach ($layouts as $l)
1156 if (!in_array($l,
$ret))
1172 $lm_tree =
new ilTree($cont_obj_id);
1173 $lm_tree->setTableNames(
'lm_tree',
'lm_data');
1174 $lm_tree->setTreeTablePK(
"lm_id");
1176 if ($lm_tree->isInTree($page_id))
1178 $path = $lm_tree->getPathFull($page_id, $lm_tree->readRootId());
1179 foreach (
$path as $node)
1181 if ($node[
"type"] ==
"st")
1199 $lm_tree =
new ilTree($cont_obj_id);
1200 $lm_tree->setTableNames(
'lm_tree',
'lm_data');
1201 $lm_tree->setTreeTablePK(
"lm_id");
1204 if ($lm_tree->isInTree($page_id))
1207 $path = $lm_tree->getPathFull($page_id, $lm_tree->readRootId());
1208 foreach (
$path as $node)
1210 if ($node[
"type"] ==
"st")
1214 foreach ($tconds as $tcond)
1234 $lm_tree =
new ilTree($cont_obj_id);
1235 $lm_tree->setTableNames(
'lm_tree',
'lm_data');
1236 $lm_tree->setTreeTablePK(
"lm_id");
1239 if ($lm_tree->isInTree($page_id))
1242 $path = $lm_tree->getPathFull($page_id, $lm_tree->readRootId());
1243 foreach (
$path as $node)
1245 if ($node[
"type"] ==
"st")
1249 foreach ($tconds as $tcond)
1254 return $node[
"child"];
1274 function notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params = 0)
1314 if ($a_node_id==
$_GET[
"ref_id"])
1316 $parent_obj =& $this->
ilias->obj_factory->getInstanceByRefId($a_node_id);
1317 $parent_type = $parent_obj->getType();
1318 if($parent_type == $this->
getType())
1320 $a_node_id = (int) $tree->getParentId($a_node_id);
1324 parent::notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params);
1333 $tree =
new ilTree($a_cont_obj_id);
1334 $tree->setTableNames(
'lm_tree',
'lm_data');
1335 $tree->setTreeTablePK(
"lm_id");
1336 if ($tree->isInTree($a_page_id))
1338 $succ = $tree->fetchSuccessorNode($a_page_id,
"pg");
1351 $tree->setTableNames(
'lm_tree',
'lm_data');
1352 $tree->setTreeTablePK(
"lm_id");
1354 $tree->checkTreeChilds();
1370 $set = $ilDB->query(
"SELECT DISTINCT l1.lm_id".
1372 " JOIN lm_tree l2 ON ( l1.child = l2.parent".
1373 " AND l1.lm_id = l2.lm_id )".
1374 " JOIN lm_data ON ( l1.child = lm_data.obj_id )".
1375 " WHERE (l2.lft < l1.lft".
1376 " OR l2.rgt > l1.rgt OR l2.lft > l1.rgt OR l2.rgt < l1.lft)".
1377 " AND l1.lm_id = ".$ilDB->quote($this->getId(),
"integer").
1378 " ORDER BY lm_data.create_date DESC" 1380 if ($rec = $ilDB->fetchAssoc($set))
1386 $nodes = $tree->getSubtree($tree->getNodeData($tree->getRootId()));
1387 foreach ($nodes as $node)
1389 $q =
"SELECT * FROM lm_data WHERE obj_id = ".
1390 $ilDB->quote($node[
"child"],
"integer");
1391 $obj_set = $ilDB->query($q);
1392 $obj_rec = $ilDB->fetchAssoc($obj_set);
1395 $node_data = $tree->getNodeData($node[
"child"]);
1396 $tree->deleteTree($node_data);
1401 $nodes = $tree->getSubtree($tree->getNodeData($tree->getRootId()));
1402 foreach ($nodes as $node)
1404 $q =
"SELECT * FROM lm_data WHERE obj_id = ".
1405 $ilDB->quote($node[
"parent"],
"integer");
1406 $obj_set = $ilDB->query($q);
1407 $obj_rec = $ilDB->fetchAssoc($obj_set);
1408 if ($obj_rec[
"type"] ==
"pg")
1410 $node_data = $tree->getNodeData($node[
"child"]);
1411 if ($tree->isInTree($node[
"child"]))
1413 $tree->deleteTree($node_data);
1420 $set = $ilDB->query(
"SELECT DISTINCT l1.lm_id".
1422 " JOIN lm_tree l2 ON ( l1.child = l2.child AND l1.lm_id <> l2.lm_id )".
1423 " JOIN lm_data ON (l1.child = lm_data.obj_id)".
1424 " WHERE l1.child <> 1".
1425 " AND l1.lm_id <> lm_data.lm_id".
1426 " AND l1.lm_id = ".$ilDB->quote($this->getId(),
"integer"));
1427 if ($rec = $ilDB->fetchAssoc($set))
1429 $set = $ilDB->query(
"SELECT DISTINCT l1.child ".
1431 " JOIN lm_tree l2 ON ( l1.child = l2.child AND l1.lm_id <> l2.lm_id )".
1432 " JOIN lm_data ON (l1.child = lm_data.obj_id)".
1433 " WHERE l1.child <> 1".
1434 " AND l1.lm_id <> lm_data.lm_id".
1435 " AND l1.lm_id = ".$ilDB->quote($this->getId(),
"integer"));
1436 include_once(
"./Modules/LearningModule/classes/class.ilLMObjectFactory.php");
1437 while ($rec = $ilDB->fetchAssoc($set))
1441 if (is_object($cobj))
1443 if ($cobj->getType() ==
"pg")
1446 $pg_copy = $cobj->copy($this);
1449 $ilDB->manipulate(
"UPDATE lm_tree SET ".
1450 " child = ".$ilDB->quote($pg_copy->getId(),
"integer").
1451 " WHERE child = ".$ilDB->quote($cobj->getId(),
"integer").
1452 " AND lm_id = ".$ilDB->quote($this->getId(),
"integer")
1455 else if ($cobj->getType() ==
"st")
1458 $st_copy = $cobj->copy($this);
1461 $ilDB->manipulate(
"UPDATE lm_tree SET ".
1462 " child = ".$ilDB->quote($st_copy->getId(),
"integer").
1463 " WHERE child = ".$ilDB->quote($cobj->getId(),
"integer").
1464 " AND lm_id = ".$ilDB->quote($this->getId(),
"integer")
1468 $ilDB->manipulate(
"UPDATE lm_tree SET ".
1469 " parent = ".$ilDB->quote($st_copy->getId(),
"integer").
1470 " WHERE parent = ".$ilDB->quote($cobj->getId(),
"integer").
1471 " AND lm_id = ".$ilDB->quote($this->getId(),
"integer")
1486 function exportXML(&$a_xml_writer, $a_inst, $a_target_dir, &$expLog)
1494 $attrs[
"Type"] =
"LearningModule";
1498 $attrs[
"Type"] =
"LibObject";
1501 $a_xml_writer->xmlStartTag(
"ContentObject", $attrs);
1508 $expLog->write(date(
"[y-m-d H:i:s] ").
"Start Export Structure Objects");
1509 $ilBench->start(
"ContentObjectExport",
"exportStructureObjects");
1511 $ilBench->stop(
"ContentObjectExport",
"exportStructureObjects");
1512 $expLog->write(date(
"[y-m-d H:i:s] ").
"Finished Export Structure Objects");
1515 $expLog->write(date(
"[y-m-d H:i:s] ").
"Start Export Page Objects");
1516 $ilBench->start(
"ContentObjectExport",
"exportPageObjects");
1518 $ilBench->stop(
"ContentObjectExport",
"exportPageObjects");
1519 $expLog->write(date(
"[y-m-d H:i:s] ").
"Finished Export Page Objects");
1522 $expLog->write(date(
"[y-m-d H:i:s] ").
"Start Export Media Objects");
1523 $ilBench->start(
"ContentObjectExport",
"exportMediaObjects");
1525 $ilBench->stop(
"ContentObjectExport",
"exportMediaObjects");
1526 $expLog->write(date(
"[y-m-d H:i:s] ").
"Finished Export Media Objects");
1529 $expLog->write(date(
"[y-m-d H:i:s] ").
"Start Export File Items");
1530 $ilBench->start(
"ContentObjectExport",
"exportFileItems");
1532 $ilBench->stop(
"ContentObjectExport",
"exportFileItems");
1533 $expLog->write(date(
"[y-m-d H:i:s] ").
"Finished Export File Items");
1536 if (count($this->q_ids) > 0)
1538 $qti_file = fopen($a_target_dir.
"/qti.xml",
"w");
1539 include_once(
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php");
1541 fwrite($qti_file, $pool->toXML($this->q_ids));
1547 $expLog->write(date(
"[y-m-d H:i:s] ").
"Start Export Properties");
1549 $expLog->write(date(
"[y-m-d H:i:s] ").
"Finished Export Properties");
1551 $a_xml_writer->xmlEndTag(
"ContentObject");
1562 include_once(
"Services/MetaData/classes/class.ilMD2XML.php");
1564 $md2xml->setExportMode(
true);
1565 $md2xml->startExport();
1566 $a_xml_writer->appendXML($md2xml->getXML());
1577 include_once
'./Modules/LearningModule/classes/class.ilStructureObject.php';
1579 $childs = $this->lm_tree->getChilds($this->lm_tree->getRootId());
1580 foreach ($childs as $child)
1582 if($child[
"type"] !=
"st")
1588 $structure_obj->exportXML($a_xml_writer, $a_inst, $expLog);
1589 unset($structure_obj);
1604 include_once
"./Modules/LearningModule/classes/class.ilLMPageObject.php";
1605 include_once
"./Modules/LearningModule/classes/class.ilLMPage.php";
1608 foreach ($pages as $page)
1612 $expLog->write(date(
"[y-m-d H:i:s] ").
"Page Object ".$page[
"obj_id"]);
1616 $page_obj->exportXML($a_xml_writer,
"normal", $a_inst);
1619 $mob_ids = $page_obj->getMediaObjectIDs();
1620 foreach($mob_ids as $mob_id)
1622 $this->mob_ids[$mob_id] = $mob_id;
1626 $file_ids = $page_obj->getFileItemIds();
1627 foreach($file_ids as $file_id)
1629 $this->file_ids[$file_id] = $file_id;
1633 $q_ids = $page_obj->getQuestionIds();
1634 foreach($q_ids as $q_id)
1636 $this->q_ids[$q_id] = $q_id;
1652 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
1654 $linked_mobs = array();
1657 foreach ($this->mob_ids as $mob_id)
1661 $expLog->write(date(
"[y-m-d H:i:s] ").
"Media Object ".$mob_id);
1663 $media_obj->exportXML($a_xml_writer, $a_inst);
1664 $media_obj->exportFiles($a_target_dir);
1666 $lmobs = $media_obj->getLinkedMediaObjects($this->mob_ids);
1667 $linked_mobs = array_merge($linked_mobs, $lmobs);
1674 foreach ($linked_mobs as $mob_id)
1678 $expLog->write(date(
"[y-m-d H:i:s] ").
"Media Object ".$mob_id);
1680 $media_obj->exportXML($a_xml_writer, $a_inst);
1681 $media_obj->exportFiles($a_target_dir);
1694 include_once(
"./Modules/File/classes/class.ilObjFile.php");
1696 foreach ($this->file_ids as $file_id)
1698 $expLog->write(date(
"[y-m-d H:i:s] ").
"File Item ".$file_id);
1699 $file_obj =
new ilObjFile($file_id,
false);
1700 $file_obj->export($a_target_dir);
1712 $a_xml_writer->xmlStartTag(
"Properties", $attrs);
1715 $attrs = array(
"Name" =>
"Layout",
"Value" => $this->
getLayout());
1716 $a_xml_writer->xmlElement(
"Property", $attrs);
1719 $attrs = array(
"Name" =>
"PageHeader",
"Value" => $this->
getPageHeader());
1720 $a_xml_writer->xmlElement(
"Property", $attrs);
1723 $attrs = array(
"Name" =>
"TOCMode",
"Value" => $this->
getTOCMode());
1724 $a_xml_writer->xmlElement(
"Property", $attrs);
1727 $attrs = array(
"Name" =>
"ActiveLMMenu",
"Value" =>
1729 $a_xml_writer->xmlElement(
"Property", $attrs);
1732 $attrs = array(
"Name" =>
"ActiveNumbering",
"Value" =>
1734 $a_xml_writer->xmlElement(
"Property", $attrs);
1737 $attrs = array(
"Name" =>
"ActiveTOC",
"Value" =>
1739 $a_xml_writer->xmlElement(
"Property", $attrs);
1742 $attrs = array(
"Name" =>
"ActivePrintView",
"Value" =>
1744 $a_xml_writer->xmlElement(
"Property", $attrs);
1750 $attrs = array(
"Name" =>
"CleanFrames",
"Value" =>
1752 $a_xml_writer->xmlElement(
"Property", $attrs);
1755 $attrs = array(
"Name" =>
"PublicNotes",
"Value" =>
1757 $a_xml_writer->xmlElement(
"Property", $attrs);
1760 $attrs = array(
"Name" =>
"HistoryUserComments",
"Value" =>
1762 $a_xml_writer->xmlElement(
"Property", $attrs);
1765 $attrs = array(
"Name" =>
"Rating",
"Value" =>
1767 $a_xml_writer->xmlElement(
"Property", $attrs);
1768 $attrs = array(
"Name" =>
"RatingPages",
"Value" =>
1770 $a_xml_writer->xmlElement(
"Property", $attrs);
1775 $attrs = array(
"Name" =>
"HeaderPage",
"Value" =>
1776 "il_".IL_INST_ID.
"_pg_".$this->getHeaderPage());
1777 $a_xml_writer->xmlElement(
"Property", $attrs);
1783 $attrs = array(
"Name" =>
"FooterPage",
"Value" =>
1784 "il_".IL_INST_ID.
"_pg_".$this->getFooterPage());
1785 $a_xml_writer->xmlElement(
"Property", $attrs);
1788 $a_xml_writer->xmlEndTag(
"Properties");
1798 $types = array(
"xml",
"html",
"scorm");
1800 foreach ($types as
$type)
1804 if (!@is_dir($dir) or
1805 !is_writeable($dir))
1816 while ($entry = $cdir->read())
1818 if ($entry !=
"." and
1820 substr($entry, -4) ==
".zip" and
1821 ereg(
"^[0-9]{10}_{2}[0-9]+_{2}(lm_)*[0-9]+\.zip\$", $entry))
1823 $file[$entry.$type] = array(
"type" => $type,
"file" => $entry,
1824 "size" => filesize($dir.
"/".$entry));
1846 $this->public_export_file[$a_type] = $a_file;
1858 return $this->public_export_file[$a_type];
1867 if (!@is_dir($dir) or
1868 !is_writeable($dir))
1880 while ($entry = $dir->read())
1882 if ($entry !=
"." and
1884 substr($entry, -4) ==
".pdf" and
1885 ereg(
"^[0-9]{10}_{2}[0-9]+_{2}(lm_)*[0-9]+\.pdf\$", $entry))
1914 include(
"./Modules/LearningModule/classes/class.ilContObjectManifestBuilder.php");
1916 $man_builder->buildManifest();
1917 $man_builder->dump($a_target_dir);
1920 copy(
"Modules/LearningModule/scorm_xsd/adlcp_rootv1p2.xsd", $a_target_dir.
"/adlcp_rootv1p2.xsd");
1921 copy(
"Modules/LearningModule/scorm_xsd/imscp_rootv1p1p2.xsd", $a_target_dir.
"/imscp_rootv1p1p2.xsd");
1922 copy(
"Modules/LearningModule/scorm_xsd/imsmd_rootv1p2p1.xsd", $a_target_dir.
"/imsmd_rootv1p2p1.xsd");
1923 copy(
"Modules/LearningModule/scorm_xsd/ims_xml.xsd", $a_target_dir.
"/ims_xml.xsd");
1927 $zip_file = $a_target_dir.
"/".$date.
"__".IL_INST_ID.
"__".
1931 $a_target_dir.
"/imsmanifest.xml",
1932 $a_target_dir.
"/adlcp_rootv1p2.xsd",
1933 $a_target_dir.
"/imscp_rootv1p1p2.xsd",
1934 $a_target_dir.
"/ims_xml.xsd",
1935 $a_target_dir.
"/imsmd_rootv1p2p1.xsd")
1941 rename($zip_file, $dest_file);
1950 function exportHTML($a_target_dir,
$log, $a_zip_file =
true, $a_export_format =
"html", $a_lang =
"")
1954 $user_lang = $ilUser->getLanguage();
1957 $ilUser->setLanguage($a_lang);
1958 $ilUser->setCurrentLanguage($a_lang);
1959 $ilObjDataCache->deleteCachedEntry($this->
getId());
1965 $mob_dir = $a_target_dir.
"/mobs";
1967 $file_dir = $a_target_dir.
"/files";
1969 $teximg_dir = $a_target_dir.
"/teximg";
1971 $style_dir = $a_target_dir.
"/style";
1973 $style_img_dir = $a_target_dir.
"/style/images";
1975 $content_style_dir = $a_target_dir.
"/content_style";
1977 $content_style_img_dir = $a_target_dir.
"/content_style/images";
1983 $style_name = $ilUser->prefs[
"style"].
".css";
1984 copy($location_stylesheet, $style_dir.
"/".$style_name);
1985 $fh = fopen($location_stylesheet,
"r");
1986 $css = fread($fh, filesize($location_stylesheet));
1987 preg_match_all(
"/url\(([^\)]*)\)/",$css,$files);
1988 foreach (array_unique($files[1]) as $fileref)
1990 $fileref = dirname($location_stylesheet).
"/".$fileref;
1991 if (is_file($fileref))
1993 copy($fileref, $style_img_dir.
"/".basename($fileref));
2000 $ilBench->start(
"ExportHTML",
"exportContentStyle");
2003 $cont_stylesheet =
"./Services/COPage/css/content.css";
2005 $css = fread(fopen($cont_stylesheet,
'r'),filesize($cont_stylesheet));
2006 preg_match_all(
"/url\(([^\)]*)\)/",$css,$files);
2007 foreach (array_unique($files[1]) as $fileref)
2009 if (is_file(str_replace(
"..",
".", $fileref)))
2011 copy(str_replace(
"..",
".", $fileref), $content_style_img_dir.
"/".basename($fileref));
2013 $css = str_replace($fileref,
"images/".basename($fileref),$css);
2015 fwrite(fopen($content_style_dir.
"/content.css",
'w'),$css);
2020 $style->writeCSSFile($content_style_dir.
"/content.css",
"images");
2021 $style->copyImagesToDir($content_style_img_dir);
2023 $ilBench->stop(
"ExportHTML",
"exportContentStyle");
2027 copy($syn_stylesheet, $a_target_dir.
"/syntaxhighlight.css");
2030 include_once(
"./Modules/LearningModule/classes/class.ilLMPresentationGUI.php");
2031 $_GET[
"cmd"] =
"nop";
2033 $lm_gui->setOfflineMode(
true);
2034 $lm_gui->setOfflineDirectory($a_target_dir);
2035 $lm_gui->setExportFormat($a_export_format);
2039 if ($a_lang == $ot->getMasterLanguage())
2045 $lm_gui->lang = $a_lang;
2050 $ilBench->start(
"ExportHTML",
"exportHTMLPages");
2052 $ilBench->stop(
"ExportHTML",
"exportHTMLPages");
2055 $ilBench->start(
"ExportHTML",
"exportHTMLGlossaryTerms");
2057 $ilBench->stop(
"ExportHTML",
"exportHTMLGlossaryTerms");
2060 $ilBench->start(
"ExportHTML",
"exportHTMLMediaObjects");
2061 $linked_mobs = array();
2062 foreach ($this->offline_mobs as $mob)
2066 $this->
exportHTMLMOB($a_target_dir, $lm_gui, $mob,
"_blank", $linked_mobs);
2069 $linked_mobs2 = array();
2070 foreach ($linked_mobs as $mob)
2074 $this->
exportHTMLMOB($a_target_dir, $lm_gui, $mob,
"_blank", $linked_mobs2);
2077 $_GET[
"obj_type"] =
"MediaObject";
2078 $_GET[
"obj_id"] = $a_mob_id;
2080 $ilBench->stop(
"ExportHTML",
"exportHTMLMediaObjects");
2083 $ilBench->start(
"ExportHTML",
"exportHTMLFileObjects");
2084 foreach ($this->offline_files as
$file)
2088 $ilBench->stop(
"ExportHTML",
"exportHTMLFileObjects");
2091 if (count($this->q_ids) > 0)
2093 foreach ($this->q_ids as $q_id)
2097 $a_target_dir.
"/assessment/0/".$q_id.
"/images");
2102 $ilBench->start(
"ExportHTML",
"exportHTMLTOC");
2103 $ilLocator->clearItems();
2106 $tpl =
new ilTemplate(
"tpl.main.html",
true,
true);
2108 $content =& $lm_gui->showTableOfContents();
2109 $file = $a_target_dir.
"/table_of_contents.html";
2112 if (!($fp = @fopen($file,
"w+")))
2114 die (
"<b>Error</b>: Could not open \"".$file.
"\" for writing".
2115 " in <b>".__FILE__.
"</b> on line <b>".__LINE__.
"</b><br />");
2118 fwrite($fp, $content);
2121 $ilBench->stop(
"ExportHTML",
"exportHTMLTOC");
2124 $ilBench->start(
"ExportHTML",
"exportHTMLImages");
2125 $image_dir = $a_target_dir.
"/images";
2129 $image_dir.
"/enlarge.png");
2131 $image_dir.
"/browser/plus.png");
2133 $image_dir.
"/browser/minus.png");
2135 $image_dir.
"/browser/blank.png");
2137 $image_dir.
"/spacer.png");
2139 $image_dir.
"/icon_st.png");
2141 $image_dir.
"/icon_pg.png");
2143 $image_dir.
"/icon_st_s.png");
2145 $image_dir.
"/icon_pg_s.png");
2147 $image_dir.
"/icon_lm.png");
2149 $image_dir.
"/icon_lm_s.png");
2151 $image_dir.
"/nav_arr_L.png");
2153 $image_dir.
"/nav_arr_R.png");
2155 $image_dir.
"/browser/forceexp.png");
2158 $image_dir.
"/download.png");
2159 $ilBench->stop(
"ExportHTML",
"exportHTMLImages");
2162 $services_dir = $a_target_dir.
"/Services";
2164 $media_service_dir = $services_dir.
"/MediaObjects";
2166 include_once(
"./Services/MediaObjects/classes/class.ilPlayerUtil.php");
2169 $mp3_dir = $media_service_dir.
"/flash_mp3_player";
2174 include_once(
"./Services/UIComponent/Explorer2/classes/class.ilExplorerBaseGUI.php");
2182 include_once(
"./Services/YUI/classes/class.ilYuiUtil.php");
2183 foreach (self::getSupplyingExportFiles($a_target_dir) as $f)
2185 if ($f[
"source"] !=
"")
2187 copy($f[
"source"], $f[
"target"]);
2192 $tpl =
new ilTemplate(
"tpl.main.html",
true,
true);
2193 $tpl->setVariable(
"LOCATION_STYLESHEET",$location_stylesheet);
2194 $tpl->addBlockFile(
"CONTENT",
"content",
"tpl.adm_content.html");
2198 $ilUser->setLanguage($user_lang);
2199 $ilUser->setCurrentLanguage($user_lang);
2217 $zip_file = $zip_target_dir.
"/".$date.
"__".IL_INST_ID.
"__".
2233 include_once(
"./Services/YUI/classes/class.ilYuiUtil.php");
2234 include_once(
"./Services/jQuery/classes/class.iljQueryUtil.php");
2235 include_once(
"./Services/MediaObjects/classes/class.ilPlayerUtil.php");
2236 include_once(
"./Services/UIComponent/Explorer2/classes/class.ilExplorerBaseGUI.php");
2239 "target" => $a_target_dir.
'/js/yahoo/yahoo-min.js',
2242 "target" => $a_target_dir.
'/js/yahoo/yahoo-dom-event.js',
2245 "target" => $a_target_dir.
'/js/yahoo/animation-min.js',
2247 array(
"source" =>
'./Services/JavaScript/js/Basic.js',
2248 "target" => $a_target_dir.
'/js/Basic.js',
2250 array(
"source" =>
'./Services/Accordion/js/accordion.js',
2251 "target" => $a_target_dir.
'/js/accordion.js',
2253 array(
"source" =>
'./Services/Accordion/css/accordion.css',
2254 "target" => $a_target_dir.
'/css/accordion.css',
2257 "target" => $a_target_dir.
'/js/jquery.js',
2260 "target" => $a_target_dir.
'/js/maphilight.js',
2263 "target" => $a_target_dir.
'/js/jquery-ui-min.js',
2265 array(
"source" =>
'./Services/COPage/js/ilCOPagePres.js',
2266 "target" => $a_target_dir.
'/js/ilCOPagePres.js',
2268 array(
"source" =>
'./Modules/Scorm2004/scripts/questions/pure.js',
2269 "target" => $a_target_dir.
'/js/pure.js',
2271 array(
"source" =>
'./Modules/Scorm2004/scripts/questions/question_handling.js',
2272 "target" => $a_target_dir.
'/js/question_handling.js',
2274 array(
"source" =>
'./Modules/Scorm2004/templates/default/question_handling.css',
2275 "target" => $a_target_dir.
'/css/question_handling.css',
2289 array(
"source" =>
'./Modules/LearningModule/js/LearningModule.js',
2290 "target" => $a_target_dir.
'/js/LearningModule.js',
2298 $scripts[] = array(
"source" =>
"",
2312 $file_dir = $a_target_dir.
"/files/file_".$a_file_id;
2314 include_once(
"./Modules/File/classes/class.ilObjFile.php");
2315 $file_obj =
new ilObjFile($a_file_id,
false);
2316 $source_file = $file_obj->getDirectory($file_obj->getVersion()).
"/".$file_obj->getFileName();
2317 if (!is_file($source_file))
2319 $source_file = $file_obj->getDirectory().
"/".$file_obj->getFileName();
2321 if (is_file($source_file))
2323 copy($source_file, $file_dir.
"/".$file_obj->getFileName());
2330 function exportHTMLMOB($a_target_dir, &$a_lm_gui, $a_mob_id, $a_frame, &$a_linked_mobs)
2334 $mob_dir = $a_target_dir.
"/mobs";
2337 if (@is_dir($source_dir))
2343 $tpl =
new ilTemplate(
"tpl.main.html",
true,
true);
2344 $tpl->addBlockFile(
"CONTENT",
"content",
"tpl.adm_content.html");
2345 $_GET[
"obj_type"] =
"MediaObject";
2346 $_GET[
"mob_id"] = $a_mob_id;
2347 $_GET[
"frame"] = $a_frame;
2349 $content =& $a_lm_gui->media();
2350 $file = $a_target_dir.
"/media_".$a_mob_id.
".html";
2353 if (!($fp = @fopen(
$file,
"w+")))
2355 die (
"<b>Error</b>: Could not open \"".
$file.
"\" for writing".
2356 " in <b>".__FILE__.
"</b> on line <b>".__LINE__.
"</b><br />");
2359 fwrite($fp, $content);
2363 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
2365 if ($mob_obj->hasFullscreenItem())
2367 $tpl =
new ilTemplate(
"tpl.main.html",
true,
true);
2368 $tpl->addBlockFile(
"CONTENT",
"content",
"tpl.adm_content.html");
2369 $_GET[
"obj_type"] =
"";
2370 $_GET[
"frame"] =
"";
2371 $_GET[
"mob_id"] = $a_mob_id;
2372 $_GET[
"cmd"] =
"fullscreen";
2373 $content =& $a_lm_gui->fullscreen();
2374 $file = $a_target_dir.
"/fullscreen_".$a_mob_id.
".html";
2377 if (!($fp = @fopen(
$file,
"w+")))
2379 die (
"<b>Error</b>: Could not open \"".
$file.
"\" for writing".
2380 " in <b>".__FILE__.
"</b> on line <b>".__LINE__.
"</b><br />");
2383 fwrite($fp, $content);
2386 $linked_mobs = $mob_obj->getLinkedMediaObjects();
2387 $a_linked_mobs = array_merge($a_linked_mobs, $linked_mobs);
2397 foreach($this->offline_int_links as $int_link)
2399 $ilLocator->clearItems();
2400 if ($int_link[
"type"] ==
"git")
2403 $tpl->addBlockFile(
"CONTENT",
"content",
"tpl.adm_content.html");
2405 $_GET[
"obj_id"] = $int_link[
"id"];
2406 $_GET[
"frame"] =
"_blank";
2407 $content =& $a_lm_gui->glossary();
2408 $file = $a_target_dir.
"/term_".$int_link[
"id"].
".html";
2411 if (!($fp = @fopen(
$file,
"w+")))
2413 die (
"<b>Error</b>: Could not open \"".
$file.
"\" for writing".
2414 " in <b>".__FILE__.
"</b> on line <b>".__LINE__.
"</b><br />");
2417 fwrite($fp, $content);
2421 include_once(
"./Modules/Glossary/classes/class.ilGlossaryDefinition.php");
2423 foreach($defs as $def)
2426 foreach($def_mobs as $def_mob)
2428 $this->offline_mobs[$def_mob] = $def_mob;
2433 $this->offline_files = array_merge($this->offline_files, $def_files);
2451 $first_page = $lm_tree->fetchSuccessorNode($lm_tree->getRootId(),
"pg");
2452 $this->first_page_id = $first_page[
"child"];
2456 $int_links = array();
2457 $this->offline_files = array();
2459 include_once(
"./Services/COPage/classes/class.ilPageContentUsage.php");
2460 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
2464 $exp_id_map = array();
2466 if (
$lm_set->get(
"html_export_ids"))
2468 foreach ($pages as $page)
2471 if (trim($exp_id) !=
"")
2473 $exp_id_map[$page[
"obj_id"]] = trim($exp_id);
2484 foreach ($pages as $page)
2488 $ilLocator->clearItems();
2489 $ilBench->start(
"ExportHTML",
"exportHTMLPage");
2490 $ilBench->start(
"ExportHTML",
"exportPageHTML");
2493 $ilBench->stop(
"ExportHTML",
"exportPageHTML");
2497 foreach ($pcs as $pc)
2499 if ($pc[
"type"] ==
"incl")
2502 foreach($incl_mobs as $incl_mob)
2504 $mobs[$incl_mob] = $incl_mob;
2511 foreach($pg_mobs as $pg_mob)
2513 $mobs[$pg_mob] = $pg_mob;
2518 $int_links = array_merge($int_links, $pg_links);
2521 include_once(
"./Modules/File/classes/class.ilObjFile.php");
2523 $this->offline_files = array_merge($this->offline_files, $pg_files);
2526 include_once(
"./Services/COPage/classes/class.ilPCQuestion.php");
2528 foreach($q_ids as $q_id)
2530 $this->q_ids[$q_id] = $q_id;
2533 $ilBench->stop(
"ExportHTML",
"exportHTMLPage");
2536 $this->offline_mobs =
$mobs;
2537 $this->offline_int_links = $int_links;
2546 $a_exp_id_map = array())
2552 $tpl =
new ilTemplate(
"tpl.main.html",
true,
true);
2553 $tpl->addBlockFile(
"CONTENT",
"content",
"tpl.adm_content.html");
2555 $_GET[
"obj_id"] = $a_lm_page_id;
2556 $_GET[
"frame"] = $a_frame;
2561 if (is_array($a_exp_id_map) && isset($a_exp_id_map[$a_lm_page_id]))
2563 $file = $a_target_dir.
"/lm_pg_".$a_exp_id_map[$a_lm_page_id].
".html";
2567 $file = $a_target_dir.
"/lm_pg_".$a_lm_page_id.
".html";
2572 if ($a_frame !=
"toc")
2574 $file = $a_target_dir.
"/frame_".$a_lm_page_id.
"_".$a_frame.
".html";
2578 $file = $a_target_dir.
"/frame_".$a_frame.
".html";
2583 if (@is_file(
$file))
2588 $content =& $a_lm_gui->layout(
"main.xml",
false);
2591 if (!($fp = @fopen(
$file,
"w+")))
2593 die (
"<b>Error</b>: Could not open \"".
$file.
"\" for writing".
2594 " in <b>".__FILE__.
"</b> on line <b>".__LINE__.
"</b><br />");
2601 fwrite($fp, $content);
2606 if ($this->first_page_id == $a_lm_page_id && $a_frame ==
"")
2608 copy(
$file, $a_target_dir.
"/index.html");
2612 $frameset = $a_lm_gui->getCurrentFrameSet();
2614 foreach ($frameset as $frame)
2616 $this->
exportPageHTML($a_lm_gui, $a_target_dir, $a_lm_page_id, $frame);
2633 $attrs[
"xmlns:fo"] =
"http://www.w3.org/1999/XSL/Format";
2634 $a_xml_writer->xmlStartTag(
"fo:root", $attrs);
2638 $a_xml_writer->xmlStartTag(
"fo:layout-master-set", $attrs);
2642 $attrs[
"master-name"] =
"DinA4";
2643 $attrs[
"page-height"] =
"29.7cm";
2644 $attrs[
"page-width"] =
"21cm";
2645 $attrs[
"margin-top"] =
"4cm";
2646 $attrs[
"margin-bottom"] =
"1cm";
2647 $attrs[
"margin-left"] =
"2.8cm";
2648 $attrs[
"margin-right"] =
"7.3cm";
2649 $a_xml_writer->xmlStartTag(
"fo:simple-page-master", $attrs);
2653 $attrs[
"margin-top"] =
"0cm";
2654 $attrs[
"margin-bottom"] =
"1.25cm";
2655 $a_xml_writer->xmlElement(
"fo:region-body", $attrs);
2659 $attrs[
"extent"] =
"1cm";
2660 $a_xml_writer->xmlElement(
"fo:region-before", $attrs);
2664 $attrs[
"extent"] =
"1cm";
2665 $a_xml_writer->xmlElement(
"fo:region-after", $attrs);
2668 $a_xml_writer->xmlEndTag(
"fo:simple-page-master");
2671 $a_xml_writer->xmlEndTag(
"fo:layout-master-set");
2675 $attrs[
"master-reference"] =
"DinA4";
2676 $a_xml_writer->xmlStartTag(
"fo:page-sequence", $attrs);
2680 $attrs[
"flow-name"] =
"xsl-region-body";
2681 $a_xml_writer->xmlStartTag(
"fo:flow", $attrs);
2686 $ilBench->start(
"ContentObjectExport",
"exportFOStructureObjects");
2688 $ilBench->stop(
"ContentObjectExport",
"exportFOStructureObjects");
2692 $a_xml_writer->xmlEndTag(
"fo:flow");
2695 $a_xml_writer->xmlEndTag(
"fo:page-sequence");
2698 $a_xml_writer->xmlEndTag(
"fo:root");
2709 $childs = $this->lm_tree->getChilds($this->lm_tree->getRootId());
2710 foreach ($childs as $child)
2712 if($child[
"type"] !=
"st")
2718 $structure_obj->exportFO($a_xml_writer, $expLog);
2719 unset($structure_obj);
2725 include_once(
"./Modules/LearningModule/classes/class.ilContObjectExport.php");
2729 $export_file = $cont_exp->buildExportFile();
2730 return $export_file;
2744 $lmtree->setTableNames(
'lm_tree',
'lm_data');
2745 $lmtree->setTreeTablePK(
"lm_id");
2748 $source_obj->setLMId($this->
getId());
2753 $target_obj->setLMId($this->
getId());
2754 $target_parent = $lmtree->getParentId(
$target_id);
2758 if ($source_obj->getType() ==
"pg")
2761 if ($lmtree->isInTree($source_obj->getId()))
2763 $node_data = $lmtree->getNodeData($source_obj->getId());
2766 if ($movecopy ==
"move")
2768 $parent_id = $lmtree->getParentId($source_obj->getId());
2769 $lmtree->deleteTree($node_data);
2772 require_once(
"./Services/History/classes/class.ilHistory.php");
2783 $new_page =& $source_obj->copy();
2784 $source_id = $new_page->getId();
2785 $source_obj =& $new_page;
2789 if(!$lmtree->isInTree($source_obj->getId()))
2796 else if ($as_subitem)
2800 $pg_childs =& $lmtree->getChildsByType($parent,
"pg");
2801 if (count($pg_childs) != 0)
2803 $target_pos = $pg_childs[count($pg_childs) - 1][
"obj_id"];
2809 $parent = $target_parent;
2813 $lmtree->insertNode($source_obj->getId(),
2814 $parent, $target_pos);
2817 if ($movecopy ==
"move")
2820 include_once(
"./Services/History/classes/class.ilHistory.php");
2834 if ($source_obj->getType() ==
"st")
2837 $source_node = $lmtree->getNodeData($source_id);
2838 $subnodes = $lmtree->getSubtree($source_node);
2841 foreach ($subnodes as $subnode)
2856 $pg_childs =& $lmtree->getChildsByType($target_parent,
"pg");
2857 if (count($pg_childs) != 0)
2859 $target_pos = $pg_childs[count($pg_childs) - 1][
"obj_id"];
2862 else if ($as_subitem)
2866 $childs =& $lmtree->getChilds($target_parent);
2867 if (count($childs) != 0)
2869 $target_pos = $childs[count($childs) - 1][
"obj_id"];
2894 if ($movecopy ==
"move")
2896 $lmtree->deleteTree($source_node);
2901 $new_chapter =& $source_obj->copy($lmtree, $target_parent, $target_pos);
2904 if (!$lmtree->isInTree($source_id))
2906 $lmtree->insertNode($source_id, $target_parent, $target_pos);
2909 if ($movecopy ==
"move")
2911 foreach ($subnodes as $node)
2913 if($node[
"obj_id"] != $source_id)
2915 $lmtree->insertNode($node[
"obj_id"], $node[
"parent"]);
2933 include_once
"./Modules/LearningModule/classes/class.ilLMPageObject.php";
2934 include_once
"./Modules/LearningModule/classes/class.ilLMPage.php";
2939 foreach ($pages as $page)
2943 $cpage =
new ilLMPage($page[
"obj_id"]);
2945 $error = @$cpage->validateDom();
2949 $this->lng->loadLanguageModule(
"content");
2953 $mess.= $this->lng->txt(
"obj_pg").
": ".
$title;
2954 $mess.=
'<div class="small">';
2955 foreach ($error as $e)
2957 $err_mess = implode($e,
" - ");
2958 if (!is_int(strpos($err_mess,
":0:")))
2960 $mess.= htmlentities($err_mess).
"<br />";
2979 $a_import_into_help_module = 0)
2987 $file = pathinfo($a_filename);
2991 $a_filename, $full_path);
2996 $subdir = basename(
$file[
"basename"],
".".
$file[
"extension"]);
3002 if ($a_import_into_help_module > 0)
3007 foreach ($files as
$file)
3009 if (is_int(strpos($file[
"entry"],
"__help_")) &&
3010 is_int(strpos($file[
"entry"],
".zip")))
3012 include_once(
"./Services/Export/classes/class.ilImport.php");
3014 $imp->getMapping()->addMapping(
'Services/Help',
'help_module', 0, $a_import_into_help_module);
3015 include_once(
"./Modules/LearningModule/classes/class.ilLMObject.php");
3017 foreach ($chaps as $chap)
3019 $chap_arr = explode(
"_", $chap[
"import_id"]);
3020 $imp->getMapping()->addMapping(
'Services/Help',
'help_chap',
3021 $chap_arr[count($chap_arr) - 1], $chap[
"obj_id"]);
3023 $imp->importEntity($dir.
"/".$file[
"entry"], $file[
"entry"],
3024 "help",
"Services/Help",
true);
3047 $subdir = basename($a_directory);
3048 $xml_file = $a_directory.
"/".$subdir.
".xml";
3051 if (!is_dir($a_directory))
3053 return sprintf($lng->txt(
"cont_no_subdir_in_zip"), $subdir);
3057 if (!is_file($xml_file))
3059 return sprintf($lng->txt(
"cont_zip_file_invalid"), $subdir.
"/".$subdir.
".xml");
3063 $qti_file = $a_directory.
"/qti.xml";
3065 if (is_file($qti_file))
3067 include_once
"./Services/QTI/classes/class.ilQTIParser.php";
3068 include_once(
"./Modules/Test/classes/class.ilObjTest.php");
3071 $result = $qtiParser->startParsing ();
3072 $founditems = & $qtiParser->getFoundItems ();
3074 if (count($founditems) > 0)
3077 $qtiParser->setTestObject($testObj);
3078 $result = $qtiParser->startParsing();
3079 $qtis = array_merge($qtis, $qtiParser->getImportMapping());
3083 include_once (
"./Modules/LearningModule/classes/class.ilContObjParser.php");
3084 $contParser =
new ilContObjParser($this, $xml_file, $subdir, $qmapping);
3085 $contParser->setQuestionMapping($qtis);
3086 $contParser->startParsing();
3091 $style_file = $a_directory.
"/style.xml";
3092 $style_zip_file = $a_directory.
"/style.zip";
3093 if (is_file($style_zip_file))
3095 require_once(
"./Services/Style/classes/class.ilObjStyleSheet.php");
3097 $style->import($style_zip_file);
3100 else if (is_file($style_file))
3102 require_once(
"./Services/Style/classes/class.ilObjStyleSheet.php");
3104 $style->import($style_file);
3117 include_once(
"./Modules/LearningModule/classes/class.ilLMPage.php");
3137 $new_obj = parent::cloneObject($a_target_id,$a_copy_id);
3141 $new_obj->setTitle($this->
getTitle());
3144 $new_obj->setLayout($this->
getLayout());
3158 $new_obj->setRating($this->
hasRating());
3163 $new_obj->createLMTree();
3166 include_once(
"./Services/Style/classes/class.ilObjStyleSheet.php");
3168 if ($style_id > 0 &&
3171 $style_obj = $ilias->obj_factory->getInstanceByObjId($style_id);
3172 $new_id = $style_obj->ilClone();
3173 $new_obj->setStyleSheetId($new_id);
3181 include_once(
'Services/Tracking/classes/class.ilLPObjSettings.php');
3183 $obj_settings->cloneSettings($new_obj->getId());
3184 unset($obj_settings);
3187 include_once(
"./Services/Object/classes/class.ilObjectTranslation.php");
3189 $ot->copy($new_obj->getId());
3201 $parent_id = $a_target_obj->lm_tree->readRootId();
3203 include_once(
"./Modules/LearningModule/classes/class.ilLMObject.php");
3204 include_once(
"./Modules/LearningModule/classes/class.ilLMPageObject.php");
3207 $chapters = $this->lm_tree->getChildsByType($this->lm_tree->readRootId(),
"st");
3208 $copied_nodes = array();
3210 foreach ($chapters as $chap)
3219 foreach ($pages as $p)
3221 if (!$this->lm_tree->isInTree($p[
"obj_id"]))
3224 $target_item = $item->copy($a_target_obj);
3225 $copied_nodes[$item->getId()] = $target_item->getId();
3231 $a_target_obj->checkTree();
3247 $set = $ilDB->query(
"SELECT * FROM lm_glossaries ".
3248 " WHERE lm_id = ".$ilDB->quote($a_lm_id,
"integer")
3251 while ($rec = $ilDB->fetchAssoc($set))
3253 $glos[] = $rec[
"glo_id"];
3267 include_once(
"./Modules/Glossary/classes/class.ilGlossaryTerm.php");
3271 include_once(
"./Modules/LearningModule/classes/class.ilLMPage.php");
3275 $found_pages = array();
3276 foreach ($pages as $p)
3279 $c = $pg->getXMLContent();
3280 foreach ($terms as
$t)
3282 if (is_int(stripos($c, $t[
"term"])))
3284 $found_pages[$p[
"id"]][
"terms"][] =
$t;
3285 if (!is_object($found_pages[$p[
"id"]][
"page"]))
3287 $found_pages[$p[
"id"]][
"page"] = $pg;
3295 include_once(
"./Services/COPage/classes/class.ilPCParagraph.php");
3296 foreach ($found_pages as
$id => $fp)
3316 if (!$a_as_obj_id && $a_id > 0 && $a_id == OH_REF_ID)
3329 $this->rating = (bool)$a_value;
3339 $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 getTermList($a_glo_id, $searchterm="", $a_first_letter="", $a_def="", $a_tax_node=0, $a_add_amet_fields=false, $a_amet_filter="")
Get all terms for given set of glossary ids.
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.
updateMetaData()
update meta data entry
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.
_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.
copyAllPagesAndChapters($a_target_obj)
Copy all pages and chapters.
update()
update complete object (meta data and properties)
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)
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 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.
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
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 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.
_lookupOnline($a_id)
check wether content object is online
static getLocalPath($a_name="")
Get local path of a YUI js file.
_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
_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)
initDefaultRoles()
init default roles settings OBSOLETE.
importFromZipFile($a_tmp_file, $a_filename, $a_validate=true, $a_import_into_help_module=0)
Import lm from zip file.
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.
createRoleFolder()
creates a local role folder
static yn2tf($a_yn)
convert "y"/"n" to true/false
setAutoGlossaries($a_val)
Set auto glossaries.
if(strpos($jquery_path, './')===0) else if(strpos($jquery_path, '.')===0) $mathJaxSetting
_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
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.