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"];
 
  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").
 
  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");
 
 1017                 $lm_set = $ilDB->query($q);
 
 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");
 
 1113                 $lm_set = $ilDB->query($q);
 
 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))
 
 1173                 $lm_tree->setTableNames(
'lm_tree',
'lm_data');
 
 1179                         foreach (
$path as $node)
 
 1181                                 if ($node[
"type"] == 
"st")
 
 1200                 $lm_tree->setTableNames(
'lm_tree',
'lm_data');
 
 1208                         foreach (
$path as $node)
 
 1210                                 if ($node[
"type"] == 
"st")
 
 1214                                         foreach ($tconds as $tcond)
 
 1235                 $lm_tree->setTableNames(
'lm_tree',
'lm_data');
 
 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);
 
 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");
 
 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");
 
 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;