27     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"];
    81         $this->lom_services = $DIC->learningObjectMetadata();
    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;
   734     public function setTOCMode(
string $a_toc_mode = 
"chapters"): void
   736         $this->toc_mode = $a_toc_mode;
   741         $this->lm_menu_active = $a_act_lm_menu;
   751         $this->toc_active = $a_toc;
   761         $this->numbering = $a_num;
   771         $this->print_view_active = $a_print;
   781         $this->prevent_glossary_appendix_active = $a_print;
   794         $this->hide_header_footer_print = $a_val;
   804         $this->pub_notes = $a_pub_notes;
   814         $this->clean_frames = $a_clean;
   824         $this->header_page = $a_pg;
   834         $this->footer_page = $a_pg;
   846         $q = 
"SELECT * FROM content_object WHERE id = " .
   850         $this->
setLayout((
string) $lm_rec[
"default_layout"]);
   852         $this->
setTOCMode((
string) $lm_rec[
"toc_mode"]);
   863         $this->
setRating((
bool) $lm_rec[
"rating"]);
   885         $q = 
"UPDATE content_object SET " .
   886             " default_layout = " . 
$ilDB->quote($this->
getLayout(), 
"text") . 
", " .
   899             " rating = " . 
$ilDB->quote($this->
hasRating(), 
"integer") . 
", " .
   906             " WHERE id = " . 
$ilDB->quote($this->
getId(), 
"integer");
   909         $this->notes->domain()->activateComments($this->
getId(), $this->
publicNotes());
   919         $this->db->
