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");
 
   41                 $this->
ilObject($a_id,$a_call_by_reference);
 
   43                 $this->mob_ids = array();
 
   44                 $this->file_ids = array();
 
   45                 $this->q_ids = array();
 
   51         function create($a_no_meta_data = 
false)
 
   77                 global $rbacadmin, $rbacreview;
 
  100                 return $roles ? $roles : array();
 
  110 #               echo "Content<br>\n"; 
  113                 $this->lm_tree->setTableNames(
'lm_tree',
'lm_data');
 
  114                 $this->lm_tree->setTreeTablePK(
"lm_id");
 
  166                 $this->import_id = $a_id;
 
  176                 $this->layout_per_page = $a_val;
 
  186                 return $this->layout_per_page;
 
  239                 $this->lm_tree->setTreeTablePK(
"lm_id");
 
  240                 $this->lm_tree->setTableNames(
'lm_tree',
'lm_data');
 
  241                 $this->lm_tree->addTree($this->
getId(), 1);
 
  251                 include_once(
"./Modules/LearningModule/classes/class.ilLMObject.php");
 
  252                 include_once(
"./Modules/LearningModule/classes/class.ilStructureObject.php");
 
  253                 include_once(
"./Modules/LearningModule/classes/class.ilLMPageObject.php");
 
  255                 $root_id = $this->lm_tree->getRootId();
 
  259                 $chap->setType(
"st");
 
  260                 $chap->setTitle($lng->txt(
"cont_new_chap"));
 
  261                 $chap->setLMId($this->
getId());
 
  267                 $page->setType(
"pg");
 
  268                 $page->setTitle($lng->txt(
"cont_new_page"));
 
  269                 $page->setLMId($this->
getId());
 
  292                 if(!is_writable($lm_data_dir))
 
  294                         $this->ilias->raiseError(
"Content object Data Directory (".$lm_data_dir
 
  295                                 .
") not writeable.",$this->ilias->error_obj->FATAL);
 
  299                 $lm_dir = $lm_data_dir.
"/lm_".$this->
getId();
 
  301                 if(!@is_dir($lm_dir))
 
  303                         $this->ilias->raiseError(
"Creation of Learning Module Directory failed.",$this->ilias->error_obj->FATAL);
 
  311                         $this->ilias->raiseError(
"Creation of Import Directory failed.",$this->ilias->error_obj->FATAL);
 
  321                         "/lm_".$this->getId();
 
  329                 if(strlen($this->import_dir))
 
  335                         "/lm_".$this->getId().
"/import";
 
  354                 $this->import_dir = $a_import_dir;
 
  366                 if(!is_writable($lm_data_dir))
 
  368                         $this->ilias->raiseError(
"Content object Data Directory (".$lm_data_dir
 
  369                                 .
") not writeable.",$this->ilias->error_obj->FATAL);
 
  372                 $lm_dir = $lm_data_dir.
"/lm_".$this->
getId();
 
  374                 if(!@is_dir($lm_dir))
 
  376                         $this->ilias->raiseError(
"Creation of Learning Module Directory failed.",$this->ilias->error_obj->FATAL);
 
  383                                 $export_dir = $lm_dir.
"/export_html";
 
  388                                 $export_dir = $lm_dir.
"/export_scorm";
 
  392                                 $export_dir = $lm_dir.
"/export";
 
  397                 if(!@is_dir($export_dir))
 
  399                         $this->ilias->raiseError(
"Creation of Export Directory failed.",$this->ilias->error_obj->FATAL);
 
  443                 if (!parent::delete())
 
  449                 include_once(
"./Modules/LearningModule/classes/class.ilLMObject.php");
 
  457                 $nested->init($this->
getId(), 
"bib");
 
  458                 $nested->deleteAllDBData();
 
  462                 $this->lm_tree->removeTree($this->lm_tree->getTreeId());
 
  468                 $q = 
"DELETE FROM content_object WHERE id = ".
 
  469                         $ilDB->quote($this->
getId(), 
"integer");
 
  470                 $ilDB->manipulate($q);
 
  473                 $q = 
"DELETE FROM lm_menu WHERE lm_id = ".
 
  474                         $ilDB->quote($this->
getId(), 
"integer");
 
  475                 $ilDB->manipulate($q);
 
  498                 $this->layout = $a_layout;
 
  514                 $this->style_id = $a_style_id;
 
  524                 $q = 
"UPDATE content_object SET ".
 
  525                         " stylesheet = ".$ilDB->quote((
int) $a_style_id, 
"integer").
 
  526                         " WHERE id = ".$ilDB->quote($this->
getId(), 
"integer");
 
  527                 $ilDB->manipulate($q);
 
  529                 $this->style_id = $a_style_id;
 
  539                 if ($a_from_style < 0)  
 
  541                         $q = 
"SELECT stylesheet FROM content_object, style_data ".
 
  542                                 " WHERE content_object.stylesheet = style_data.id ".
 
  543                                 " AND style_data.standard = ".$ilDB->quote(0, 
"integer").
 
  544                                 " AND content_object.stylesheet > ".$ilDB->quote(0, 
"integer");
 
  545                         $style_set = $ilDB->query($q);
 
  546                         while($style_rec = $ilDB->fetchAssoc($style_set))
 
  549                                 $q = 
"UPDATE content_object SET ".
 
  550                                         " stylesheet = ".$ilDB->quote((
int) $a_to_style, 
"integer").
 
  551                                         " WHERE stylesheet = ".$ilDB->quote($style_rec[
"stylesheet"], 
"integer");
 
  552                                 $ilDB->manipulate($q);
 
  555                                 $style_obj =& $ilias->obj_factory->getInstanceByObjId($style_rec[
"stylesheet"]);
 
  556                                 $style_obj->delete();
 
  561                         $q = 
"UPDATE content_object SET ".
 
  562                                 " stylesheet = ".$ilDB->quote((
int) $a_to_style, 
"integer").
 
  563                                 " WHERE stylesheet = ".$ilDB->quote($a_from_style, 
"integer");
 
  564                         $ilDB->manipulate($q);
 
  575                 $q = 
"SELECT stylesheet FROM content_object ".
 
  576                         " WHERE id = ".$ilDB->quote($a_cont_obj_id, 
"integer");
 
  577                 $res = $ilDB->query($q);
 
  578                 $sheet = $ilDB->fetchAssoc(
$res);
 
  580                 return $sheet[
"stylesheet"];
 
  590                 $q = 
"SELECT id FROM content_object ".
 
  591                         " WHERE stylesheet = ".$ilDB->quote($a_style_id, 
"integer");
 
  592                 $res = $ilDB->query($q);
 
  594                 while($cont = $ilDB->fetchAssoc(
$res))
 
  596                         $obj_ids[] = $cont[
"id"];
 
  610                 $q = 
"SELECT count(*) as cnt FROM content_object ".
 
  611                         " WHERE stylesheet = ".$ilDB->quote($a_style_id, 
"integer");
 
  612                 $cset = $ilDB->query($q);
 
  613                 $crow = $ilDB->fetchAssoc($cset);
 
  615                 return (
int) $crow[
"cnt"];
 
  627                 $q = 
"SELECT count(*) as cnt FROM content_object, style_data ".
 
  628                         " WHERE stylesheet = style_data.id ".
 
  629                         " AND standard = ".$ilDB->quote(0, 
"integer");
 
  630                 $cset = $ilDB->query($q);
 
  631                 $crow = $ilDB->fetchAssoc($cset);
 
  633                 return (
int) $crow[
"cnt"];
 
  643                 $q = 
