25     protected \ILIAS\Notes\Service 
$notes;
    68         bool $a_call_by_reference = 
true    71         $this->main_tpl = $DIC->ui()->mainTemplate();
    73         $this->
user = $DIC->user();
    74         $this->db = $DIC->database();
    75         $this->tree = $DIC->repositoryTree();
    76         $this->
lng = $DIC->language();
    77         $this->error = $DIC[
"ilErr"];
    78         if (isset($DIC[
"ilLocator"])) {
    79             $this->
locator = $DIC[
"ilLocator"];
    82         $this->notes = $DIC->notes();
    93         $this->mob_ids = array();
    94         $this->file_ids = array();
    95         $this->q_ids = array();
    96         $cs = $DIC->contentStyle();
    97         $this->content_style_domain = $cs->domain();
   104         bool $a_no_meta_data = 
false   106         $id = parent::create();
   110         if (!$a_no_meta_data) {
   131             "SELECT * FROM lm_glossaries " .
   132             " WHERE lm_id = " . 
$ilDB->quote($this->getId(), 
"integer")
   135         while ($rec = 
$ilDB->fetchAssoc($set)) {
   136             $glos[] = $rec[
"glo_id"];
   143         $this->layout_per_page = $a_val;
   156         $this->disable_def_feedback = $a_val;
   166         $this->progr_icons = $a_val;
   176         $this->store_tries = $a_val;
   186         $this->restrict_forw_nav = $a_val;
   214             "DELETE FROM lm_glossaries WHERE " .
   215             " lm_id = " . 
$ilDB->quote($this->getId(), 
"integer")
   218             $ilDB->manipulate(
"INSERT INTO lm_glossaries " .
   219                 "(lm_id, glo_id) VALUES (" .
   220                 $ilDB->quote($this->getId(), 
"integer") . 
"," .
   221                 $ilDB->quote($glo_id, 
"integer") .
   230     public function import(): 
void   238         $this->lm_tree->addTree($this->
getId(), 1);
   243         $this->auto_glossaries = array();
   244         if (is_array($a_val)) {
   245             foreach ($a_val as $v) {
   248                     !in_array($v, $this->auto_glossaries)) {
   249                     $this->auto_glossaries[] = $v;
   264             if ($g != $a_glo_id) {
   271     public function addFirstChapterAndPage(): 
void   276         $root_id = $this->lm_tree->getRootId();
   280         $chap->setType(
"st");
   281         $chap->setTitle(
$lng->
txt(
"cont_new_chap"));
   282         $chap->setLMId($this->
getId());
   290         $page->setType(
"pg");
   291         $page->setTitle(
$lng->
txt(
"cont_new_page"));
   292         $page->setLMId($this->
getId());
   302         $this->for_translation = $a_val;
   326         if (!is_writable($lm_data_dir)) {
   327             $ilErr->raiseError(
"Content object Data Directory (" . $lm_data_dir
   328                 . 
") not writeable.", 
$ilErr->FATAL);
   332         $lm_dir = $lm_data_dir . 
"/lm_" . $this->
getId();
   334         if (!is_dir($lm_dir)) {
   335             $ilErr->raiseError(
"Creation of Learning Module Directory failed.", 
$ilErr->FATAL);
   339         $import_dir = $lm_dir . 
"/import";
   341         if (!is_dir($import_dir)) {
   342             $ilErr->raiseError(
"Creation of Import Directory failed.", 
$ilErr->FATAL);
   349             "/lm_" . $this->
getId();
   354         if (strlen($this->import_dir)) {
   359             "/lm_" . $this->
getId() . 
"/import";
   360         if (is_dir($import_dir)) {
   368         $this->import_dir = $a_import_dir;
   378         string $a_type = 
"xml"   384         $lm_dir = $lm_data_dir . 
"/lm_" . $this->
getId();
   386         if (!is_dir($lm_dir)) {
   387             $ilErr->raiseError(
"Creation of Learning Module Directory failed.", 
$ilErr->FATAL);
   392                 if (substr($a_type, 0, 4) == 
"html") {
   393                     $export_dir = $lm_dir . 
"/export_" . $a_type;
   395                     $export_dir = $lm_dir . 
"/export";
   401         if (!is_dir($export_dir)) {
   402             $ilErr->raiseError(
"Creation of Export Directory failed.", 
$ilErr->FATAL);
   407         string $a_type = 
"xml"   411                 if (substr($a_type, 0, 4) == 
"html") {
   430     public function delete(): 
bool   435         if (!parent::delete()) {
   449         $this->lm_tree->removeTree($this->lm_tree->getTreeId());
   455         $q = 
"DELETE FROM content_object WHERE id = " .
   460         $q = 
"DELETE FROM lm_menu WHERE lm_id = " .
   466             "DELETE FROM lm_glossaries WHERE " .
   467             " lm_id = " . 
$ilDB->quote($this->getId(), 
"integer")
   481         $this->layout = $a_layout;
   490         $ilDB = $DIC->database();
   493             "UPDATE content_object SET " .
   494             " header_page = " . 
$ilDB->quote($a_page_id, 
"integer") .
   495             " WHERE id = " . 
$ilDB->quote($a_lm_id, 
"integer")
   505         $ilDB = $DIC->database();
   508             "UPDATE content_object SET " .
   509             " footer_page = " . 
$ilDB->quote($a_page_id, 
"integer") .
   510             " WHERE id = " . 
$ilDB->quote($a_lm_id, 
"integer")
   524         $ilDB = $DIC->database();
   526         if ($a_from_style < 0) {        
   527             $q = 
"SELECT stylesheet FROM content_object, style_data " .
   528                 " WHERE content_object.stylesheet = style_data.id " .
   529                 " AND style_data.standard = " . 
$ilDB->quote(0, 
"integer") .
   530                 " AND content_object.stylesheet > " . 
$ilDB->quote(0, 
"integer");
   532             while ($style_rec = 
$ilDB->fetchAssoc($style_set)) {
   534                 $q = 
"UPDATE content_object SET " .
   535                     " stylesheet = " . 
$ilDB->quote($a_to_style, 
"integer") .
   536                     " WHERE stylesheet = " . 
$ilDB->quote($style_rec[
"stylesheet"], 
"integer");
   541                 $style_obj->delete();
   544             $q = 
"UPDATE content_object SET " .
   545                 " stylesheet = " . 
$ilDB->quote($a_to_style, 
"integer") .
   546                 " WHERE stylesheet = " . 
$ilDB->quote($a_from_style, 
"integer");
   557         $ilDB = $DIC->database();
   559         $q = 
"SELECT " . $a_field . 
" FROM content_object " .
   560             " WHERE id = " . 
$ilDB->quote($a_obj_id, 
"integer");
   565         return $rec[$a_field];
   571         return self::_lookup($a_obj_id, 
"restrict_forw_nav");
   578         $ilDB = $DIC->database();
   580         $q = 
"SELECT stylesheet FROM content_object " .
   581             " WHERE id = " . 
$ilDB->quote($a_cont_obj_id, 
"integer");
   585         return (
int) $sheet[
"stylesheet"];
   592         $ilDB = $DIC->database();
   594         $q = 
"SELECT id FROM content_object " .
   595             " WHERE stylesheet = " . 
$ilDB->quote($a_style_id, 
"integer");
   598         while ($cont = 
$ilDB->fetchAssoc(
$res)) {
   599             $obj_ids[] = (
int) $cont[
"id"];
   608         $ilDB = $DIC->database();
   610         $q = 
"SELECT disable_def_feedback FROM content_object " .
   611             " WHERE id = " . 
$ilDB->quote($a_id, 
"integer");
   615         return (
bool) ($rec[
"disable_def_feedback"] ?? 
false);
   622         $ilDB = $DIC->database();
   624         $q = 
"SELECT store_tries FROM content_object " .
   625             " WHERE id = " . 
$ilDB->quote($a_id, 
"integer");
   629         return (
bool) ($rec[
"store_tries"] ?? 
false);
   640         $ilDB = $DIC->database();
   642         $q = 
"SELECT count(*) as cnt FROM content_object " .
   643             " WHERE stylesheet = " . 
$ilDB->quote($a_style_id, 
"integer");
   645         $crow = 
$ilDB->fetchAssoc($cset);
   647         return (
int) ($crow[
"cnt"] ?? 0);
   658         $ilDB = $DIC->database();
   661         $q = 
"SELECT count(*) as cnt FROM content_object, style_data " .
   662             " WHERE stylesheet = style_data.id " .
   663             " AND standard = " . 
$ilDB->quote(0, 
"integer");
   665         $crow = 
$ilDB->fetchAssoc($cset);
   667         return (
int) $crow[
"cnt"];
   677         $ilDB = $DIC->database();
   679         $q = 
"SELECT count(*) as cnt FROM content_object " .
   680             " WHERE stylesheet = " . 
$ilDB->quote(0, 
"integer");
   682         $crow = 
$ilDB->fetchAssoc($cset);
   684         return (
int) $crow[
"cnt"];
   695         $ilDB = $DIC->database();
   697         $q = 
"UPDATE content_object SET " .
   698             " stylesheet = " . 
$ilDB->quote(0, 
"integer") .
   699             " WHERE stylesheet = " . 
$ilDB->quote($a_style_id, 
"integer");
   719         $this->pg_header = $a_pg_header;
   742     public function setTOCMode(
string $a_toc_mode = 
"chapters"): void
   744         $this->toc_mode = $a_toc_mode;
   749         $this->lm_menu_active = $a_act_lm_menu;
   759         $this->toc_active = $a_toc;
   769         $this->numbering = $a_num;
   779         $this->print_view_active = $a_print;
   789         $this->prevent_glossary_appendix_active = $a_print;
   802         $this->hide_header_footer_print = $a_val;
   812         $this->downloads_active = $a_down;
   822         $this->downloads_public_active = $a_down;
   832         $this->pub_notes = $a_pub_notes;
   842         $this->clean_frames = $a_clean;
   852         $this->user_comments = $a_comm;
   857         $this->public_access_mode = $a_mode;
   867         $this->header_page = $a_pg;
   877         $this->footer_page = $a_pg;
   889         $q = 
"SELECT * FROM content_object WHERE id = " .
   893         $this->
setLayout((
string) $lm_rec[
"default_layout"]);
   895         $this->
setTOCMode((
string) $lm_rec[
"toc_mode"]);
   912         $this->
setRating((
bool) $lm_rec[
"rating"]);
   934         $q = 
"UPDATE content_object SET " .
   935             " default_layout = " . 
$ilDB->quote($this->
getLayout(), 
"text") . 
", " .
   954             " rating = " . 
$ilDB->quote($this->
hasRating(), 
"integer") . 
", " .
   961             " WHERE id = " . 
$ilDB->quote($this->
getId(), 
"integer");
   964         $this->notes->domain()->activateComments($this->
getId(), $this->
publicNotes());
   974         $this->db->
insert(
"content_object", [
   975             "id" => [
"integer", $this->
getId()],
   980         $this->notes->domain()->activateComments($this->
getId());
   991         $dir = opendir(
"./Modules/LearningModule/layouts/lm");
   995         while ($file = readdir($dir)) {
   996             if ($file != 
"." && $file != 
".." && $file != 
"CVS" && $file != 
".svn") {
   998                 if (is_dir(
"./Modules/LearningModule/layouts/lm/" . $file)) {
   999                     $layouts[$file] = $file;
  1007             'toc2win' => 
'toc2win',
  1008             'toc2windyn' => 
'toc2windyn',
  1009             '1window' => 
'1window',
  1010             '2window' => 
'2window',
  1011             '3window' => 
'3window',
  1012             'presentation' => 
'presentation',
  1013             'fullscreen' => 
'fullscreen'  1016         foreach ($layouts as $l) {
  1017             if (!in_array($l, $ret)) {
  1033         $lm_tree = 
new ilTree($cont_obj_id);
  1037         if ($lm_tree->
isInTree($page_id)) {
  1039             foreach (
$path as $node) {
  1040                 if ($node[
"type"] == 
"st") {
  1059         $lm_tree = 
new ilTree($cont_obj_id);
  1064         if ($lm_tree->
isInTree($page_id)) {
  1067             foreach (
$path as $node) {
  1068                 if ($node[
"type"] == 
"st") {
  1071                     foreach ($tconds as $tcond) {
  1088         int $cont_obj_ref_id,
  1092         $lm_tree = 
new ilTree($cont_obj_id);
  1096         if ($lm_tree->
isInTree($page_id)) {
  1099             foreach (
$path as $node) {
  1100                 if ($node[
"type"] == 
"st") {
  1103                     foreach ($tconds as $tcond) {
  1106                             return (
int) $node[
"child"];
  1154         $set = 
$ilDB->query(
  1155             "SELECT DISTINCT l1.lm_id" .
  1156             " FROM lm_tree l1" .
  1157             " JOIN lm_tree l2 ON ( l1.child = l2.parent" .
  1158             " AND l1.lm_id = l2.lm_id )" .
  1159             " JOIN lm_data ON ( l1.child = lm_data.obj_id )" .
  1160             " WHERE (l2.lft < l1.lft" .
  1161             " OR l2.rgt > l1.rgt OR l2.lft > l1.rgt OR l2.rgt < l1.lft)" .
  1162             " AND l1.lm_id = " . 
$ilDB->quote($this->getId(), 
"integer") .
  1163             " ORDER BY lm_data.create_date DESC"  1165         if ($rec = 
$ilDB->fetchAssoc($set)) {
  1170         $set = 
$ilDB->query(
"SELECT * FROM lm_tree WHERE lm_tree.lm_id = " . 
$ilDB->quote($this->getId(), 
"integer"));
  1171         while ($node = 
$ilDB->fetchAssoc($set)) {
  1172             $q = 
"SELECT * FROM lm_data WHERE obj_id = " .
  1173                 $ilDB->quote($node[
"child"], 
"integer");
  1175             $obj_rec = 
$ilDB->fetchAssoc($obj_set);
  1178                 $node_data[
"child"] = $node[
"child"];
  1185         foreach ($nodes as $node) {
  1186             $q = 
"SELECT * FROM lm_data WHERE obj_id = " .
  1187                 $ilDB->quote($node[
"parent"], 
"integer");
  1189             $obj_rec = 
$ilDB->fetchAssoc($obj_set);
  1190             if (($obj_rec[
"type"] ?? 
"") == 
"pg") {
  1200         $set = 
$ilDB->query(
"SELECT DISTINCT l1.lm_id" .
  1201                 " FROM lm_tree l1" .
  1202                 " JOIN lm_tree l2 ON ( l1.child = l2.child AND l1.lm_id <> l2.lm_id )" .
  1203                 " JOIN lm_data ON (l1.child = lm_data.obj_id)" .
  1204                 " WHERE l1.child <> 1" .
  1205                 " AND l1.lm_id <> lm_data.lm_id" .
  1206                 " AND l1.lm_id = " . 
$ilDB->quote($this->getId(), 
"integer"));
  1207         if ($rec = 
$ilDB->fetchAssoc($set)) {
  1208             $set = 
$ilDB->query(
"SELECT DISTINCT l1.child " .
  1209                 " FROM lm_tree l1" .
  1210                 " JOIN lm_tree l2 ON ( l1.child = l2.child AND l1.lm_id <> l2.lm_id )" .
  1211                 " JOIN lm_data ON (l1.child = lm_data.obj_id)" .
  1212                 " WHERE l1.child <> 1" .
  1213                 " AND l1.lm_id <> lm_data.lm_id" .
  1214                 " AND l1.lm_id = " . 
$ilDB->quote($this->getId(), 
"integer"));
  1215             while ($rec = 
$ilDB->fetchAssoc($set)) {
  1218                 if (is_object($cobj)) {
  1219                     if ($cobj->getType() == 
"pg") {
  1221                         $pg_copy = $cobj->copy($this->lm);
  1225                             "UPDATE lm_tree SET " .
  1226                             " child = " . 
$ilDB->quote($pg_copy->getId(), 
"integer") .
  1227                             " WHERE child = " . 
$ilDB->quote($cobj->getId(), 
"integer") .
  1228                             " AND lm_id = " . 
$ilDB->quote($this->getId(), 
"integer")
  1230                     } elseif ($cobj->getType() == 
"st") {
  1232                         $st_copy = $cobj->copy($this->lm);
  1236                             "UPDATE lm_tree SET " .
  1237                             " child = " . 
$ilDB->quote($st_copy->getId(), 
"integer") .
  1238                             " WHERE child = " . 
$ilDB->quote($cobj->getId(), 
"integer") .
  1239                             " AND lm_id = " . 
$ilDB->quote($this->getId(), 
"integer")
  1244                             "UPDATE lm_tree SET " .
  1245                             " parent = " . 
$ilDB->quote($st_copy->getId(), 
"integer") .
  1246                             " WHERE parent = " . 
$ilDB->quote($cobj->getId(), 
"integer") .
  1247                             " AND lm_id = " . 
$ilDB->quote($this->getId(), 
"integer")
  1255         $set = 
$ilDB->queryF(
  1256             "SELECT * FROM lm_data " .
  1257             " WHERE lm_id = %s AND type = %s",
  1258             array(
"integer", 
"text"),
  1259             array($this->
getId(), 
"pg")
  1261         while ($rec = 
$ilDB->fetchAssoc($set)) {
  1264                 $lm_page->setId($rec[
"obj_id"]);
  1265                 $lm_page->setParentId($this->
getId());
  1266                 $lm_page->create(
false);
  1284         $set = 
$ilDB->query(
  1285             "SELECT l1.child, l1.lft l1lft, l1.rgt l1rgt, l2.parent, l2.lft l2lft, l2.rgt l2rgt" .
  1286             " FROM lm_tree l1" .
  1287             " JOIN lm_tree l2 ON ( l1.child = l2.parent" .
  1288             " AND l1.lm_id = l2.lm_id )" .
  1289             " JOIN lm_data ON ( l1.child = lm_data.obj_id )" .
  1290             " WHERE (l2.lft < l1.lft" .
  1291             " OR l2.rgt > l1.rgt OR l2.lft > l1.rgt OR l2.rgt < l1.lft)" .
  1292             " AND l1.lm_id = " . 
$ilDB->quote($this->getId(), 
"integer") .
  1293             " ORDER BY lm_data.create_date DESC"  1295         while ($rec = 
$ilDB->fetchAssoc($set)) {
  1296             $issues[] = 
"Tree numbering: " . print_r($rec, 
true);
  1300         $set = 
$ilDB->query(
"SELECT * FROM lm_tree WHERE lm_tree.lm_id = " . 
$ilDB->quote($this->getId(), 
"integer"));
  1301         while ($node = 
$ilDB->fetchAssoc($set)) {
  1302             $q = 
"SELECT * FROM lm_data WHERE obj_id = " .
  1303                 $ilDB->quote($node[
"child"], 
"integer");
  1305             $obj_rec = 
$ilDB->fetchAssoc($obj_set);
  1307                 $issues[] = 
"Tree entry without data entry: " . print_r($node, 
true);
  1313         foreach ($nodes as $node) {
  1314             $q = 
"SELECT * FROM lm_data WHERE obj_id = " .
  1315                 $ilDB->quote($node[
"parent"], 
"integer");
  1317             $obj_rec = 
$ilDB->fetchAssoc($obj_set);
  1318             if (($obj_rec[
"type"] ?? 
"") == 
"pg") {
  1321                     $issues[] = 
"Subtree with page parent: " . print_r($node_data, 
true);
  1328         $set = 
$ilDB->query(
"SELECT DISTINCT l1.lm_id" .
  1329             " FROM lm_tree l1" .
  1330             " JOIN lm_tree l2 ON ( l1.child = l2.child AND l1.lm_id <> l2.lm_id )" .
  1331             " JOIN lm_data ON (l1.child = lm_data.obj_id)" .
  1332             " WHERE l1.child <> 1" .
  1333             " AND l1.lm_id <> lm_data.lm_id" .
  1334             " AND l1.lm_id = " . 
$ilDB->quote($this->getId(), 
"integer"));
  1335         if ($rec = 
$ilDB->fetchAssoc($set)) {
  1336             $set = 
$ilDB->query(
"SELECT DISTINCT l1.child " .
  1337                 " FROM lm_tree l1" .
  1338                 " JOIN lm_tree l2 ON ( l1.child = l2.child AND l1.lm_id <> l2.lm_id )" .
  1339                 " JOIN lm_data ON (l1.child = lm_data.obj_id)" .
  1340                 " WHERE l1.child <> 1" .
  1341                 " AND l1.lm_id <> lm_data.lm_id" .
  1342                 " AND l1.lm_id = " . 
$ilDB->quote($this->getId(), 
"integer"));
  1343             while ($rec = 
$ilDB->fetchAssoc($set)) {
  1344                 $set3 = 
$ilDB->queryF(
  1345                     "SELECT * FROM lm_tree " .
  1346                     " WHERE child = %s ",
  1348                     array($rec[
"child"])
  1350                 while ($rec3 = 
$ilDB->fetchAssoc($set3)) {
  1351                     $issues[] = 
"Multi-reference item: " . print_r($rec3, 
true);
  1357         $set = 
$ilDB->queryF(
  1358             "SELECT * FROM lm_data " .
  1359             " WHERE lm_id = %s AND type = %s",
  1360             array(
"integer", 
"text"),
  1361             array($this->
getId(), 
"pg")
  1363         while ($rec = 
$ilDB->fetchAssoc($set)) {
  1365                 $issues[] = 
"Missing COPage: " . print_r($rec, 
true);
  1376         string $a_target_dir,
  1382                 $attrs[
"Type"] = 
"LearningModule";
  1385         $a_xml_writer->
xmlStartTag(
"ContentObject", $attrs);
  1392         $expLog->
write(date(
"[y-m-d H:i:s] ") . 
"Start Export Structure Objects");
  1394         $expLog->
write(date(
"[y-m-d H:i:s] ") . 
"Finished Export Structure Objects");
  1397         $expLog->
write(date(
"[y-m-d H:i:s] ") . 
"Start Export Page Objects");
  1399         $expLog->
write(date(
"[y-m-d H:i:s] ") . 
"Finished Export Page Objects");
  1402         $expLog->
write(date(
"[y-m-d H:i:s] ") . 
"Start Export Media Objects");
  1404         $expLog->
write(date(
"[y-m-d H:i:s] ") . 
"Finished Export Media Objects");
  1407         $expLog->
write(date(
"[y-m-d H:i:s] ") . 
"Start Export File Items");
  1409         $expLog->
write(date(
"[y-m-d H:i:s] ") . 
"Finished Export File Items");
  1412         if (count($this->q_ids) > 0) {
  1413             $qti_file = fopen($a_target_dir . 
"/qti.xml", 
"w");
  1415             fwrite($qti_file, $pool->questionsToXML($this->q_ids));
  1421         $expLog->
write(date(
"[y-m-d H:i:s] ") . 
"Start Export Properties");
  1423         $expLog->
write(date(
"[y-m-d H:i:s] ") . 
"Finished Export Properties");
  1425         $a_xml_writer->
xmlEndTag(
"ContentObject");
  1432         $md2xml->setExportMode(
true);
  1433         $md2xml->startExport();
  1434         $a_xml_writer->
appendXML($md2xml->getXML());
  1442         $childs = $this->lm_tree->getChilds($this->lm_tree->getRootId());
  1443         foreach ($childs as $child) {
  1444             if ($child[
"type"] != 
"st") {
  1449             $structure_obj->exportXML($a_xml_writer, $a_inst, $expLog);
  1450             unset($structure_obj);
  1460         foreach ($pages as $page) {
  1462                 $expLog->
write(date(
"[y-m-d H:i:s] ") . 
"Page Object " . $page[
"obj_id"]);
  1466                 $page_obj->exportXML($a_xml_writer, 
"normal", $a_inst);
  1469                 $mob_ids = $page_obj->getMediaObjectIds();
  1470                 foreach ($mob_ids as $mob_id) {
  1471                     $this->mob_ids[$mob_id] = $mob_id;
  1475                 $file_ids = $page_obj->getFileItemIds();
  1476                 foreach ($file_ids as $file_id) {
  1477                     $this->file_ids[$file_id] = $file_id;
  1481                 $q_ids = $page_obj->getQuestionIds();
  1482                 foreach ($q_ids as $q_id) {
  1483                     $this->q_ids[$q_id] = $q_id;
  1494         string $a_target_dir,
  1497         $linked_mobs = array();
  1500         foreach ($this->mob_ids as $mob_id) {
  1502                 $expLog->
write(date(
"[y-m-d H:i:s] ") . 
"Media Object " . $mob_id);
  1504                 $media_obj->exportXML($a_xml_writer, $a_inst);
  1505                 $media_obj->exportFiles($a_target_dir);
  1507                 $lmobs = $media_obj->getLinkedMediaObjects($this->mob_ids);
  1508                 $linked_mobs = array_merge($linked_mobs, $lmobs);
  1515         foreach ($linked_mobs as $mob_id) {
  1517                 $expLog->
write(date(
"[y-m-d H:i:s] ") . 
"Media Object " . $mob_id);
  1519                 $media_obj->exportXML($a_xml_writer, $a_inst);
  1520                 $media_obj->exportFiles($a_target_dir);
  1527         string $a_target_dir,
  1530         foreach ($this->file_ids as $file_id) {
  1531             $expLog->
write(date(
"[y-m-d H:i:s] ") . 
"File Item " . $file_id);
  1532             $file_obj = 
new ilObjFile($file_id, 
false);
  1533             $file_obj->export($a_target_dir);
  1546         $attrs = array(
"Name" => 
"Layout", 
"Value" => $this->
getLayout());
  1547         $a_xml_writer->
xmlElement(
"Property", $attrs);
  1550         $attrs = array(
"Name" => 
"PageHeader", 
"Value" => $this->
getPageHeader());
  1551         $a_xml_writer->
xmlElement(
"Property", $attrs);
  1554         $attrs = array(
"Name" => 
"TOCMode", 
"Value" => $this->
getTOCMode());
  1555         $a_xml_writer->
xmlElement(
"Property", $attrs);
  1558         $attrs = array(
"Name" => 
"ActiveLMMenu", 
"Value" =>
  1560         $a_xml_writer->
xmlElement(
"Property", $attrs);
  1563         $attrs = array(
"Name" => 
"ActiveNumbering", 
"Value" =>
  1565         $a_xml_writer->
xmlElement(
"Property", $attrs);
  1568         $attrs = array(
"Name" => 
"ActiveTOC", 
"Value" =>
  1570         $a_xml_writer->
xmlElement(
"Property", $attrs);
  1573         $attrs = array(
"Name" => 
"ActivePrintView", 
"Value" =>
  1575         $a_xml_writer->
xmlElement(
"Property", $attrs);
  1581         $attrs = array(
"Name" => 
"CleanFrames", 
"Value" =>
  1583         $a_xml_writer->
xmlElement(
"Property", $attrs);
  1586         $attrs = array(
"Name" => 
"PublicNotes", 
"Value" =>
  1588         $a_xml_writer->
xmlElement(
"Property", $attrs);
  1591         $attrs = array(
"Name" => 
"HistoryUserComments", 
"Value" =>
  1593         $a_xml_writer->
xmlElement(
"Property", $attrs);
  1596         $attrs = array(
"Name" => 
"Rating", 
"Value" =>
  1598         $a_xml_writer->
xmlElement(
"Property", $attrs);
  1599         $attrs = array(
"Name" => 
"RatingPages", 
"Value" =>
  1601         $a_xml_writer->
xmlElement(
"Property", $attrs);
  1605             $attrs = array(
"Name" => 
"HeaderPage", 
"Value" =>
  1607             $a_xml_writer->
xmlElement(
"Property", $attrs);
  1612             $attrs = array(
"Name" => 
"FooterPage", 
"Value" =>
  1614             $a_xml_writer->
xmlElement(
"Property", $attrs);
  1618         $attrs = array(
"Name" => 
"LayoutPerPage", 
"Value" =>
  1620         $a_xml_writer->
xmlElement(
"Property", $attrs);
  1623         $attrs = array(
"Name" => 
"ProgressIcons", 
"Value" =>
  1625         $a_xml_writer->
xmlElement(
"Property", $attrs);
  1628         $attrs = array(
"Name" => 
"StoreTries", 
"Value" =>
  1630         $a_xml_writer->
xmlElement(
"Property", $attrs);
  1633         $attrs = array(
"Name" => 
"RestrictForwardNavigation", 
"Value" =>
  1635         $a_xml_writer->
xmlElement(
"Property", $attrs);
  1638         $attrs = array(
"Name" => 
"DisableDefaultFeedback", 
"Value" =>
  1640         $a_xml_writer->
xmlElement(
"Property", $attrs);
  1649         $types = array(
"xml", 
"html");
  1651         foreach ($types as 
$type) {
  1654             if (!is_dir($dir) or
  1655                 !is_writeable($dir)) {
  1665             while ($entry = $cdir->read()) {
  1666                 if ($entry != 
"." and
  1668                     substr($entry, -4) == 
".zip" and
  1669                     preg_match(
"~^[0-9]{10}_{2}[0-9]+_{2}(lm_)*[0-9]+\.zip\$~", $entry)) {
  1670                     $file[$entry . 
$type] = array(
"type" => $type, 
"file" => $entry,
  1671                         "size" => filesize($dir . 
"/" . $entry));
  1691         $this->public_export_file[$a_type] = $a_file;
  1696         return $this->public_export_file[$a_type] ?? 
"";
  1703         if (!is_dir($dir) or
  1704             !is_writeable($dir)) {
  1715         while ($entry = $dir->read()) {
  1716             if ($entry != 
"." and
  1718                 substr($entry, -4) == 
".pdf" and
  1719                 preg_match(
"~^[0-9]{10}_{2}[0-9]+_{2}(lm_)*[0-9]+\.pdf\$~", $entry)) {
  1736         bool $as_subitem = 
false,
  1737         string $movecopy = 
"move"  1739         if ($source_id === $target_id) {
  1743         $lmtree->setTableNames(
'lm_tree', 
'lm_data');
  1744         $lmtree->setTreeTablePK(
"lm_id");
  1747         $source_obj->setLMId($this->
getId());
  1749         if (!$first_child) {
  1751             $target_obj->setLMId($this->
getId());
  1752             $target_parent = $lmtree->getParentId($target_id);
  1756         if ($source_obj->getType() == 
"pg") {
  1758             if ($lmtree->isInTree($source_obj->getId())) {
  1759                 $node_data = $lmtree->getNodeData($source_obj->getId());
  1762                 if ($movecopy == 
"move") {
  1763                     $parent_id = $lmtree->getParentId($source_obj->getId());
  1764                     $lmtree->deleteTree($node_data);
  1768                         $source_obj->getId(),
  1781                     $new_page = $source_obj->copy($this->lm);
  1782                     $source_id = $new_page->getId();
  1783                     $source_obj = $new_page;
  1787                 if (!$lmtree->isInTree($source_obj->getId())) {
  1790                         $parent = $target_id;
  1791                     } elseif ($as_subitem) {            
  1792                         $parent = $target_id;
  1794                         $pg_childs = $lmtree->getChildsByType($parent, 
"pg");
  1795                         if (count($pg_childs) != 0) {
  1796                             $target_pos = $pg_childs[count($pg_childs) - 1][
"obj_id"];
  1799                         $target_pos = $target_id;
  1800                         $parent = $target_parent;
  1804                     $lmtree->insertNode(
  1805                         $source_obj->getId(),
  1811                     if ($movecopy == 
"move") {
  1814                             $source_obj->getId(),
  1831         if ($source_obj->getType() == 
"st") {
  1833             $source_node = $lmtree->getNodeData($source_id);
  1834             $subnodes = $lmtree->getSubTree($source_node);
  1837             foreach ($subnodes as $subnode) {
  1838                 if ($subnode[
"obj_id"] == $target_id) {
  1843             $target_pos = $target_id;
  1847                 $target_parent = $target_id;
  1849                 $pg_childs = $lmtree->getChildsByType($target_parent, 
"pg");
  1850                 if (count($pg_childs) != 0) {
  1851                     $target_pos = $pg_childs[count($pg_childs) - 1][
"obj_id"];
  1853             } elseif ($as_subitem) {            
  1854                 $target_parent = $target_id;
  1856                 $childs = $lmtree->getChilds($target_parent);
  1857                 if (count($childs) != 0) {
  1858                     $target_pos = $childs[count($childs) - 1][
"obj_id"];
  1863             if ($movecopy == 
"move") {
  1864                 $lmtree->deleteTree($source_node);
  1867                 throw new ilException(
"ilObjContentObject: Not implemented");
  1871             if (!$lmtree->isInTree($source_id)) {
  1872                 $lmtree->insertNode($source_id, $target_parent, $target_pos);
  1875                 foreach ($subnodes as $node) {
  1876                     if ($node[
"obj_id"] != $source_id) {
  1877                         $lmtree->insertNode($node[
"obj_id"], $node[
"parent"]);
  1897         foreach ($pages as $page) {
  1899                 $cpage = 
new ilLMPage($page[
"obj_id"]);
  1901                 $error = $cpage->validateDom();
  1904                     $this->
lng->loadLanguageModule(
"content");
  1905                     $this->main_tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"cont_import_validation_errors"));
  1908                     $mess .= $this->
lng->txt(
"obj_pg") . 
": " . 
$title;
  1909                     $mess .= 
'<div class="small">';
  1911                         $err_mess = implode(
" - ", $e);
  1912                         if (!is_int(strpos($err_mess, 
":0:"))) {
  1913                             $mess .= htmlentities($err_mess) . 
"<br />";
  1925     public function cloneObject(
int $target_id, 
int $copy_id = 0, 
bool $omit_tree = 
false): ?
ilObject  1928         $new_obj = parent::cloneObject($target_id, $copy_id, $omit_tree);
  1935         if (!$cp_options->isRootNode($this->getRefId())) {
  1942         $new_obj->setLayout($this->
getLayout());
  1956         $new_obj->setRating($this->
hasRating());
  1966         $new_obj->createLMTree();
  1969         $style = $this->content_style_domain->styleForObjId($this->
getId());
  1970         $style->cloneTo($new_obj->getId());
  1979             $new_obj->setHeaderPage($new_page_header);
  1982             $new_obj->setFooterPage($new_page_footer);
  1988         $obj_settings->cloneSettings($new_obj->getId());
  1989         unset($obj_settings);
  1993         $ot->copy($new_obj->getId());
  1997         $menu->setObjId($this->
getId());
  1999         $new_menu->setObjId($new_obj->getId());
  2000         foreach ($menu->getMenuEntries() as $entry) {
  2008             $new_menu->setTarget($entry[
"link"] ?? 
"");
  2009             $new_menu->setTitle($entry[
"title"] ?? 
"");
  2010             $new_menu->setLinkType($entry[
"type"] ?? 
"");
  2011             $new_menu->setLinkRefId($entry[
"ref_id"] ?? 0);
  2012             $new_menu->create();
  2024         $parent_id = $a_target_obj->lm_tree->readRootId();
  2028         $chapters = $this->lm_tree->getChildsByType($this->lm_tree->readRootId(), 
"st");
  2029         $copied_nodes = array();
  2031         foreach ($chapters as $chap) {
  2032             $cid = ilLMObject::pasteTree(
  2047         foreach ($pages as $p) {
  2048             if (!$this->lm_tree->isInTree($p[
"obj_id"])) {
  2050                 $target_item = $item->copy($a_target_obj);
  2051                 $copied_nodes[$item->getId()] = $target_item->getId();
  2057         foreach ($copied_nodes as $old_id => $new_id) {
  2058             $options->appendMapping(
  2060                 $a_target_obj->
getRefId() . 
'_' . $new_id
  2068         return $copied_nodes;
  2076         $ilDB = $DIC->database();
  2079         $set = 
$ilDB->query(
  2080             "SELECT * FROM lm_glossaries " .
  2081             " WHERE lm_id = " . 
$ilDB->quote($a_lm_id, 
"integer")
  2084         while ($rec = 
$ilDB->fetchAssoc($set)) {
  2085             $glos[] = $rec[
"glo_id"];
  2100         $found_pages = array();
  2101         foreach ($pages as $p) {
  2103             $c = $pg->getXMLContent();
  2104             foreach ($terms as $t) {
  2105                 if (is_int(stripos(
$c, $t[
"term"]))) {
  2106                     $found_pages[$p[
"id"]][
"terms"][] = $t;
  2107                     if (!is_object($found_pages[$p[
"id"]][
"page"] ?? null)) {
  2108                         $found_pages[$p[
"id"]][
"page"] = $pg;
  2116         foreach ($found_pages as 
$id => $fp) {
  2132         bool $a_as_obj_id = 
false  2134         if (!$a_as_obj_id && $a_id > 0 && $a_id === (
int) OH_REF_ID) {
  2145         $this->rating = $a_value;
  2155         $this->rating_pages = $a_value;
  2167         switch ($a_element) {
  2171                     $obj_lp->getCurrentMode(),
  2182                 if (!is_object($md_gen = $md->getGeneral())) {
  2187                 if ($ot->getContentActivated()) {
  2188                     $ot->setDefaultTitle($md_gen->getTitle());
  2190                     foreach ($md_gen->getDescriptionIds() as 
$id) {
  2191                         $md_des = $md_gen->getDescription(
$id);
  2192                         $ot->setDefaultDescription($md_des->getDescription());
  2208         $dirs = array(
"xml");
  2209         $export_files = array();
  2212         if ($ot->getContentActivated()) {
  2213             $langs = $ot->getLanguages();
  2214             foreach ($langs as $l => $ldata) {
  2215                 $dirs[] = 
"html_" . $l;
  2217             $dirs[] = 
"html_all";
  2222         foreach ($dirs as $dir) {
  2223             $type = explode(
"_", $dir);
  2230                     $export_files[] = array(
"type" => 
$type,
  2238         return $export_files;
 getHideHeaderFooterPrint()
 
static updateInternalLinks(array $a_copied_nodes, string $a_parent_type="lm")
Update internal links, after multiple pages have been copied. 
 
setRatingPages(bool $a_value)
 
setActiveLMMenu(bool $a_act_lm_menu)
 
static _getNrOfAssignedLMs(int $a_style_id)
gets the number of learning modules assigned to a content style 
 
executeDragDrop(int $source_id, int $target_id, bool $first_child, bool $as_subitem=false, string $movecopy="move")
 
static _getMissingPreconditionsOfPage(int $cont_ref_id, int $cont_obj_id, int $page_id)
gets all missing preconditions of page 
 
setActiveNumbering(bool $a_num)
 
setCleanFrames(bool $a_clean)
 
fetchSuccessorNode(int $a_node_id, string $a_type="")
get node data of successor node 
 
static _getNrLMsNoStyle()
get number of learning modules assigned no style 
 
getNodeData(int $a_node_id, ?int $a_tree_pk=null)
get all information of a node. 
 
static _lookupDisableDefaultFeedback(int $a_id)
 
setActiveDownloadsPublic(bool $a_down)
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
insert(string $table_name, array $values)
 
static getLogger(string $a_component_id)
Get component logger. 
 
static writeFooterPage(int $a_lm_id, int $a_page_id)
 
checkStructure()
Check tree (this has been copied from fixTree due to a bug fixing, should be reorganised) ...
 
setActivePrintView(bool $a_print)
 
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
 
removeAutoGlossary(int $a_glo_id)
 
exportXMLMediaObjects(ilXmlWriter $a_xml_writer, int $a_inst, string $a_target_dir, ilLog $expLog)
 
validatePages()
Validate all pages. 
 
static _createEntry(int $a_obj_id, string $a_action, array $a_info_params=[], string $a_obj_type="", string $a_user_comment="", bool $a_update_last=false)
Creates a new history entry for an object. 
 
setActiveTOC(bool $a_toc)
 
isActiveHistoryUserComments()
 
isActivePreventGlossaryAppendix()
 
static autoLinkGlossariesPage(ilPageObject $a_page, array $a_terms)
Auto link glossary of whole page. 
 
setAutoGlossaries(array $a_val)
 
checkTreeChilds(bool $a_no_zero_child=true)
check, if all childs of tree nodes exist in object table 
 
bool $disable_def_feedback
 
static _lookupRestrictForwardNavigation(int $a_obj_id)
 
static _deleteAllObjectData(ilObjLearningModule $a_cobj)
delete all objects of content object (digi book / learning module) 
 
setProgressIcons(bool $a_val)
 
setStoreTries(bool $a_val)
 
static getInstance(ilObjLearningModule $a_content_obj, int $a_id=0, bool $a_halt=true)
 
isInTree(?int $a_node_id)
get all information of a node. 
 
static getAvailableLayouts()
get all available lm layouts 
 
static _lookupContObjIdByStyleId(int $a_style_id)
 
bool $downloads_public_active
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
static _lookupStoreTries(int $a_id)
 
createExportDirectory(string $a_type="xml")
creates data directory for export files (data_dir/lm_data/lm_<id>/export, depending on data directory...
 
setTreeTablePK(string $a_column_name)
set column containing primary key in tree table 
 
static writeHeaderPage(int $a_lm_id, int $a_page_id)
 
deleteTree(array $a_node)
delete node and the whole subtree under this node 
 
const LP_MODE_COLLECTION_TLT
 
appendXML(string $a_str)
append xml string to document 
 
setImportDirectory(string $a_import_dir)
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
isActiveDownloadsPublic()
 
static getTermList(array $a_glo_ref_id, string $searchterm="", string $a_first_letter="", string $a_def="", int $a_tax_node=0, bool $a_add_amet_fields=false, array $a_amet_filter=null, bool $a_include_references=false)
Get all terms for given set of glossary ids. 
 
exportXMLMetaData(ilXmlWriter $a_xml_writer)
 
static makeDirParents(string $a_dir)
Create a new directory and all parent directories. 
 
static hasSuccessorPage(int $a_cont_obj_id, int $a_page_id)
checks if page has a successor page 
 
setPageHeader(string $a_pg_header=ilLMObject::CHAPTER_TITLE)
set page header mode 
 
getPublicAccessMode()
get public access mode ("complete" | "selected") 
 
setForTranslation(bool $a_val)
Set for translation (lm has been imported for translation purposes) 
 
getPathFull(int $a_endnode_id, int $a_startnode_id=0)
get path from a given startnode to a given endnode if startnode is not given the rootnode is startnod...
 
static putInTree(ilLMObject $a_obj, int $a_parent_id=0, int $a_target_node_id=0)
put this object into content object tree 
 
ilGlobalTemplateInterface $main_tpl
 
static _lookupObjId(int $ref_id)
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
xmlEndTag(string $tag)
Writes an endtag. 
 
setRestrictForwardNavigation(bool $a_val)
 
static _lookupTitle(int $a_obj_id)
 
create(bool $a_no_meta_data=false)
create content object 
 
setTableNames(string $a_table_tree, string $a_table_obj_data, string $a_table_obj_reference="")
set table names The primary key of the table containing your object_data must be 'obj_id' You may use...
 
static isInfoEnabled(int $obj_id)
 
cloneMetaData(ilObject $target_obj)
Copy meta data. 
 
array $public_export_file
 
setHistoryUserComments(bool $a_comm)
 
static _checkCondition(array $condition, int $a_usr_id=0)
checks wether a single condition is fulfilled every trigger object type must implement a static metho...
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
bool $hide_header_footer_print
 
getPageHeader()
get page header mode (ilLMOBject::CHAPTER_TITLE | ilLMOBject::PAGE_TITLE | ilLMOBject::NO_HEADER) ...
 
doMDUpdateListener(string $a_element)
 
static _checkPreconditionsOfPage(int $cont_ref_id, int $cont_obj_id, int $page_id)
checks whether the preconditions of a page are fulfilled or not 
 
string $public_access_mode
 
getExportDirectory(string $a_type="xml")
 
static _exists(string $a_parent_type, int $a_id, string $a_lang="", bool $a_no_cache=false)
Checks whether page exists. 
 
setTOCMode(string $a_toc_mode="chapters")
set toc mode 
 
checkTree()
check consistence of tree all left & right values are checked if they are exists only once ...
 
static _lookupStyleSheetId(int $a_cont_obj_id)
 
getPublicExportFiles()
Get public export files. 
 
static delDir(string $a_dir, bool $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively 
 
setPublicExportFile(string $a_type, string $a_file)
specify public export file for type 
 
getTOCMode()
get toc mode ("chapters" | "pages") 
 
renumber(int $node_id=1, int $i=1)
Wrapper for renumber. 
 
static getInstance(int $obj_id)
 
static _moveLMStyles(int $a_from_style, int $a_to_style)
move learning modules from one style to another 
 
static _refreshStatus(int $a_obj_id, ?array $a_users=null)
 
exportFileItems(string $a_target_dir, ilLog $expLog)
 
setActiveDownloads(bool $a_down)
 
setLayout(string $a_layout)
 
static getDataDir()
get data directory (outside webspace) 
 
getDisableDefaultFeedback()
 
static _deleteStyleAssignments(int $a_style_id)
delete all style references to style 
 
setPublicNotes(bool $a_pub_notes)
 
setActivePreventGlossaryAppendix(bool $a_print)
 
createImportDirectory()
creates data directory for import files (data_dir/lm_data/lm_<id>/import, depending on data directory...
 
getPublicExportFile(string $a_type)
 
static lookupAutoGlossaries(int $a_lm_id)
 
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id 
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
static _checkAllConditionsOfTarget(int $a_target_ref_id, int $a_target_id, string $a_target_type="", int $a_usr_id=0)
checks wether all conditions of a target object are fulfilled 
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
ILIAS Style Content DomainService $content_style_domain
 
getRestrictForwardNavigation()
 
static getPageList(int $lm_id)
 
autoLinkGlossaryTerms(int $a_glo_ref_id)
 
static _getNrLMsIndividualStyles()
get number of learning modules with individual styles 
 
exportXMLStructureObjects(ilXmlWriter $a_xml_writer, int $a_inst, ilLog $expLog)
 
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins 
 
setDisableDefaultFeedback(bool $a_val)
Set disable default feedback for questions. 
 
bool $prevent_glossary_appendix_active
 
xmlStartTag(string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
Writes a starttag. 
 
setLayoutPerPage(bool $a_val)
 
copyAllPagesAndChapters(ilObjLearningModule $a_target_obj, int $a_copy_id=0)
 
static yn2tf(string $a_yn)
 
static _getInstance(int $a_copy_id)
 
xmlElement(string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content) 
 
write(string $a_msg, $a_log_level=null)
logging 
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
exportXML(ilXmlWriter $a_xml_writer, int $a_inst, string $a_target_dir, ilLog $expLog)
 
getSubTree(array $a_node, bool $a_with_data=true, array $a_type=[])
get all nodes in the subtree under specified node 
 
static _lookupType(int $id, bool $reference=false)
 
setHideHeaderFooterPrint(bool $a_val)
Set hide header footer in print mode. 
 
exportXMLProperties(ilXmlWriter $a_xml_writer, ilLog $expLog)
 
static getInstance(int $obj_id)
 
createProperties()
create new properties record 
 
getOfflineFiles(string $dir)
 
static _lookup(int $a_obj_id, string $a_field)
 
static _getMissingPreconditionsTopChapter(int $cont_obj_ref_id, int $cont_obj_id, int $page_id)
get top chapter of page for that any precondition is missing 
 
ILIAS Notes Service $notes
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
exportXMLPageObjects(ilXmlWriter $a_xml_writer, int $a_inst, ilLog $expLog)
 
static _getPersistedConditionsOfTarget(int $a_target_ref_id, int $a_target_obj_id, string $a_target_type="")
get all persisted conditions of target object 
 
static isOnlineHelpModule(int $a_id, bool $a_as_obj_id=false)
Is module an online module. 
 
static makeDir(string $a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
 
setPublicAccessMode(string $a_mode)
 
static getAllPages(string $a_parent_type, int $a_parent_id, string $a_lang="-")
Get all pages for parent object.