insert(
"content_object", [
   920             "id" => [
"integer", $this->
getId()],
   925         $this->notes->domain()->activateComments($this->
getId());
   936         $dir = opendir(
"./components/ILIAS/LearningModule/layouts/lm");
   940         while ($file = readdir($dir)) {
   941             if ($file != 
"." && $file != 
".." && $file != 
"CVS" && $file != 
".svn") {
   943                 if (is_dir(
"./components/ILIAS/LearningModule/layouts/lm/" . $file)) {
   944                     $layouts[$file] = $file;
   952             'toc2win' => 
'toc2win',
   953             'toc2windyn' => 
'toc2windyn',
   954             '1window' => 
'1window',
   955             '2window' => 
'2window',
   956             '3window' => 
'3window',
   957             'presentation' => 
'presentation',
   958             'fullscreen' => 
'fullscreen'   961         foreach ($layouts as $l) {
   962             if (!in_array($l, $ret)) {
   978         $lm_tree = 
new ilTree($cont_obj_id);
   984             foreach (
$path as $node) {
   985                 if ($node[
"type"] == 
"st") {
  1004         $lm_tree = 
new ilTree($cont_obj_id);
  1009         if ($lm_tree->
isInTree($page_id)) {
  1012             foreach (
$path as $node) {
  1013                 if ($node[
"type"] == 
"st") {
  1016                     foreach ($tconds as $tcond) {
  1033         int $cont_obj_ref_id,
  1037         $lm_tree = 
new ilTree($cont_obj_id);
  1041         if ($lm_tree->
isInTree($page_id)) {
  1044             foreach (
$path as $node) {
  1045                 if ($node[
"type"] == 
"st") {
  1048                     foreach ($tconds as $tcond) {
  1051                             return (
int) $node[
"child"];
  1099         $set = 
$ilDB->query(
  1100             "SELECT DISTINCT l1.lm_id" .
  1101             " FROM lm_tree l1" .
  1102             " JOIN lm_tree l2 ON ( l1.child = l2.parent" .
  1103             " AND l1.lm_id = l2.lm_id )" .
  1104             " JOIN lm_data ON ( l1.child = lm_data.obj_id )" .
  1105             " WHERE (l2.lft < l1.lft" .
  1106             " OR l2.rgt > l1.rgt OR l2.lft > l1.rgt OR l2.rgt < l1.lft)" .
  1107             " AND l1.lm_id = " . 
$ilDB->quote($this->getId(), 
"integer") .
  1108             " ORDER BY lm_data.create_date DESC"  1110         if ($rec = 
$ilDB->fetchAssoc($set)) {
  1115         $set = 
$ilDB->query(
"SELECT * FROM lm_tree WHERE lm_tree.lm_id = " . 
$ilDB->quote($this->getId(), 
"integer"));
  1116         while ($node = 
$ilDB->fetchAssoc($set)) {
  1117             $q = 
"SELECT * FROM lm_data WHERE obj_id = " .
  1118                 $ilDB->quote($node[
"child"], 
"integer");
  1120             $obj_rec = 
$ilDB->fetchAssoc($obj_set);
  1123                 $node_data[
"child"] = $node[
"child"];
  1130         foreach ($nodes as $node) {
  1131             $q = 
"SELECT * FROM lm_data WHERE obj_id = " .
  1132                 $ilDB->quote($node[
"parent"], 
"integer");
  1134             $obj_rec = 
$ilDB->fetchAssoc($obj_set);
  1135             if (($obj_rec[
"type"] ?? 
"") == 
"pg") {
  1145         $set = 
$ilDB->query(
"SELECT DISTINCT l1.lm_id" .
  1146                 " FROM lm_tree l1" .
  1147                 " JOIN lm_tree l2 ON ( l1.child = l2.child AND l1.lm_id <> l2.lm_id )" .
  1148                 " JOIN lm_data ON (l1.child = lm_data.obj_id)" .
  1149                 " WHERE l1.child <> 1" .
  1150                 " AND l1.lm_id <> lm_data.lm_id" .
  1151                 " AND l1.lm_id = " . 
$ilDB->quote($this->getId(), 
"integer"));
  1152         if ($rec = 
$ilDB->fetchAssoc($set)) {
  1153             $set = 
$ilDB->query(
"SELECT DISTINCT l1.child " .
  1154                 " FROM lm_tree l1" .
  1155                 " JOIN lm_tree l2 ON ( l1.child = l2.child AND l1.lm_id <> l2.lm_id )" .
  1156                 " JOIN lm_data ON (l1.child = lm_data.obj_id)" .
  1157                 " WHERE l1.child <> 1" .
  1158                 " AND l1.lm_id <> lm_data.lm_id" .
  1159                 " AND l1.lm_id = " . 
$ilDB->quote($this->getId(), 
"integer"));
  1160             while ($rec = 
$ilDB->fetchAssoc($set)) {
  1163                 if (is_object($cobj)) {
  1164                     if ($cobj->getType() == 
"pg") {
  1166                         $pg_copy = $cobj->copy($this->lm);
  1170                             "UPDATE lm_tree SET " .
  1171                             " child = " . 
$ilDB->quote($pg_copy->getId(), 
"integer") .
  1172                             " WHERE child = " . 
$ilDB->quote($cobj->getId(), 
"integer") .
  1173                             " AND lm_id = " . 
$ilDB->quote($this->getId(), 
"integer")
  1175                     } elseif ($cobj->getType() == 
"st") {
  1177                         $st_copy = $cobj->copy($this->lm);
  1181                             "UPDATE lm_tree SET " .
  1182                             " child = " . 
$ilDB->quote($st_copy->getId(), 
"integer") .
  1183                             " WHERE child = " . 
$ilDB->quote($cobj->getId(), 
"integer") .
  1184                             " AND lm_id = " . 
$ilDB->quote($this->getId(), 
"integer")
  1189                             "UPDATE lm_tree SET " .
  1190                             " parent = " . 
$ilDB->quote($st_copy->getId(), 
"integer") .
  1191                             " WHERE parent = " . 
$ilDB->quote($cobj->getId(), 
"integer") .
  1192                             " AND lm_id = " . 
$ilDB->quote($this->getId(), 
"integer")
  1200         $set = 
$ilDB->queryF(
  1201             "SELECT * FROM lm_data " .
  1202             " WHERE lm_id = %s AND type = %s",
  1203             array(
"integer", 
"text"),
  1204             array($this->
getId(), 
"pg")
  1206         while ($rec = 
$ilDB->fetchAssoc($set)) {
  1209                 $lm_page->setId($rec[
"obj_id"]);
  1210                 $lm_page->setParentId($this->
getId());
  1211                 $lm_page->create(
false);
  1229         $set = 
$ilDB->query(
  1230             "SELECT l1.child, l1.lft l1lft, l1.rgt l1rgt, l2.parent, l2.lft l2lft, l2.rgt l2rgt" .
  1231             " FROM lm_tree l1" .
  1232             " JOIN lm_tree l2 ON ( l1.child = l2.parent" .
  1233             " AND l1.lm_id = l2.lm_id )" .
  1234             " JOIN lm_data ON ( l1.child = lm_data.obj_id )" .
  1235             " WHERE (l2.lft < l1.lft" .
  1236             " OR l2.rgt > l1.rgt OR l2.lft > l1.rgt OR l2.rgt < l1.lft)" .
  1237             " AND l1.lm_id = " . 
$ilDB->quote($this->getId(), 
"integer") .
  1238             " ORDER BY lm_data.create_date DESC"  1240         while ($rec = 
$ilDB->fetchAssoc($set)) {
  1241             $issues[] = 
"Tree numbering: " . print_r($rec, 
true);
  1245         $set = 
$ilDB->query(
"SELECT * FROM lm_tree WHERE lm_tree.lm_id = " . 
$ilDB->quote($this->getId(), 
"integer"));
  1246         while ($node = 
$ilDB->fetchAssoc($set)) {
  1247             $q = 
"SELECT * FROM lm_data WHERE obj_id = " .
  1248                 $ilDB->quote($node[
"child"], 
"integer");
  1250             $obj_rec = 
$ilDB->fetchAssoc($obj_set);
  1252                 $issues[] = 
"Tree entry without data entry: " . print_r($node, 
true);
  1258         foreach ($nodes as $node) {
  1259             $q = 
"SELECT * FROM lm_data WHERE obj_id = " .
  1260                 $ilDB->quote($node[
"parent"], 
"integer");
  1262             $obj_rec = 
$ilDB->fetchAssoc($obj_set);
  1263             if (($obj_rec[
"type"] ?? 
"") == 
"pg") {
  1266                     $issues[] = 
"Subtree with page parent: " . print_r($node_data, 
true);
  1273         $set = 
$ilDB->query(
"SELECT DISTINCT l1.lm_id" .
  1274             " FROM lm_tree l1" .
  1275             " JOIN lm_tree l2 ON ( l1.child = l2.child AND l1.lm_id <> l2.lm_id )" .
  1276             " JOIN lm_data ON (l1.child = lm_data.obj_id)" .
  1277             " WHERE l1.child <> 1" .
  1278             " AND l1.lm_id <> lm_data.lm_id" .
  1279             " AND l1.lm_id = " . 
$ilDB->quote($this->getId(), 
"integer"));
  1280         if ($rec = 
$ilDB->fetchAssoc($set)) {
  1281             $set = 
$ilDB->query(
"SELECT DISTINCT l1.child " .
  1282                 " FROM lm_tree l1" .
  1283                 " JOIN lm_tree l2 ON ( l1.child = l2.child AND l1.lm_id <> l2.lm_id )" .
  1284                 " JOIN lm_data ON (l1.child = lm_data.obj_id)" .
  1285                 " WHERE l1.child <> 1" .
  1286                 " AND l1.lm_id <> lm_data.lm_id" .
  1287                 " AND l1.lm_id = " . 
$ilDB->quote($this->getId(), 
"integer"));
  1288             while ($rec = 
$ilDB->fetchAssoc($set)) {
  1289                 $set3 = 
$ilDB->queryF(
  1290                     "SELECT * FROM lm_tree " .
  1291                     " WHERE child = %s ",
  1293                     array($rec[
"child"])
  1295                 while ($rec3 = 
$ilDB->fetchAssoc($set3)) {
  1296                     $issues[] = 
"Multi-reference item: " . print_r($rec3, 
true);
  1302         $set = 
$ilDB->queryF(
  1303             "SELECT * FROM lm_data " .
  1304             " WHERE lm_id = %s AND type = %s",
  1305             array(
"integer", 
"text"),
  1306             array($this->
getId(), 
"pg")
  1308         while ($rec = 
$ilDB->fetchAssoc($set)) {
  1310                 $issues[] = 
"Missing COPage: " . print_r($rec, 
true);
  1321         string $a_target_dir,
  1327                 $attrs[
"Type"] = 
"LearningModule";
  1330         $a_xml_writer->
xmlStartTag(
"ContentObject", $attrs);
  1337         $expLog->
write(date(
"[y-m-d H:i:s] ") . 
"Start Export Structure Objects");
  1339         $expLog->
write(date(
"[y-m-d H:i:s] ") . 
"Finished Export Structure Objects");
  1342         $expLog->
write(date(
"[y-m-d H:i:s] ") . 
"Start Export Page Objects");
  1344         $expLog->
write(date(
"[y-m-d H:i:s] ") . 
"Finished Export Page Objects");
  1347         $expLog->
write(date(
"[y-m-d H:i:s] ") . 
"Start Export Media Objects");
  1349         $expLog->
write(date(
"[y-m-d H:i:s] ") . 
"Finished Export Media Objects");
  1352         $expLog->
write(date(
"[y-m-d H:i:s] ") . 
"Start Export File Items");
  1354         $expLog->
write(date(
"[y-m-d H:i:s] ") . 
"Finished Export File Items");
  1357         if (count($this->q_ids) > 0) {
  1358             $qti_file = fopen($a_target_dir . 
"/qti.xml", 
"w");
  1360             fwrite($qti_file, $pool->questionsToXML($this->q_ids));
  1366         $expLog->
write(date(
"[y-m-d H:i:s] ") . 
"Start Export Properties");
  1368         $expLog->
write(date(
"[y-m-d H:i:s] ") . 
"Finished Export Properties");
  1370         $a_xml_writer->
xmlEndTag(
"ContentObject");
  1394         $childs = $this->lm_tree->getChilds($this->lm_tree->getRootId());
  1395         foreach ($childs as $child) {
  1396             if ($child[
"type"] != 
"st") {
  1401             $structure_obj->exportXML($a_xml_writer, $a_inst, $expLog);
  1402             unset($structure_obj);
  1412         foreach ($pages as $page) {
  1414                 $expLog->
write(date(
"[y-m-d H:i:s] ") . 
"Page Object " . $page[
"obj_id"]);
  1418                 $page_obj->exportXML($a_xml_writer, 
"normal", $a_inst);
  1421                 $mob_ids = $page_obj->getMediaObjectIds();
  1422                 foreach ($mob_ids as $mob_id) {
  1423                     $this->mob_ids[$mob_id] = $mob_id;
  1427                 $file_ids = $page_obj->getFileItemIds();
  1428                 foreach ($file_ids as $file_id) {
  1429                     $this->file_ids[$file_id] = $file_id;
  1433                 $q_ids = $page_obj->getQuestionIds();
  1434                 foreach ($q_ids as $q_id) {
  1435                     $this->q_ids[$q_id] = $q_id;
  1446         string $a_target_dir,
  1449         $linked_mobs = array();
  1452         foreach ($this->mob_ids as $mob_id) {
  1454                 $expLog->
write(date(
"[y-m-d H:i:s] ") . 
"Media Object " . $mob_id);
  1456                 $media_obj->exportXML($a_xml_writer, $a_inst);
  1457                 $media_obj->exportFiles($a_target_dir);
  1459                 $lmobs = $media_obj->getLinkedMediaObjects($this->mob_ids);
  1460                 $linked_mobs = array_merge($linked_mobs, $lmobs);
  1467         foreach ($linked_mobs as $mob_id) {
  1469                 $expLog->
write(date(
"[y-m-d H:i:s] ") . 
"Media Object " . $mob_id);
  1471                 $media_obj->exportXML($a_xml_writer, $a_inst);
  1472                 $media_obj->exportFiles($a_target_dir);
  1479         string $a_target_dir,
  1482         foreach ($this->file_ids as $file_id) {
  1483             $expLog->
write(date(
"[y-m-d H:i:s] ") . 
"File Item " . $file_id);
  1484             $file_obj = 
new ilObjFile($file_id, 
false);
  1485             $file_obj->export($a_target_dir);
  1498         $attrs = array(
"Name" => 
"Layout", 
"Value" => $this->
getLayout());
  1499         $a_xml_writer->
xmlElement(
"Property", $attrs);
  1502         $attrs = array(
"Name" => 
"PageHeader", 
"Value" => $this->
getPageHeader());
  1503         $a_xml_writer->
xmlElement(
"Property", $attrs);
  1506         $attrs = array(
"Name" => 
"TOCMode", 
"Value" => $this->
getTOCMode());
  1507         $a_xml_writer->
xmlElement(
"Property", $attrs);
  1510         $attrs = array(
"Name" => 
"ActiveLMMenu", 
"Value" =>
  1512         $a_xml_writer->
xmlElement(
"Property", $attrs);
  1515         $attrs = array(
"Name" => 
"ActiveNumbering", 
"Value" =>
  1517         $a_xml_writer->
xmlElement(
"Property", $attrs);
  1520         $attrs = array(
"Name" => 
"ActiveTOC", 
"Value" =>
  1522         $a_xml_writer->
xmlElement(
"Property", $attrs);
  1525         $attrs = array(
"Name" => 
"ActivePrintView", 
"Value" =>
  1527         $a_xml_writer->
xmlElement(
"Property", $attrs);
  1533         $attrs = array(
"Name" => 
"CleanFrames", 
"Value" =>
  1535         $a_xml_writer->
xmlElement(
"Property", $attrs);
  1538         $attrs = array(
"Name" => 
"PublicNotes", 
"Value" =>
  1540         $a_xml_writer->
xmlElement(
"Property", $attrs);
  1543         $attrs = array(
"Name" => 
"Rating", 
"Value" =>
  1545         $a_xml_writer->
xmlElement(
"Property", $attrs);
  1546         $attrs = array(
"Name" => 
"RatingPages", 
"Value" =>
  1548         $a_xml_writer->
xmlElement(
"Property", $attrs);
  1552             $attrs = array(
"Name" => 
"HeaderPage", 
"Value" =>
  1554             $a_xml_writer->
xmlElement(
"Property", $attrs);
  1559             $attrs = array(
"Name" => 
"FooterPage", 
"Value" =>
  1561             $a_xml_writer->
xmlElement(
"Property", $attrs);
  1565         $attrs = array(
"Name" => 
"LayoutPerPage", 
"Value" =>
  1567         $a_xml_writer->
xmlElement(
"Property", $attrs);
  1570         $attrs = array(
"Name" => 
"ProgressIcons", 
"Value" =>
  1572         $a_xml_writer->
xmlElement(
"Property", $attrs);
  1575         $attrs = array(
"Name" => 
"StoreTries", 
"Value" =>
  1577         $a_xml_writer->
xmlElement(
"Property", $attrs);
  1580         $attrs = array(
"Name" => 
"RestrictForwardNavigation", 
"Value" =>
  1582         $a_xml_writer->
xmlElement(
"Property", $attrs);
  1585         $attrs = array(
"Name" => 
"DisableDefaultFeedback", 
"Value" =>
  1587         $a_xml_writer->
xmlElement(
"Property", $attrs);
  1596         $types = array(
"xml", 
"html");
  1598         foreach ($types as 
$type) {
  1601             if (!is_dir($dir) or
  1602                 !is_writeable($dir)) {
  1612             while ($entry = $cdir->read()) {
  1613                 if ($entry != 
"." and
  1615                     substr($entry, -4) == 
".zip" and
  1616                     preg_match(
"~^[0-9]{10}_{2}[0-9]+_{2}(lm_)*[0-9]+\.zip\$~", $entry)) {
  1617                     $file[$entry . 
$type] = array(
"type" => $type, 
"file" => $entry,
  1618                         "size" => filesize($dir . 
"/" . $entry));
  1635         bool $as_subitem = 
false,
  1636         string $movecopy = 
"move"  1638         if ($source_id === $target_id) {
  1642         $lmtree->setTableNames(
'lm_tree', 
'lm_data');
  1643         $lmtree->setTreeTablePK(
"lm_id");
  1646         $source_obj->setLMId($this->
getId());
  1648         if (!$first_child) {
  1650             $target_obj->setLMId($this->
getId());
  1651             $target_parent = $lmtree->getParentId($target_id);
  1655         if ($source_obj->getType() == 
"pg") {
  1657             if ($lmtree->isInTree($source_obj->getId())) {
  1658                 $node_data = $lmtree->getNodeData($source_obj->getId());
  1661                 if ($movecopy == 
"move") {
  1662                     $parent_id = $lmtree->getParentId($source_obj->getId());
  1663                     $lmtree->deleteTree($node_data);
  1667                     $new_page = $source_obj->copy($this->lm);
  1668                     $source_id = $new_page->getId();
  1669                     $source_obj = $new_page;
  1673                 if (!$lmtree->isInTree($source_obj->getId())) {
  1676                         $parent = $target_id;
  1677                     } elseif ($as_subitem) {            
  1678                         $parent = $target_id;
  1680                         $pg_childs = $lmtree->getChildsByType($parent, 
"pg");
  1681                         if (count($pg_childs) != 0) {
  1682                             $target_pos = $pg_childs[count($pg_childs) - 1][
"obj_id"];
  1685                         $target_pos = $target_id;
  1686                         $parent = $target_parent;
  1690                     $lmtree->insertNode(
  1691                         $source_obj->getId(),
  1701         if ($source_obj->getType() == 
"st") {
  1703             $source_node = $lmtree->getNodeData($source_id);
  1704             $subnodes = $lmtree->getSubTree($source_node);
  1707             foreach ($subnodes as $subnode) {
  1708                 if ($subnode[
"obj_id"] == $target_id) {
  1713             $target_pos = $target_id;
  1717                 $target_parent = $target_id;
  1719                 $pg_childs = $lmtree->getChildsByType($target_parent, 
"pg");
  1720                 if (count($pg_childs) != 0) {
  1721                     $target_pos = $pg_childs[count($pg_childs) - 1][
"obj_id"];
  1723             } elseif ($as_subitem) {            
  1724                 $target_parent = $target_id;
  1726                 $childs = $lmtree->getChilds($target_parent);
  1727                 if (count($childs) != 0) {
  1728                     $target_pos = $childs[count($childs) - 1][
"obj_id"];
  1733             if ($movecopy == 
"move") {
  1734                 $lmtree->deleteTree($source_node);
  1737                 throw new ilException(
"ilObjContentObject: Not implemented");
  1741             if (!$lmtree->isInTree($source_id)) {
  1742                 $lmtree->insertNode($source_id, $target_parent, $target_pos);
  1745                 foreach ($subnodes as $node) {
  1746                     if ($node[
"obj_id"] != $source_id) {
  1747                         $lmtree->insertNode($node[
"obj_id"], $node[
"parent"]);
  1767         foreach ($pages as $page) {
  1769                 $cpage = 
new ilLMPage($page[
"obj_id"]);
  1771                 $error = $cpage->validateDom();
  1774                     $this->
lng->loadLanguageModule(
"content");
  1775                     $this->main_tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"cont_import_validation_errors"));
  1778                     $mess .= $this->
lng->txt(
"obj_pg") . 
": " . 
$title;
  1779                     $mess .= 
'<div class="small">';
  1781                         $err_mess = implode(
" - ", $e);
  1782                         if (!is_int(strpos($err_mess, 
":0:"))) {
  1783                             $mess .= htmlentities($err_mess) . 
"<br />";
  1795     public function cloneObject(
int $target_id, 
int $copy_id = 0, 
bool $omit_tree = 
false): ?
ilObject  1798         $new_obj = parent::cloneObject($target_id, $copy_id, $omit_tree);
  1805         if (!$cp_options->isRootNode($this->getRefId())) {
  1812         $new_obj->setLayout($this->
getLayout());
  1822         $new_obj->setRating($this->
hasRating());
  1832         $new_obj->createLMTree();
  1835         $style = $this->content_style_domain->styleForObjId($this->
getId());
  1836         $style->cloneTo($new_obj->getId());
  1845             $new_obj->setHeaderPage($new_page_header);
  1848             $new_obj->setFooterPage($new_page_footer);
  1854         $obj_settings->cloneSettings($new_obj->getId());
  1855         unset($obj_settings);
  1859         $ot->copy($new_obj->getId());
  1863         $menu->setObjId($this->
getId());
  1865         $new_menu->setObjId($new_obj->getId());
  1866         foreach ($menu->getMenuEntries() as $entry) {
  1874             $new_menu->setTarget($entry[
"link"] ?? 
"");
  1875             $new_menu->setTitle($entry[
"title"] ?? 
"");
  1876             $new_menu->setLinkType($entry[
"type"] ?? 
"");
  1877             $new_menu->setLinkRefId($entry[
"ref_id"] ?? 0);
  1878             $new_menu->create();
  1890         $parent_id = $a_target_obj->lm_tree->readRootId();
  1894         $chapters = $this->lm_tree->getChildsByType($this->lm_tree->readRootId(), 
"st");
  1895         $copied_nodes = array();
  1897         foreach ($chapters as $chap) {
  1898             $cid = ilLMObject::pasteTree(
  1913         foreach ($pages as $p) {
  1914             if (!$this->lm_tree->isInTree($p[
"obj_id"])) {
  1916                 $target_item = $item->copy($a_target_obj);
  1917                 $copied_nodes[$item->getId()] = $target_item->getId();
  1923         foreach ($copied_nodes as $old_id => $new_id) {
  1924             $options->appendMapping(
  1926                 $a_target_obj->
getRefId() . 
'_' . $new_id
  1934         return $copied_nodes;
  1942         $ilDB = $DIC->database();
  1945         $set = 
$ilDB->query(
  1946             "SELECT * FROM lm_glossaries " .
  1947             " WHERE lm_id = " . 
$ilDB->quote($a_lm_id, 
"integer")
  1950         while ($rec = 
$ilDB->fetchAssoc($set)) {
  1951             $glos[] = $rec[
"glo_id"];
  1966         $found_pages = array();
  1967         foreach ($pages as $p) {
  1969             $c = $pg->getXMLContent();
  1970             foreach ($terms as $t) {
  1971                 if (is_int(stripos(
$c, $t[
"term"]))) {
  1972                     $found_pages[$p[
"id"]][
"terms"][] = $t;
  1973                     if (!is_object($found_pages[$p[
"id"]][
"page"] ?? null)) {
  1974                         $found_pages[$p[
"id"]][
"page"] = $pg;
  1982         foreach ($found_pages as 
$id => $fp) {
  1998         bool $a_as_obj_id = 
false  2000         if (!$a_as_obj_id && $a_id > 0 && $a_id === (
int) OH_REF_ID) {
  2011         $this->rating = $a_value;
  2021         $this->rating_pages = $a_value;
  2033         switch ($a_element) {
  2037                     $obj_lp->getCurrentMode(),
  2047                 if (!$ot->getContentActivated()) {
  2051                 $paths = $this->lom_services->paths();
  2052                 $reader = $this->lom_services->read(
  2056                     $paths->custom()->withNextStep(
'general')->get()
  2059                 $ot->setDefaultTitle($reader->firstData($paths->title())->value());
  2060                 $ot->setDefaultDescription($reader->firstData($paths->firstDescription())->value());
 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)
 
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. 
 
setActiveTOC(bool $a_toc)
 
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)
 
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
 
setImportDirectory(string $a_import_dir)
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
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 
 
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
 
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 
 
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)
 
static delDir(string $a_dir, bool $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively 
 
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)
 
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...
 
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 
 
ILIAS Style Content DomainService $content_style_domain
 
getRestrictForwardNavigation()
 
static getPageList(int $lm_id)
 
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins 
 
__construct(Container $dic, ilPlugin $plugin)
 
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)
 
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)
 
LOMServices $lom_services
 
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 
 
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 ...
 
static getAllPages(string $a_parent_type, int $a_parent_id, string $a_lang="-")
Get all pages for parent object.