"SELECT count(*) as cnt FROM content_object ".
 
  644                         " WHERE stylesheet = ".$ilDB->quote(0, 
"integer");
 
  645                 $cset = $ilDB->query($q);
 
  646                 $crow = $ilDB->fetchAssoc($cset);
 
  648                 return (
int) $crow[
"cnt"];
 
  660                 $q = 
"UPDATE content_object SET ".
 
  661                         " stylesheet = ".$ilDB->quote(0, 
"integer").
 
  662                         " WHERE stylesheet = ".$ilDB->quote((
int) $this->
getId($a_style_id), 
"integer");
 
  664                 $ilDB->manipulate($q);
 
  682                 $this->pg_header = $a_pg_header;
 
  690                 return $this->toc_mode;
 
  698                 return $this->public_access_mode;
 
  708                 $this->toc_mode = $a_toc_mode;
 
  713                 $this->online = $a_online;
 
  723                 $this->lm_menu_active = $a_act_lm_menu;
 
  728                 return $this->lm_menu_active;
 
  733                 $this->toc_active = $a_toc;
 
  738                 return $this->toc_active;
 
  743                 $this->numbering = $a_num;
 
  748                 return $this->numbering;
 
  753                 $this->print_view_active = $a_print;
 
  758                 return $this->print_view_active;
 
  763                 $this->prevent_glossary_appendix_active = $a_print;
 
  768                 return $this->prevent_glossary_appendix_active;
 
  773                 $this->downloads_active = $a_down;
 
  778                 return $this->downloads_active;
 
  783                 $this->downloads_public_active = $a_down;
 
  788                 return $this->downloads_public_active;
 
  793                 $this->pub_notes = $a_pub_notes;
 
  798                 return $this->pub_notes;
 
  803                 $this->clean_frames = $a_clean;
 
  808                 return $this->clean_frames;
 
  813                 $this->user_comments = $a_comm;
 
  818                 $this->public_access_mode = $a_mode;
 
  823                 return $this->user_comments;
 
  828                 $this->header_page = $a_pg;
 
  833                 return $this->header_page;
 
  838                 $this->footer_page = $a_pg;
 
  843                 return $this->footer_page;
 
  853                 $q = 
"SELECT * FROM content_object WHERE id = ".
 
  854                         $ilDB->quote($this->
getId(), 
"integer");
 
  855                 $lm_set = $ilDB->query($q);
 
  856                 $lm_rec = $ilDB->fetchAssoc($lm_set);
 
  857                 $this->
setLayout($lm_rec[
"default_layout"]);
 
  894                 $q = 
"UPDATE content_object SET ".
 
  895                         " default_layout = ".$ilDB->quote($this->
getLayout(), 
"text").
", ".
 
  896                         " stylesheet = ".$ilDB->quote($this->
getStyleSheetId(), 
"integer").
",".
 
  897                         " page_header = ".$ilDB->quote($this->
getPageHeader(), 
"text").
",".
 
  898                         " toc_mode = ".$ilDB->quote($this->
getTOCMode(), 
"text").
",".
 
  913                         " header_page = ".$ilDB->quote($this->
getHeaderPage(), 
"integer").
",".
 
  914                         " footer_page = ".$ilDB->quote($this->
getFooterPage(), 
"integer").
",".
 
  916                         " layout_per_page = ".$ilDB->quote($this->
getLayoutPerPage(), 
"integer").
" ".
 
  917                         " WHERE id = ".$ilDB->quote($this->
getId(), 
"integer");
 
  918                 $ilDB->manipulate($q);
 
  928                 $q = 
"INSERT INTO content_object (id) VALUES (".$ilDB->quote($this->
getId(), 
"integer").
")";
 
  929                 $ilDB->manipulate($q);
 
  942                 $q = 
"SELECT is_online FROM content_object WHERE id = ".$ilDB->quote($a_id, 
"integer");
 
  943                 $lm_set = $ilDB->query($q);
 
  944                 $lm_rec = $ilDB->fetchAssoc($lm_set);
 
  956                 $dir = opendir(
"./Modules/LearningModule/layouts/lm");
 
  960                 while(
$file = readdir($dir))
 
  965                                 if (@is_dir(
"./Modules/LearningModule/layouts/lm/".
$file))
 
  975                         'toc2win' => 
'toc2win',
 
  976                         'toc2windyn' => 
'toc2windyn',
 
  977                         '1window' => 
'1window',
 
  978                         '2window' => 
'2window',
 
  979                         '3window' => 
'3window',
 
  980                         'presentation' => 
'presentation',
 
  981                         'fullscreen' => 
'fullscreen' 
  984                 foreach ($layouts as $l)
 
  986                         if (!in_array($l, 
$ret))
 
 1003                 $lm_tree->setTableNames(
'lm_tree',
'lm_data');
 
 1009                         foreach (
$path as $node)
 
 1011                                 if ($node[
"type"] == 
"st")
 
 1030                 $lm_tree->setTableNames(
'lm_tree',
'lm_data');
 
 1038                         foreach (
$path as $node)
 
 1040                                 if ($node[
"type"] == 
"st")
 
 1044                                         foreach ($tconds as $tcond)
 
 1065                 $lm_tree->setTableNames(
'lm_tree',
'lm_data');
 
 1073                         foreach (
$path as $node)
 
 1075                                 if ($node[
"type"] == 
"st")
 
 1079                                         foreach ($tconds as $tcond)
 
 1084                                                         return $node[
"child"];
 
 1104         function notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params = 0)
 
 1144                 if ($a_node_id==
$_GET[
"ref_id"])
 
 1146                         $parent_obj =& $this->ilias->obj_factory->getInstanceByRefId($a_node_id);
 
 1147                         $parent_type = $parent_obj->getType();
 
 1148                         if($parent_type == $this->
getType())
 
 1150                                 $a_node_id = (int) $tree->getParentId($a_node_id);
 
 1154                 parent::notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params);
 
 1163                 $tree = 
