00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00037 include_once "classes/class.ilObjectGUI.php";
00038 include_once "content/classes/class.ilObjContentObject.php";
00039 include_once ("content/classes/class.ilLMPageObjectGUI.php");
00040 include_once ("content/classes/class.ilStructureObjectGUI.php");
00041
00042 class ilObjContentObjectGUI extends ilObjectGUI
00043 {
00044 var $ctrl;
00045
00051 function ilObjContentObjectGUI($a_data,$a_id = 0,$a_call_by_reference = true, $a_prepare_output = true)
00052 {
00053 global $lng, $ilCtrl;
00054
00055 $this->ctrl =& $ilCtrl;
00056 $lng->loadLanguageModule("content");
00057 parent::ilObjectGUI($a_data,$a_id,$a_call_by_reference,$a_prepare_output);
00058 $this->actions = $this->objDefinition->getActions("lm");
00059
00060 }
00061
00065 function &executeCommand()
00066 {
00067 if ($this->ctrl->getRedirectSource() == "ilinternallinkgui")
00068 {
00069 $this->explorer();
00070 return;
00071 }
00072
00073 if ($this->ctrl->getCmdClass() == "ilinternallinkgui")
00074 {
00075 $this->ctrl->setReturn($this, "explorer");
00076 }
00077
00078
00079 $next_class = $this->ctrl->getNextClass($this);
00080
00081
00082 $cmd = $this->ctrl->getCmd();
00083
00084 $this->addLocations();
00085 switch($next_class)
00086 {
00087 case "ilobjstylesheetgui":
00088 include_once ("classes/class.ilObjStyleSheetGUI.php");
00089 $this->ctrl->setReturn($this, "properties");
00090 $style_gui =& new ilObjStyleSheetGUI("", $this->object->getStyleSheetId(), false, false);
00091 $ret =& $this->ctrl->forwardCommand($style_gui);
00092
00093
00094 if ($cmd == "save")
00095 {
00096 $style_id = $ret;
00097 $this->object->setStyleSheetId($style_id);
00098 $this->object->update();
00099 $this->ctrl->redirectByClass("ilobjstylesheetgui", "edit");
00100 }
00101 break;
00102
00103 case "illmpageobjectgui":
00104 $this->ctrl->setReturn($this, "properties");
00105
00106
00107
00108 $pg_gui =& new ilLMPageObjectGUI($this->object);
00109 if ($_GET["obj_id"] != "")
00110 {
00111 $obj =& ilLMObjectFactory::getInstance($this->object, $_GET["obj_id"]);
00112 $pg_gui->setLMPageObject($obj);
00113 }
00114
00115 $ret =& $this->ctrl->forwardCommand($pg_gui);
00116 if ($cmd == "save" || $cmd == "cancel")
00117 {
00118 $this->ctrl->redirect($this, "pages");
00119 }
00120 break;
00121
00122 case "ilstructureobjectgui":
00123 $this->ctrl->setReturn($this, "properties");
00124 $st_gui =& new ilStructureObjectGUI($this->object, $this->object->lm_tree);
00125 if ($_GET["obj_id"] != "")
00126 {
00127 $obj =& ilLMObjectFactory::getInstance($this->object, $_GET["obj_id"]);
00128 $st_gui->setStructureObject($obj);
00129 }
00130
00131 $ret =& $this->ctrl->forwardCommand($st_gui);
00132 if ($cmd == "save" || $cmd == "cancel")
00133 {
00134 if ($_GET["obj_id"] == "")
00135 {
00136 $this->ctrl->redirect($this, "chapters");
00137 }
00138 else
00139 {
00140 $this->ctrl->setCmd("subchap");
00141 $this->executeCommand();
00142 }
00143 }
00144 break;
00145
00146 default:
00147 if ($cmd == "create")
00148 {
00149 switch ($_POST["new_type"])
00150 {
00151 case "pg":
00152 $this->setTabs();
00153 $this->ctrl->setCmdClass("ilLMPageObjectGUI");
00154 $ret =& $this->executeCommand();
00155 break;
00156
00157 case "st":
00158 $this->setTabs();
00159 $this->ctrl->setCmdClass("ilStructureObjectGUI");
00160 $ret =& $this->executeCommand();
00161 break;
00162 }
00163 }
00164 else
00165 {
00166 $ret =& $this->$cmd();
00167 }
00168 break;
00169 }
00170 return $ret;
00171 }
00172
00173 function _forwards()
00174 {
00175 return array("ilLMPageObjectGUI", "ilStructureObjectGUI","ilObjStyleSheetGUI");
00176 }
00177
00181 function properties()
00182 {
00183 $this->setTabs();
00184
00185
00186 $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
00187
00188
00189 $this->tpl->setCurrentBlock("btn_cell");
00190 $this->tpl->setVariable("BTN_LINK","lm_presentation.php?ref_id=".$this->object->getRefID());
00191 $this->tpl->setVariable("BTN_TARGET"," target=\"ilContObj".$this->object->getID()."\" ");
00192 $this->tpl->setVariable("BTN_TXT",$this->lng->txt("view"));
00193 $this->tpl->parseCurrentBlock();
00194
00195 $this->tpl->setCurrentBlock("btn_cell");
00196 $this->tpl->setVariable("BTN_LINK", $this->ctrl->getLinkTarget($this, "fixTreeConfirm"));
00197
00198 $this->tpl->setVariable("BTN_TXT", $this->lng->txt("cont_fix_tree"));
00199 $this->tpl->parseCurrentBlock();
00200
00201
00202
00203
00204 if ($this->ilias->getSetting("pub_section"))
00205 {
00206 if ($this->object->getType() != "dbk")
00207 {
00208 $this->tpl->setCurrentBlock("btn_cell");
00209 $this->tpl->setVariable("BTN_LINK", $this->ctrl->getLinkTarget($this, "editPublicSection"));
00210
00211 $this->tpl->setVariable("BTN_TXT", $this->lng->txt("public_section"));
00212 $this->tpl->parseCurrentBlock();
00213 }
00214 }
00215
00216
00217 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.lm_properties.html", true);
00218 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
00219 $this->tpl->setVariable("TXT_PROPERTIES", $this->lng->txt("cont_lm_properties"));
00220
00221
00222 $this->tpl->setVariable("TXT_ONLINE", $this->lng->txt("cont_online"));
00223 $this->tpl->setVariable("CBOX_ONLINE", "cobj_online");
00224 $this->tpl->setVariable("VAL_ONLINE", "y");
00225 if ($this->object->getOnline())
00226 {
00227 $this->tpl->setVariable("CHK_ONLINE", "checked");
00228 }
00229
00230
00231 $this->tpl->setVariable("TXT_LAYOUT", $this->lng->txt("cont_def_layout"));
00232 $layouts = ilObjContentObject::getAvailableLayouts();
00233 $select_layout = ilUtil::formSelect ($this->object->getLayout(), "lm_layout",
00234 $layouts, false, true);
00235 $this->tpl->setVariable("SELECT_LAYOUT", $select_layout);
00236
00237
00238 $this->tpl->setVariable("TXT_STYLE", $this->lng->txt("cont_style"));
00239 $fixed_style = $this->ilias->getSetting("fixed_content_style_id");
00240 if ($fixed_style > 0)
00241 {
00242 $this->tpl->setVariable("VAL_STYLE",
00243 ilObject::_lookupTitle($fixed_style)." (".
00244 $this->lng->txt("global_fixed").")");
00245 }
00246 else
00247 {
00248 $this->tpl->setCurrentBlock("style_edit");
00249 if ($this->object->getStyleSheetId() > 0)
00250 {
00251 $this->tpl->setVariable("VAL_STYLE",
00252 ilObject::_lookupTitle($this->object->getStyleSheetId()));
00253
00254
00255 $this->tpl->setVariable("LINK_STYLE_EDIT",
00256 $this->ctrl->getLinkTargetByClass("ilObjStyleSheetGUI", "edit"));
00257 $this->tpl->setVariable("TXT_STYLE_EDIT",
00258 $this->lng->txt("edit"));
00259 $this->tpl->setVariable("IMG_STYLE_EDIT",
00260 ilUtil::getImagePath("icon_pencil.gif"));
00261
00262
00263 $this->tpl->setVariable("LINK_STYLE_DROP",
00264 $this->ctrl->getLinkTargetByClass("ilObjStyleSheetGUI", "delete"));
00265 $this->tpl->setVariable("TXT_STYLE_DROP",
00266 $this->lng->txt("delete"));
00267 $this->tpl->setVariable("IMG_STYLE_DROP",
00268 ilUtil::getImagePath("delete.gif"));
00269 }
00270 else
00271 {
00272 $this->tpl->setVariable("VAL_STYLE",
00273 $this->lng->txt("default"));
00274 $this->tpl->setVariable("LINK_STYLE_CREATE",
00275 $this->ctrl->getLinkTargetByClass("ilObjStyleSheetGUI", "create"));
00276 $this->tpl->setVariable("TXT_STYLE_CREATE",
00277 $this->lng->txt("create"));
00278 }
00279 $this->tpl->parseCurrentBlock();
00280 }
00281
00282
00283 $this->tpl->setVariable("TXT_PAGE_HEADER", $this->lng->txt("cont_page_header"));
00284 $pg_header = array ("st_title" => $this->lng->txt("cont_st_title"),
00285 "pg_title" => $this->lng->txt("cont_pg_title"),
00286 "none" => $this->lng->txt("cont_none"));
00287 $select_pg_head = ilUtil::formSelect ($this->object->getPageHeader(), "lm_pg_header",
00288 $pg_header, false, true);
00289 $this->tpl->setVariable("SELECT_PAGE_HEADER", $select_pg_head);
00290
00291
00292 $this->tpl->setVariable("TXT_NUMBER", $this->lng->txt("cont_act_number"));
00293 $this->tpl->setVariable("CBOX_NUMBER", "cobj_act_number");
00294 $this->tpl->setVariable("VAL_NUMBER", "y");
00295 if ($this->object->isActiveNumbering())
00296 {
00297 $this->tpl->setVariable("CHK_NUMBER", "checked");
00298 }
00299
00300
00301 $this->tpl->setVariable("TXT_TOC_MODE", $this->lng->txt("cont_toc_mode"));
00302 $arr_toc_mode = array ("chapters" => $this->lng->txt("cont_chapters_only"),
00303 "pages" => $this->lng->txt("cont_chapters_and_pages"));
00304 $select_toc_mode = ilUtil::formSelect ($this->object->getTOCMode(), "toc_mode",
00305 $arr_toc_mode, false, true);
00306 $this->tpl->setVariable("SELECT_TOC_MODE", $select_toc_mode);
00307
00308
00309 $this->tpl->setVariable("TXT_CLEAN_FRAMES", $this->lng->txt("cont_clean_frames"));
00310 $this->tpl->setVariable("TXT_CLEAN_FRAMES_DESC", $this->lng->txt("cont_clean_frames_desc"));
00311 $this->tpl->setVariable("CBOX_CLEAN_FRAMES", "cobj_clean_frames");
00312 $this->tpl->setVariable("VAL_CLEAN_FRAMES", "y");
00313 if ($this->object->cleanFrames())
00314 {
00315 $this->tpl->setVariable("CHK_CLEAN_FRAMES", "checked");
00316 }
00317
00318
00319 $this->tpl->setVariable("TXT_HIST_USER_COMMENTS", $this->lng->txt("enable_hist_user_comments"));
00320 $this->tpl->setVariable("TXT_HIST_USER_COMMENTS_DESC", $this->lng->txt("enable_hist_user_comments_desc"));
00321 $this->tpl->setVariable("CBOX_HIST_USER_COMMENTS", "cobj_user_comments");
00322 $this->tpl->setVariable("VAL_HIST_USER_COMMENTS", "y");
00323 if ($this->object->isActiveHistoryUserComments())
00324 {
00325 $this->tpl->setVariable("CHK_HIST_USER_COMMENTS", "checked");
00326 }
00327
00328
00329 $this->tpl->setVariable("TXT_LM_MENU", $this->lng->txt("cont_lm_menu"));
00330 $this->tpl->setVariable("TXT_ACT_MENU", $this->lng->txt("cont_active"));
00331 $this->tpl->setVariable("CBOX_LM_MENU", "cobj_act_lm_menu");
00332 $this->tpl->setVariable("VAL_LM_MENU", "y");
00333 if ($this->object->isActiveLMMenu())
00334 {
00335 $this->tpl->setVariable("CHK_LM_MENU", "checked");
00336 }
00337
00338
00339 $this->tpl->setVariable("TXT_TOC", $this->lng->txt("cont_toc"));
00340 $this->tpl->setVariable("CBOX_TOC", "cobj_act_toc");
00341 $this->tpl->setVariable("VAL_TOC", "y");
00342 if ($this->object->isActiveTOC())
00343 {
00344 $this->tpl->setVariable("CHK_TOC", "checked");
00345 }
00346
00347
00348 $this->tpl->setVariable("TXT_PRINT", $this->lng->txt("cont_print_view"));
00349 $this->tpl->setVariable("CBOX_PRINT", "cobj_act_print");
00350 $this->tpl->setVariable("VAL_PRINT", "y");
00351 if ($this->object->isActivePrintView())
00352 {
00353 $this->tpl->setVariable("CHK_PRINT", "checked");
00354 }
00355
00356
00357 $this->tpl->setVariable("TXT_DOWNLOADS", $this->lng->txt("cont_downloads"));
00358 $this->tpl->setVariable("TXT_DOWNLOADS_DESC", $this->lng->txt("cont_downloads_desc"));
00359 $this->tpl->setVariable("CBOX_DOWNLOADS", "cobj_act_downloads");
00360 $this->tpl->setVariable("VAL_DOWNLOADS", "y");
00361 if ($this->object->isActiveDownloads())
00362 {
00363 $this->tpl->setVariable("CHK_DOWNLOADS", "checked");
00364 }
00365
00366
00367 $this->__initLMMenuEditor();
00368 $entries = $this->lmme_obj->getMenuEntries();
00369
00370 if (count($entries) > 0)
00371 {
00372 foreach ($entries as $entry)
00373 {
00374 $this->ctrl->setParameter($this, "menu_entry", $entry["id"]);
00375
00376 $this->tpl->setCurrentBlock("menu_entries");
00377
00378 if ($entry["type"] == "intern")
00379 {
00380 $entry["link"] = ILIAS_HTTP_PATH."/goto.php?target=".$entry["link"];
00381 }
00382
00383
00384 if (!strstr($entry["link"],'http://'))
00385 {
00386 $entry["link"] = "http://".$entry["link"];
00387 }
00388
00389 $this->tpl->setVariable("ENTRY_LINK", $entry["link"]);
00390 $this->tpl->setVariable("ENTRY_TITLE", $entry["title"]);
00391
00392 $this->tpl->setVariable("CBOX_ENTRY", "menu_entries[]");
00393 $this->tpl->setVariable("VAL_ENTRY", $entry["id"]);
00394
00395 if (ilUtil::yn2tf($entry["active"]))
00396 {
00397 $this->tpl->setVariable("CHK_ENTRY", "checked=\"checked\"");
00398 }
00399
00400
00401 $this->tpl->setVariable("LINK_EDIT", $this->ctrl->getLinkTarget($this,"editMenuEntry"));
00402 $this->tpl->setVariable("TARGET_EDIT", "content");
00403 $this->tpl->setVariable("TXT_EDIT", $this->lng->txt("edit"));
00404 $this->tpl->setVariable("IMG_EDIT", ilUtil::getImagePath("icon_pencil.gif"));
00405
00406 $this->tpl->setVariable("LINK_DROP", $this->ctrl->getLinkTarget($this,"deleteMenuEntry"));
00407 $this->tpl->setVariable("TARGET_DROP", "content");
00408 $this->tpl->setVariable("TXT_DROP", $this->lng->txt("drop"));
00409 $this->tpl->setVariable("IMG_DROP", ilUtil::getImagePath("delete.gif"));
00410
00411 $this->tpl->parseCurrentBlock();
00412 }
00413 }
00414
00415
00416
00417
00418 $this->tpl->setCurrentBlock("commands");
00419 $this->tpl->setVariable("BTN_NAME", "saveProperties");
00420 $this->tpl->setVariable("BTN_TEXT", $this->lng->txt("save"));
00421 $this->tpl->setVariable("BTN_NAME2", "addMenuEntry");
00422 $this->tpl->setVariable("BTN_TEXT2", $this->lng->txt("add_menu_entry"));
00423 $this->tpl->parseCurrentBlock();
00424 }
00425
00429 function explorer()
00430 {
00431 global $ilUser, $ilias;
00432
00433 switch ($this->object->getType())
00434 {
00435 case "lm":
00436 $gui_class = "ilobjlearningmodulegui";
00437 break;
00438
00439 case "dlb":
00440 $gui_class = "ilobjdlbookgui";
00441 break;
00442 }
00443
00444
00445
00446 $this->tpl = new ilTemplate("tpl.main.html", true, true);
00447
00448
00449
00450 $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
00451
00452
00453 $this->tpl->addBlockFile("CONTENT", "content", "tpl.explorer.html");
00454
00455 require_once ("content/classes/class.ilLMEditorExplorer.php");
00456 $exp = new ilLMEditorExplorer("lm_edit.php?cmd=view&ref_id=".$this->object->getRefId(),
00457 $this->object, $gui_class);
00458
00459 $exp->setTargetGet("obj_id");
00460 $exp->setExpandTarget($this->ctrl->getLinkTarget($this, "explorer"));
00461
00462 if ($_GET["lmmovecopy"] == "1")
00463 {
00464 $this->proceedDragDrop();
00465 }
00466
00467
00468 if ($_GET["lmexpand"] == "")
00469 {
00470 $mtree = new ilTree($this->object->getId());
00471 $mtree->setTableNames('lm_tree','lm_data');
00472 $mtree->setTreeTablePK("lm_id");
00473 $expanded = $mtree->readRootId();
00474 }
00475 else
00476 {
00477 $expanded = $_GET["lmexpand"];
00478 }
00479
00480 $exp->setExpand($expanded);
00481
00482
00483 $exp->setOutput(0);
00484 $output = $exp->getOutput();
00485
00486 include_once("content/classes/Pages/class.ilPageEditorGUI.php");
00487 if (ilPageEditorGUI::_doJSEditing())
00488 {
00489
00490
00491 $IDS = "";
00492 for ($i=0;$i<count($exp->iconList);$i++)
00493 {
00494 if ($i>0) $IDS .= ",";
00495 $IDS .= "'".$exp->iconList[$i]."'";
00496 }
00497 $this->tpl->setVariable("ICONIDS",$IDS);
00498
00499 $this->tpl->setVariable("TESTPFAD",$this->ctrl->getLinkTarget($this, "explorer")."&lmmovecopy=1");
00500 $this->tpl->setVariable("POPUPLINK",$this->ctrl->getLinkTarget($this, "popup")."&ptype=movecopytreenode");
00501 }
00502
00503
00504 $this->tpl->setCurrentBlock("content");
00505 $this->tpl->setVariable("TXT_EXPLORER_HEADER", $this->lng->txt("cont_chap_and_pages"));
00506 $this->tpl->setVariable("EXP_REFRESH", $this->lng->txt("refresh"));
00507 $this->tpl->setVariable("EXPLORER",$output);
00508 $this->ctrl->setParameter($this, "lmexpand", $_GET["lmexpand"]);
00509
00510 $this->tpl->setVariable("ACTION", $this->ctrl->getLinkTarget($this, "explorer"));
00511 $this->tpl->parseCurrentBlock();
00512
00513
00514 }
00515
00516
00520 function proceedDragDrop()
00521 {
00522 $lmtree = new ilTree($this->object->getId());
00523 $lmtree->setTableNames('lm_tree','lm_data');
00524 $lmtree->setTreeTablePK("lm_id");
00525
00526
00527
00528 $source_id = $_GET["dragdropSource"];
00529
00530
00531 $target_id = $_GET["dragdropTarget"];
00532
00533
00534 $movecopy = $_GET["dragdropCopymove"];
00535
00536
00537 $position = $_GET["dragdropPosition"];
00538
00539
00540
00541
00542
00543
00544 $source_obj = ilLMObjectFactory::getInstance($this->object, $source_id, true);
00545 $source_obj->setLMId($this->object->getId());
00546 $target_obj = ilLMObjectFactory::getInstance($this->object, $target_id, true);
00547 $target_obj->setLMId($this->object->getId());
00548 $target_parent = $lmtree->getParentId($target_id);
00549
00550
00551
00552 if ($source_obj->getType() == "pg")
00553 {
00554 if ($lmtree->isInTree($source_obj->getId()))
00555 {
00556 $node_data = $lmtree->getNodeData($source_obj->getId());
00557
00558
00559 if ($movecopy == "move")
00560 {
00561 $parent_id = $lmtree->getParentId($source_obj->getId());
00562 $lmtree->deleteTree($node_data);
00563
00564
00565 require_once("classes/class.ilHistory.php");
00566 ilHistory::_createEntry($source_obj->getId(), "cut",
00567 array(ilLMObject::_lookupTitle($parent_id), $parent_id),
00568 $this->object->getType().":pg");
00569 ilHistory::_createEntry($parent_id, "cut_page",
00570 array(ilLMObject::_lookupTitle($source_obj->getId()), $source_obj->getId()),
00571 $this->object->getType().":st");
00572 }
00573 else
00574 {
00575
00576 $new_page =& $source_obj->copy();
00577 $source_id = $new_page->getId();
00578 $source_obj =& $new_page;
00579 }
00580
00581
00582 if(!$lmtree->isInTree($source_obj->getId()))
00583 {
00584
00585 if ($target_obj->getType() == "pg")
00586 {
00587 $target_pos = $target_id;
00588 if ($position == "before")
00589 {
00590 $target_pos = IL_FIRST_NODE;
00591 if ($pred = $lmtree->fetchPredecessorNode($target_id))
00592 {
00593 if ($lmtree->getParentId($pred["child"]) == $target_parent)
00594 {
00595 $target_pos = $pred["child"];
00596 }
00597 }
00598 }
00599 $parent = $target_parent;
00600 }
00601 else
00602 {
00603 $target_pos = IL_FIRST_NODE;
00604 $parent = $target_id;
00605 }
00606
00607
00608 $lmtree->insertNode($source_obj->getId(),
00609 $parent, $target_pos);
00610
00611
00612 if ($movecopy == "move")
00613 {
00614
00615 include_once("classes/class.ilHistory.php");
00616 ilHistory::_createEntry($source_obj->getId(), "paste",
00617 array(ilLMObject::_lookupTitle($parent), $parent),
00618 $this->object->getType().":pg");
00619 ilHistory::_createEntry($parent, "paste_page",
00620 array(ilLMObject::_lookupTitle($source_obj->getId()), $source_obj->getId()),
00621 $this->object->getType().":st");
00622 }
00623
00624 }
00625 }
00626 }
00627
00628
00629 if ($source_obj->getType() == "st")
00630 {
00631
00632 if ($target_obj->getType() != "st")
00633 {
00634 return;
00635 }
00636 $source_node = $lmtree->getNodeData($source_id);
00637 $subnodes = $lmtree->getSubtree($source_node);
00638
00639
00640 foreach ($subnodes as $subnode)
00641 {
00642 if($subnode["obj_id"] == $target_id)
00643 {
00644 return;
00645 }
00646 }
00647
00648 $target_pos = $target_id;
00649
00650
00651 if ($position == "before")
00652 {
00653 $target_pos = IL_FIRST_NODE;
00654
00655
00656 $childs = $lmtree->getChildsByType($target_parent, "st");
00657 $found = false;
00658 foreach ($childs as $child)
00659 {
00660 if ($child["obj_id"] == $target_id)
00661 {
00662 $found = true;
00663 }
00664 if (!$found)
00665 {
00666 $target_pos = $child["obj_id"];
00667 }
00668 }
00669
00670
00671 if ($target_pos == IL_FIRST_NODE)
00672 {
00673 $pg_childs =& $lmtree->getChildsByType($target_parent, "pg");
00674 if (count($pg_childs) != 0)
00675 {
00676 $target_pos = $pg_childs[count($pg_childs) - 1]["obj_id"];
00677 }
00678 }
00679 }
00680
00681
00682 if ($position == "into")
00683 {
00684 $target_parent = $target_id;
00685 $target_pos = IL_FIRST_NODE;
00686
00687
00688 if ($target_pos == IL_FIRST_NODE)
00689 {
00690 $pg_childs =& $lmtree->getChildsByType($target_parent, "pg");
00691 if (count($pg_childs) != 0)
00692 {
00693 $target_pos = $pg_childs[count($pg_childs) - 1]["obj_id"];
00694 }
00695 }
00696 }
00697
00698
00699
00700 if ($movecopy == "move")
00701 {
00702 $lmtree->deleteTree($source_node);
00703 }
00704 else
00705 {
00706
00707 $new_chapter =& $source_obj->copy($lmtree, $target_parent, $target_pos);
00708 }
00709
00710 if (!$lmtree->isInTree($source_id))
00711 {
00712 $lmtree->insertNode($source_id, $target_parent, $target_pos);
00713
00714
00715 if ($movecopy == "move")
00716 {
00717 foreach ($subnodes as $node)
00718 {
00719 if($node["obj_id"] != $source_id)
00720 {
00721 $lmtree->insertNode($node["obj_id"], $node["parent"]);
00722 }
00723 }
00724 }
00725 }
00726
00727
00728 $this->object->checkTree();
00729
00730 }
00731
00732
00733 $this->object->checkTree();
00734 }
00735
00736
00737
00741 function saveProperties()
00742 {
00743 $this->object->setLayout($_POST["lm_layout"]);
00744 $this->object->setPageHeader($_POST["lm_pg_header"]);
00745 $this->object->setTOCMode($_POST["toc_mode"]);
00746 $this->object->setOnline(ilUtil::yn2tf($_POST["cobj_online"]));
00747 $this->object->setActiveLMMenu(ilUtil::yn2tf($_POST["cobj_act_lm_menu"]));
00748 $this->object->setActiveNumbering(ilUtil::yn2tf($_POST["cobj_act_number"]));
00749 $this->object->setActiveTOC(ilUtil::yn2tf($_POST["cobj_act_toc"]));
00750 $this->object->setActivePrintView(ilUtil::yn2tf($_POST["cobj_act_print"]));
00751 $this->object->setActiveDownloads(ilUtil::yn2tf($_POST["cobj_act_downloads"]));
00752 $this->object->setCleanFrames(ilUtil::yn2tf($_POST["cobj_clean_frames"]));
00753 $this->object->setHistoryUserComments(ilUtil::yn2tf($_POST["cobj_user_comments"]));
00754 $this->object->updateProperties();
00755
00756 $this->__initLMMenuEditor();
00757 $this->lmme_obj->updateActiveStatus($_POST["menu_entries"]);
00758
00759 sendInfo($this->lng->txt("msg_obj_modified"), true);
00760 $this->ctrl->redirect($this, "properties");
00761 }
00762
00766 function createObject()
00767 {
00768 global $rbacsystem;
00769
00770 $new_type = $_POST["new_type"] ? $_POST["new_type"] : $_GET["new_type"];
00771
00772 if (!$rbacsystem->checkAccess("create", $_GET["ref_id"], $new_type))
00773 {
00774 $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
00775 }
00776 else
00777 {
00778
00779 $data = array();
00780 $data["fields"] = array();
00781 $data["fields"]["title"] = ilUtil::prepareFormOutput($_SESSION["error_post_vars"]["Fobject"]["title"],true);
00782 $data["fields"]["desc"] = ilUtil::stripSlashes($_SESSION["error_post_vars"]["Fobject"]["desc"]);
00783
00784 $this->getTemplateFile("create", $new_type);
00785
00786 foreach ($data["fields"] as $key => $val)
00787 {
00788 $this->tpl->setVariable("TXT_".strtoupper($key), $this->lng->txt($key));
00789 $this->tpl->setVariable(strtoupper($key), $val);
00790
00791 if ($this->prepare_output)
00792 {
00793 $this->tpl->parseCurrentBlock();
00794 }
00795 }
00796
00797 $this->tpl->setVariable("FORMACTION", $this->getFormAction("save","adm_object.php?cmd=gateway&ref_id=".
00798 $_GET["ref_id"]."&new_type=".$new_type));
00799 $this->tpl->setVariable("TXT_HEADER", $this->lng->txt($new_type."_new"));
00800 $this->tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
00801 $this->tpl->setVariable("TXT_SUBMIT", $this->lng->txt($new_type."_add"));
00802 $this->tpl->setVariable("CMD_SUBMIT", "save");
00803 $this->tpl->setVariable("TARGET", $this->getTargetFrame("save"));
00804 $this->tpl->setVariable("TXT_REQUIRED_FLD", $this->lng->txt("required_field"));
00805
00806 $this->tpl->setVariable("TXT_IMPORT_LM", $this->lng->txt("import_".$new_type));
00807 $this->tpl->setVariable("TXT_LM_FILE", $this->lng->txt("file"));
00808 $this->tpl->setVariable("TXT_IMPORT", $this->lng->txt("import"));
00809
00810
00811 $umf=get_cfg_var("upload_max_filesize");
00812
00813 $pms=get_cfg_var("post_max_size");
00814
00815
00816 $max_filesize=min($umf, $pms);
00817 if (!$max_filesize) $max_filesize=max($umf, $pms);
00818
00819
00820 $this->tpl->setVariable("TXT_FILE_INFO", $this->lng->txt("file_notice")." $max_filesize.");
00821
00822 }
00823 }
00824
00828 function saveObject()
00829 {
00830 global $rbacadmin, $rbacsystem;
00831
00832
00833
00834
00835 if (!$rbacsystem->checkAccess("create", $_GET["ref_id"], $_GET["new_type"]))
00836 {
00837 $this->ilias->raiseError($this->lng->txt("no_create_permission"), $this->ilias->error_obj->MESSAGE);
00838 }
00839 else
00840 {
00841
00842 if ($_POST["Fobject"]["title"] == "")
00843 {
00844 $this->ilias->raiseError($this->lng->txt("please_enter_title"), $this->ilias->error_obj->MESSAGE);
00845 return;
00846 }
00847
00848
00849 include_once("content/classes/class.ilObjContentObject.php");
00850 $newObj = new ilObjContentObject();
00851 $newObj->setType($this->type);
00852 $newObj->setTitle($_POST["Fobject"]["title"]);#"content object ".$newObj->getId());
00853 $newObj->setDescription($_POST["Fobject"]["desc"]);
00854 $newObj->create();
00855 $newObj->createReference();
00856 $newObj->putInTree($_GET["ref_id"]);
00857 $newObj->setPermissions($_GET["ref_id"]);
00858 $newObj->notify("new",$_GET["ref_id"],$_GET["parent_non_rbac_id"],$_GET["ref_id"],$newObj->getRefId());
00859
00860
00861
00862
00863
00864
00865
00866 $newObj->createLMTree();
00867 unset($newObj);
00868
00869
00870 sendInfo($this->lng->txt($this->type."_added"), true);
00871 ilUtil::redirect($this->getReturnLocation("save","adm_object.php?".$this->link_params));
00872 }
00873 }
00874
00875
00876 function chooseMetaSectionObject($a_target = "")
00877 {
00878 if ($a_target == "")
00879 {
00880 $a_target = "adm_object.php?ref_id=".$this->object->getRefId();
00881 }
00882
00883 include_once "classes/class.ilMetaDataGUI.php";
00884 $meta_gui =& new ilMetaDataGUI();
00885 $meta_gui->setObject($this->object);
00886 $meta_gui->edit("ADM_CONTENT", "adm_content",
00887 $a_target, $_REQUEST["meta_section"]);
00888 }
00889
00890
00891 function chooseMetaSection()
00892 {
00893 $this->setTabs();
00894
00895 $this->chooseMetaSectionObject($this->ctrl->getLinkTarget($this));
00896 }
00897
00898 function addMetaObject($a_target = "")
00899 {
00900 if ($a_target == "")
00901 {
00902 $a_target = "adm_object.php?ref_id=".$this->object->getRefId();
00903 }
00904
00905 include_once "classes/class.ilMetaDataGUI.php";
00906 $meta_gui =& new ilMetaDataGUI();
00907 $meta_gui->setObject($this->object);
00908 $meta_name = $_POST["meta_name"] ? $_POST["meta_name"] : $_GET["meta_name"];
00909 $meta_index = $_POST["meta_index"] ? $_POST["meta_index"] : $_GET["meta_index"];
00910 if ($meta_index == "")
00911 $meta_index = 0;
00912 $meta_path = $_POST["meta_path"] ? $_POST["meta_path"] : $_GET["meta_path"];
00913 $meta_section = $_POST["meta_section"] ? $_POST["meta_section"] : $_GET["meta_section"];
00914 if ($meta_name != "")
00915 {
00916 $meta_gui->meta_obj->add($meta_name, $meta_path, $meta_index);
00917 }
00918 else
00919 {
00920 sendInfo($this->lng->txt("meta_choose_element"), true);
00921 }
00922 $meta_gui->edit("ADM_CONTENT", "adm_content", $a_target, $meta_section);
00923 }
00924
00925 function addMeta()
00926 {
00927 $this->setTabs();
00928 $this->addMetaObject($this->ctrl->getLinkTarget($this));
00929 }
00930
00934 function addBibItemObject($a_target = "")
00935 {
00936 include_once "content/classes/class.ilBibItemGUI.php";
00937 $bib_gui =& new ilBibItemGUI();
00938 $bib_gui->setObject($this->object);
00939 $bibItemName = $_POST["bibItemName"] ? $_POST["bibItemName"] : $_GET["bibItemName"];
00940 $bibItemIndex = $_POST["bibItemIndex"] ? $_POST["bibItemIndex"] : $_GET["bibItemIndex"];
00941 if ($bibItemIndex == "")
00942 $bibItemIndex = 0;
00943 $bibItemPath = $_POST["bibItemPath"] ? $_POST["bibItemPath"] : $_GET["bibItemPath"];
00944 if ($bibItemName != "")
00945 {
00946 $bib_gui->bib_obj->add($bibItemName, $bibItemPath, $bibItemIndex);
00947 $data = $bib_gui->bib_obj->getElement("BibItem");
00948 $bibItemIndex = (count($data) - 1);
00949 }
00950 else
00951 {
00952 sendInfo($this->lng->txt("bibitem_choose_element"), true);
00953 }
00954 if ($a_target == "")
00955 {
00956 $a_target = "adm_object.php?ref_id=" . $this->object->getRefId();
00957 }
00958
00959 $bib_gui->edit("ADM_CONTENT", "adm_content", $a_target, $bibItemIndex);
00960 }
00961
00965 function addBibItem()
00966 {
00967 $this->setTabs();
00968 $this->addBibItemObject($this->ctrl->getLinkTarget($this));
00969 }
00970
00971 function deleteMetaObject($a_target = "")
00972 {
00973 if ($a_target == "")
00974 {
00975 $a_target = "adm_object.php?ref_id=".$this->object->getRefId();
00976 }
00977
00978 include_once "classes/class.ilMetaDataGUI.php";
00979 $meta_gui =& new ilMetaDataGUI();
00980 $meta_gui->setObject($this->object);
00981 $meta_index = $_POST["meta_index"] ? $_POST["meta_index"] : $_GET["meta_index"];
00982 $meta_gui->meta_obj->delete($_GET["meta_name"], $_GET["meta_path"], $meta_index);
00983 $meta_gui->edit("ADM_CONTENT", "adm_content", $a_target, $_GET["meta_section"]);
00984 }
00985
00986 function deleteMeta()
00987 {
00988 $this->setTabs();
00989 $this->deleteMetaObject($this->ctrl->getLinkTarget($this));
00990 }
00991
00995 function deleteBibItemObject($a_target = "")
00996 {
00997 include_once "content/classes/class.ilBibItemGUI.php";
00998 $bib_gui =& new ilBibItemGUI();
00999 $bib_gui->setObject($this->object);
01000 $bibItemIndex = $_POST["bibItemIndex"] ? $_POST["bibItemIndex"] : $_GET["bibItemIndex"];
01001 $bib_gui->bib_obj->delete($_GET["bibItemName"], $_GET["bibItemPath"], $bibItemIndex);
01002 if (strpos($bibItemIndex, ",") > 0)
01003 {
01004 $bibItemIndex = substr($bibItemIndex, 0, strpos($bibItemIndex, ","));
01005 }
01006 if ($a_target == "")
01007 {
01008 $a_target = "adm_object.php?ref_id=" . $this->object->getRefId();
01009 }
01010
01011 $bib_gui->edit("ADM_CONTENT", "adm_content", $a_target, $bibItemIndex);
01012 }
01013
01017 function deleteBibItem()
01018 {
01019 $this->setTabs();
01020 $this->deleteBibItemObject($this->ctrl->getLinkTarget($this));
01021 }
01022
01023 function editMetaObject($a_target = "")
01024 {
01025
01026 if ($a_target == "")
01027 {
01028 $a_target = "adm_object.php?ref_id=".$this->object->getRefId();
01029 }
01030
01031 include_once "classes/class.ilMetaDataGUI.php";
01032 $meta_gui =& new ilMetaDataGUI();
01033 $meta_gui->setObject($this->object);
01034
01035 $meta_gui->edit("ADM_CONTENT", "adm_content", $a_target, $_GET["meta_section"]);
01036 }
01037
01038 function editMeta()
01039 {
01040 $this->setTabs();
01041 $this->editMetaObject($this->ctrl->getLinkTarget($this));
01042 }
01043
01047 function editBibItemObject($a_target = "")
01048 {
01049 include_once "content/classes/class.ilBibItemGUI.php";
01050 $bib_gui =& new ilBibItemGUI();
01051 $bib_gui->setObject($this->object);
01052 $bibItemIndex = $_POST["bibItemIndex"] ? $_POST["bibItemIndex"] : $_GET["bibItemIndex"];
01053 $bibItemIndex *= 1;
01054 if ($bibItemIndex < 0)
01055 {
01056 $bibItemIndex = 0;
01057 }
01058 if ($a_target == "")
01059 {
01060 $a_target = "adm_object.php?ref_id=" . $this->object->getRefId();
01061 }
01062
01063 $bib_gui->edit("ADM_CONTENT", "adm_content", $a_target, $bibItemIndex);
01064 }
01065
01069 function editBibItem()
01070 {
01071 $this->setTabs();
01072 $this->editBibItemObject($this->ctrl->getLinkTarget($this));
01073 }
01074
01075 function saveMetaObject($a_target = "adm_object.php")
01076 {
01077 include_once "classes/class.ilMetaDataGUI.php";
01078 $meta_gui =& new ilMetaDataGUI();
01079 $meta_gui->setObject($this->object);
01080
01081 $meta_gui->save($_POST["meta_section"]);
01082 ilUtil::redirect($a_target . "?cmd=editMeta&ref_id=" . $this->object->getRefId() . "&meta_section=" . $_POST["meta_section"]);
01083 }
01084
01085 function saveMeta()
01086 {
01087 $this->saveMetaObject("lm_edit.php");
01088 }
01089
01093 function saveBibItemObject($a_target = "")
01094 {
01095 include_once "content/classes/class.ilBibItemGUI.php";
01096 $bib_gui =& new ilBibItemGUI();
01097 $bib_gui->setObject($this->object);
01098 $bibItemIndex = $_POST["bibItemIndex"] ? $_POST["bibItemIndex"] : $_GET["bibItemIndex"];
01099 $bibItemIndex *= 1;
01100 if ($bibItemIndex < 0)
01101 {
01102 $bibItemIndex = 0;
01103 }
01104 $bibItemIndex = $bib_gui->save($bibItemIndex);
01105
01106 if ($a_target == "")
01107 {
01108 $a_target = "adm_object.php?ref_id=" . $this->object->getRefId();
01109 }
01110
01111 $bib_gui->edit("ADM_CONTENT", "adm_content", $a_target, $bibItemIndex);
01112 }
01113
01117 function saveBibItem()
01118 {
01119 $this->setTabs();
01120 $this->saveBibItemObject($this->ctrl->getLinkTarget($this));
01121 }
01122
01128 function viewObject()
01129 {
01130 global $rbacsystem, $tree, $tpl;
01131
01132
01133 if (!$rbacsystem->checkAccess("visible,read",$this->object->getRefId()))
01134 {
01135 $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
01136 }
01137
01138
01139
01140 $showViewInFrameset = $this->ilias->ini->readVariable("layout","view_target") == "frame";
01141
01142
01143 $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
01144
01145 if (!defined("ILIAS_MODULE"))
01146 {
01147 $this->tpl->setCurrentBlock("btn_cell");
01148 $this->tpl->setVariable("BTN_LINK","content/lm_edit.php?ref_id=".$this->object->getRefID());
01149 $this->tpl->setVariable("BTN_TARGET"," target=\"bottom\" ");
01150 $this->tpl->setVariable("BTN_TXT",$this->lng->txt("edit"));
01151 $this->tpl->parseCurrentBlock();
01152 }
01153
01154
01155 $this->tpl->setCurrentBlock("btn_cell");
01156 if (!defined("ILIAS_MODULE"))
01157 {
01158 $this->tpl->setVariable("BTN_LINK","content/lm_presentation.php?ref_id=".$this->object->getRefID());
01159 }
01160 else
01161 {
01162 $this->tpl->setVariable("BTN_LINK","lm_presentation.php?ref_id=".$this->object->getRefID());
01163 }
01164
01165
01166 if ($showViewInFrameset)
01167 {
01168 $view_frame = "bottom";
01169 }
01170 else
01171 {
01172 $view_frame = "ilContObj".$this->object->getID();
01173 }
01174 $this->tpl->setVariable("BTN_TARGET"," target=\"$view_frame\" ");
01175 $this->tpl->setVariable("BTN_TXT",$this->lng->txt("view"));
01176 $this->tpl->parseCurrentBlock();
01177
01178 parent::viewObject();
01179
01180 }
01181
01187 function exportObject()
01188 {
01189 return;
01190 }
01191
01197 function importObject()
01198 {
01199 $this->createObject();
01200 return;
01201 }
01202
01203
01210 function importFileObject()
01211 {
01212 global $_FILES, $rbacsystem, $ilDB;
01213
01214 include_once "content/classes/class.ilObjLearningModule.php";
01215
01216
01217 $source = $_FILES["xmldoc"]["tmp_name"];
01218 if (($source == 'none') || (!$source))
01219 {
01220 $this->ilias->raiseError("No file selected!",$this->ilias->error_obj->MESSAGE);
01221 }
01222
01223
01224
01225
01226
01227
01228
01229
01230 $info = pathinfo($_FILES["xmldoc"]["name"]);
01231 if (strtolower($info["extension"]) != "zip")
01232 {
01233 $this->ilias->raiseError("File must be a zip file!",$this->ilias->error_obj->MESSAGE);
01234 }
01235
01236
01237 include_once("content/classes/class.ilObjContentObject.php");
01238 $newObj = new ilObjContentObject();
01239 $newObj->setType($_GET["new_type"]);
01240 $newObj->setTitle($_FILES["xmldoc"]["name"]);
01241 $newObj->setDescription("");
01242 $newObj->create(true);
01243 $newObj->createReference();
01244 $newObj->putInTree($_GET["ref_id"]);
01245 $newObj->setPermissions($_GET["ref_id"]);
01246 $newObj->notify("new",$_GET["ref_id"],$_GET["parent_non_rbac_id"],$_GET["ref_id"],$newObj->getRefId());
01247
01248
01249 $newObj->createLMTree();
01250
01251
01252 $newObj->createImportDirectory();
01253
01254
01255 $file = pathinfo($_FILES["xmldoc"]["name"]);
01256 $full_path = $newObj->getImportDirectory()."/".$_FILES["xmldoc"]["name"];
01257
01258 ilUtil::moveUploadedFile($_FILES["xmldoc"]["tmp_name"],
01259 $_FILES["xmldoc"]["name"], $full_path);
01260
01261
01262
01263
01264 ilUtil::unzip($full_path);
01265
01266
01267 $subdir = basename($file["basename"],".".$file["extension"]);
01268 $xml_file = $newObj->getImportDirectory()."/".$subdir."/".$subdir.".xml";
01269
01270
01271 include_once ("content/classes/class.ilContObjParser.php");
01272 $contParser = new ilContObjParser($newObj, $xml_file, $subdir);
01273 $contParser->startParsing();
01274
01275
01276 $style_file = $newObj->getImportDirectory()."/".$subdir."/style.xml";
01277 if (is_file($style_file))
01278 {
01279 require_once("classes/class.ilObjStyleSheet.php");
01280 $style = new ilObjStyleSheet();
01281 $style->createFromXMLFile($style_file);
01282 $newObj->writeStyleSheetId($style->getId());
01283 }
01284
01285
01286 if (is_object($newObj->meta_data))
01287 {
01288 $newObj->meta_data->read();
01289 $newObj->setTitle($newObj->meta_data->getTitle());
01290 $newObj->setDescription($newObj->meta_data->getDescription());
01291 ilObject::_writeTitle($newObj->getID(), $newObj->getTitle());
01292 ilObject::_writeDescription($newObj->getID(), $newObj->getDescription());
01293
01294
01295 }
01296
01297 sendInfo($this->lng->txt($this->type."_added"),true);
01298 ilUtil::redirect($this->getReturnLocation("save","adm_object.php?".$this->link_params));
01299
01300 }
01301
01305 function chapters()
01306 {
01307 global $tree;
01308
01309 $this->setTabs();
01310
01311 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.structure_edit.html", true);
01312 $num = 0;
01313
01314 $this->ctrl->setParameter($this, "backcmd", "chapters");
01315 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
01316 $this->tpl->setVariable("HEADER_TEXT", $this->lng->txt("cont_chapters"));
01317 $this->tpl->setVariable("CHECKBOX_TOP", IL_FIRST_NODE);
01318
01319
01320 $cnt = 0;
01321 $childs = $this->lm_tree->getChilds($this->lm_tree->getRootId());
01322 foreach ($childs as $child)
01323 {
01324 if($child["type"] != "st")
01325 {
01326 continue;
01327 }
01328
01329 $this->tpl->setCurrentBlock("table_row");
01330
01331 $css_row = ilUtil::switchColor($cnt++,"tblrow1","tblrow2");
01332
01333
01334 $this->tpl->setVariable("CHECKBOX_ID", $child["obj_id"]);
01335 $this->tpl->setVariable("CSS_ROW", $css_row);
01336 $this->tpl->setVariable("IMG_OBJ", ilUtil::getImagePath("icon_cat.gif"));
01337
01338
01339 $this->ctrl->setParameter($this, "backcmd", "");
01340 $this->ctrl->setParameterByClass("ilStructureObjectGUI", "obj_id", $child["obj_id"]);
01341 $this->tpl->setVariable("LINK_TARGET",
01342 $this->ctrl->getLinkTargetByClass("ilStructureObjectGUI", "view"));
01343
01344
01345 $this->tpl->setVariable("TEXT_CONTENT", $child["title"]);
01346
01347 $this->tpl->parseCurrentBlock();
01348 }
01349 if($cnt == 0)
01350 {
01351 $this->tpl->setCurrentBlock("notfound");
01352 $this->tpl->setVariable("NUM_COLS", 3);
01353 $this->tpl->setVariable("TXT_OBJECT_NOT_FOUND", $this->lng->txt("obj_not_found"));
01354 $this->tpl->parseCurrentBlock();
01355 }
01356 else
01357 {
01358
01359 $this->tpl->setVariable("NUM_COLS", 3);
01360 $acts = array("delete" => "delete", "move" => "moveChapter");
01361 if (ilEditClipboard::getContentObjectType() == "st")
01362 {
01363 if ($this->lm_tree->isInTree(ilEditClipboard::getContentObjectId()))
01364 {
01365 $acts["pasteChapter"] = "pasteChapter";
01366 }
01367 }
01368 $this->setActions($acts);
01369 $this->showActions();
01370 }
01371
01372
01373 $this->tpl->setVariable("NUM_COLS", 3);
01374 $subobj = array("st");
01375 $opts = ilUtil::formSelect(12,"new_type",$subobj);
01376 $this->tpl->setCurrentBlock("add_object");
01377 $this->tpl->setVariable("SELECT_OBJTYPE", $opts);
01378 $this->tpl->setVariable("BTN_NAME", "create");
01379 $this->tpl->setVariable("TXT_ADD", $this->lng->txt("insert"));
01380 $this->tpl->parseCurrentBlock();
01381
01382 $this->tpl->setCurrentBlock("form");
01383 $this->tpl->parseCurrentBlock();
01384
01385 }
01386
01387
01388
01389
01390
01391 function pages()
01392 {
01393 global $tree;
01394
01395 $this->setTabs();
01396
01397 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.all_pages.html", true);
01398 $num = 0;
01399
01400 $this->tpl->setCurrentBlock("form");
01401 $this->ctrl->setParameter($this, "backcmd", "pages");
01402 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
01403 $this->tpl->setVariable("HEADER_TEXT", $this->lng->txt("cont_pages"));
01404 $this->tpl->setVariable("CONTEXT", $this->lng->txt("context"));
01405 $this->tpl->setVariable("CHECKBOX_TOP", IL_FIRST_NODE);
01406
01407 $cnt = 0;
01408 $pages = ilLMPageObject::getPageList($this->object->getId());
01409 foreach ($pages as $page)
01410 {
01411 $this->tpl->setCurrentBlock("table_row");
01412
01413 $css_row = ilUtil::switchColor($cnt++,"tblrow1","tblrow2");
01414
01415
01416 $this->tpl->setVariable("CHECKBOX_ID", $page["obj_id"]);
01417 $this->tpl->setVariable("CSS_ROW", $css_row);
01418 $this->tpl->setVariable("IMG_OBJ", ilUtil::getImagePath("icon_le.gif"));
01419
01420
01421 $this->ctrl->setParameter($this, "backcmd", "");
01422 $this->ctrl->setParameterByClass("ilLMPageObjectGUI", "obj_id", $page["obj_id"]);
01423
01424 $this->tpl->setVariable("LINK_TARGET",
01425 $this->ctrl->getLinkTargetByClass("ilLMPageObjectGUI", "view"));
01426
01427
01428 $this->tpl->setVariable("TEXT_CONTENT", $page["title"]);
01429
01430
01431 if ($this->lm_tree->isInTree($page["obj_id"]))
01432 {
01433 $path_str = $this->getContextPath($page["obj_id"]);
01434 }
01435 else
01436 {
01437 $path_str = "---";
01438 }
01439 $this->tpl->setVariable("TEXT_CONTEXT", $path_str);
01440
01441 $this->tpl->parseCurrentBlock();
01442 }
01443 if($cnt == 0)
01444 {
01445 $this->tpl->setCurrentBlock("notfound");
01446 $this->tpl->setVariable("NUM_COLS", 4);
01447 $this->tpl->setVariable("TXT_OBJECT_NOT_FOUND", $this->lng->txt("obj_not_found"));
01448 $this->tpl->parseCurrentBlock();
01449 }
01450 else
01451 {
01452 $acts = array("delete" => "delete", "movePage" => "movePage", "copyPage" => "copyPage");
01453 if(ilEditClipboard::getContentObjectType() == "pg" &&
01454 ilEditClipboard::getAction() == "copy")
01455 {
01456 $acts["pastePage"] = "pastePage";
01457 }
01458
01459
01460
01461
01462
01463
01464 $this->setActions($acts);
01465 $this->tpl->setVariable("NUM_COLS", 4);
01466 $this->showActions();
01467
01468
01469
01470
01471
01472
01473
01474
01475 }
01476
01477
01478 $this->tpl->setVariable("NUM_COLS", 4);
01479
01480 $subobj = array("pg");
01481 $opts = ilUtil::formSelect(12,"new_type",$subobj);
01482 $this->tpl->setCurrentBlock("add_object");
01483 $this->tpl->setVariable("SELECT_OBJTYPE", $opts);
01484 $this->tpl->setVariable("BTN_NAME", "create");
01485 $this->tpl->setVariable("TXT_ADD", $this->lng->txt("create"));
01486 $this->tpl->parseCurrentBlock();
01487
01488
01489 $this->tpl->setCurrentBlock("form");
01490 $this->tpl->parseCurrentBlock();
01491
01492 }
01493
01497 function pastePage()
01498 {
01499 if(ilEditClipboard::getContentObjectType() != "pg")
01500 {
01501 $this->ilias->raiseError($this->lng->txt("no_page_in_clipboard"),$this->ilias->error_obj->MESSAGE);
01502 }
01503
01504
01505 $id = ilEditClipboard::getContentObjectId();
01506
01507
01508 if (ilEditClipboard::getAction() == "copy")
01509 {
01510
01511 if (ilLMObject::_lookupContObjID(ilEditClipboard::getContentObjectId())
01512 == $this->object->getID())
01513 {
01514 $lm_page = new ilLMPageObject($this->object, $id);
01515 $new_page =& $lm_page->copy();
01516 $id = $new_page->getId();
01517 }
01518 else
01519 {
01520
01521 $lm_id = ilLMObject::_lookupContObjID(ilEditClipboard::getContentObjectId());
01522 $lm_obj =& $this->ilias->obj_factory->getInstanceByObjId($lm_id);
01523 $lm_page = new ilLMPageObject($lm_obj, $id);
01524 $new_page =& $lm_page->copyToOtherContObject($this->object);
01525 $id = $new_page->getId();
01526 }
01527 }
01528
01529
01530 if (ilEditClipboard::getAction() == "cut")
01531 {
01532
01533 if (ilLMObject::_lookupContObjID(ilEditClipboard::getContentObjectId())
01534 != $this->object->getID())
01535 {
01536 $lm_id = ilLMObject::_lookupContObjID(ilEditClipboard::getContentObjectId());
01537 $lm_obj =& $this->ilias->obj_factory->getInstanceByObjId($lm_id);
01538 $lm_page = new ilLMPageObject($lm_obj, $id);
01539 $lm_page->setLMId($this->object->getID());
01540 $lm_page->update();
01541 $page =& $lm_page->getPageObject();
01542 $page->buildDom();
01543 $page->setParentId($this->object->getID());
01544 $page->update();
01545 }
01546 }
01547
01548
01549 ilEditClipboard::clear();
01550 $this->ctrl->redirect($this, "pages");
01551 }
01552
01556 function copyPage()
01557 {
01558 if(!isset($_POST["id"]))
01559 {
01560 $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
01561 }
01562 if(count($_POST["id"]) > 1)
01563 {
01564 $this->ilias->raiseError($this->lng->txt("cont_select_max_one_item"),$this->ilias->error_obj->MESSAGE);
01565 }
01566
01567
01568 ilEditClipboard::storeContentObject("pg",$_POST["id"][0],"copy");
01569
01570 sendInfo($this->lng->txt("msg_copy_clipboard"), true);
01571
01572 $this->ctrl->redirect($this, "pages");
01573 }
01574
01582 function delete($a_parent_subobj_id = 0)
01583 {
01584 if(!isset($_POST["id"]))
01585 {
01586 $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
01587 }
01588
01589 if(count($_POST["id"]) == 1 && $_POST["id"][0] == IL_FIRST_NODE)
01590 {
01591 $this->ilias->raiseError($this->lng->txt("cont_select_item"), $this->ilias->error_obj->MESSAGE);
01592 }
01593
01594 if ($a_parent_subobj_id == 0)
01595 {
01596 $this->setTabs();
01597 }
01598
01599
01600 $_SESSION["saved_post"] = $_POST["id"];
01601
01602 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.confirm_deletion.html", true);
01603
01604 sendInfo($this->lng->txt("info_delete_sure"));
01605
01606 if ($a_parent_subobj_id != 0)
01607 {
01608 $this->ctrl->setParameterByClass("ilStructureObjectGUI", "backcmd", $_GET["backcmd"]);
01609 $this->ctrl->setParameterByClass("ilStructureObjectGUI", "obj_id", $a_parent_subobj_id);
01610 $this->tpl->setVariable("FORMACTION",
01611 $this->ctrl->getFormActionByClass("ilStructureObjectGUI"));
01612 }
01613 else
01614 {
01615 $this->ctrl->setParameter($this, "backcmd", $_GET["backcmd"]);
01616 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
01617 }
01618
01619 $this->tpl->setCurrentBlock("table_header");
01620 $this->tpl->setVariable("TEXT",$this->lng->txt("objects"));
01621 $this->tpl->parseCurrentBlock();
01622
01623
01624
01625
01626 $counter = 0;
01627 foreach($_POST["id"] as $id)
01628 {
01629 if ($id != IL_FIRST_NODE)
01630 {
01631 $obj =& new ilLMObject($this->object, $id);
01632 switch($obj->getType())
01633 {
01634 case "pg":
01635 $this->tpl->setVariable("IMG_OBJ", ilUtil::getImagePath("icon_le.gif"));
01636 break;
01637 case "st":
01638 $this->tpl->setVariable("IMG_OBJ", ilUtil::getImagePath("icon_cat.gif"));
01639 break;
01640 }
01641 $this->tpl->setCurrentBlock("table_row");
01642 $this->tpl->setVariable("CSS_ROW",ilUtil::switchColor(++$counter,"tblrow1","tblrow2"));
01643 $this->tpl->setVariable("TEXT_CONTENT", $obj->getTitle());
01644 $this->tpl->parseCurrentBlock();
01645 }
01646 }
01647
01648
01649 $this->tpl->setVariable("IMG_ARROW",ilUtil::getImagePath("arrow_downright.gif"));
01650 $buttons = array( "cancelDelete" => $this->lng->txt("cancel"),
01651 "confirmedDelete" => $this->lng->txt("confirm"));
01652 foreach ($buttons as $name => $value)
01653 {
01654 $this->tpl->setCurrentBlock("operation_btn");
01655 $this->tpl->setVariable("BTN_NAME",$name);
01656 $this->tpl->setVariable("BTN_VALUE",$value);
01657 $this->tpl->parseCurrentBlock();
01658 }
01659 }
01660
01664 function cancelDelete()
01665 {
01666 session_unregister("saved_post");
01667
01668 $this->ctrl->redirect($this, $_GET["backcmd"]);
01669
01670 }
01671
01679 function confirmedDelete($a_parent_subobj_id = 0)
01680 {
01681 $tree = new ilTree($this->object->getId());
01682 $tree->setTableNames('lm_tree','lm_data');
01683 $tree->setTreeTablePK("lm_id");
01684
01685
01686 if (!isset($_SESSION["saved_post"]))
01687 {
01688 $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
01689 }
01690
01691
01692 foreach ($_SESSION["saved_post"] as $id)
01693 {
01694 if ($id != IL_FIRST_NODE)
01695 {
01696 $obj =& ilLMObjectFactory::getInstance($this->object, $id, false);
01697 $node_data = $tree->getNodeData($id);
01698 if (is_object($obj))
01699 {
01700 $obj->setLMId($this->object->getId());
01701 $obj->delete();
01702 }
01703 if($tree->isInTree($id))
01704 {
01705 $tree->deleteTree($node_data);
01706 }
01707 }
01708 }
01709
01710
01711 $this->object->checkTree();
01712
01713
01714 sendInfo($this->lng->txt("info_deleted"),true);
01715
01716 if ($a_parent_subobj_id == 0)
01717 {
01718 $this->ctrl->redirect($this, $_GET["backcmd"]);
01719 }
01720 }
01721
01722
01723
01730 function getContextPath($a_endnode_id, $a_startnode_id = 1)
01731 {
01732 $path = "";
01733
01734 $tmpPath = $this->lm_tree->getPathFull($a_endnode_id, $a_startnode_id);
01735
01736
01737 for ($i = 1; $i < (count($tmpPath) - 1); $i++)
01738 {
01739 if ($path != "")
01740 {
01741 $path .= " > ";
01742 }
01743
01744 $path .= $tmpPath[$i]["title"];
01745 }
01746
01747 return $path;
01748 }
01749
01750
01751
01757 function showActions()
01758 {
01759 $notoperations = array();
01760
01761 $operations = array();
01762
01763 $d = $this->actions;
01764
01765 foreach ($d as $row)
01766 {
01767 if (!in_array($row["name"], $notoperations))
01768 {
01769 $operations[] = $row;
01770 }
01771 }
01772
01773 if (count($operations)>0)
01774 {
01775 foreach ($operations as $val)
01776 {
01777 $this->tpl->setCurrentBlock("operation_btn");
01778 $this->tpl->setVariable("BTN_NAME", $val["lng"]);
01779 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt($val["lng"]));
01780 $this->tpl->parseCurrentBlock();
01781 }
01782
01783 $this->tpl->setCurrentBlock("operation");
01784 $this->tpl->setVariable("IMG_ARROW",ilUtil::getImagePath("arrow_downright.gif"));
01785 $this->tpl->parseCurrentBlock();
01786 }
01787 }
01788
01792 function perm()
01793 {
01794 $this->setTabs();
01795
01796 $this->setFormAction("addRole", $this->ctrl->getLinkTarget($this, "addRole"));
01797 $this->setFormAction("permSave", $this->ctrl->getLinkTarget($this, "permSave"));
01798 $this->permObject();
01799 }
01800
01801
01805 function permSave()
01806 {
01807 $this->setReturnLocation("permSave", $this->ctrl->getLinkTarget($this, "perm"));
01808 $this->permSaveObject();
01809 }
01810
01811
01815 function addRole()
01816 {
01817 $this->setReturnLocation("addRole", $this->ctrl->getLinkTarget($this, "perm"));
01818 $this->addRoleObject();
01819 }
01820
01821
01825 function owner()
01826 {
01827 $this->setTabs();
01828 $this->ownerObject();
01829 }
01830
01831
01835 function view()
01836 {
01837 $this->viewObject();
01838 }
01839
01840
01844 function moveChapter($a_parent_subobj_id = 0)
01845 {
01846 if(!isset($_POST["id"]))
01847 {
01848 $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
01849 }
01850
01851 if(count($_POST["id"]) > 1)
01852 {
01853 $this->ilias->raiseError($this->lng->txt("cont_select_max_one_item"),$this->ilias->error_obj->MESSAGE);
01854 }
01855
01856 if(count($_POST["id"]) == 1 && $_POST["id"][0] == IL_FIRST_NODE)
01857 {
01858 $this->ilias->raiseError($this->lng->txt("cont_select_item"), $this->ilias->error_obj->MESSAGE);
01859 }
01860
01861
01862 ilEditClipboard::storeContentObject("st", $_POST["id"][0]);
01863
01864 sendInfo($this->lng->txt("cont_chap_select_target_now"), true);
01865
01866 if ($a_parent_subobj_id == 0)
01867 {
01868 $this->ctrl->redirect($this, "chapters");
01869 }
01870 }
01871
01872
01876 function pasteChapter($a_parent_subobj_id = 0)
01877 {
01878 if (ilEditClipboard::getContentObjectType() != "st")
01879 {
01880 $this->ilias->raiseError($this->lng->txt("no_chapter_in_clipboard"),$this->ilias->error_obj->MESSAGE);
01881 }
01882
01883 $tree = new ilTree($this->object->getId());
01884 $tree->setTableNames('lm_tree','lm_data');
01885 $tree->setTreeTablePK("lm_id");
01886
01887
01888 $id = ilEditClipboard::getContentObjectId();
01889
01890 $node = $tree->getNodeData($id);
01891
01892 $subnodes = $tree->getSubtree($node);
01893
01894
01895 foreach ($subnodes as $subnode)
01896 {
01897 if($subnode["obj_id"] == $a_parent_subobj_id)
01898 {
01899 $this->ilias->raiseError($this->lng->txt("cont_target_within_source"),$this->ilias->error_obj->MESSAGE);
01900 }
01901 }
01902 if($_POST["id"][0] == $id)
01903 {
01904 ilEditClipboard::clear();
01905 $this->ctrl->redirect($this, "chapters");
01906 }
01907
01908
01909
01910
01911 $tree->deleteTree($node);
01912 if(!isset($_POST["id"]))
01913 {
01914 $target = IL_LAST_NODE;
01915 }
01916 else
01917 {
01918 $target = $_POST["id"][0];
01919 }
01920
01921
01922 $parent = ($a_parent_subobj_id == 0)
01923 ? $tree->getRootId()
01924 : $a_parent_subobj_id;
01925
01926
01927 if($target == IL_FIRST_NODE)
01928 {
01929 $childs =& $tree->getChildsByType($parent, "pg");
01930 if (count($childs) != 0)
01931 {
01932 $target = $childs[count($childs) - 1]["obj_id"];
01933 }
01934 }
01935
01936
01937 if (!$tree->isInTree($id))
01938 {
01939 $tree->insertNode($id, $parent, $target);
01940
01941 foreach ($subnodes as $node)
01942 {
01943
01944
01945 if($node["obj_id"] != $id)
01946 {
01947 $tree->insertNode($node["obj_id"], $node["parent"]);
01948 }
01949 }
01950 }
01951
01952 ilEditClipboard::clear();
01953
01954
01955 $this->object->checkTree();
01956
01957 if ($a_parent_subobj_id == 0)
01958 {
01959 $this->ctrl->redirect($this, "chapters");
01960 }
01961 }
01962
01966 function movePage()
01967 {
01968 if(!isset($_POST["id"]))
01969 {
01970 $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
01971 }
01972 if(count($_POST["id"]) > 1)
01973 {
01974 $this->ilias->raiseError($this->lng->txt("cont_select_max_one_item"),$this->ilias->error_obj->MESSAGE);
01975 }
01976
01977
01978 ilEditClipboard::storeContentObject("pg", $_POST["id"][0]);
01979
01980 sendInfo($this->lng->txt("cont_page_select_target_now"), true);
01981 $this->ctrl->redirect($this, "pages");
01982 }
01983
01987 function cancel()
01988 {
01989 if ($_GET["new_type"] == "pg")
01990 {
01991 $this->ctrl->redirect($this, "pages");
01992 }
01993 else
01994 {
01995 $this->ctrl->redirect($this, "chapters");
01996 }
01997 }
01998
01999
02003 function export()
02004 {
02005 require_once("content/classes/class.ilContObjectExport.php");
02006 $cont_exp = new ilContObjectExport($this->object);
02007 $cont_exp->buildExportFile();
02008 $this->exportList();
02009 }
02010
02014 function exportMenu()
02015 {
02016
02017 $this->tpl->setCurrentBlock("btn_cell");
02018 $this->tpl->setVariable("BTN_LINK", $this->ctrl->getLinkTarget($this, "export"));
02019 $this->tpl->setVariable("BTN_TXT", $this->lng->txt("cont_create_export_file_xml"));
02020 $this->tpl->parseCurrentBlock();
02021
02022
02023 $this->tpl->setCurrentBlock("btn_cell");
02024 $this->tpl->setVariable("BTN_LINK", $this->ctrl->getLinkTarget($this, "exportHTML"));
02025 $this->tpl->setVariable("BTN_TXT", $this->lng->txt("cont_create_export_file_html"));
02026 $this->tpl->parseCurrentBlock();
02027
02028
02029 $this->tpl->setCurrentBlock("btn_cell");
02030 $this->tpl->setVariable("BTN_LINK", $this->ctrl->getLinkTarget($this, "exportSCORM"));
02031 $this->tpl->setVariable("BTN_TXT", $this->lng->txt("cont_create_export_file_scorm"));
02032 $this->tpl->parseCurrentBlock();
02033
02034
02035 if (is_file($this->object->getExportDirectory()."/export.log"))
02036 {
02037 $this->tpl->setCurrentBlock("btn_cell");
02038 $this->tpl->setVariable("BTN_LINK", $this->ctrl->getLinkTarget($this, "viewExportLog"));
02039 $this->tpl->setVariable("BTN_TXT", $this->lng->txt("cont_view_last_export_log"));
02040 $this->tpl->parseCurrentBlock();
02041 }
02042
02043 }
02044
02045
02046
02047
02048 function exportList()
02049 {
02050 global $tree;
02051
02052 $this->setTabs();
02053
02054
02055 $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
02056
02057 $this->exportMenu();
02058
02059 $export_files = $this->object->getExportFiles();
02060
02061
02062 require_once("classes/class.ilTableGUI.php");
02063 $tbl = new ilTableGUI();
02064
02065
02066 $this->tpl->addBlockfile("ADM_CONTENT", "adm_content", "tpl.table.html");
02067
02068
02069 $this->tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.export_file_row.html", true);
02070
02071 $num = 0;
02072
02073 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
02074
02075 $tbl->setTitle($this->lng->txt("cont_export_files"));
02076
02077 $tbl->setHeaderNames(array("", $this->lng->txt("type"),
02078 $this->lng->txt("cont_file"),
02079 $this->lng->txt("cont_size"), $this->lng->txt("date") ));
02080
02081 $cols = array("", "type", "file", "size", "date");
02082 $header_params = array("ref_id" => $_GET["ref_id"],
02083 "cmd" => "exportList", "cmdClass" => strtolower(get_class($this)));
02084 $tbl->setHeaderVars($cols, $header_params);
02085 $tbl->setColumnWidth(array("1%", "9%", "40%", "20%", "20%"));
02086
02087
02088 $tbl->setOrderColumn($_GET["sort_by"]);
02089 $tbl->setOrderDirection($_GET["sort_order"]);
02090 $tbl->setLimit($_GET["limit"]);
02091 $tbl->setOffset($_GET["offset"]);
02092 $tbl->setMaxCount($this->maxcount);
02093
02094
02095 $this->tpl->setVariable("COLUMN_COUNTS", 5);
02096
02097
02098 $this->tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.gif"));
02099 $this->tpl->setCurrentBlock("tbl_action_btn");
02100 $this->tpl->setVariable("BTN_NAME", "confirmDeleteExportFile");
02101 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("delete"));
02102 $this->tpl->parseCurrentBlock();
02103
02104 $this->tpl->setCurrentBlock("tbl_action_btn");
02105 $this->tpl->setVariable("BTN_NAME", "downloadExportFile");
02106 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("download"));
02107 $this->tpl->parseCurrentBlock();
02108
02109 $this->tpl->setCurrentBlock("tbl_action_btn");
02110 $this->tpl->setVariable("BTN_NAME", "publishExportFile");
02111 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("cont_public_access"));
02112 $this->tpl->parseCurrentBlock();
02113
02114
02115 $tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
02116
02117
02118 $tbl->setMaxCount(count($export_files));
02119 $export_files = array_slice($export_files, $_GET["offset"], $_GET["limit"]);
02120 $tbl->render();
02121 if(count($export_files) > 0)
02122 {
02123 $i=0;
02124 foreach($export_files as $exp_file)
02125 {
02126 $this->tpl->setCurrentBlock("tbl_content");
02127 $this->tpl->setVariable("TXT_FILENAME", $exp_file["file"]);
02128
02129 $css_row = ilUtil::switchColor($i++, "tblrow1", "tblrow2");
02130 $this->tpl->setVariable("CSS_ROW", $css_row);
02131
02132 $this->tpl->setVariable("TXT_SIZE", $exp_file["size"]);
02133 $public_str = ($exp_file["file"] == $this->object->getPublicExportFile($exp_file["type"]))
02134 ? " <b>(".$this->lng->txt("public").")<b>"
02135 : "";
02136 $this->tpl->setVariable("TXT_TYPE", $exp_file["type"].$public_str);
02137 $this->tpl->setVariable("CHECKBOX_ID", $exp_file["type"].":".$exp_file["file"]);
02138
02139 $file_arr = explode("__", $exp_file["file"]);
02140 $this->tpl->setVariable("TXT_DATE", date("Y-m-d H:i:s",$file_arr[0]));
02141
02142 $this->tpl->parseCurrentBlock();
02143 }
02144 }
02145 else
02146 {
02147 $this->tpl->setCurrentBlock("notfound");
02148 $this->tpl->setVariable("TXT_OBJECT_NOT_FOUND", $this->lng->txt("obj_not_found"));
02149 $this->tpl->setVariable("NUM_COLS", 4);
02150 $this->tpl->parseCurrentBlock();
02151 }
02152
02153 $this->tpl->parseCurrentBlock();
02154 }
02155
02156
02157
02158
02159 function viewExportLog()
02160 {
02161 global $tree;
02162
02163 $this->setTabs();
02164
02165
02166 $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
02167
02168 $this->exportMenu();
02169
02170
02171 $this->tpl->setVariable("ADM_CONTENT",
02172 nl2br(file_get_contents($this->object->getExportDirectory()."/export.log")));
02173
02174 $this->tpl->parseCurrentBlock();
02175 }
02176
02180 function downloadExportFile()
02181 {
02182 if(!isset($_POST["file"]))
02183 {
02184 $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
02185 }
02186
02187 if (count($_POST["file"]) > 1)
02188 {
02189 $this->ilias->raiseError($this->lng->txt("cont_select_max_one_item"),$this->ilias->error_obj->MESSAGE);
02190 }
02191
02192 $file = explode(":", $_POST["file"][0]);
02193 $export_dir = $this->object->getExportDirectory($file[0]);
02194 ilUtil::deliverFile($export_dir."/".$file[1],
02195 $file[1]);
02196 }
02197
02201 function publishExportFile()
02202 {
02203 if(!isset($_POST["file"]))
02204 {
02205 $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
02206 }
02207 if (count($_POST["file"]) > 1)
02208 {
02209 $this->ilias->raiseError($this->lng->txt("cont_select_max_one_item"),$this->ilias->error_obj->MESSAGE);
02210 }
02211
02212 $file = explode(":", $_POST["file"][0]);
02213 $export_dir = $this->object->getExportDirectory($file[0]);
02214
02215 if ($this->object->getPublicExportFile($file[0]) ==
02216 $file[1])
02217 {
02218 $this->object->setPublicExportFile($file[0], "");
02219 }
02220 else
02221 {
02222 $this->object->setPublicExportFile($file[0], $file[1]);
02223 }
02224 $this->object->update();
02225 $this->ctrl->redirect($this, "exportList");
02226 }
02227
02231 function downloadPDFFile()
02232 {
02233 if(!isset($_POST["file"]))
02234 {
02235 $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
02236 }
02237
02238 if (count($_POST["file"]) > 1)
02239 {
02240 $this->ilias->raiseError($this->lng->txt("cont_select_max_one_item"),$this->ilias->error_obj->MESSAGE);
02241 }
02242
02243
02244 $export_dir = $this->object->getOfflineDirectory();
02245 ilUtil::deliverFile($export_dir."/".$_POST["file"][0],
02246 $_POST["file"][0]);
02247 }
02248
02252 function confirmDeleteExportFile()
02253 {
02254 if(!isset($_POST["file"]))
02255 {
02256 $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
02257 }
02258
02259 $this->setTabs();
02260
02261
02262 $_SESSION["ilExportFiles"] = $_POST["file"];
02263
02264 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.confirm_deletion.html", true);
02265
02266 sendInfo($this->lng->txt("info_delete_sure"));
02267
02268 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
02269
02270
02271 $this->tpl->setCurrentBlock("table_header");
02272 $this->tpl->setVariable("TEXT",$this->lng->txt("objects"));
02273 $this->tpl->parseCurrentBlock();
02274
02275
02276 $counter = 0;
02277 foreach($_POST["file"] as $file)
02278 {
02279 $file = explode(":", $file);
02280 $this->tpl->setCurrentBlock("table_row");
02281 $this->tpl->setVariable("CSS_ROW",ilUtil::switchColor(++$counter,"tblrow1","tblrow2"));
02282 $this->tpl->setVariable("TEXT_CONTENT", $file[1]." (".$file[0].")");
02283 $this->tpl->parseCurrentBlock();
02284 }
02285
02286
02287 $this->tpl->setVariable("IMG_ARROW",ilUtil::getImagePath("arrow_downright.gif"));
02288 $buttons = array( "cancelDeleteExportFile" => $this->lng->txt("cancel"),
02289 "deleteExportFile" => $this->lng->txt("confirm"));
02290 foreach ($buttons as $name => $value)
02291 {
02292 $this->tpl->setCurrentBlock("operation_btn");
02293 $this->tpl->setVariable("BTN_NAME",$name);
02294 $this->tpl->setVariable("BTN_VALUE",$value);
02295 $this->tpl->parseCurrentBlock();
02296 }
02297 }
02298
02299
02303 function cancelDeleteExportFile()
02304 {
02305 session_unregister("ilExportFiles");
02306 $this->ctrl->redirect($this, "exportList");
02307 }
02308
02309
02313 function deleteExportFile()
02314 {
02315 foreach($_SESSION["ilExportFiles"] as $file)
02316 {
02317 $file = explode(":", $file);
02318 $export_dir = $this->object->getExportDirectory($file[0]);
02319
02320 $exp_file = $export_dir."/".$file[1];
02321 $exp_dir = $export_dir."/".substr($file[1], 0, strlen($file[1]) - 4);
02322 if (@is_file($exp_file))
02323 {
02324 unlink($exp_file);
02325 }
02326 if (@is_dir($exp_dir))
02327 {
02328 ilUtil::delDir($exp_dir);
02329 }
02330 }
02331 $this->ctrl->redirect($this, "exportList");
02332 }
02333
02338 function fixTreeConfirm()
02339 {
02340 $this->setTabs();
02341
02342 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.confirm.html");
02343
02344 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
02345
02346
02347 $this->tpl->setVariable("TXT_CONFIRM", $this->lng->txt("confirmation"));
02348 $this->tpl->setVariable("TXT_CONTENT", $this->lng->txt("cont_fix_tree_confirm"));
02349 $this->tpl->setVariable("CMD_CANCEL", "cancelFixTree");
02350 $this->tpl->setVariable("CMD_OK", "fixTree");
02351 $this->tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
02352 $this->tpl->setVariable("TXT_OK", $this->lng->txt("cont_fix_tree"));
02353 }
02354
02358 function cancelFixTree()
02359 {
02360 $this->ctrl->redirect($this, "properties");
02361 }
02362
02366 function fixTree()
02367 {
02368 $this->object->fixTree();
02369 sendInfo($this->lng->txt("cont_tree_fixed"), true);
02370 $this->ctrl->redirect($this, "properties");
02371 }
02372
02376 function setilLMMenu($a_offline = false, $a_export_format = "")
02377 {
02378 if (!$this->object->isActiveLMMenu())
02379 {
02380 return "";
02381 }
02382
02383 include_once("./classes/class.ilTemplate.php");
02384
02385 $tpl_menu =& new ilTemplate("tpl.lm_menu.html", true, true, true);
02386 $tpl_menu->setCurrentBlock("lm_menu_btn");
02387
02388
02389
02390 $showViewInFrameset = $this->ilias->ini->readVariable("layout","view_target") == "frame";
02391
02392 if ($showViewInFrameset)
02393 {
02394 $buttonTarget = "bottom";
02395 }
02396 else
02397 {
02398 $buttonTarget = "_top";
02399 }
02400
02401 if ($a_export_format == "scorm")
02402 {
02403 $buttonTarget = "";
02404 }
02405
02406 if ($this->object->isActiveTOC())
02407 {
02408 if (!$a_offline)
02409 {
02410 $tpl_menu->setVariable("BTN_LINK", "./lm_presentation.php?cmd=showTableOfContents&ref_id="
02411 .$_GET["ref_id"]."&obj_id=".$_GET["obj_id"]);
02412 }
02413 else
02414 {
02415 $tpl_menu->setVariable("BTN_LINK", "./table_of_contents.html");
02416 }
02417 $tpl_menu->setVariable("BTN_TXT", $this->lng->txt("cont_contents"));
02418 $tpl_menu->setVariable("BTN_TARGET", $buttonTarget);
02419 $tpl_menu->parseCurrentBlock();
02420 }
02421
02422
02423 if ($this->object->isActivePrintView())
02424 {
02425 if (!$a_offline)
02426 {
02427 $tpl_menu->setVariable("BTN_LINK", "./lm_presentation.php?cmd=showPrintViewSelection&ref_id="
02428 .$_GET["ref_id"]."&obj_id=".$_GET["obj_id"]);
02429 $tpl_menu->setVariable("BTN_TXT", $this->lng->txt("cont_print_view"));
02430 $tpl_menu->setVariable("BTN_TARGET", $buttonTarget);
02431 $tpl_menu->parseCurrentBlock();
02432 }
02433 }
02434
02435
02436 if ($this->object->isActiveDownloads() && !$a_offline)
02437 {
02438 $tpl_menu->setVariable("BTN_LINK", "./lm_presentation.php?cmd=showDownloadList&ref_id="
02439 .$_GET["ref_id"]."&obj_id=".$_GET["obj_id"]);
02440 $tpl_menu->setVariable("BTN_TXT", $this->lng->txt("download"));
02441 $tpl_menu->setVariable("BTN_TARGET", $buttonTarget);
02442 $tpl_menu->parseCurrentBlock();
02443 }
02444
02445
02446 $this->__initLMMenuEditor();
02447 $entries = $this->lmme_obj->getMenuEntries(true);
02448
02449 if (count($entries) > 0)
02450 {
02451 foreach ($entries as $entry)
02452 {
02453
02454 if ($entry["type"] == "intern")
02455 {
02456 $entry["link"] = ILIAS_HTTP_PATH."/goto.php?target=".$entry["link"];
02457 }
02458
02459
02460 if (!strstr($entry["link"],'http://'))
02461 {
02462 $entry["link"] = "http://".$entry["link"];
02463 }
02464
02465 $tpl_menu->setVariable("BTN_LINK", $entry["link"]);
02466 $tpl_menu->setVariable("BTN_TXT", $entry["title"]);
02467
02468 $tpl_menu->setVariable("BTN_TARGET", "_blank");
02469 $tpl_menu->parseCurrentBlock();
02470 }
02471 }
02472
02473 if(!$showViewInFrameset and
02474 $this->object->isActiveLMMenu())
02475 {
02476 $tpl_menu->setCurrentBlock("js_close");
02477 $tpl_menu->setVariable("JS_BTN_TXT",$this->lng->txt('close'));
02478 $tpl_menu->parseCurrentBlock();
02479 }
02480
02481 return $tpl_menu->get();
02482 }
02483
02487 function createPDF()
02488 {
02489 require_once("content/classes/class.ilContObjectExport.php");
02490 $cont_exp = new ilContObjectExport($this->object, "pdf");
02491 $cont_exp->buildExportFile();
02492 $this->offlineList();
02493 }
02494
02498 function exportHTML()
02499 {
02500 require_once("content/classes/class.ilContObjectExport.php");
02501 $cont_exp = new ilContObjectExport($this->object, "html");
02502 $cont_exp->buildExportFile();
02503
02504 $this->exportList();
02505 }
02506
02510 function exportSCORM()
02511 {
02512 require_once("content/classes/class.ilContObjectExport.php");
02513 $cont_exp = new ilContObjectExport($this->object, "scorm");
02514 $cont_exp->buildExportFile();
02515
02516 $this->exportList();
02517 }
02518
02522 function addLocations()
02523 {
02524 global $lng;
02525
02526 $obj_id = $_GET["obj_id"];
02527 $tree =& $this->object->getTree();
02528
02529 if (($obj_id != 0) && $tree->isInTree($obj_id))
02530 {
02531 $path = $tree->getPathFull($obj_id);
02532 }
02533 else
02534 {
02535 $path = $tree->getPathFull($tree->getRootId());
02536 if ($obj_id != 0)
02537 {
02538 $path[] = array("type" => "pg", "child" => $this->obj_id,
02539 "title" => ilLMPageObject::_getPresentationTitle($this->obj_id));
02540 }
02541 }
02542
02543 $modifier = 1;
02544
02545 foreach ($path as $key => $row)
02546 {
02547 if ($row["child"] == 1)
02548 {
02549 $this->ctrl->setParameter($this, "obj_id", "");
02550 $this->ctrl->addLocation(
02551 $this->object->getTitle(),
02552 $this->ctrl->getLinkTarget($this, "properties"));
02553 }
02554 else
02555 {
02556 $title = $row["title"];
02557 switch($row["type"])
02558 {
02559 case "st":
02560 $this->ctrl->setParameterByClass("ilstructureobjectgui", "obj_id", $row["child"]);
02561 $this->ctrl->addLocation(
02562 $title,
02563 $this->ctrl->getLinkTargetByClass("ilstructureobjectgui", "view"));
02564 break;
02565
02566 case "pg":
02567 $this->ctrl->setParameterByClass("illmpageobjectgui", "obj_id", $row["child"]);
02568 $this->ctrl->addLocation(
02569 $title,
02570 $this->ctrl->getLinkTargetByClass("illmpageobjectgui", "view"));
02571 break;
02572 }
02573 }
02574 }
02575 $this->ctrl->setParameter($this, "obj_id", $_GET["obj_id"]);
02576 }
02577
02578
02582 function setTabs()
02583 {
02584
02585 include_once("classes/class.ilTabsGUI.php");
02586 $tabs_gui =& new ilTabsGUI();
02587 $this->getTabs($tabs_gui);
02588 $this->tpl->setVariable("TABS", $tabs_gui->getHTML());
02589 $this->tpl->setVariable("HEADER", $this->object->getTitle());
02590 }
02591
02597 function getTabs(&$tabs_gui)
02598 {
02599
02600 $tabs_gui->getTargetsByObjectType($this, $this->object->getType());
02601 }
02602
02603 function editPublicSection()
02604 {
02605 $this->setTabs();
02606
02607 switch ($this->object->getType())
02608 {
02609 case "lm":
02610 $gui_class = "ilobjlearningmodulegui";
02611 break;
02612
02613 case "dlb":
02614 $gui_class = "ilobjdlbookgui";
02615 break;
02616 }
02617
02618
02619 $this->lm_obj =& new ilObjLearningModule($this->ref_id, true);
02620
02621 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.lm_public_selector.html");
02622
02623 require_once ("content/classes/class.ilPublicSectionSelector.php");
02624 $exp = new ilPublicSectionSelector("lm_edit.php?cmd=view&ref_id=".$this->object->getRefId(),
02625 $this->object, $gui_class);
02626
02627 $exp->setTargetGet("obj_id");
02628
02629
02630 $exp->setOutput(0);
02631 $output = $exp->getOutput();
02632
02633
02634 foreach ($exp->format_options as $node)
02635 {
02636 if (!$node["container"])
02637 {
02638 $pages[] = $node["child"];
02639 }
02640 }
02641
02642 $js_pages = ilUtil::array_php2js($pages);
02643
02644
02645
02646
02647 $this->tpl->setVariable("TXT_SET_PUBLIC_MODE", $this->lng->txt("set_public_mode"));
02648 $this->tpl->setVariable("TXT_CHOOSE_PUBLIC_MODE", $this->lng->txt("choose_public_mode"));
02649 $modes = array("complete" => $this->lng->txt("all_pages"), "selected" => $this->lng->txt("selected_pages_only"));
02650 $select_public_mode = ilUtil::formSelect ($this->object->getPublicAccessMode(),"lm_public_mode",$modes, false, true);
02651 $this->tpl->setVariable("SELECT_PUBLIC_MODE", $select_public_mode);
02652
02653 $this->tpl->setVariable("TXT_EXPLORER_HEADER", $this->lng->txt("choose_public_pages"));
02654 $this->tpl->setVariable("EXP_REFRESH", $this->lng->txt("refresh"));
02655 $this->tpl->setVariable("EXPLORER",$output);
02656 $this->tpl->setVariable("ONCLICK",$js_pages);
02657 $this->tpl->setVariable("TXT_CHECKALL", $this->lng->txt("check_all"));
02658 $this->tpl->setVariable("TXT_UNCHECKALL", $this->lng->txt("uncheck_all"));
02659 $this->tpl->setVariable("TXT_SAVE", $this->lng->txt("save"));
02660 $this->tpl->setVariable("FORMACTION", $this->ctrl->getLinkTarget($this, "savePublicSection"));
02661 $this->tpl->parseCurrentBlock();
02662 }
02663
02664 function savePublicSection()
02665 {
02666
02667 $this->object->setPublicAccessMode($_POST["lm_public_mode"]);
02668 $this->object->updateProperties();
02669 ilLMObject::_writePublicAccessStatus($_POST["pages"],$this->object->getId());
02670 sendInfo($this->lng->txt("msg_obj_modified"), true);
02671 $this->ctrl->redirect($this, "editPublicSection");
02672 }
02673
02674 function linkChecker()
02675 {
02676 global $ilias,$ilUser;
02677
02678 $this->__initLinkChecker();
02679
02680 $invalid_links = $this->link_checker_obj->getInvalidLinksFromDB();
02681
02682
02683 $this->setTabs();
02684
02685 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.link_check.html", true);
02686
02687 if($last_access = $this->link_checker_obj->getLastCheckTimestamp())
02688 {
02689 $this->tpl->setCurrentBlock("LAST_MODIFIED");
02690 $this->tpl->setVariable("AS_OF",$this->lng->txt('last_change').": ");
02691 $this->tpl->setVariable("LAST_CHECK",date('Y-m-d H:i:s',$last_access));
02692 $this->tpl->parseCurrentBlock();
02693 }
02694
02695
02696 $this->tpl->setVariable("F_ACTION",$this->ctrl->getFormAction($this));
02697
02698 $this->tpl->setVariable("TYPE_IMG",ilUtil::getImagePath('icon_lm.gif'));
02699 $this->tpl->setVariable("ALT_IMG",$this->lng->txt('learning_module'));
02700 $this->tpl->setVariable("TITLE",$this->object->getTitle().' ('.$this->lng->txt('link_check').')');
02701 $this->tpl->setVariable("PAGE_TITLE",$this->lng->txt('cont_pg_title'));
02702 $this->tpl->setVariable("URL",$this->lng->txt('url'));
02703 $this->tpl->setVariable("OPTIONS",$this->lng->txt('edit'));
02704
02705 if(!count($invalid_links))
02706 {
02707 $this->tpl->setCurrentBlock("no_invalid");
02708 $this->tpl->setVariable("TXT_NO_INVALID",$this->lng->txt('no_invalid_links'));
02709 $this->tpl->parseCurrentBlock();
02710 }
02711 else
02712 {
02713 $counter = 0;
02714 foreach($invalid_links as $invalid)
02715 {
02716 $this->tpl->setCurrentBlock("invalid_row");
02717 $this->tpl->setVariable("ROW_COLOR",ilUtil::switchColor(++$counter,'tblrow1','tblrow2'));
02718 $this->tpl->setVariable("ROW_PAGE_TITLE",
02719 ilLMPageObject::_getPresentationTitle($invalid['page_id'],$this->object->getPageHeader()));
02720 $this->tpl->setVariable("ROW_URL",$invalid['url']);
02721
02722
02723
02724 $this->ctrl->setParameterByClass('ilLMPageObjectGUI','obj_id',$invalid['page_id']);
02725 $this->tpl->setVariable("ROW_EDIT_LINK",$this->ctrl->getLinkTargetByClass('ilLMPageObjectGUI','view'));
02726
02727 $this->tpl->setVariable("ROW_IMG",ilUtil::getImagePath('edit.gif'));
02728 $this->tpl->setVariable("ROW_ALT_IMG",$this->lng->txt('edit'));
02729 $this->tpl->parseCurrentBlock();
02730 }
02731 }
02732 if((bool) $ilias->getSetting('cron_link_check'))
02733 {
02734 include_once './classes/class.ilLinkCheckNotify.php';
02735
02736
02737 $this->tpl->setCurrentBlock("MESSAGE_BLOCK");
02738 $this->tpl->setVariable("INFO_MESSAGE",$this->lng->txt('link_check_message_a'));
02739 $this->tpl->setVariable("CHECK_MESSAGE",ilUtil::formCheckbox(
02740 ilLinkCheckNotify::_getNotifyStatus($ilUser->getId(),$this->object->getId()),
02741 'link_check_message',
02742 1));
02743 $this->tpl->setVariable("INFO_MESSAGE_LONG",$this->lng->txt('link_check_message_b'));
02744 $this->tpl->parseCurrentBlock();
02745
02746
02747 $this->tpl->setCurrentBlock("CRON_ENABLED");
02748 $this->tpl->setVariable("DOWNRIGHT_IMG",ilUtil::getImagePath('arrow_downright.gif'));
02749 $this->tpl->setVariable("BTN_SUBMIT_LINK_CHECK",$this->lng->txt('save'));
02750 $this->tpl->parseCurrentBlock();
02751 }
02752 $this->tpl->setVariable("BTN_REFRESH",$this->lng->txt('refresh'));
02753
02754 return true;
02755
02756 }
02757 function saveLinkCheck()
02758 {
02759 global $ilDB,$ilUser;
02760
02761 include_once './classes/class.ilLinkCheckNotify.php';
02762
02763 $link_check_notify =& new ilLinkCheckNotify($ilDB);
02764 $link_check_notify->setUserId($ilUser->getId());
02765 $link_check_notify->setObjId($this->object->getId());
02766
02767 if($_POST['link_check_message'])
02768 {
02769 sendInfo($this->lng->txt('link_check_message_enabled'));
02770 $link_check_notify->addNotifier();
02771 }
02772 else
02773 {
02774 sendInfo($this->lng->txt('link_check_message_disabled'));
02775 $link_check_notify->deleteNotifier();
02776 }
02777 $this->linkChecker();
02778
02779 return true;
02780 }
02781
02782
02783
02784 function refreshLinkCheck()
02785 {
02786 $this->__initLinkChecker();
02787
02788 if(!$this->link_checker_obj->checkPear())
02789 {
02790 sendInfo($this->lng->txt('missing_pear_library'));
02791 $this->linkChecker();
02792
02793 return false;
02794 }
02795
02796 $this->link_checker_obj->checkLinks();
02797 sendInfo($this->lng->txt('link_checker_refreshed'));
02798
02799 $this->linkChecker();
02800
02801 return true;
02802 }
02803
02804 function __initLinkChecker()
02805 {
02806 global $ilDB;
02807
02808 include_once './classes/class.ilLinkChecker.php';
02809
02810 $this->link_checker_obj =& new ilLinkChecker($ilDB,false);
02811 $this->link_checker_obj->setObjId($this->object->getId());
02812
02813 return true;
02814 }
02815
02816 function __initLMMenuEditor()
02817 {
02818 include_once './content/classes/class.ilLMMenuEditor.php';
02819
02820 $this->lmme_obj =& new ilLMMenuEditor();
02821 $this->lmme_obj->setObjId($this->object->getId());
02822
02823 return true;
02824 }
02825
02829 function addMenuEntry()
02830 {
02831 $this->setTabs();
02832
02833 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.lm_menu_entry_form.html",true);
02834
02835 if (isset($_GET["link_ref_id"]))
02836 {
02837 $obj_type = ilObject::_lookupType($_GET["link_ref_id"],true);
02838 $obj_id = ilObject::_lookupObjectId($_GET["link_ref_id"]);
02839 $title = ilObject::_lookupTitle($obj_id);
02840
02841 $target_link = $obj_type."_".$_GET["link_ref_id"];
02842 $this->tpl->setVariable("TITLE", $title);
02843 $this->tpl->setVariable("TARGET", $target_link);
02844 $this->tpl->setVariable("LINK_REF_ID", $_GET["link_ref_id"]);
02845 }
02846
02847 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
02848 $this->tpl->setVariable("TXT_NEW_ENTRY", $this->lng->txt("lm_menu_new_entry"));
02849 $this->tpl->setVariable("TXT_TARGET", $this->lng->txt("lm_menu_entry_target"));
02850 $this->tpl->setVariable("TXT_TITLE", $this->lng->txt("lm_menu_entry_title"));
02851 $this->tpl->setVariable("BTN_NAME", "saveMenuEntry");
02852 $this->tpl->setVariable("BTN_TEXT", $this->lng->txt("save"));
02853 $this->tpl->setVariable("BTN_NAME2", "showEntrySelector");
02854 $this->tpl->setVariable("BTN_TEXT2", $this->lng->txt("lm_menu_select_internal_object"));
02855 $this->tpl->parseCurrentBlock();
02856 }
02857
02861 function saveMenuEntry()
02862 {
02863
02864 if (empty($_POST["title"]))
02865 {
02866 $this->ilias->raiseError($this->lng->txt("please_enter_title"),$this->ilias->error_obj->MESSAGE);
02867 }
02868 if (empty($_POST["target"]))
02869 {
02870 $this->ilias->raiseError($this->lng->txt("please_enter_target"),$this->ilias->error_obj->MESSAGE);
02871 }
02872
02873 $this->__initLMMenuEditor();
02874 $this->lmme_obj->setTitle($_POST["title"]);
02875 $this->lmme_obj->setTarget($_POST["target"]);
02876 $this->lmme_obj->setLinkRefId($_POST["link_ref_id"]);
02877
02878 if ($_POST["link_ref_id"])
02879 {
02880 $this->lmme_obj->setLinkType("intern");
02881 }
02882
02883 $this->lmme_obj->create();
02884
02885 sendInfo($this->lng->txt("msg_entry_added"), true);
02886 $this->ctrl->redirect($this, "properties");
02887 }
02888
02892 function deleteMenuEntry()
02893 {
02894 if (empty($_GET["menu_entry"]))
02895 {
02896 $this->ilias->raiseError($this->lng->txt("no_menu_entry_id"),$this->ilias->error_obj->MESSAGE);
02897 }
02898
02899 $this->__initLMMenuEditor();
02900 $this->lmme_obj->delete($_GET["menu_entry"]);
02901
02902 sendInfo($this->lng->txt("msg_entry_removed"), true);
02903 $this->ctrl->redirect($this, "properties");
02904 }
02905
02909 function editMenuEntry()
02910 {
02911 if (empty($_GET["menu_entry"]))
02912 {
02913 $this->ilias->raiseError($this->lng->txt("no_menu_entry_id"),$this->ilias->error_obj->MESSAGE);
02914 }
02915
02916 $this->__initLMMenuEditor();
02917 $this->lmme_obj->readEntry($_GET["menu_entry"]);
02918
02919 $this->setTabs();
02920
02921 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.lm_menu_entry_form.html",true);
02922
02923 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
02924 $this->tpl->setVariable("TXT_NEW_ENTRY", $this->lng->txt("lm_menu_edit_entry"));
02925 $this->tpl->setVariable("TXT_TARGET", $this->lng->txt("lm_menu_entry_target"));
02926 $this->tpl->setVariable("TXT_TITLE", $this->lng->txt("lm_menu_entry_title"));
02927 $this->tpl->setVariable("TITLE", $this->lmme_obj->getTitle());
02928 $this->tpl->setVariable("TARGET", $this->lmme_obj->getTarget());
02929 $this->tpl->setVariable("ENTRY_ID", $this->lmme_obj->getEntryId());
02930 $this->tpl->setVariable("BTN_NAME", "updateMenuEntry");
02931 $this->tpl->setVariable("BTN_TEXT", $this->lng->txt("save"));
02932 $this->tpl->setVariable("BTN_NAME2", "showEntrySelector");
02933 $this->tpl->setVariable("BTN_TEXT2", $this->lng->txt("lm_menu_select_internal_object"));
02934 $this->tpl->parseCurrentBlock();
02935 }
02936
02940 function updateMenuEntry()
02941 {
02942 if (empty($_POST["menu_entry"]))
02943 {
02944 $this->ilias->raiseError($this->lng->txt("no_menu_entry_id"),$this->ilias->error_obj->MESSAGE);
02945 }
02946
02947
02948 if (empty($_POST["title"]))
02949 {
02950 $this->ilias->raiseError($this->lng->txt("please_enter_title"),$this->ilias->error_obj->MESSAGE);
02951 }
02952 if (empty($_POST["target"]))
02953 {
02954 $this->ilias->raiseError($this->lng->txt("please_enter_target"),$this->ilias->error_obj->MESSAGE);
02955 }
02956
02957 $this->__initLMMenuEditor();
02958 $this->lmme_obj->readEntry($_POST["menu_entry"]);
02959 $this->lmme_obj->setTitle($_POST["title"]);
02960 $this->lmme_obj->setTarget($_POST["target"]);
02961 $this->lmme_obj->update();
02962
02963 sendInfo($this->lng->txt("msg_entry_updated"), true);
02964 $this->ctrl->redirect($this, "properties");
02965 }
02966
02967 function showEntrySelector()
02968 {
02969 $this->setTabs();
02970
02971 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.lm_menu_object_selector.html",true);
02972
02973 sendInfo($this->lng->txt("lm_menu_select_object_to_add"));
02974
02975 require_once ("content/classes/class.ilLMMenuObjectSelector.php");
02976 $exp = new ilLMMenuObjectSelector($this->ctrl->getLinkTarget($this,'test'),$this);
02977
02978 $exp->setExpand($_GET["lm_menu_expand"] ? $_GET["lm_menu_expand"] : $this->tree->readRootId());
02979 $exp->setExpandTarget($this->ctrl->getLinkTarget($this,'showEntrySelector'));
02980 $exp->setTargetGet("ref_id");
02981 $exp->setRefId($this->cur_ref_id);
02982
02983 $sel_types = array('lm','dbk','glo','frm','exc','tst','svy');
02984 $exp->setSelectableTypes($sel_types);
02985
02986
02987
02988
02989 $exp->setOutput(0);
02990 $output = $exp->getOutput();
02991
02992
02993 foreach ($exp->format_options as $node)
02994 {
02995 if (!$node["container"])
02996 {
02997 $pages[] = $node["child"];
02998 }
02999 }
03000
03001
03002
03003
03004 $this->tpl->setVariable("TXT_SET_PUBLIC_MODE", $this->lng->txt("set_public_mode"));
03005 $this->tpl->setVariable("TXT_CHOOSE_PUBLIC_MODE", $this->lng->txt("choose_public_mode"));
03006 $modes = array("complete" => $this->lng->txt("all_pages"), "selected" => $this->lng->txt("selected_pages_only"));
03007 $select_public_mode = ilUtil::formSelect ($this->object->getPublicAccessMode(),"lm_public_mode",$modes, false, true);
03008 $this->tpl->setVariable("SELECT_PUBLIC_MODE", $select_public_mode);
03009
03010 $this->tpl->setVariable("TXT_EXPLORER_HEADER", $this->lng->txt("choose_public_pages"));
03011 $this->tpl->setVariable("EXP_REFRESH", $this->lng->txt("refresh"));
03012 $this->tpl->setVariable("EXPLORER",$output);
03013 $this->tpl->setVariable("ONCLICK",$js_pages);
03014 $this->tpl->setVariable("TXT_CHECKALL", $this->lng->txt("check_all"));
03015 $this->tpl->setVariable("TXT_UNCHECKALL", $this->lng->txt("uncheck_all"));
03016 $this->tpl->setVariable("TXT_SAVE", $this->lng->txt("save"));
03017 $this->tpl->setVariable("FORMACTION", $this->ctrl->getLinkTarget($this, "savePublicSection"));
03018 $this->tpl->parseCurrentBlock();
03019 }
03020 }
03021 ?>