new ilTree($a_cont_obj_id);
 
 1164                 $tree->setTableNames(
'lm_tree',
'lm_data');
 
 1165                 $tree->setTreeTablePK(
"lm_id");
 
 1166                 if ($tree->isInTree($a_page_id))
 
 1168                         $succ = $tree->fetchSuccessorNode($a_page_id, 
"pg");
 
 1181                 $tree->setTableNames(
'lm_tree',
'lm_data');
 
 1182                 $tree->setTreeTablePK(
"lm_id");
 
 1184                 $tree->checkTreeChilds();
 
 1200                 $set = $ilDB->query(
"SELECT DISTINCT l1.lm_id".
 
 1202                         " JOIN lm_tree l2 ON ( l1.child = l2.parent".
 
 1203                         " AND l1.lm_id = l2.lm_id )".
 
 1204                         " JOIN lm_data ON ( l1.child = lm_data.obj_id )".
 
 1205                         " WHERE (l2.lft < l1.lft".
 
 1206                         " OR l2.rgt > l1.rgt OR l2.lft > l1.rgt OR l2.rgt < l1.lft)".
 
 1207                         " AND l1.lm_id = ".$ilDB->quote($this->getId(), 
"integer").
 
 1208                         " ORDER BY lm_data.create_date DESC" 
 1210                 if ($rec = $ilDB->fetchAssoc($set))
 
 1216                 $nodes = $tree->getSubtree($tree->getNodeData($tree->getRootId()));
 
 1217                 foreach ($nodes as $node)
 
 1219                         $q = 
"SELECT * FROM lm_data WHERE obj_id = ".
 
 1220                                 $ilDB->quote($node[
"child"], 
"integer");
 
 1221                         $obj_set = $ilDB->query($q);
 
 1222                         $obj_rec = $ilDB->fetchAssoc($obj_set);
 
 1225                                 $node_data = $tree->getNodeData($node[
"child"]);
 
 1226                                 $tree->deleteTree($node_data);
 
 1231                 $nodes = $tree->getSubtree($tree->getNodeData($tree->getRootId()));
 
 1232                 foreach ($nodes as $node)
 
 1234                         $q = 
"SELECT * FROM lm_data WHERE obj_id = ".
 
 1235                                 $ilDB->quote($node[
"parent"], 
"integer");
 
 1236                         $obj_set = $ilDB->query($q);
 
 1237                         $obj_rec = $ilDB->fetchAssoc($obj_set);
 
 1238                         if ($obj_rec[
"type"] == 
"pg")
 
 1240                                 $node_data = $tree->getNodeData($node[
"child"]);
 
 1241                                 if ($tree->isInTree($node[
"child"]))
 
 1243                                         $tree->deleteTree($node_data);
 
 1250                 $set = $ilDB->query(
"SELECT DISTINCT l1.lm_id".
 
 1252                                 " JOIN lm_tree l2 ON ( l1.child = l2.child AND l1.lm_id <> l2.lm_id )".
 
 1253                                 " JOIN lm_data ON (l1.child = lm_data.obj_id)".
 
 1254                                 " WHERE l1.child <> 1".
 
 1255                                 " AND l1.lm_id <> lm_data.lm_id".
 
 1256                                 " AND l1.lm_id = ".$ilDB->quote($this->getId(), 
"integer"));
 
 1257                 if ($rec = $ilDB->fetchAssoc($set))
 
 1259                         $set = $ilDB->query(
"SELECT DISTINCT l1.child ".
 
 1261                                 " JOIN lm_tree l2 ON ( l1.child = l2.child AND l1.lm_id <> l2.lm_id )".
 
 1262                                 " JOIN lm_data ON (l1.child = lm_data.obj_id)".
 
 1263                                 " WHERE l1.child <> 1".
 
 1264                                 " AND l1.lm_id <> lm_data.lm_id".
 
 1265                                 " AND l1.lm_id = ".$ilDB->quote($this->getId(), 
"integer"));
 
 1266                         include_once(
"./Modules/LearningModule/classes/class.ilLMObjectFactory.php");
 
 1267                         while ($rec = $ilDB->fetchAssoc($set))
 
 1271                                 if (is_object($cobj))
 
 1273                                         if ($cobj->getType() == 
"pg")
 
 1276                                                 $pg_copy = $cobj->copy($this);
 
 1279                                                 $ilDB->manipulate(
"UPDATE lm_tree SET ".
 
 1280                                                         " child = ".$ilDB->quote($pg_copy->getId(), 
"integer").
 
 1281                                                         " WHERE child = ".$ilDB->quote($cobj->getId(), 
"integer").
 
 1282                                                         " AND lm_id = ".$ilDB->quote($this->getId(), 
"integer")
 
 1285                                         else if ($cobj->getType() == 
"st")
 
 1288                                                 $st_copy = $cobj->copy($this);
 
 1291                                                 $ilDB->manipulate(
"UPDATE lm_tree SET ".
 
 1292                                                         " child = ".$ilDB->quote($st_copy->getId(), 
"integer").
 
 1293                                                         " WHERE child = ".$ilDB->quote($cobj->getId(), 
"integer").
 
 1294                                                         " AND lm_id = ".$ilDB->quote($this->getId(), 
"integer")
 
 1298                                                 $ilDB->manipulate(
"UPDATE lm_tree SET ".
 
 1299                                                         " parent = ".$ilDB->quote($st_copy->getId(), 
"integer").
 
 1300                                                         " WHERE parent = ".$ilDB->quote($cobj->getId(), 
"integer").
 
 1301                                                         " AND lm_id = ".$ilDB->quote($this->getId(), 
"integer")
 
 1316         function exportXML(&$a_xml_writer, $a_inst, $a_target_dir, &$expLog)
 
 1324                                 $attrs[
"Type"] = 
"LearningModule";
 
 1328                                 $attrs[
"Type"] = 
"LibObject";
 
 1331                 $a_xml_writer->xmlStartTag(
"ContentObject", $attrs);
 
 1338                 $expLog->write(date(
"[y-m-d H:i:s] ").
"Start Export Structure Objects");
 
 1339                 $ilBench->start(
"ContentObjectExport", 
"exportStructureObjects");
 
 1341                 $ilBench->stop(
"ContentObjectExport", 
"exportStructureObjects");
 
 1342                 $expLog->write(date(
"[y-m-d H:i:s] ").
"Finished Export Structure Objects");
 
 1345                 $expLog->write(date(
"[y-m-d H:i:s] ").
"Start Export Page Objects");
 
 1346                 $ilBench->start(
"ContentObjectExport", 
"exportPageObjects");
 
 1348                 $ilBench->stop(
"ContentObjectExport", 
"exportPageObjects");
 
 1349                 $expLog->write(date(
"[y-m-d H:i:s] ").
"Finished Export Page Objects");
 
 1352                 $expLog->write(date(
"[y-m-d H:i:s] ").
"Start Export Media Objects");
 
 1353                 $ilBench->start(
"ContentObjectExport", 
"exportMediaObjects");
 
 1355                 $ilBench->stop(
"ContentObjectExport", 
"exportMediaObjects");
 
 1356                 $expLog->write(date(
"[y-m-d H:i:s] ").
"Finished Export Media Objects");
 
 1359                 $expLog->write(date(
"[y-m-d H:i:s] ").
"Start Export File Items");
 
 1360                 $ilBench->start(
"ContentObjectExport", 
"exportFileItems");
 
 1362                 $ilBench->stop(
"ContentObjectExport", 
"exportFileItems");
 
 1363                 $expLog->write(date(
"[y-m-d H:i:s] ").
"Finished Export File Items");
 
 1366                 if (count($this->q_ids) > 0)
 
 1368                         $qti_file = fopen($a_target_dir.
"/qti.xml", 
"w");
 
 1369                         include_once(
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php");
 
 1371                         fwrite($qti_file, $pool->toXML($this->q_ids));
 
 1377                 $expLog->write(date(
"[y-m-d H:i:s] ").
"Start Export Properties");
 
 1379                 $expLog->write(date(
"[y-m-d H:i:s] ").
"Finished Export Properties");
 
 1381                 $a_xml_writer->xmlEndTag(
"ContentObject");
 
 1392                 include_once(
"Services/MetaData/classes/class.ilMD2XML.php");
 
 1394                 $md2xml->setExportMode(
true);
 
 1395                 $md2xml->startExport();
 
 1396                 $a_xml_writer->appendXML($md2xml->getXML());
 
 1407                 include_once 
'./Modules/LearningModule/classes/class.ilStructureObject.php';
 
 1409                 $childs = $this->lm_tree->getChilds($this->lm_tree->getRootId());
 
 1410                 foreach ($childs as $child)
 
 1412                         if($child[
"type"] != 
"st")
 
 1418                         $structure_obj->exportXML($a_xml_writer, $a_inst, $expLog);
 
 1419                         unset($structure_obj);
 
 1434                 include_once 
"./Modules/LearningModule/classes/class.ilLMPageObject.php";
 
 1437                 foreach ($pages as $page)
 
 1441                                 $expLog->write(date(
"[y-m-d H:i:s] ").
"Page Object ".$page[
"obj_id"]);
 
 1445                                 $page_obj->exportXML($a_xml_writer, 
"normal", $a_inst);
 
 1448                                 $mob_ids = $page_obj->getMediaObjectIDs();
 
 1449                                 foreach($mob_ids as $mob_id)
 
 1451                                         $this->mob_ids[$mob_id] = $mob_id;
 
 1455                                 $file_ids = $page_obj->getFileItemIds();
 
 1456                                 foreach($file_ids as $file_id)
 
 1458                                         $this->file_ids[$file_id] = $file_id;
 
 1462                                 $q_ids = $page_obj->getQuestionIds();
 
 1463                                 foreach($q_ids as $q_id)
 
 1465                                         $this->q_ids[$q_id] = $q_id;
 
 1481                 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
 
 1483                 $linked_mobs = array();
 
 1486                 foreach ($this->mob_ids as $mob_id)
 
 1490                                 $expLog->write(date(
"[y-m-d H:i:s] ").
"Media Object ".$mob_id);
 
 1492                                 $media_obj->exportXML($a_xml_writer, $a_inst);
 
 1493                                 $media_obj->exportFiles($a_target_dir);
 
 1495                                 $lmobs = $media_obj->getLinkedMediaObjects($this->mob_ids);
 
 1496                                 $linked_mobs = array_merge($linked_mobs, $lmobs);
 
 1503                 foreach ($linked_mobs as $mob_id)
 
 1507                                 $expLog->write(date(
"[y-m-d H:i:s] ").
"Media Object ".$mob_id);
 
 1509                                 $media_obj->exportXML($a_xml_writer, $a_inst);
 
 1510                                 $media_obj->exportFiles($a_target_dir);
 
 1523                 include_once(
"./Modules/File/classes/class.ilObjFile.php");
 
 1525                 foreach ($this->file_ids as $file_id)
 
 1527                         $expLog->write(date(
"[y-m-d H:i:s] ").
"File Item ".$file_id);
 
 1528                         $file_obj = 
new ilObjFile($file_id, 
false);
 
 1529                         $file_obj->export($a_target_dir);
 
 1541                 $a_xml_writer->xmlStartTag(
"Properties", $attrs);
 
 1544                 $attrs = array(
"Name" => 
"Layout", 
"Value" => $this->
getLayout());
 
 1545                 $a_xml_writer->xmlElement(
"Property", $attrs);
 
 1548                 $attrs = array(
"Name" => 
"PageHeader", 
"Value" => $this->
getPageHeader());
 
 1549                 $a_xml_writer->xmlElement(
"Property", $attrs);
 
 1552                 $attrs = array(
"Name" => 
"TOCMode", 
"Value" => $this->
getTOCMode());
 
 1553                 $a_xml_writer->xmlElement(
"Property", $attrs);
 
 1556                 $attrs = array(
"Name" => 
"ActiveLMMenu", 
"Value" =>
 
 1558                 $a_xml_writer->xmlElement(
"Property", $attrs);
 
 1561                 $attrs = array(
"Name" => 
"ActiveNumbering", 
"Value" =>
 
 1563                 $a_xml_writer->xmlElement(
"Property", $attrs);
 
 1566                 $attrs = array(
"Name" => 
"ActiveTOC", 
"Value" =>
 
 1568                 $a_xml_writer->xmlElement(
"Property", $attrs);
 
 1571                 $attrs = array(
"Name" => 
"ActivePrintView", 
"Value" =>
 
 1573                 $a_xml_writer->xmlElement(
"Property", $attrs);
 
 1579                 $attrs = array(
"Name" => 
"CleanFrames", 
"Value" =>
 
 1581                 $a_xml_writer->xmlElement(
"Property", $attrs);
 
 1584                 $attrs = array(
"Name" => 
"PublicNotes", 
"Value" =>
 
 1586                 $a_xml_writer->xmlElement(
"Property", $attrs);
 
 1589                 $attrs = array(
"Name" => 
"HistoryUserComments", 
"Value" =>
 
 1591                 $a_xml_writer->xmlElement(
"Property", $attrs);
 
 1596                         $attrs = array(
"Name" => 
"HeaderPage", 
"Value" =>
 
 1597                                 "il_".IL_INST_ID.
"_pg_".$this->getHeaderPage());
 
 1598                         $a_xml_writer->xmlElement(
"Property", $attrs);
 
 1604                         $attrs = array(
"Name" => 
"FooterPage", 
"Value" =>
 
 1605                                 "il_".IL_INST_ID.
"_pg_".$this->getFooterPage());
 
 1606                         $a_xml_writer->xmlElement(
"Property", $attrs);
 
 1609                 $a_xml_writer->xmlEndTag(
"Properties");
 
 1619                 $types = array(
"xml", 
"html", 
"scorm");
 
 1621                 foreach ($types as 
$type)
 
 1625                         if (!@is_dir($dir) or
 
 1626                                 !is_writeable($dir))
 
 1637                         while ($entry = $cdir->read())
 
 1639                                 if ($entry != 
"." and
 
 1641                                         substr($entry, -4) == 
".zip" and
 
 1642                                         ereg(
"^[0-9]{10}_{2}[0-9]+_{2}(lm_)*[0-9]+\.zip\$", $entry))
 
 1644                                         $file[$entry.$type] = array(
"type" => $type, 
"file" => $entry,
 
 1645                                                 "size" => filesize($dir.
"/".$entry));
 
 1667                 $this->public_export_file[$a_type] = $a_file;
 
 1679                 return $this->public_export_file[$a_type];
 
 1688                 if (!@is_dir($dir) or
 
 1689                         !is_writeable($dir))
 
 1701                 while ($entry = $dir->read())
 
 1703                         if ($entry != 
"." and
 
 1705                                 substr($entry, -4) == 
".pdf" and
 
 1706                                 ereg(
"^[0-9]{10}_{2}[0-9]+_{2}(lm_)*[0-9]+\.pdf\$", $entry))
 
 1735                 include(
"./Modules/LearningModule/classes/class.ilContObjectManifestBuilder.php");
 
 1737                 $man_builder->buildManifest();
 
 1738                 $man_builder->dump($a_target_dir);
 
 1741                 copy(
"Modules/LearningModule/scorm_xsd/adlcp_rootv1p2.xsd", $a_target_dir.
"/adlcp_rootv1p2.xsd");
 
 1742                 copy(
"Modules/LearningModule/scorm_xsd/imscp_rootv1p1p2.xsd", $a_target_dir.
"/imscp_rootv1p1p2.xsd");
 
 1743                 copy(
"Modules/LearningModule/scorm_xsd/imsmd_rootv1p2p1.xsd", $a_target_dir.
"/imsmd_rootv1p2p1.xsd");
 
 1744                 copy(
"Modules/LearningModule/scorm_xsd/ims_xml.xsd", $a_target_dir.
"/ims_xml.xsd");
 
 1748                 $zip_file = $a_target_dir.
"/".$date.
"__".IL_INST_ID.
"__".
 
 1752                         $a_target_dir.
"/imsmanifest.xml",
 
 1753                         $a_target_dir.
"/adlcp_rootv1p2.xsd",
 
 1754                         $a_target_dir.
"/imscp_rootv1p1p2.xsd",
 
 1755                         $a_target_dir.
"/ims_xml.xsd",
 
 1756                         $a_target_dir.
"/imsmd_rootv1p2p1.xsd")
 
 1762                 rename($zip_file, $dest_file);
 
 1771         function exportHTML($a_target_dir, 
$log, $a_zip_file = 
true, $a_export_format = 
"html")
 
 1778                 $mob_dir = $a_target_dir.
"/mobs";
 
 1780                 $file_dir = $a_target_dir.
"/files";
 
 1782                 $teximg_dir = $a_target_dir.
"/teximg";
 
 1784                 $style_dir = $a_target_dir.
"/style";
 
 1786                 $style_img_dir = $a_target_dir.
"/style/images";
 
 1788                 $content_style_dir = $a_target_dir.
"/content_style";
 
 1790                 $content_style_img_dir = $a_target_dir.
"/content_style/images";
 
 1796                 $style_name = $ilUser->prefs[
"style"].
".css";
 
 1797                 copy($location_stylesheet, $style_dir.
"/".$style_name);
 
 1798                 $fh = fopen($location_stylesheet, 
"r");
 
 1799                 $css = fread($fh, filesize($location_stylesheet));
 
 1800                 preg_match_all(
"/url\(([^\)]*)\)/",$css,$files);
 
 1801                 foreach (array_unique($files[1]) as $fileref)
 
 1803                         $fileref = dirname($location_stylesheet).
"/".$fileref;
 
 1804                         if (is_file($fileref))
 
 1806                                 copy($fileref, $style_img_dir.
"/".basename($fileref));
 
 1813                 $ilBench->start(
"ExportHTML", 
"exportContentStyle");
 
 1816                         $cont_stylesheet = 
"./Services/COPage/css/content.css";
 
 1818                         $css = fread(fopen($cont_stylesheet,
'r'),filesize($cont_stylesheet));
 
 1819                         preg_match_all(
"/url\(([^\)]*)\)/",$css,$files);
 
 1820                         foreach (array_unique($files[1]) as $fileref)
 
 1822                                 if (is_file(str_replace(
"..", 
".", $fileref)))
 
 1824                                         copy(str_replace(
"..", 
".", $fileref), $content_style_img_dir.
"/".basename($fileref));
 
 1826                                 $css = str_replace($fileref, 
"images/".basename($fileref),$css);
 
 1828                         fwrite(fopen($content_style_dir.
"/content.css",
'w'),$css);
 
 1833                         $style->writeCSSFile($content_style_dir.
"/content.css", 
"images");
 
 1834                         $style->copyImagesToDir($content_style_img_dir);
 
 1836                 $ilBench->stop(
"ExportHTML", 
"exportContentStyle");
 
 1840                 copy($syn_stylesheet, $a_target_dir.
"/syntaxhighlight.css");
 
 1843                 include_once(
"./Modules/LearningModule/classes/class.ilLMPresentationGUI.php");
 
 1844                 $_GET[
"cmd"] = 
"nop";
 
 1846                 $lm_gui->setOfflineMode(
true);
 
 1847                 $lm_gui->setOfflineDirectory($a_target_dir);
 
 1848                 $lm_gui->setExportFormat($a_export_format);
 
 1851                 $ilBench->start(
"ExportHTML", 
"exportHTMLPages");
 
 1853                 $ilBench->stop(
"ExportHTML", 
"exportHTMLPages");
 
 1856                 $ilBench->start(
"ExportHTML", 
"exportHTMLGlossaryTerms");
 
 1858                 $ilBench->stop(
"ExportHTML", 
"exportHTMLGlossaryTerms");
 
 1861                 $ilBench->start(
"ExportHTML", 
"exportHTMLMediaObjects");
 
 1862                 $linked_mobs = array();
 
 1863                 foreach ($this->offline_mobs as $mob)
 
 1867                                 $this->
exportHTMLMOB($a_target_dir, $lm_gui, $mob, 
"_blank", $linked_mobs);
 
 1870                 $linked_mobs2 = array();                                
 
 1871                 foreach ($linked_mobs as $mob)
 
 1875                                 $this->
exportHTMLMOB($a_target_dir, $lm_gui, $mob, 
"_blank", $linked_mobs2);
 
 1878                 $_GET[
"obj_type"]  = 
"MediaObject";
 
 1879                 $_GET[
"obj_id"]  = $a_mob_id;
 
 1881                 $ilBench->stop(
"ExportHTML", 
"exportHTMLMediaObjects");
 
 1884                 $ilBench->start(
"ExportHTML", 
"exportHTMLFileObjects");
 
 1885                 foreach ($this->offline_files as 
$file)
 
 1889                 $ilBench->stop(
"ExportHTML", 
"exportHTMLFileObjects");
 
 1892                 $ilBench->start(
"ExportHTML", 
"exportHTMLTOC");
 
 1893                 $ilLocator->clearItems();
 
 1896                         $tpl = 
new ilTemplate(
"tpl.main.html", 
true, 
true);
 
 1898                         $content =& $lm_gui->showTableOfContents();
 
 1899                         $file = $a_target_dir.
"/table_of_contents.html";
 
 1902                         if (!($fp = @fopen($file,
"w+")))
 
 1904                                 die (
"<b>Error</b>: Could not open \"".$file.
"\" for writing".
 
 1905                                         " in <b>".__FILE__.
"</b> on line <b>".__LINE__.
"</b><br />");
 
 1908                         fwrite($fp, $content);
 
 1911                 $ilBench->stop(
"ExportHTML", 
"exportHTMLTOC");
 
 1914                 $ilBench->start(
"ExportHTML", 
"exportHTMLImages");
 
 1915                 $image_dir = $a_target_dir.
"/images";
 
 1919                         $image_dir.
"/enlarge.png");
 
 1921                         $image_dir.
"/browser/plus.png");
 
 1923                         $image_dir.
"/browser/minus.png");
 
 1925                         $image_dir.
"/browser/blank.png");
 
 1927                         $image_dir.
"/spacer.png");
 
 1929                         $image_dir.
"/icon_st.png");
 
 1931                         $image_dir.
"/icon_pg.png");
 
 1933                         $image_dir.
"/icon_st_s.png");
 
 1935                         $image_dir.
"/icon_pg_s.png");
 
 1937                         $image_dir.
"/icon_lm.png");
 
 1939                         $image_dir.
"/icon_lm_s.png");
 
 1941                         $image_dir.
"/nav_arr_L.png");
 
 1943                         $image_dir.
"/nav_arr_R.png");
 
 1945                         $image_dir.
"/browser/forceexp.png");
 
 1948                         $image_dir.
"/download.png");
 
 1949                 $ilBench->stop(
"ExportHTML", 
"exportHTMLImages");
 
 1952                 $services_dir = $a_target_dir.
"/Services";
 
 1954                 $media_service_dir = $services_dir.
"/MediaObjects";
 
 1956                 include_once(
"./Services/MediaObjects/classes/class.ilPlayerUtil.php");
 
 1959                 $mp3_dir = $media_service_dir.
"/flash_mp3_player";
 
 1964                 copy(
"./Services/MediaObjects/flash_mp3_player/mp3player.swf",
 
 1965                         $mp3_dir.
"/mp3player.swf");
 
 1971                 include_once(
"./Services/YUI/classes/class.ilYuiUtil.php");
 
 1972                 foreach (self::getSupplyingExportFiles($a_target_dir) as $f)
 
 1974                         if ($f[
"source"] != 
"")
 
 1976                                 copy($f[
"source"], $f[
"target"]);
 
 1981                 $tpl = 
new ilTemplate(
"tpl.main.html", 
true, 
true);
 
 1982                 $tpl->setVariable(
"LOCATION_STYLESHEET",$location_stylesheet);
 
 1983                 $tpl->addBlockFile(
"CONTENT", 
"content", 
"tpl.adm_content.html");
 
 1986                 $ilBench->start(
"ExportHTML", 
"zip");
 
 1999                 $ilBench->stop(
"ExportHTML", 
"zip");
 
 2011                 include_once(
"./Services/YUI/classes/class.ilYuiUtil.php");
 
 2012                 include_once(
"./Services/jQuery/classes/class.iljQueryUtil.php");
 
 2013                 include_once(
"./Services/MediaObjects/classes/class.ilPlayerUtil.php");
 
 2016                                 "target" => $a_target_dir.
'/js/yahoo/yahoo-min.js',
 
 2019                                 "target" => $a_target_dir.
'/js/yahoo/yahoo-dom-event.js',
 
 2022                                 "target" => $a_target_dir.
'/js/yahoo/animation-min.js',
 
 2024                         array(
"source" => 
'./Services/JavaScript/js/Basic.js',
 
 2025                                 "target" => $a_target_dir.
'/js/Basic.js',
 
 2027                         array(
"source" => 
'./Services/Accordion/js/accordion.js',
 
 2028                                 "target" => $a_target_dir.
'/js/accordion.js',
 
 2030                         array(
"source" => 
'./Services/Accordion/css/accordion.css',
 
 2031                                 "target" => $a_target_dir.
'/css/accordion.css',
 
 2034                                 "target" => $a_target_dir.
'/js/jquery.js',
 
 2037                                 "target" => $a_target_dir.
'/js/maphilight.js',
 
 2040                                 "target" => $a_target_dir.
'/js/jquery-ui-min.js',
 
 2042                         array(
"source" => 
'./Services/COPage/js/ilCOPagePres.js',
 
 2043                                 "target" => $a_target_dir.
'/js/ilCOPagePres.js',
 
 2045                         array(
"source" => 
'./Modules/Scorm2004/scripts/questions/pure.js',
 
 2046                                 "target" => $a_target_dir.
'/js/pure.js',
 
 2048                         array(
"source" => 
'./Modules/Scorm2004/scripts/questions/question_handling.js',
 
 2049                                 "target" => $a_target_dir.
'/js/question_handling.js',
 
 2051                         array(
"source" => 
'./Modules/Scorm2004/templates/default/question_handling.css',
 
 2052                                 "target" => $a_target_dir.
'/css/question_handling.css',
 
 2066                         $scripts[] = array(
"source" => 
"",
 
 2080                 $file_dir = $a_target_dir.
"/files/file_".$a_file_id;
 
 2082                 include_once(
"./Modules/File/classes/class.ilObjFile.php");
 
 2083                 $file_obj = 
new ilObjFile($a_file_id, 
false);
 
 2084                 $source_file = $file_obj->getDirectory($file_obj->getVersion()).
"/".$file_obj->getFileName();
 
 2085                 if (!is_file($source_file))
 
 2087                         $source_file = $file_obj->getDirectory().
"/".$file_obj->getFileName();
 
 2089                 if (is_file($source_file))
 
 2091                         copy($source_file, $file_dir.
"/".$file_obj->getFileName());
 
 2098         function exportHTMLMOB($a_target_dir, &$a_lm_gui, $a_mob_id, $a_frame, &$a_linked_mobs)
 
 2102                 $mob_dir = $a_target_dir.
"/mobs";
 
 2105                 if (@is_dir($source_dir))
 
 2111                 $tpl = 
new ilTemplate(
"tpl.main.html", 
true, 
true);
 
 2112                 $tpl->addBlockFile(
"CONTENT", 
"content", 
"tpl.adm_content.html");
 
 2113                 $_GET[
"obj_type"]  = 
"MediaObject";
 
 2114                 $_GET[
"mob_id"]  = $a_mob_id;
 
 2115                 $_GET[
"frame"] = $a_frame;
 
 2117                 $content =& $a_lm_gui->media();
 
 2118                 $file = $a_target_dir.
"/media_".$a_mob_id.
".html";
 
 2121                 if (!($fp = @fopen(
$file,
"w+")))
 
 2123                         die (
"<b>Error</b>: Could not open \"".
$file.
"\" for writing".
 
 2124                                 " in <b>".__FILE__.
"</b> on line <b>".__LINE__.
"</b><br />");
 
 2127                 fwrite($fp, $content);
 
 2131                 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
 
 2133                 if ($mob_obj->hasFullscreenItem())
 
 2135                         $tpl = 
new ilTemplate(
"tpl.main.html", 
true, 
true);
 
 2136                         $tpl->addBlockFile(
"CONTENT", 
"content", 
"tpl.adm_content.html");
 
 2137                         $_GET[
"obj_type"]  = 
"";
 
 2138                         $_GET[
"frame"]  = 
"";
 
 2139                         $_GET[
"mob_id"]  = $a_mob_id;
 
 2140                         $_GET[
"cmd"] = 
"fullscreen";
 
 2141                         $content =& $a_lm_gui->fullscreen();
 
 2142                         $file = $a_target_dir.
"/fullscreen_".$a_mob_id.
".html";
 
 2145                         if (!($fp = @fopen(
$file,
"w+")))
 
 2147                                 die (
"<b>Error</b>: Could not open \"".
$file.
"\" for writing".
 
 2148                                         " in <b>".__FILE__.
"</b> on line <b>".__LINE__.
"</b><br />");
 
 2151                         fwrite($fp, $content);
 
 2154                 $linked_mobs = $mob_obj->getLinkedMediaObjects();
 
 2155                 $a_linked_mobs = array_merge($a_linked_mobs, $linked_mobs);
 
 2165                 foreach($this->offline_int_links as $int_link)
 
 2167                         $ilLocator->clearItems();
 
 2168                         if ($int_link[
"type"] == 
"git")
 
 2171                                 $tpl->addBlockFile(
"CONTENT", 
"content", 
"tpl.adm_content.html");
 
 2173                                 $_GET[
"obj_id"] = $int_link[
"id"];
 
 2174                                 $_GET[
"frame"] = 
"_blank";
 
 2175                                 $content =& $a_lm_gui->glossary();
 
 2176                                 $file = $a_target_dir.
"/term_".$int_link[
"id"].
".html";
 
 2179                                 if (!($fp = @fopen(
$file,
"w+")))
 
 2181                                         die (
"<b>Error</b>: Could not open \"".
$file.
"\" for writing".
 
 2182                                                         " in <b>".__FILE__.
"</b> on line <b>".__LINE__.
"</b><br />");
 
 2185                                 fwrite($fp, $content);
 
 2189                                 include_once(
"./Modules/Glossary/classes/class.ilGlossaryDefinition.php");
 
 2191                                 foreach($defs as $def)
 
 2194                                         foreach($def_mobs as $def_mob)
 
 2196                                                 $this->offline_mobs[$def_mob] = $def_mob;
 
 2201                                         $this->offline_files = array_merge($this->offline_files, $def_files);
 
 2220                 $this->first_page_id = $first_page[
"child"];
 
 2224                 $int_links = array();
 
 2225                 $this->offline_files = array();
 
 2227                 include_once(
"./Services/COPage/classes/class.ilPageContentUsage.php");
 
 2228                 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
 
 2232                 $exp_id_map = array();
 
 2234                 if ($lm_set->get(
"html_export_ids"))
 
 2236                         foreach ($pages as $page)
 
 2239                                 if (trim($exp_id) != 
"")
 
 2241                                         $exp_id_map[$page[
"obj_id"]] = trim($exp_id);
 
 2247                 foreach ($pages as $page)
 
 2251                                 $ilLocator->clearItems();
 
 2252                                 $ilBench->start(
"ExportHTML", 
"exportHTMLPage");
 
 2253                                 $ilBench->start(
"ExportHTML", 
"exportPageHTML");
 
 2256                                 $ilBench->stop(
"ExportHTML", 
"exportPageHTML");
 
 2260                                 foreach ($pcs as $pc)
 
 2262                                         if ($pc[
"type"] == 
"incl")
 
 2265                                                 foreach($incl_mobs as $incl_mob)
 
 2267                                                         $mobs[$incl_mob] = $incl_mob;
 
 2274                                 foreach($pg_mobs as $pg_mob)
 
 2276                                         $mobs[$pg_mob] = $pg_mob;
 
 2281                                 $int_links = array_merge($int_links, $pg_links);
 
 2284                                 include_once(
"./Modules/File/classes/class.ilObjFile.php");
 
 2286                                 $this->offline_files = array_merge($this->offline_files, $pg_files);
 
 2288                                 $ilBench->stop(
"ExportHTML", 
"exportHTMLPage");
 
 2291                 $this->offline_mobs = 
$mobs;
 
 2292                 $this->offline_int_links = $int_links;
 
 2303                 $a_exp_id_map = array())
 
 2309                 $tpl = 
new ilTemplate(
"tpl.main.html", 
true, 
true);
 
 2310                 $tpl->addBlockFile(
"CONTENT", 
"content", 
"tpl.adm_content.html");
 
 2312                 $_GET[
"obj_id"] = $a_lm_page_id;
 
 2313                 $_GET[
"frame"] = $a_frame;
 
 2318                         if (is_array($a_exp_id_map) && isset($a_exp_id_map[$a_lm_page_id]))
 
 2320                                 $file = $a_target_dir.
"/lm_pg_".$a_exp_id_map[$a_lm_page_id].
".html";
 
 2324                                 $file = $a_target_dir.
"/lm_pg_".$a_lm_page_id.
".html";
 
 2329                         if ($a_frame != 
"toc")
 
 2331                                 $file = $a_target_dir.
"/frame_".$a_lm_page_id.
"_".$a_frame.
".html";
 
 2335                                 $file = $a_target_dir.
"/frame_".$a_frame.
".html";
 
 2340                 if (@is_file(
$file))
 
 2345                 $ilBench->start(
"ExportHTML", 
"layout");
 
 2346                 $ilBench->start(
"ExportHTML", 
"layout_".$a_frame);
 
 2347                 $content =& $a_lm_gui->layout(
"main.xml", 
false);
 
 2348                 $ilBench->stop(
"ExportHTML", 
"layout_".$a_frame);
 
 2349                 $ilBench->stop(
"ExportHTML", 
"layout");
 
 2352                 if (!($fp = @fopen(
$file,
"w+")))
 
 2354                         die (
"<b>Error</b>: Could not open \"".
$file.
"\" for writing".
 
 2355                                         " in <b>".__FILE__.
"</b> on line <b>".__LINE__.
"</b><br />");
 
 2362                 fwrite($fp, $content);
 
 2367                 if ($this->first_page_id == $a_lm_page_id && $a_frame == 
"")
 
 2369                         copy(
$file, $a_target_dir.
"/index.html");
 
 2373                 $ilBench->start(
"ExportHTML", 
"getCurrentFrameSet");
 
 2374                 $frameset = $a_lm_gui->getCurrentFrameSet();
 
 2375                 $ilBench->stop(
"ExportHTML", 
"getCurrentFrameSet");
 
 2377                 foreach ($frameset as $frame)
 
 2379                         $this->
exportPageHTML($a_lm_gui, $a_target_dir, $a_lm_page_id, $frame);
 
 2396                 $attrs[
"xmlns:fo"] = 
"http://www.w3.org/1999/XSL/Format";
 
 2397                 $a_xml_writer->xmlStartTag(
"fo:root", $attrs);
 
 2401                 $a_xml_writer->xmlStartTag(
"fo:layout-master-set", $attrs);
 
 2405                 $attrs[
"master-name"] = 
"DinA4";
 
 2406                 $attrs[
"page-height"] = 
"29.7cm";
 
 2407                 $attrs[
"page-width"] = 
"21cm";
 
 2408                 $attrs[
"margin-top"] = 
"4cm";
 
 2409                 $attrs[
"margin-bottom"] = 
"1cm";
 
 2410                 $attrs[
"margin-left"] = 
"2.8cm";
 
 2411                 $attrs[
"margin-right"] = 
"7.3cm";
 
 2412                 $a_xml_writer->xmlStartTag(
"fo:simple-page-master", $attrs);
 
 2416                 $attrs[
"margin-top"] = 
"0cm";
 
 2417                 $attrs[
"margin-bottom"] = 
"1.25cm";
 
 2418                 $a_xml_writer->xmlElement(
"fo:region-body", $attrs);
 
 2422                 $attrs[
"extent"] = 
"1cm";
 
 2423                 $a_xml_writer->xmlElement(
"fo:region-before", $attrs);
 
 2427                 $attrs[
"extent"] = 
"1cm";
 
 2428                 $a_xml_writer->xmlElement(
"fo:region-after", $attrs);
 
 2431                 $a_xml_writer->xmlEndTag(
"fo:simple-page-master");
 
 2434                 $a_xml_writer->xmlEndTag(
"fo:layout-master-set");
 
 2438                 $attrs[
"master-reference"] = 
"DinA4";
 
 2439                 $a_xml_writer->xmlStartTag(
"fo:page-sequence", $attrs);
 
 2443                 $attrs[
"flow-name"] = 
"xsl-region-body";
 
 2444                 $a_xml_writer->xmlStartTag(
"fo:flow", $attrs);
 
 2449                 $ilBench->start(
"ContentObjectExport", 
"exportFOStructureObjects");
 
 2451                 $ilBench->stop(
"ContentObjectExport", 
"exportFOStructureObjects");
 
 2455                 $a_xml_writer->xmlEndTag(
"fo:flow");
 
 2458                 $a_xml_writer->xmlEndTag(
"fo:page-sequence");
 
 2461                 $a_xml_writer->xmlEndTag(
"fo:root");
 
 2472                 $childs = $this->lm_tree->getChilds($this->lm_tree->getRootId());
 
 2473                 foreach ($childs as $child)
 
 2475                         if($child[
"type"] != 
"st")
 
 2481                         $structure_obj->exportFO($a_xml_writer, $expLog);
 
 2482                         unset($structure_obj);
 
 2488                 include_once(
"./Modules/LearningModule/classes/class.ilContObjectExport.php");
 
 2492                 $export_file = $cont_exp->buildExportFile();
 
 2493                 return $export_file;
 
 2507                 $lmtree->setTableNames(
'lm_tree',
'lm_data');
 
 2508                 $lmtree->setTreeTablePK(
"lm_id");
 
 2511                 $source_obj->setLMId($this->
getId());
 
 2516                         $target_obj->setLMId($this->
getId());
 
 2517                         $target_parent = $lmtree->getParentId(
$target_id);
 
 2521                 if ($source_obj->getType() == 
"pg")
 
 2524                         if ($lmtree->isInTree($source_obj->getId()))
 
 2526                                 $node_data = $lmtree->getNodeData($source_obj->getId());
 
 2529                                 if ($movecopy == 
"move")
 
 2531                                         $parent_id = $lmtree->getParentId($source_obj->getId());
 
 2532                                         $lmtree->deleteTree($node_data);
 
 2535                                         require_once(
"./Services/History/classes/class.ilHistory.php");
 
 2546                                         $new_page =& $source_obj->copy();
 
 2547                                         $source_id = $new_page->getId();
 
 2548                                         $source_obj =& $new_page;
 
 2552                                 if(!$lmtree->isInTree($source_obj->getId()))
 
 2559                                         else if ($as_subitem)           
 
 2563                                                 $pg_childs =& $lmtree->getChildsByType($parent, 
"pg");
 
 2564                                                 if (count($pg_childs) != 0)
 
 2566                                                         $target_pos = $pg_childs[count($pg_childs) - 1][
"obj_id"];
 
 2572                                                 $parent = $target_parent;
 
 2576                                         $lmtree->insertNode($source_obj->getId(),
 
 2577                                                 $parent, $target_pos);
 
 2580                                         if ($movecopy == 
"move")
 
 2583                                                 include_once(
"./Services/History/classes/class.ilHistory.php");
 
 2597                 if ($source_obj->getType() == 
"st")
 
 2600                         $source_node = $lmtree->getNodeData($source_id);
 
 2601                         $subnodes = $lmtree->getSubtree($source_node);
 
 2604                         foreach ($subnodes as $subnode)
 
 2619                                 $pg_childs =& $lmtree->getChildsByType($target_parent, 
"pg");
 
 2620                                 if (count($pg_childs) != 0)
 
 2622                                         $target_pos = $pg_childs[count($pg_childs) - 1][
"obj_id"];
 
 2625                         else if ($as_subitem)           
 
 2629                                 $childs =& $lmtree->getChilds($target_parent);
 
 2630                                 if (count($childs) != 0)
 
 2632                                         $target_pos = $childs[count($childs) - 1][
"obj_id"];
 
 2657                         if ($movecopy == 
"move")
 
 2659                                 $lmtree->deleteTree($source_node);
 
 2664                                 $new_chapter =& $source_obj->copy($lmtree, $target_parent, $target_pos);
 
 2667                         if (!$lmtree->isInTree($source_id))
 
 2669                                 $lmtree->insertNode($source_id, $target_parent, $target_pos);
 
 2672                                 if ($movecopy == 
"move")
 
 2674                                         foreach ($subnodes as $node)
 
 2676                                                 if($node[
"obj_id"] != $source_id)
 
 2678                                                         $lmtree->insertNode($node[
"obj_id"], $node[
"parent"]);
 
 2696                 include_once 
"./Modules/LearningModule/classes/class.ilLMPageObject.php";
 
 2697                 include_once 
"./Services/COPage/classes/class.ilPageObject.php";
 
 2702                 foreach ($pages as $page)
 
 2708                                 $error = @$cpage->validateDom();
 
 2712                                         $this->lng->loadLanguageModule(
"content");
 
 2716                                         $mess.= $this->lng->txt(
"obj_pg").
": ".
$title;
 
 2717                                         $mess.= 
'<div class="small">';
 
 2718                                         foreach ($error as $e)
 
 2720                                                 $err_mess = implode($e, 
" - ");
 
 2721                                                 if (!is_int(strpos($err_mess, 
":0:")))
 
 2723                                                         $mess.= htmlentities($err_mess).
"<br />";
 
 2742                 $a_import_into_help_module = 0)
 
 2750                 $file = pathinfo($a_filename);
 
 2754                         $a_filename, $full_path);
 
 2759                 $subdir = basename(
$file[
"basename"],
".".
$file[
"extension"]);
 
 2765                 if ($a_import_into_help_module > 0)
 
 2770                         foreach ($files as 
$file)
 
 2772                                 if (is_int(strpos($file[
"entry"], 
"__help_")) && 
 
 2773                                         is_int(strpos($file[
"entry"], 
".zip")))
 
 2775                                         include_once(
"./Services/Export/classes/class.ilImport.php");
 
 2777                                         $imp->getMapping()->addMapping(
'Services/Help', 
'help_module', 0, $a_import_into_help_module);
 
 2778                                         include_once(
"./Modules/LearningModule/classes/class.ilLMObject.php");
 
 2780                                         foreach ($chaps as $chap)
 
 2782                                                 $chap_arr = explode(
"_", $chap[
"import_id"]);
 
 2783                                                 $imp->getMapping()->addMapping(
'Services/Help', 
'help_chap',
 
 2784                                                         $chap_arr[count($chap_arr) - 1], $chap[
"obj_id"]);
 
 2786                                         $imp->importEntity($dir.
"/".$file[
"entry"], $file[
"entry"],
 
 2787                                                 "help", 
"Services/Help", 
true);
 
 2810                 $subdir = basename($a_directory);
 
 2811                 $xml_file = $a_directory.
"/".$subdir.
".xml";
 
 2814                 if (!is_dir($a_directory))
 
 2816                         return sprintf($lng->txt(
"cont_no_subdir_in_zip"), $subdir);
 
 2820                 if (!is_file($xml_file))
 
 2822                         return sprintf($lng->txt(
"cont_zip_file_invalid"), $subdir.
"/".$subdir.
".xml");
 
 2826                 $qti_file = $a_directory.
"/qti.xml";
 
 2828                 if (is_file($qti_file))
 
 2830                         include_once 
"./Services/QTI/classes/class.ilQTIParser.php";
 
 2831                         include_once(
"./Modules/Test/classes/class.ilObjTest.php");
 
 2834                         $result = $qtiParser->startParsing ();
 
 2835                         $founditems = & $qtiParser->getFoundItems ();
 
 2837                         if (count($founditems) > 0)
 
 2840                                 $qtiParser->setTestObject($testObj);
 
 2841                                 $result = $qtiParser->startParsing();
 
 2842                                 $qtis = array_merge($qtis, $qtiParser->getImportMapping());
 
 2846                 include_once (
"./Modules/LearningModule/classes/class.ilContObjParser.php");
 
 2847                 $contParser = 
new ilContObjParser($this, $xml_file, $subdir, $qmapping);
 
 2848                 $contParser->setQuestionMapping($qtis);
 
 2849                 $contParser->startParsing();
 
 2854                 $style_file = $a_directory.
"/style.xml";
 
 2855                 $style_zip_file = $a_directory.
"/style.zip";
 
 2856                 if (is_file($style_zip_file))   
 
 2858                         require_once(
"./Services/Style/classes/class.ilObjStyleSheet.php");
 
 2860                         $style->import($style_zip_file);
 
 2863                 else if (is_file($style_file))  
 
 2865                         require_once(
"./Services/Style/classes/class.ilObjStyleSheet.php");
 
 2867                         $style->import($style_file);
 
 2880                         include_once(
"./Services/COPage/classes/class.ilPageObject.php");
 
 2904                 $new_obj->setTitle($this->
getTitle());
 
 2907                 $new_obj->setLayout($this->
getLayout());
 
 2924                 $new_obj->createLMTree();
 
 2927                 include_once(
"./Services/Style/classes/class.ilObjStyleSheet.php");
 
 2932                         $style_obj = $ilias->obj_factory->getInstanceByObjId(
$style_id);
 
 2933                         $new_id = $style_obj->ilClone();
 
 2934                         $new_obj->setStyleSheetId($new_id);
 
 2942                 include_once(
'Services/Tracking/classes/class.ilLPObjSettings.php');
 
 2944                 $obj_settings->cloneSettings($new_obj->getId());
 
 2945                 unset($obj_settings);
 
 2958                 $parent_id = $a_target_obj->lm_tree->readRootId();
 
 2960                 include_once(
"./Modules/LearningModule/classes/class.ilLMObject.php");
 
 2961                 include_once(
"./Modules/LearningModule/classes/class.ilLMPageObject.php");
 
 2964                 $chapters = $this->lm_tree->getChildsByType($this->lm_tree->readRootId(), 
"st");
 
 2965                 $copied_nodes = array();
 
 2967                 foreach ($chapters as $chap)
 
 2976                 foreach ($pages as $p)
 
 2978                         if (!$this->lm_tree->isInTree($p[
"obj_id"]))
 
 2981                                 $target_item = $item->copy($a_target_obj);
 
 2982                                 $copied_nodes[$item->getId()] = $target_item->getId();
 
 2988                 $a_target_obj->checkTree();
 
 3003                 if ($a_ref_id > 0 && $a_ref_id == OH_REF_ID)