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 include_once "classes/class.ilObjectGUI.php";
00025 include_once "./Modules/LearningModule/classes/class.ilObjContentObject.php";
00026 include_once ("./Modules/LearningModule/classes/class.ilLMPageObjectGUI.php");
00027 include_once ("./Modules/LearningModule/classes/class.ilStructureObjectGUI.php");
00028
00040 class ilObjContentObjectGUI extends ilObjectGUI
00041 {
00042 var $ctrl;
00043
00049 function ilObjContentObjectGUI($a_data,$a_id = 0,$a_call_by_reference = true, $a_prepare_output = false)
00050 {
00051 global $lng, $ilCtrl;
00052
00053 $this->ctrl =& $ilCtrl;
00054 $lng->loadLanguageModule("content");
00055 parent::ilObjectGUI($a_data,$a_id,$a_call_by_reference,false);
00056 $this->actions = $this->objDefinition->getActions("lm");
00057 }
00058
00062 function &executeCommand()
00063 {
00064 global $ilAccess;
00065
00066 if ($this->ctrl->getRedirectSource() == "ilinternallinkgui")
00067 {
00068 $this->explorer();
00069 return;
00070 }
00071
00072 if ($this->ctrl->getCmdClass() == "ilinternallinkgui")
00073 {
00074 $this->ctrl->setReturn($this, "explorer");
00075 }
00076
00077
00078 $next_class = $this->ctrl->getNextClass($this);
00079
00080
00081 $cmd = $this->ctrl->getCmd();
00082
00083 switch($next_class)
00084 {
00085 case "illearningprogressgui":
00086 $this->addLocations();
00087 include_once './Services/Tracking/classes/class.ilLearningProgressGUI.php';
00088 $this->setTabs();
00089
00090 $new_gui =& new ilLearningProgressGUI(LP_MODE_REPOSITORY,$this->object->getRefId());
00091 $new_gui->activateStatistics();
00092 $this->ctrl->forwardCommand($new_gui);
00093
00094 break;
00095
00096 case 'ilmdeditorgui':
00097 $this->addLocations();
00098 include_once 'Services/MetaData/classes/class.ilMDEditorGUI.php';
00099 $this->setTabs();
00100 $md_gui =& new ilMDEditorGUI($this->object->getId(), 0, $this->object->getType());
00101 $md_gui->addObserver($this->object,'MDUpdateListener','General');
00102
00103 $this->ctrl->forwardCommand($md_gui);
00104 break;
00105
00106 case "ilobjstylesheetgui":
00107 $this->addLocations();
00108 include_once ("classes/class.ilObjStyleSheetGUI.php");
00109 $this->ctrl->setReturn($this, "properties");
00110 $style_gui =& new ilObjStyleSheetGUI("", $this->object->getStyleSheetId(), false, false);
00111 $style_gui->omitLocator();
00112 if ($cmd == "create" || $_GET["new_type"]=="sty")
00113 {
00114 $style_gui->setCreationMode(true);
00115 }
00116 $ret =& $this->ctrl->forwardCommand($style_gui);
00117
00118
00119 if ($cmd == "save" || $cmd == "copyStyle" || $cmd == "importStyle")
00120 {
00121 $style_id = $ret;
00122 $this->object->setStyleSheetId($style_id);
00123 $this->object->update();
00124 $this->ctrl->redirectByClass("ilobjstylesheetgui", "edit");
00125 }
00126 break;
00127
00128 case "illmpageobjectgui":
00129 $this->ctrl->saveParameter($this, array("obj_id"));
00130 $this->addLocations();
00131 $this->ctrl->setReturn($this, "properties");
00132
00133
00134
00135 $pg_gui =& new ilLMPageObjectGUI($this->object);
00136 if ($_GET["obj_id"] != "")
00137 {
00138 $obj =& ilLMObjectFactory::getInstance($this->object, $_GET["obj_id"]);
00139 $pg_gui->setLMPageObject($obj);
00140 }
00141
00142 $ret =& $this->ctrl->forwardCommand($pg_gui);
00143 if ($cmd == "save" || $cmd == "cancel")
00144 {
00145 $this->ctrl->redirect($this, "pages");
00146 }
00147 break;
00148
00149 case "ilstructureobjectgui":
00150 $this->ctrl->saveParameter($this, array("obj_id"));
00151 $this->addLocations();
00152 $this->ctrl->setReturn($this, "properties");
00153 $st_gui =& new ilStructureObjectGUI($this->object, $this->object->lm_tree);
00154 if ($_GET["obj_id"] != "")
00155 {
00156 $obj =& ilLMObjectFactory::getInstance($this->object, $_GET["obj_id"]);
00157 $st_gui->setStructureObject($obj);
00158 }
00159
00160 $ret =& $this->ctrl->forwardCommand($st_gui);
00161 if ($cmd == "save" || $cmd == "cancel")
00162 {
00163 if ($_GET["obj_id"] == "")
00164 {
00165 $this->ctrl->redirect($this, "chapters");
00166 }
00167 else
00168 {
00169 $this->ctrl->setCmd("subchap");
00170 $this->executeCommand();
00171 }
00172 }
00173 break;
00174
00175 case 'ilpermissiongui':
00176 if (strtolower($_GET["baseClass"]) == "iladministrationgui")
00177 {
00178 $this->prepareOutput();
00179 }
00180 else
00181 {
00182 $this->addLocations(true);
00183 $this->setTabs();
00184 }
00185 include_once("./classes/class.ilPermissionGUI.php");
00186 $perm_gui =& new ilPermissionGUI($this);
00187 $ret =& $this->ctrl->forwardCommand($perm_gui);
00188 break;
00189
00190
00191 case 'ilinfoscreengui':
00192 $this->addLocations(true);
00193 $this->setTabs();
00194 include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
00195 $info = new ilInfoScreenGUI($this);
00196 $info->enablePrivateNotes();
00197
00198
00199 $info->enableNews();
00200 if ($ilAccess->checkAccess("write", "", $_GET["ref_id"]))
00201 {
00202 $info->enableNewsEditing();
00203 $info->setBlockProperty("news", "settings", true);
00204 }
00205
00206
00207 $info->addMetaDataSections($this->object->getId(), 0,
00208 $this->object->getType());
00209
00210 $ret =& $this->ctrl->forwardCommand($info);
00211 break;
00212
00213 default:
00214 $new_type = $_POST["new_type"]
00215 ? $_POST["new_type"]
00216 : $_GET["new_type"];
00217
00218
00219 if ($cmd == "create" &&
00220 !in_array($new_type, array("dbk", "lm")))
00221 {
00222
00223 switch ($new_type)
00224 {
00225 case "pg":
00226 $this->setTabs();
00227 $this->ctrl->setCmdClass("ilLMPageObjectGUI");
00228 $ret =& $this->executeCommand();
00229 break;
00230
00231 case "st":
00232 $this->setTabs();
00233 $this->ctrl->setCmdClass("ilStructureObjectGUI");
00234 $ret =& $this->executeCommand();
00235 break;
00236 }
00237 }
00238 else
00239 {
00240
00241 if ($this->getCreationMode() == true &&
00242 in_array($new_type, array("dbk", "lm")))
00243 {
00244 $this->prepareOutput();
00245 if ($cmd == "")
00246 {
00247 $cmd = "create";
00248 }
00249 $cmd .= "Object";
00250 $ret =& $this->$cmd();
00251 }
00252 else
00253 {
00254 $this->addLocations();
00255 $ret =& $this->$cmd();
00256 }
00257 }
00258 break;
00259 }
00260 return $ret;
00261 }
00262
00263 function _forwards()
00264 {
00265 return array("ilLMPageObjectGUI", "ilStructureObjectGUI","ilObjStyleSheetGUI");
00266 }
00267
00271 function properties()
00272 {
00273 global $lng;
00274
00275 $lng->loadLanguageModule("style");
00276 $this->setTabs();
00277
00278
00279 $showViewInFrameset = true;
00280
00281 if ($showViewInFrameset)
00282 {
00283 $buttonTarget = ilFrameTargetInfo::_getFrame("MainContent");
00284 }
00285 else
00286 {
00287 $buttonTarget = "ilContObj".$this->object->getID();
00288 }
00289
00290
00291 $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
00292
00293
00294 $this->tpl->setCurrentBlock("btn_cell");
00295 $this->tpl->setVariable("BTN_LINK", "ilias.php?baseClass=ilLMPresentationGUI&ref_id=".$this->object->getRefID());
00296 $this->tpl->setVariable("BTN_TARGET"," target=\"".$buttonTarget."\" ");
00297 $this->tpl->setVariable("BTN_TXT",$this->lng->txt("view"));
00298 $this->tpl->parseCurrentBlock();
00299
00300 $this->tpl->setCurrentBlock("btn_cell");
00301 $this->tpl->setVariable("BTN_LINK", $this->ctrl->getLinkTarget($this, "fixTreeConfirm"));
00302
00303 $this->tpl->setVariable("BTN_TXT", $this->lng->txt("cont_fix_tree"));
00304 $this->tpl->parseCurrentBlock();
00305
00306
00307
00308
00309 if ($this->ilias->getSetting("pub_section"))
00310 {
00311 if ($this->object->getType() != "dbk")
00312 {
00313 $this->tpl->setCurrentBlock("btn_cell");
00314 $this->tpl->setVariable("BTN_LINK", $this->ctrl->getLinkTarget($this, "editPublicSection"));
00315
00316 $this->tpl->setVariable("BTN_TXT", $this->lng->txt("public_section"));
00317 $this->tpl->parseCurrentBlock();
00318 }
00319 }
00320
00321
00322 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.lm_properties.html", "Modules/LearningModule");
00323 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
00324 $this->tpl->setVariable("TXT_PROPERTIES", $this->lng->txt("cont_lm_properties"));
00325
00326
00327 $this->tpl->setVariable("TXT_ONLINE", $this->lng->txt("cont_online"));
00328 $this->tpl->setVariable("CBOX_ONLINE", "cobj_online");
00329 $this->tpl->setVariable("VAL_ONLINE", "y");
00330 if ($this->object->getOnline())
00331 {
00332 $this->tpl->setVariable("CHK_ONLINE", "checked");
00333 }
00334
00335
00336 $this->tpl->setVariable("TXT_LAYOUT", $this->lng->txt("cont_def_layout"));
00337 $layouts = ilObjContentObject::getAvailableLayouts();
00338 $select_layout = ilUtil::formSelect ($this->object->getLayout(), "lm_layout",
00339 $layouts, false, true);
00340 $this->tpl->setVariable("SELECT_LAYOUT", $select_layout);
00341
00342
00343 $this->tpl->setVariable("TXT_STYLE", $this->lng->txt("cont_style"));
00344 $fixed_style = $this->ilias->getSetting("fixed_content_style_id");
00345
00346 if ($fixed_style > 0)
00347 {
00348 $this->tpl->setVariable("VAL_STYLE",
00349 ilObject::_lookupTitle($fixed_style)." (".
00350 $this->lng->txt("global_fixed").")");
00351 }
00352 else
00353 {
00354 $this->tpl->setCurrentBlock("style_edit");
00355 $style_id = $this->object->getStyleSheetId();
00356
00357 $st_styles = ilObjStyleSheet::_getStandardStyles(true, false,
00358 $_GET["ref_id"]);
00359
00360 $st_styles[0] = $this->lng->txt("default");
00361 ksort($st_styles);
00362 $style_sel = ilUtil::formSelect ($style_id, "style_id",
00363 $st_styles, false, true);
00364
00365 if ($style_id > 0)
00366 {
00367
00368 if (ilObjStyleSheet::_lookupStandard($style_id))
00369 {
00370 $this->tpl->setVariable("VAL_STYLE",
00371 $style_sel);
00372 }
00373
00374 else
00375 {
00376 $this->tpl->setVariable("VAL_STYLE",
00377 ilObject::_lookupTitle($style_id));
00378 $this->tpl->setVariable("LINK_STYLE_EDIT",
00379 $this->ctrl->getLinkTargetByClass("ilObjStyleSheetGUI", "edit"));
00380 $this->tpl->setVariable("TXT_STYLE_EDIT",
00381 $this->lng->txt("edit"));
00382
00383
00384
00385
00386 $this->tpl->setVariable("LINK_STYLE_DROP",
00387 $this->ctrl->getLinkTargetByClass("ilObjStyleSheetGUI", "delete"));
00388 $this->tpl->setVariable("TXT_STYLE_DROP",
00389 $this->lng->txt("delete"));
00390
00391
00392 }
00393 }
00394
00395 if ($style_id <= 0 || ilObjStyleSheet::_lookupStandard($style_id))
00396 {
00397 $this->tpl->setVariable("VAL_STYLE",
00398 $style_sel);
00399 $this->tpl->setVariable("LINK_STYLE_CREATE",
00400 $this->ctrl->getLinkTargetByClass("ilObjStyleSheetGUI", "create"));
00401 $this->tpl->setVariable("TXT_STYLE_CREATE",
00402 $this->lng->txt("sty_create_ind_style"));
00403 }
00404 $this->tpl->parseCurrentBlock();
00405 }
00406
00407
00408 $this->tpl->setVariable("TXT_PAGE_HEADER", $this->lng->txt("cont_page_header"));
00409 $pg_header = array ("st_title" => $this->lng->txt("cont_st_title"),
00410 "pg_title" => $this->lng->txt("cont_pg_title"),
00411 "none" => $this->lng->txt("cont_none"));
00412 $select_pg_head = ilUtil::formSelect ($this->object->getPageHeader(), "lm_pg_header",
00413 $pg_header, false, true);
00414 $this->tpl->setVariable("SELECT_PAGE_HEADER", $select_pg_head);
00415
00416
00417 $this->tpl->setVariable("TXT_NUMBER", $this->lng->txt("cont_act_number"));
00418 $this->tpl->setVariable("CBOX_NUMBER", "cobj_act_number");
00419 $this->tpl->setVariable("VAL_NUMBER", "y");
00420 if ($this->object->isActiveNumbering())
00421 {
00422 $this->tpl->setVariable("CHK_NUMBER", "checked");
00423 }
00424
00425
00426 $this->tpl->setVariable("TXT_TOC_MODE", $this->lng->txt("cont_toc_mode"));
00427 $arr_toc_mode = array ("chapters" => $this->lng->txt("cont_chapters_only"),
00428 "pages" => $this->lng->txt("cont_chapters_and_pages"));
00429 $select_toc_mode = ilUtil::formSelect ($this->object->getTOCMode(), "toc_mode",
00430 $arr_toc_mode, false, true);
00431 $this->tpl->setVariable("SELECT_TOC_MODE", $select_toc_mode);
00432
00433
00434 if (!$this->ilias->getSetting('disable_notes'))
00435 {
00436 $this->tpl->setVariable("TXT_PUB_NOTES", $this->lng->txt("cont_public_notes"));
00437 $this->tpl->setVariable("TXT_PUB_NOTES_DESC", $this->lng->txt("cont_public_notes_desc"));
00438 $this->tpl->setVariable("CBOX_PUB_NOTES", "cobj_pub_notes");
00439 $this->tpl->setVariable("VAL_PUB_NOTES", "y");
00440 if ($this->object->publicNotes())
00441 {
00442 $this->tpl->setVariable("CHK_PUB_NOTES", "checked");
00443 }
00444 }
00445
00446
00447 $this->tpl->setVariable("TXT_CLEAN_FRAMES", $this->lng->txt("cont_synchronize_frames"));
00448 $this->tpl->setVariable("TXT_CLEAN_FRAMES_DESC", $this->lng->txt("cont_synchronize_frames_desc"));
00449 $this->tpl->setVariable("CBOX_CLEAN_FRAMES", "cobj_clean_frames");
00450 $this->tpl->setVariable("VAL_CLEAN_FRAMES", "y");
00451 if ($this->object->cleanFrames())
00452 {
00453 $this->tpl->setVariable("CHK_CLEAN_FRAMES", "checked");
00454 }
00455
00456
00457 $this->tpl->setVariable("TXT_HIST_USER_COMMENTS", $this->lng->txt("enable_hist_user_comments"));
00458 $this->tpl->setVariable("TXT_HIST_USER_COMMENTS_DESC", $this->lng->txt("enable_hist_user_comments_desc"));
00459 $this->tpl->setVariable("CBOX_HIST_USER_COMMENTS", "cobj_user_comments");
00460 $this->tpl->setVariable("VAL_HIST_USER_COMMENTS", "y");
00461 if ($this->object->isActiveHistoryUserComments())
00462 {
00463 $this->tpl->setVariable("CHK_HIST_USER_COMMENTS", "checked");
00464 }
00465
00466
00467 $this->tpl->setVariable("TXT_LM_MENU", $this->lng->txt("cont_lm_menu"));
00468 $this->tpl->setVariable("TXT_ACT_MENU", $this->lng->txt("cont_active"));
00469 $this->tpl->setVariable("CBOX_LM_MENU", "cobj_act_lm_menu");
00470 $this->tpl->setVariable("VAL_LM_MENU", "y");
00471 if ($this->object->isActiveLMMenu())
00472 {
00473 $this->tpl->setVariable("CHK_LM_MENU", "checked");
00474 }
00475
00476
00477 $this->tpl->setVariable("TXT_TOC", $this->lng->txt("cont_toc"));
00478 $this->tpl->setVariable("CBOX_TOC", "cobj_act_toc");
00479 $this->tpl->setVariable("VAL_TOC", "y");
00480 if ($this->object->isActiveTOC())
00481 {
00482 $this->tpl->setVariable("CHK_TOC", "checked");
00483 }
00484
00485
00486 $this->tpl->setVariable("TXT_PRINT", $this->lng->txt("cont_print_view"));
00487 $this->tpl->setVariable("CBOX_PRINT", "cobj_act_print");
00488 $this->tpl->setVariable("VAL_PRINT", "y");
00489 if ($this->object->isActivePrintView())
00490 {
00491 $this->tpl->setVariable("CHK_PRINT", "checked");
00492 }
00493
00494
00495 $this->tpl->setVariable("TXT_DOWNLOADS", $this->lng->txt("cont_downloads"));
00496 $this->tpl->setVariable("TXT_DOWNLOADS_DESC", $this->lng->txt("cont_downloads_desc"));
00497 $this->tpl->setVariable("CBOX_DOWNLOADS", "cobj_act_downloads");
00498 $this->tpl->setVariable("VAL_DOWNLOADS", "y");
00499
00500 if ($this->object->isActiveDownloads())
00501 {
00502 $this->tpl->setVariable("CHK_DOWNLOADS", "checked=\"checked\"");
00503 }
00504
00505 $this->tpl->setVariable("TXT_DOWNLOADS_PUBLIC_DESC", $this->lng->txt("cont_downloads_public_desc"));
00506 $this->tpl->setVariable("CBOX_DOWNLOADS_PUBLIC", "cobj_act_downloads_public");
00507 $this->tpl->setVariable("VAL_DOWNLOADS_PUBLIC", "y");
00508
00509 if ($this->object->isActiveDownloadsPublic())
00510 {
00511 $this->tpl->setVariable("CHK_DOWNLOADS_PUBLIC", "checked=\"checked\"");
00512 }
00513
00514 if (!$this->object->isActiveDownloads())
00515 {
00516 $this->tpl->setVariable("CHK2_DOWNLOADS_PUBLIC", "disabled=\"disabled\"");
00517 }
00518
00519
00520 $this->__initLMMenuEditor();
00521 $entries = $this->lmme_obj->getMenuEntries();
00522
00523 if (count($entries) > 0)
00524 {
00525 foreach ($entries as $entry)
00526 {
00527 $this->ctrl->setParameter($this, "menu_entry", $entry["id"]);
00528
00529 $this->tpl->setCurrentBlock("menu_entries");
00530
00531 if ($entry["type"] == "intern")
00532 {
00533 $entry["link"] = ILIAS_HTTP_PATH."/goto.php?target=".$entry["link"];
00534 }
00535
00536
00537 if (!strstr($entry["link"],'://') && !strstr($entry["link"],'mailto:'))
00538 {
00539 $entry["link"] = "http://".$entry["link"];
00540 }
00541
00542 $this->tpl->setVariable("ENTRY_LINK", $entry["link"]);
00543 $this->tpl->setVariable("ENTRY_TITLE", $entry["title"]);
00544
00545 $this->tpl->setVariable("CBOX_ENTRY", "menu_entries[]");
00546 $this->tpl->setVariable("VAL_ENTRY", $entry["id"]);
00547
00548 if (ilUtil::yn2tf($entry["active"]))
00549 {
00550 $this->tpl->setVariable("CHK_ENTRY", "checked=\"checked\"");
00551 }
00552
00553
00554 $this->tpl->setVariable("LINK_EDIT", $this->ctrl->getLinkTarget($this,"editMenuEntry"));
00555 $this->tpl->setVariable("TARGET_EDIT", "content");
00556 $this->tpl->setVariable("TXT_EDIT", $this->lng->txt("edit"));
00557 $this->tpl->setVariable("IMG_EDIT", ilUtil::getImagePath("icon_pencil.gif"));
00558
00559 $this->tpl->setVariable("LINK_DROP", $this->ctrl->getLinkTarget($this,"deleteMenuEntry"));
00560 $this->tpl->setVariable("TARGET_DROP", "content");
00561 $this->tpl->setVariable("TXT_DROP", $this->lng->txt("drop"));
00562 $this->tpl->setVariable("IMG_DROP", ilUtil::getImagePath("delete.gif"));
00563
00564 $this->tpl->parseCurrentBlock();
00565 }
00566 }
00567
00568
00569
00570
00571 $this->tpl->setCurrentBlock("commands");
00572 $this->tpl->setVariable("BTN_NAME", "saveProperties");
00573 $this->tpl->setVariable("BTN_TEXT", $this->lng->txt("save"));
00574 $this->tpl->setVariable("BTN_NAME2", "addMenuEntry");
00575 $this->tpl->setVariable("BTN_TEXT2", $this->lng->txt("add_menu_entry"));
00576 $this->tpl->parseCurrentBlock();
00577 }
00578
00582 function explorer()
00583 {
00584 global $ilUser, $ilias;
00585
00586 switch ($this->object->getType())
00587 {
00588 case "lm":
00589 $gui_class = "ilobjlearningmodulegui";
00590 break;
00591
00592 case "dlb":
00593 $gui_class = "ilobjdlbookgui";
00594 break;
00595 }
00596
00597
00598
00599 $this->tpl = new ilTemplate("tpl.main.html", true, true);
00600
00601
00602
00603 $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
00604
00605
00606 $this->tpl->addBlockFile("CONTENT", "content", "tpl.explorer.html");
00607 $this->tpl->setVariable("IMG_SPACE", ilUtil::getImagePath("spacer.gif", false));
00608
00609 require_once ("./Modules/LearningModule/classes/class.ilLMEditorExplorer.php");
00610 $exp = new ilLMEditorExplorer($this->ctrl->getLinkTarget($this, "view"),
00611 $this->object, $gui_class);
00612
00613 $exp->setTargetGet("obj_id");
00614 $exp->setExpandTarget($this->ctrl->getLinkTarget($this, "explorer"));
00615
00616 if ($_GET["lmmovecopy"] == "1")
00617 {
00618 $this->proceedDragDrop();
00619 }
00620
00621
00622 if ($_GET["lmexpand"] == "")
00623 {
00624 $mtree = new ilTree($this->object->getId());
00625 $mtree->setTableNames('lm_tree','lm_data');
00626 $mtree->setTreeTablePK("lm_id");
00627 $expanded = $mtree->readRootId();
00628 }
00629 else
00630 {
00631 $expanded = $_GET["lmexpand"];
00632 }
00633
00634 $exp->setExpand($expanded);
00635
00636
00637 $exp->setOutput(0);
00638 $output = $exp->getOutput();
00639
00640 include_once("./Services/COPage/classes/class.ilPageEditorGUI.php");
00641 if (ilPageEditorGUI::_doJSEditing())
00642 {
00643
00644
00645 $IDS = "";
00646 for ($i=0;$i<count($exp->iconList);$i++)
00647 {
00648 if ($i>0) $IDS .= ",";
00649 $IDS .= "'".$exp->iconList[$i]."'";
00650 }
00651 $this->tpl->setVariable("ICONIDS",$IDS);
00652
00653 $this->tpl->setVariable("TESTPFAD",$this->ctrl->getLinkTarget($this, "explorer")."&lmmovecopy=1");
00654
00655 $this->tpl->setVariable("POPUPLINK",$this->ctrl->getLinkTarget($this, "popup")."&ptype=movecopytreenode");
00656 }
00657
00658
00659 $this->tpl->setCurrentBlock("content");
00660 $this->tpl->setVariable("TXT_EXPLORER_HEADER", $this->lng->txt("cont_chap_and_pages"));
00661 $this->tpl->setVariable("EXP_REFRESH", $this->lng->txt("refresh"));
00662 $this->tpl->setVariable("EXPLORER",$output);
00663 $this->ctrl->setParameter($this, "lmexpand", $_GET["lmexpand"]);
00664 $this->tpl->setVariable("ACTION", $this->ctrl->getLinkTarget($this, "explorer"));
00665 $this->tpl->parseCurrentBlock();
00666
00667
00668 }
00669
00673 function popup()
00674 {
00675 include_once "./Services/COPage/classes/class.ilWysiwygUtil.php";
00676 $popup = new ilWysiwygUtil();
00677 $popup->show($_GET["ptype"]);
00678 exit;
00679 }
00680
00684 function proceedDragDrop()
00685 {
00686 $lmtree = new ilTree($this->object->getId());
00687 $lmtree->setTableNames('lm_tree','lm_data');
00688 $lmtree->setTreeTablePK("lm_id");
00689
00690
00691
00692 $source_id = $_GET["dragdropSource"];
00693
00694
00695 $target_id = $_GET["dragdropTarget"];
00696
00697
00698 $movecopy = $_GET["dragdropCopymove"];
00699
00700
00701 $position = $_GET["dragdropPosition"];
00702
00703
00704
00705
00706
00707
00708 $source_obj = ilLMObjectFactory::getInstance($this->object, $source_id, true);
00709 $source_obj->setLMId($this->object->getId());
00710 $target_obj = ilLMObjectFactory::getInstance($this->object, $target_id, true);
00711 $target_obj->setLMId($this->object->getId());
00712 $target_parent = $lmtree->getParentId($target_id);
00713
00714
00715
00716 if ($source_obj->getType() == "pg")
00717 {
00718 if ($lmtree->isInTree($source_obj->getId()))
00719 {
00720 $node_data = $lmtree->getNodeData($source_obj->getId());
00721
00722
00723 if ($movecopy == "move")
00724 {
00725 $parent_id = $lmtree->getParentId($source_obj->getId());
00726 $lmtree->deleteTree($node_data);
00727
00728
00729 require_once("classes/class.ilHistory.php");
00730 ilHistory::_createEntry($source_obj->getId(), "cut",
00731 array(ilLMObject::_lookupTitle($parent_id), $parent_id),
00732 $this->object->getType().":pg");
00733 ilHistory::_createEntry($parent_id, "cut_page",
00734 array(ilLMObject::_lookupTitle($source_obj->getId()), $source_obj->getId()),
00735 $this->object->getType().":st");
00736 }
00737 else
00738 {
00739
00740 $new_page =& $source_obj->copy();
00741 $source_id = $new_page->getId();
00742 $source_obj =& $new_page;
00743 }
00744
00745
00746 if(!$lmtree->isInTree($source_obj->getId()))
00747 {
00748
00749 if ($target_obj->getType() == "pg")
00750 {
00751 $target_pos = $target_id;
00752 if ($position == "before")
00753 {
00754 $target_pos = IL_FIRST_NODE;
00755 if ($pred = $lmtree->fetchPredecessorNode($target_id))
00756 {
00757 if ($lmtree->getParentId($pred["child"]) == $target_parent)
00758 {
00759 $target_pos = $pred["child"];
00760 }
00761 }
00762 }
00763 $parent = $target_parent;
00764 }
00765 else
00766 {
00767 $target_pos = IL_FIRST_NODE;
00768 $parent = $target_id;
00769 }
00770
00771
00772 $lmtree->insertNode($source_obj->getId(),
00773 $parent, $target_pos);
00774
00775
00776 if ($movecopy == "move")
00777 {
00778
00779 include_once("classes/class.ilHistory.php");
00780 ilHistory::_createEntry($source_obj->getId(), "paste",
00781 array(ilLMObject::_lookupTitle($parent), $parent),
00782 $this->object->getType().":pg");
00783 ilHistory::_createEntry($parent, "paste_page",
00784 array(ilLMObject::_lookupTitle($source_obj->getId()), $source_obj->getId()),
00785 $this->object->getType().":st");
00786 }
00787
00788 }
00789 }
00790 }
00791
00792
00793 if ($source_obj->getType() == "st")
00794 {
00795
00796 if ($target_obj->getType() != "st")
00797 {
00798 return;
00799 }
00800 $source_node = $lmtree->getNodeData($source_id);
00801 $subnodes = $lmtree->getSubtree($source_node);
00802
00803
00804 foreach ($subnodes as $subnode)
00805 {
00806 if($subnode["obj_id"] == $target_id)
00807 {
00808 return;
00809 }
00810 }
00811
00812 $target_pos = $target_id;
00813
00814
00815 if ($position == "before")
00816 {
00817 $target_pos = IL_FIRST_NODE;
00818
00819
00820 $childs = $lmtree->getChildsByType($target_parent, "st");
00821 $found = false;
00822 foreach ($childs as $child)
00823 {
00824 if ($child["obj_id"] == $target_id)
00825 {
00826 $found = true;
00827 }
00828 if (!$found)
00829 {
00830 $target_pos = $child["obj_id"];
00831 }
00832 }
00833
00834
00835 if ($target_pos == IL_FIRST_NODE)
00836 {
00837 $pg_childs =& $lmtree->getChildsByType($target_parent, "pg");
00838 if (count($pg_childs) != 0)
00839 {
00840 $target_pos = $pg_childs[count($pg_childs) - 1]["obj_id"];
00841 }
00842 }
00843 }
00844
00845
00846 if ($position == "into")
00847 {
00848 $target_parent = $target_id;
00849 $target_pos = IL_FIRST_NODE;
00850
00851
00852 if ($target_pos == IL_FIRST_NODE)
00853 {
00854 $pg_childs =& $lmtree->getChildsByType($target_parent, "pg");
00855 if (count($pg_childs) != 0)
00856 {
00857 $target_pos = $pg_childs[count($pg_childs) - 1]["obj_id"];
00858 }
00859 }
00860 }
00861
00862
00863
00864 if ($movecopy == "move")
00865 {
00866 $lmtree->deleteTree($source_node);
00867 }
00868 else
00869 {
00870
00871 $copied_nodes = array();
00872 $new_chapter =& $source_obj->copy($lmtree, $target_parent, $target_pos, $copied_nodes);
00873 ilLMObject::updateInternalLinks($copied_nodes);
00874 }
00875
00876 if (!$lmtree->isInTree($source_id))
00877 {
00878 $lmtree->insertNode($source_id, $target_parent, $target_pos);
00879
00880
00881 if ($movecopy == "move")
00882 {
00883 foreach ($subnodes as $node)
00884 {
00885 if($node["obj_id"] != $source_id)
00886 {
00887 $lmtree->insertNode($node["obj_id"], $node["parent"]);
00888 }
00889 }
00890 }
00891 }
00892
00893
00894 $this->object->checkTree();
00895
00896 }
00897
00898
00899 $this->object->checkTree();
00900 }
00901
00902
00903
00907 function saveProperties()
00908 {
00909 global $ilias;
00910
00911 if ($ilias->getSetting("fixed_content_style_id") <= 0 &&
00912 (ilObjStyleSheet::_lookupStandard($this->object->getStyleSheetId())
00913 || $this->object->getStyleSheetId() == 0))
00914 {
00915 $this->object->setStyleSheetId($_POST["style_id"]);
00916 }
00917 $this->object->setLayout($_POST["lm_layout"]);
00918 $this->object->setPageHeader($_POST["lm_pg_header"]);
00919 $this->object->setTOCMode($_POST["toc_mode"]);
00920 $this->object->setOnline(ilUtil::yn2tf($_POST["cobj_online"]));
00921 $this->object->setActiveLMMenu(ilUtil::yn2tf($_POST["cobj_act_lm_menu"]));
00922 $this->object->setActiveNumbering(ilUtil::yn2tf($_POST["cobj_act_number"]));
00923 $this->object->setActiveTOC(ilUtil::yn2tf($_POST["cobj_act_toc"]));
00924 $this->object->setActivePrintView(ilUtil::yn2tf($_POST["cobj_act_print"]));
00925 $this->object->setActiveDownloads(ilUtil::yn2tf($_POST["cobj_act_downloads"]));
00926 $this->object->setActiveDownloadsPublic(ilUtil::yn2tf($_POST["cobj_act_downloads_public"]));
00927 $this->object->setCleanFrames(ilUtil::yn2tf($_POST["cobj_clean_frames"]));
00928 $this->object->setPublicNotes(ilUtil::yn2tf($_POST["cobj_pub_notes"]));
00929 $this->object->setHistoryUserComments(ilUtil::yn2tf($_POST["cobj_user_comments"]));
00930 $this->object->updateProperties();
00931
00932 $this->__initLMMenuEditor();
00933 $this->lmme_obj->updateActiveStatus($_POST["menu_entries"]);
00934
00935 ilUtil::sendInfo($this->lng->txt("msg_obj_modified"), true);
00936 $this->ctrl->redirect($this, "properties");
00937 }
00938
00942 function createObject()
00943 {
00944 global $rbacsystem;
00945
00946 $new_type = $_POST["new_type"] ? $_POST["new_type"] : $_GET["new_type"];
00947
00948 if (!$rbacsystem->checkAccess("create", $_GET["ref_id"], $new_type))
00949 {
00950 $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
00951 }
00952 else
00953 {
00954
00955 $data = array();
00956 $data["fields"] = array();
00957 $data["fields"]["title"] = ilUtil::prepareFormOutput($_SESSION["error_post_vars"]["Fobject"]["title"],true);
00958 $data["fields"]["desc"] = ilUtil::stripSlashes($_SESSION["error_post_vars"]["Fobject"]["desc"]);
00959
00960 $this->getTemplateFile("create", $new_type);
00961
00962 $this->tpl->setVariable("TYPE_IMG",
00963 ilUtil::getImagePath("icon_".$new_type.".gif"));
00964 $this->tpl->setVariable("ALT_IMG",
00965 $this->lng->txt("obj_".$new_type));
00966
00967 foreach ($data["fields"] as $key => $val)
00968 {
00969 $this->tpl->setVariable("TXT_".strtoupper($key), $this->lng->txt($key));
00970 $this->tpl->setVariable(strtoupper($key), $val);
00971
00972 if ($this->prepare_output)
00973 {
00974 $this->tpl->parseCurrentBlock();
00975 }
00976 }
00977
00978
00979
00980
00981 $this->ctrl->setParameter($this, "new_type", $new_type);
00982 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this, "save"));
00983
00984
00985 $this->tpl->setVariable("TXT_HEADER", $this->lng->txt($new_type."_new"));
00986 $this->tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
00987 $this->tpl->setVariable("TXT_SUBMIT", $this->lng->txt($new_type."_add"));
00988 $this->tpl->setVariable("CMD_SUBMIT", "save");
00989 $this->tpl->setVariable("TARGET", ' target="'.
00990 ilFrameTargetInfo::_getFrame("MainContent").'" ');
00991 $this->tpl->setVariable("TXT_REQUIRED_FLD", $this->lng->txt("required_field"));
00992
00993 $this->tpl->setVariable("TXT_IMPORT_LM", $this->lng->txt("import_".$new_type));
00994 $this->tpl->setVariable("TXT_LM_FILE", $this->lng->txt("file"));
00995 $this->tpl->setVariable("TXT_IMPORT", $this->lng->txt("import"));
00996
00997
00998 $umf=get_cfg_var("upload_max_filesize");
00999
01000 $pms=get_cfg_var("post_max_size");
01001
01002
01003 $max_filesize = ((int) $umf < (int) $pms)
01004 ? $umf
01005 : $pms;
01006 if ((int) $pms == 0) $max_filesize = $umf;
01007
01008 if (!$max_filesize) $max_filesize=max($umf, $pms);
01009
01010
01011 $this->tpl->setVariable("TXT_FILE_INFO", $this->lng->txt("file_notice")." $max_filesize.");
01012
01013 }
01014 }
01015
01019 function saveObject()
01020 {
01021 global $rbacadmin, $rbacsystem;
01022
01023
01024
01025
01026 if (!$rbacsystem->checkAccess("create", $_GET["ref_id"], $_GET["new_type"]))
01027 {
01028 $this->ilias->raiseError($this->lng->txt("no_create_permission"), $this->ilias->error_obj->MESSAGE);
01029 }
01030 else
01031 {
01032
01033 if ($_POST["Fobject"]["title"] == "")
01034 {
01035 $this->ilias->raiseError($this->lng->txt("please_enter_title"), $this->ilias->error_obj->MESSAGE);
01036 return;
01037 }
01038
01039
01040 include_once("./Modules/LearningModule/classes/class.ilObjContentObject.php");
01041 $newObj = new ilObjContentObject();
01042 $newObj->setType($this->type);
01043 $newObj->setTitle(ilUtil::stripSlashes($_POST["Fobject"]["title"]));#"content object ".$newObj->getId());
01044 $newObj->setDescription(ilUtil::stripSlashes($_POST["Fobject"]["desc"]));
01045 $newObj->create();
01046 $newObj->createReference();
01047 $newObj->putInTree($_GET["ref_id"]);
01048 $newObj->setPermissions($_GET["ref_id"]);
01049 $newObj->notify("new",$_GET["ref_id"],$_GET["parent_non_rbac_id"],$_GET["ref_id"],$newObj->getRefId());
01050
01051
01052
01053
01054
01055
01056 $newObj->createLMTree();
01057
01058
01059 ilUtil::sendInfo($this->lng->txt($this->type."_added"), true);
01060 ilUtil::redirect("ilias.php?ref_id=".$newObj->getRefId().
01061 "&baseClass=ilLMEditorGUI");
01062 }
01063 }
01064
01068 function addBibItemObject($a_target = "")
01069 {
01070 include_once "./Modules/LearningModule/classes/class.ilBibItemGUI.php";
01071 $bib_gui =& new ilBibItemGUI();
01072 $bib_gui->setObject($this->object);
01073 $bibItemName = $_POST["bibItemName"] ? $_POST["bibItemName"] : $_GET["bibItemName"];
01074 $bibItemIndex = $_POST["bibItemIndex"] ? $_POST["bibItemIndex"] : $_GET["bibItemIndex"];
01075 if ($bibItemIndex == "")
01076 $bibItemIndex = 0;
01077 $bibItemPath = $_POST["bibItemPath"] ? $_POST["bibItemPath"] : $_GET["bibItemPath"];
01078 if ($bibItemName != "")
01079 {
01080 $bib_gui->bib_obj->add($bibItemName, $bibItemPath, $bibItemIndex);
01081 $data = $bib_gui->bib_obj->getElement("BibItem");
01082 $bibItemIndex = (count($data) - 1);
01083 }
01084 else
01085 {
01086 ilUtil::sendInfo($this->lng->txt("bibitem_choose_element"), true);
01087 }
01088 if ($a_target == "")
01089 {
01090 $a_target = "adm_object.php?ref_id=" . $this->object->getRefId();
01091 }
01092
01093 $bib_gui->edit("ADM_CONTENT", "adm_content", $a_target, $bibItemIndex);
01094 }
01095
01099 function addBibItem()
01100 {
01101 $this->setTabs();
01102 $this->addBibItemObject($this->ctrl->getLinkTarget($this));
01103 }
01104
01108 function deleteBibItemObject($a_target = "")
01109 {
01110 include_once "./Modules/LearningModule/classes/class.ilBibItemGUI.php";
01111 $bib_gui =& new ilBibItemGUI();
01112 $bib_gui->setObject($this->object);
01113 $bibItemIndex = $_POST["bibItemIndex"] ? $_POST["bibItemIndex"] : $_GET["bibItemIndex"];
01114 $bib_gui->bib_obj->delete($_GET["bibItemName"], $_GET["bibItemPath"], $bibItemIndex);
01115 if (strpos($bibItemIndex, ",") > 0)
01116 {
01117 $bibItemIndex = substr($bibItemIndex, 0, strpos($bibItemIndex, ","));
01118 }
01119 if ($a_target == "")
01120 {
01121 $a_target = "adm_object.php?ref_id=" . $this->object->getRefId();
01122 }
01123
01124 $bib_gui->edit("ADM_CONTENT", "adm_content", $a_target, $bibItemIndex);
01125 }
01126
01130 function deleteBibItem()
01131 {
01132 $this->setTabs();
01133 $this->deleteBibItemObject($this->ctrl->getLinkTarget($this));
01134 }
01135
01136
01140 function editBibItemObject($a_target = "")
01141 {
01142 include_once "./Modules/LearningModule/classes/class.ilBibItemGUI.php";
01143 $bib_gui =& new ilBibItemGUI();
01144 $bib_gui->setObject($this->object);
01145 $bibItemIndex = $_POST["bibItemIndex"] ? $_POST["bibItemIndex"] : $_GET["bibItemIndex"];
01146 $bibItemIndex *= 1;
01147 if ($bibItemIndex < 0)
01148 {
01149 $bibItemIndex = 0;
01150 }
01151 if ($a_target == "")
01152 {
01153 $a_target = "adm_object.php?ref_id=" . $this->object->getRefId();
01154 }
01155
01156 $bib_gui->edit("ADM_CONTENT", "adm_content", $a_target, $bibItemIndex);
01157 }
01158
01162 function editBibItem()
01163 {
01164 $this->setTabs();
01165 $this->editBibItemObject($this->ctrl->getLinkTarget($this));
01166 }
01167
01171 function saveBibItemObject($a_target = "")
01172 {
01173 include_once "./Modules/LearningModule/classes/class.ilBibItemGUI.php";
01174 $bib_gui =& new ilBibItemGUI();
01175 $bib_gui->setObject($this->object);
01176 $bibItemIndex = $_POST["bibItemIndex"] ? $_POST["bibItemIndex"] : $_GET["bibItemIndex"];
01177 $bibItemIndex *= 1;
01178 if ($bibItemIndex < 0)
01179 {
01180 $bibItemIndex = 0;
01181 }
01182 $bibItemIndex = $bib_gui->save($bibItemIndex);
01183
01184 if ($a_target == "")
01185 {
01186 $a_target = "adm_object.php?ref_id=" . $this->object->getRefId();
01187 }
01188
01189 $bib_gui->edit("ADM_CONTENT", "adm_content", $a_target, $bibItemIndex);
01190 }
01191
01195 function saveBibItem()
01196 {
01197 $this->setTabs();
01198 $this->saveBibItemObject($this->ctrl->getLinkTarget($this));
01199 }
01200
01206 function exportObject()
01207 {
01208 return;
01209 }
01210
01216 function importObject()
01217 {
01218 $this->createObject();
01219 return;
01220 }
01221
01222
01229 function importFileObject()
01230 {
01231 global $_FILES, $rbacsystem, $ilDB;
01232
01233 include_once "./Modules/LearningModule/classes/class.ilObjLearningModule.php";
01234
01235
01236 $source = $_FILES["xmldoc"]["tmp_name"];
01237 if (($source == 'none') || (!$source))
01238 {
01239 $this->ilias->raiseError("No file selected!",$this->ilias->error_obj->MESSAGE);
01240 }
01241
01242
01243
01244
01245
01246
01247
01248
01249 $info = pathinfo($_FILES["xmldoc"]["name"]);
01250 if (strtolower($info["extension"]) != "zip")
01251 {
01252 $this->ilias->raiseError("File must be a zip file!",$this->ilias->error_obj->MESSAGE);
01253 }
01254
01255
01256 include_once("./Modules/LearningModule/classes/class.ilObjContentObject.php");
01257 $newObj = new ilObjContentObject();
01258 $newObj->setType($_GET["new_type"]);
01259 $newObj->setTitle($_FILES["xmldoc"]["name"]);
01260 $newObj->setDescription("");
01261 $newObj->create(true);
01262 $newObj->createReference();
01263 $newObj->putInTree($_GET["ref_id"]);
01264 $newObj->setPermissions($_GET["ref_id"]);
01265 $newObj->notify("new",$_GET["ref_id"],$_GET["parent_non_rbac_id"],$_GET["ref_id"],$newObj->getRefId());
01266
01267
01268 $newObj->createLMTree();
01269
01270
01271 $newObj->createImportDirectory();
01272
01273
01274 $file = pathinfo($_FILES["xmldoc"]["name"]);
01275 $full_path = $newObj->getImportDirectory()."/".$_FILES["xmldoc"]["name"];
01276
01277 ilUtil::moveUploadedFile($_FILES["xmldoc"]["tmp_name"],
01278 $_FILES["xmldoc"]["name"], $full_path);
01279
01280
01281
01282
01283 ilUtil::unzip($full_path);
01284
01285
01286 $subdir = basename($file["basename"],".".$file["extension"]);
01287 $xml_file = $newObj->getImportDirectory()."/".$subdir."/".$subdir.".xml";
01288
01289
01290 if (!is_dir($newObj->getImportDirectory()."/".$subdir))
01291 {
01292 $this->ilias->raiseError(sprintf($this->lng->txt("cont_no_subdir_in_zip"), $subdir),
01293 $this->ilias->error_obj->MESSAGE);
01294 }
01295
01296
01297 if (!is_file($xml_file))
01298 {
01299 $this->ilias->raiseError(sprintf($this->lng->txt("cont_zip_file_invalid"), $subdir."/".$subdir.".xml"),
01300 $this->ilias->error_obj->MESSAGE);
01301 }
01302
01303 include_once ("./Modules/LearningModule/classes/class.ilContObjParser.php");
01304 $contParser = new ilContObjParser($newObj, $xml_file, $subdir);
01305 $contParser->startParsing();
01306 ilObject::_writeImportId($newObj->getId(), $newObj->getImportId());
01307 $newObj->MDUpdateListener('General');
01308
01309
01310 $style_file = $newObj->getImportDirectory()."/".$subdir."/style.xml";
01311 if (is_file($style_file))
01312 {
01313 require_once("classes/class.ilObjStyleSheet.php");
01314 $style = new ilObjStyleSheet();
01315 $style->createFromXMLFile($style_file);
01316 $newObj->writeStyleSheetId($style->getId());
01317 }
01318
01319
01320 ilUtil::delDir($newObj->getImportDirectory());
01321 ilUtil::sendInfo($this->lng->txt($this->type."_added"),true);
01322
01323
01324 include_once("./Services/COPage/classes/class.ilPageObject.php");
01325 ilPageObject::_handleImportRepositoryLinks($newObj->getImportId(),
01326 $newObj->getType(), $newObj->getRefId());
01327 ilUtil::redirect("ilias.php?ref_id=".$newObj->getRefId().
01328 "&baseClass=ilLMEditorGUI");
01329 }
01330
01334 function chapters()
01335 {
01336 global $tree;
01337
01338 $this->setTabs();
01339
01340 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.structure_edit.html", "Modules/LearningModule");
01341 $num = 0;
01342
01343 $this->ctrl->setParameter($this, "backcmd", "chapters");
01344 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
01345 $this->tpl->setVariable("HEADER_TEXT", $this->lng->txt("cont_chapters"));
01346 $this->tpl->setVariable("CHECKBOX_TOP", IL_FIRST_NODE);
01347
01348
01349 $cnt = 0;
01350 $childs = $this->lm_tree->getChilds($this->lm_tree->getRootId());
01351 foreach ($childs as $child)
01352 {
01353 if($child["type"] != "st")
01354 {
01355 continue;
01356 }
01357
01358 $this->tpl->setCurrentBlock("table_row");
01359
01360 $css_row = ilUtil::switchColor($cnt++,"tblrow1","tblrow2");
01361
01362
01363 $this->tpl->setVariable("CHECKBOX_ID", $child["obj_id"]);
01364 $this->tpl->setVariable("CSS_ROW", $css_row);
01365 $this->tpl->setVariable("IMG_OBJ", ilUtil::getImagePath("icon_st.gif"));
01366
01367
01368 $this->ctrl->setParameter($this, "backcmd", "");
01369 $this->ctrl->setParameterByClass("ilStructureObjectGUI", "obj_id", $child["obj_id"]);
01370 $this->tpl->setVariable("LINK_TARGET",
01371 $this->ctrl->getLinkTargetByClass("ilStructureObjectGUI", "view"));
01372
01373
01374 $this->tpl->setVariable("TEXT_CONTENT",
01375 ilStructureObject::_getPresentationTitle($child["obj_id"],
01376 $this->object->isActiveNumbering()));
01377
01378 $this->tpl->parseCurrentBlock();
01379 }
01380
01381 $paste_active = false;
01382 if (ilEditClipboard::getContentObjectType() == "st")
01383 {
01384 if ($this->lm_tree->isInTree(ilEditClipboard::getContentObjectId())
01385 || ilEditClipboard::getAction() == "copy")
01386 {
01387 $paste_active = true;
01388 }
01389 }
01390
01391 if($cnt == 0 && !$paste_active)
01392 {
01393 $this->tpl->setCurrentBlock("notfound");
01394 $this->tpl->setVariable("NUM_COLS", 3);
01395 $this->tpl->setVariable("TXT_OBJECT_NOT_FOUND", $this->lng->txt("obj_not_found"));
01396 $this->tpl->parseCurrentBlock();
01397 }
01398 else
01399 {
01400
01401 $this->tpl->setVariable("NUM_COLS", 3);
01402 if ($cnt > 0)
01403 {
01404 $acts = array("delete" => "delete", "moveChapter" => "moveChapter",
01405 "copyChapter" => "copyChapter");
01406 }
01407 if ($paste_active)
01408 {
01409 $acts["pasteChapter"] = "pasteChapter";
01410 }
01411 $this->setActions($acts);
01412 $this->showActions();
01413 }
01414
01415
01416 $this->tpl->setVariable("NUM_COLS", 3);
01417 $subobj = array("st");
01418 $opts = ilUtil::formSelect(12,"new_type",$subobj);
01419 $this->tpl->setCurrentBlock("add_object");
01420 $this->tpl->setVariable("SELECT_OBJTYPE", $opts);
01421 $this->tpl->setVariable("BTN_NAME", "create");
01422 $this->tpl->setVariable("TXT_ADD", $this->lng->txt("insert"));
01423 $this->tpl->parseCurrentBlock();
01424
01425 $this->tpl->setCurrentBlock("form");
01426 $this->tpl->parseCurrentBlock();
01427
01428 }
01429
01430
01431
01432
01433
01434 function pages()
01435 {
01436 global $tree;
01437
01438 $this->setTabs();
01439
01440 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.all_pages.html", "Modules/LearningModule");
01441 $num = 0;
01442
01443 $this->tpl->setCurrentBlock("form");
01444 $this->ctrl->setParameter($this, "backcmd", "pages");
01445 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
01446 $this->tpl->setVariable("HEADER_TEXT", $this->lng->txt("cont_pages"));
01447 $this->tpl->setVariable("CONTEXT", $this->lng->txt("cont_usage"));
01448 $this->tpl->setVariable("CHECKBOX_TOP", IL_FIRST_NODE);
01449
01450 $cnt = 0;
01451 $pages = ilLMPageObject::getPageList($this->object->getId());
01452 foreach ($pages as $page)
01453 {
01454
01455 if (!ilLMPageObject::_lookupActive($page["obj_id"]))
01456 {
01457 $this->tpl->setCurrentBlock("deactivated");
01458 $this->tpl->setVariable("TXT_DEACTIVATED",
01459 $this->lng->txt("cont_page_deactivated"));
01460 $this->tpl->parseCurrentBlock();
01461 }
01462 else
01463 {
01464 if (ilPageObject::_lookupContainsDeactivatedElements($page["obj_id"],
01465 $this->object->getType()))
01466 {
01467 $this->tpl->setCurrentBlock("deactivated");
01468 $this->tpl->setVariable("TXT_DEACTIVATED",
01469 $this->lng->txt("cont_page_deactivated_elements"));
01470 $this->tpl->parseCurrentBlock();
01471 }
01472 }
01473
01474 $this->tpl->setCurrentBlock("table_row");
01475
01476 $css_row = ilUtil::switchColor($cnt++,"tblrow1","tblrow2");
01477
01478
01479 $this->tpl->setVariable("CHECKBOX_ID", $page["obj_id"]);
01480 $this->tpl->setVariable("CSS_ROW", $css_row);
01481 $this->tpl->setVariable("IMG_OBJ", ilUtil::getImagePath("icon_pg.gif"));
01482
01483
01484 $this->ctrl->setParameter($this, "backcmd", "");
01485 $this->ctrl->setParameterByClass("ilLMPageObjectGUI", "obj_id", $page["obj_id"]);
01486
01487 $this->tpl->setVariable("LINK_TARGET",
01488 $this->ctrl->getLinkTargetByClass("ilLMPageObjectGUI", "view"));
01489
01490
01491 $this->tpl->setVariable("TEXT_CONTENT", $page["title"]);
01492
01493
01494 if ($this->lm_tree->isInTree($page["obj_id"]))
01495 {
01496 $path_str = $this->getContextPath($page["obj_id"]);
01497 }
01498 else
01499 {
01500 $path_str = "---";
01501 }
01502
01503
01504 $add_str = "";
01505 if ($page["obj_id"] == $this->object->getHeaderPage())
01506 {
01507 $add_str = " <b>(".$this->lng->txt("cont_header").")</b>";
01508 }
01509 if ($page["obj_id"] == $this->object->getFooterPage())
01510 {
01511 $add_str = " <b>(".$this->lng->txt("cont_footer").")</b>";
01512 }
01513
01514 $this->tpl->setVariable("TEXT_CONTEXT", $path_str.$add_str);
01515
01516
01517 $this->tpl->parseCurrentBlock();
01518 }
01519 if($cnt == 0)
01520 {
01521 $this->tpl->setCurrentBlock("notfound");
01522 $this->tpl->setVariable("NUM_COLS", 4);
01523 $this->tpl->setVariable("TXT_OBJECT_NOT_FOUND", $this->lng->txt("obj_not_found"));
01524 $this->tpl->parseCurrentBlock();
01525 }
01526 else
01527 {
01528 $acts = array("delete" => "delete", "movePage" => "movePage", "copyPage" => "copyPage",
01529 "selectHeader" => "selectHeader", "selectFooter" => "selectFooter",
01530 "activatePages" => "cont_de_activate");
01531 if(ilEditClipboard::getContentObjectType() == "pg" &&
01532 ilEditClipboard::getAction() == "copy")
01533 {
01534 $acts["pastePage"] = "pastePage";
01535 }
01536
01537
01538
01539
01540
01541
01542 $this->setActions($acts);
01543 $this->tpl->setVariable("NUM_COLS", 4);
01544 $this->showActions();
01545
01546
01547
01548
01549
01550
01551
01552
01553 }
01554
01555
01556 $this->tpl->setVariable("NUM_COLS", 4);
01557
01558 $subobj = array("pg");
01559 $opts = ilUtil::formSelect(12,"new_type",$subobj);
01560 $this->tpl->setCurrentBlock("add_object");
01561 $this->tpl->setVariable("SELECT_OBJTYPE", $opts);
01562 $this->tpl->setVariable("BTN_NAME", "create");
01563 $this->tpl->setVariable("TXT_ADD", $this->lng->txt("create"));
01564 $this->tpl->parseCurrentBlock();
01565
01566
01567 $this->tpl->setCurrentBlock("form");
01568 $this->tpl->parseCurrentBlock();
01569
01570 }
01571
01575 function activatePages()
01576 {
01577 if (is_array($_POST["id"]))
01578 {
01579 foreach($_POST["id"] as $id)
01580 {
01581 $act = ilLMObject::_lookupActive($id);
01582 ilLMObject::_writeActive($id, !$act);
01583
01584 }
01585 }
01586
01587 $this->ctrl->redirect($this, "pages");
01588 }
01589
01593 function pastePage()
01594 {
01595 if(ilEditClipboard::getContentObjectType() != "pg")
01596 {
01597 $this->ilias->raiseError($this->lng->txt("no_page_in_clipboard"),$this->ilias->error_obj->MESSAGE);
01598 }
01599
01600
01601 $id = ilEditClipboard::getContentObjectId();
01602
01603
01604 if (ilEditClipboard::getAction() == "copy")
01605 {
01606
01607 if (ilLMObject::_lookupContObjID(ilEditClipboard::getContentObjectId())
01608 == $this->object->getID())
01609 {
01610 $lm_page = new ilLMPageObject($this->object, $id);
01611 $new_page =& $lm_page->copy();
01612 $id = $new_page->getId();
01613 }
01614 else
01615 {
01616
01617 $lm_id = ilLMObject::_lookupContObjID(ilEditClipboard::getContentObjectId());
01618 $lm_obj =& $this->ilias->obj_factory->getInstanceByObjId($lm_id);
01619 $lm_page = new ilLMPageObject($lm_obj, $id);
01620 $copied_nodes = array();
01621 $new_page =& $lm_page->copyToOtherContObject($this->object, $copied_nodes);
01622 $id = $new_page->getId();
01623 ilLMObject::updateInternalLinks($copied_nodes);
01624 }
01625 }
01626
01627
01628 if (ilEditClipboard::getAction() == "cut")
01629 {
01630
01631 if (ilLMObject::_lookupContObjID(ilEditClipboard::getContentObjectId())
01632 != $this->object->getID())
01633 {
01634 $lm_id = ilLMObject::_lookupContObjID(ilEditClipboard::getContentObjectId());
01635 $lm_obj =& $this->ilias->obj_factory->getInstanceByObjId($lm_id);
01636 $lm_page = new ilLMPageObject($lm_obj, $id);
01637 $lm_page->setLMId($this->object->getID());
01638 $lm_page->update();
01639 $page =& $lm_page->getPageObject();
01640 $page->buildDom();
01641 $page->setParentId($this->object->getID());
01642 $page->update();
01643 }
01644 }
01645
01646
01647 ilEditClipboard::clear();
01648 $this->ctrl->redirect($this, "pages");
01649 }
01650
01654 function copyPage()
01655 {
01656 if(!isset($_POST["id"]))
01657 {
01658 $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
01659 }
01660 if(count($_POST["id"]) > 1)
01661 {
01662 $this->ilias->raiseError($this->lng->txt("cont_select_max_one_item"),$this->ilias->error_obj->MESSAGE);
01663 }
01664
01665
01666 ilEditClipboard::storeContentObject("pg",$_POST["id"][0],"copy");
01667
01668 ilUtil::sendInfo($this->lng->txt("msg_copy_clipboard"), true);
01669
01670 $this->ctrl->redirect($this, "pages");
01671 }
01672
01680 function delete($a_parent_subobj_id = 0)
01681 {
01682 if(!isset($_POST["id"]))
01683 {
01684 $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
01685 }
01686
01687 if(count($_POST["id"]) == 1 && $_POST["id"][0] == IL_FIRST_NODE)
01688 {
01689 $this->ilias->raiseError($this->lng->txt("cont_select_item"), $this->ilias->error_obj->MESSAGE);
01690 }
01691
01692 if ($a_parent_subobj_id == 0)
01693 {
01694 $this->setTabs();
01695 }
01696
01697
01698 $_SESSION["saved_post"] = $_POST["id"];
01699
01700 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.confirm_deletion.html", "Modules/LearningModule");
01701
01702 ilUtil::sendInfo($this->lng->txt("info_delete_sure"));
01703
01704 if ($a_parent_subobj_id != 0)
01705 {
01706 $this->ctrl->setParameterByClass("ilStructureObjectGUI", "backcmd", $_GET["backcmd"]);
01707 $this->ctrl->setParameterByClass("ilStructureObjectGUI", "obj_id", $a_parent_subobj_id);
01708 $this->tpl->setVariable("FORMACTION",
01709 $this->ctrl->getFormActionByClass("ilStructureObjectGUI"));
01710 }
01711 else
01712 {
01713 $this->ctrl->setParameter($this, "backcmd", $_GET["backcmd"]);
01714 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
01715 }
01716
01717 $this->tpl->setCurrentBlock("table_header");
01718 $this->tpl->setVariable("TEXT",$this->lng->txt("objects"));
01719 $this->tpl->parseCurrentBlock();
01720
01721
01722
01723
01724 $counter = 0;
01725 foreach($_POST["id"] as $id)
01726 {
01727 if ($id != IL_FIRST_NODE)
01728 {
01729 $obj =& new ilLMObject($this->object, $id);
01730 switch($obj->getType())
01731 {
01732 case "pg":
01733 $this->tpl->setVariable("IMG_OBJ", ilUtil::getImagePath("icon_pg.gif"));
01734 break;
01735 case "st":
01736 $this->tpl->setVariable("IMG_OBJ", ilUtil::getImagePath("icon_st.gif"));
01737 break;
01738 }
01739 $this->tpl->setCurrentBlock("table_row");
01740 $this->tpl->setVariable("CSS_ROW",ilUtil::switchColor(++$counter,"tblrow1","tblrow2"));
01741 $this->tpl->setVariable("TEXT_CONTENT", $obj->getTitle());
01742 $this->tpl->parseCurrentBlock();
01743 }
01744 }
01745
01746
01747 $this->tpl->setVariable("IMG_ARROW",ilUtil::getImagePath("arrow_downright.gif"));
01748 $buttons = array( "cancelDelete" => $this->lng->txt("cancel"),
01749 "confirmedDelete" => $this->lng->txt("confirm"));
01750 foreach ($buttons as $name => $value)
01751 {
01752 $this->tpl->setCurrentBlock("operation_btn");
01753 $this->tpl->setVariable("BTN_NAME",$name);
01754 $this->tpl->setVariable("BTN_VALUE",$value);
01755 $this->tpl->parseCurrentBlock();
01756 }
01757 }
01758
01762 function cancelDelete()
01763 {
01764 session_unregister("saved_post");
01765
01766 $this->ctrl->redirect($this, $_GET["backcmd"]);
01767
01768 }
01769
01777 function confirmedDelete($a_parent_subobj_id = 0)
01778 {
01779 $tree = new ilTree($this->object->getId());
01780 $tree->setTableNames('lm_tree','lm_data');
01781 $tree->setTreeTablePK("lm_id");
01782
01783
01784 if (!isset($_SESSION["saved_post"]))
01785 {
01786 $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
01787 }
01788
01789
01790 foreach ($_SESSION["saved_post"] as $id)
01791 {
01792 if ($id != IL_FIRST_NODE)
01793 {
01794 $obj =& ilLMObjectFactory::getInstance($this->object, $id, false);
01795 $node_data = $tree->getNodeData($id);
01796 if (is_object($obj))
01797 {
01798 $obj->setLMId($this->object->getId());
01799
01800 include_once("classes/class.ilHistory.php");
01801 ilHistory::_createEntry($this->object->getId(), "delete_".$obj->getType(),
01802 array(ilLMObject::_lookupTitle($id), $id),
01803 $this->object->getType());
01804
01805 $obj->delete();
01806 }
01807 if($tree->isInTree($id))
01808 {
01809 $tree->deleteTree($node_data);
01810 }
01811 }
01812 }
01813
01814
01815 $this->object->checkTree();
01816
01817
01818 ilUtil::sendInfo($this->lng->txt("info_deleted"),true);
01819
01820 if ($a_parent_subobj_id == 0)
01821 {
01822 $this->ctrl->redirect($this, $_GET["backcmd"]);
01823 }
01824 }
01825
01826
01827
01834 function getContextPath($a_endnode_id, $a_startnode_id = 1)
01835 {
01836 $path = "";
01837
01838 $tmpPath = $this->lm_tree->getPathFull($a_endnode_id, $a_startnode_id);
01839
01840
01841 for ($i = 1; $i < (count($tmpPath) - 1); $i++)
01842 {
01843 if ($path != "")
01844 {
01845 $path .= " > ";
01846 }
01847
01848 $path .= $tmpPath[$i]["title"];
01849 }
01850
01851 return $path;
01852 }
01853
01854
01855
01861 function showActions()
01862 {
01863 $notoperations = array();
01864
01865 $operations = array();
01866
01867 $d = $this->actions;
01868
01869 foreach ($d as $row)
01870 {
01871 if (!in_array($row["name"], $notoperations))
01872 {
01873 $operations[] = $row;
01874 }
01875 }
01876
01877 if (count($operations)>0)
01878 {
01879 foreach ($operations as $val)
01880 {
01881 $this->tpl->setCurrentBlock("operation_btn");
01882 $this->tpl->setVariable("BTN_NAME", $val["name"]);
01883 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt($val["lng"]));
01884 $this->tpl->parseCurrentBlock();
01885 }
01886
01887 $this->tpl->setCurrentBlock("operation");
01888 $this->tpl->setVariable("IMG_ARROW",ilUtil::getImagePath("arrow_downright.gif"));
01889 $this->tpl->parseCurrentBlock();
01890 }
01891 }
01892
01896 function perm()
01897 {
01898 $this->setTabs();
01899
01900 $this->setFormAction("addRole", $this->ctrl->getLinkTarget($this, "addRole"));
01901 $this->setFormAction("permSave", $this->ctrl->getLinkTarget($this, "permSave"));
01902 $this->permObject();
01903 }
01904
01905
01909 function permSave()
01910 {
01911 $this->setReturnLocation("permSave", $this->ctrl->getLinkTarget($this, "perm"));
01912 $this->permSaveObject();
01913 }
01914
01918 function info()
01919 {
01920 $this->setTabs();
01921 $this->infoObject();
01922 }
01923
01924
01928 function addRole()
01929 {
01930 $this->setReturnLocation("addRole", $this->ctrl->getLinkTarget($this, "perm"));
01931 $this->addRoleObject();
01932 }
01933
01934
01938 function owner()
01939 {
01940 $this->setTabs();
01941 $this->ownerObject();
01942 }
01943
01944
01948 function view()
01949 {
01950 if (strtolower($_GET["baseClass"]) == "iladministrationgui")
01951 {
01952 $this->prepareOutput();
01953 parent::viewObject();
01954 }
01955 else
01956 {
01957 $this->viewObject();
01958 }
01959 }
01960
01961
01965 function moveChapter($a_parent_subobj_id = 0)
01966 {
01967 if(!isset($_POST["id"]))
01968 {
01969 $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
01970 }
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 if(count($_POST["id"]) == 1 && $_POST["id"][0] == IL_FIRST_NODE)
01978 {
01979 $this->ilias->raiseError($this->lng->txt("cont_select_item"), $this->ilias->error_obj->MESSAGE);
01980 }
01981
01982
01983 ilEditClipboard::storeContentObject("st", $_POST["id"][0], "move");
01984
01985 ilUtil::sendInfo($this->lng->txt("cont_chap_select_target_now"), true);
01986
01987 if ($a_parent_subobj_id == 0)
01988 {
01989 $this->ctrl->redirect($this, "chapters");
01990 }
01991 }
01992
01993
01997 function copyChapter($a_parent_subobj_id = 0)
01998 {
01999 if(!isset($_POST["id"]))
02000 {
02001 $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
02002 }
02003
02004 if(count($_POST["id"]) > 1)
02005 {
02006 $this->ilias->raiseError($this->lng->txt("cont_select_max_one_item"),$this->ilias->error_obj->MESSAGE);
02007 }
02008
02009 if(count($_POST["id"]) == 1 && $_POST["id"][0] == IL_FIRST_NODE)
02010 {
02011 $this->ilias->raiseError($this->lng->txt("cont_select_item"), $this->ilias->error_obj->MESSAGE);
02012 }
02013
02014
02015 ilEditClipboard::storeContentObject("st", $_POST["id"][0], "copy");
02016
02017 ilUtil::sendInfo($this->lng->txt("cont_chap_copy_select_target_now"), true);
02018
02019 if ($a_parent_subobj_id == 0)
02020 {
02021 $this->ctrl->redirect($this, "chapters");
02022 }
02023 }
02024
02028 function pasteChapter($a_parent_subobj_id = 0)
02029 {
02030 if (ilEditClipboard::getContentObjectType() != "st")
02031 {
02032 $this->ilias->raiseError($this->lng->txt("no_chapter_in_clipboard"),$this->ilias->error_obj->MESSAGE);
02033 }
02034
02035 $target_tree = new ilTree($this->object->getId());
02036 $target_tree->setTableNames('lm_tree','lm_data');
02037 $target_tree->setTreeTablePK("lm_id");
02038
02039
02040 if (ilLMObject::_lookupContObjID(ilEditClipboard::getContentObjectId())
02041 != $this->object->getID())
02042 {
02043 $source_tree = new ilTree(ilLMObject::_lookupContObjID(ilEditClipboard::getContentObjectId()));
02044 $source_tree->setTableNames('lm_tree','lm_data');
02045 $source_tree->setTreeTablePK("lm_id");
02046 }
02047 else
02048 {
02049 $source_tree =& $target_tree;
02050 }
02051
02052
02053 $id = ilEditClipboard::getContentObjectId();
02054 $node = $source_tree->getNodeData($id);
02055 $subnodes = $source_tree->getSubtree($node);
02056 foreach ($subnodes as $subnode)
02057 {
02058 if($subnode["obj_id"] == $a_parent_subobj_id)
02059 {
02060 $this->ilias->raiseError($this->lng->txt("cont_target_within_source"),$this->ilias->error_obj->MESSAGE);
02061 }
02062 }
02063 if($_POST["id"][0] == $id)
02064 {
02065 ilEditClipboard::clear();
02066 $this->ctrl->redirect($this, "chapters");
02067 }
02068
02069
02070 $parent = ($a_parent_subobj_id == 0)
02071 ? $target_tree->getRootId()
02072 : $a_parent_subobj_id;
02073
02074
02075 if(!isset($_POST["id"]))
02076 {
02077 $target = IL_LAST_NODE;
02078 }
02079 else
02080 {
02081 $target = $_POST["id"][0];
02082 }
02083 if($target == IL_FIRST_NODE)
02084 {
02085 $childs =& $target_tree->getChildsByType($parent, "pg");
02086 if (count($childs) != 0)
02087 {
02088 $target = $childs[count($childs) - 1]["obj_id"];
02089 }
02090 }
02091
02092
02093
02094
02095 if (ilEditClipboard::getAction() == "move")
02096 {
02097 if (ilLMObject::_lookupContObjID(ilEditClipboard::getContentObjectId())
02098 != $this->object->getID())
02099 {
02100
02101
02102 ilEditClipboard::clear();
02103 if ($a_parent_subobj_id == 0)
02104 {
02105 $this->ctrl->redirect($this, "chapters");
02106 }
02107 return;
02108 }
02109
02110 $target_tree->deleteTree($node);
02111
02112 if (!$target_tree->isInTree($id))
02113 {
02114 $target_tree->insertNode($id, $parent, $target);
02115
02116 foreach ($subnodes as $node)
02117 {
02118
02119
02120 if($node["obj_id"] != $id)
02121 {
02122 $target_tree->insertNode($node["obj_id"], $node["parent"]);
02123 }
02124 }
02125 }
02126 }
02127 else
02128 {
02129 $id = ilEditClipboard::getContentObjectId();
02130
02131 $copied_nodes = array();
02132 if (ilLMObject::_lookupContObjID($id)
02133 == $this->object->getID())
02134 {
02135 $source_obj = ilLMObjectFactory::getInstance($this->object, $id, true);
02136 $source_obj->setLMId($this->object->getId());
02137 $source_obj->copy($target_tree, $parent, $target, $copied_nodes);
02138 }
02139 else
02140 {
02141 $lm_id = ilLMObject::_lookupContObjID($id);
02142
02143 $source_lm =& ilObjectFactory::getInstanceByObjId($lm_id);
02144 $source_obj = ilLMObjectFactory::getInstance($source_lm, $id, true);
02145 $source_obj->setLMId($lm_id);
02146 $source_obj->copy($target_tree, $parent, $target, $copied_nodes);
02147 }
02148 }
02149
02150 ilLMObject::updateInternalLinks($copied_nodes);
02151
02152 ilEditClipboard::clear();
02153
02154
02155 $this->object->checkTree();
02156
02157 if ($a_parent_subobj_id == 0)
02158 {
02159 $this->ctrl->redirect($this, "chapters");
02160 }
02161 }
02162
02166 function movePage()
02167 {
02168 if(!isset($_POST["id"]))
02169 {
02170 $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
02171 }
02172 if(count($_POST["id"]) > 1)
02173 {
02174 $this->ilias->raiseError($this->lng->txt("cont_select_max_one_item"),$this->ilias->error_obj->MESSAGE);
02175 }
02176
02177
02178 ilEditClipboard::storeContentObject("pg", $_POST["id"][0]);
02179
02180 ilUtil::sendInfo($this->lng->txt("cont_page_select_target_now"), true);
02181 $this->ctrl->redirect($this, "pages");
02182 }
02183
02187 function cancel()
02188 {
02189 if ($_GET["new_type"] == "pg")
02190 {
02191 $this->ctrl->redirect($this, "pages");
02192 }
02193 else
02194 {
02195 $this->ctrl->redirect($this, "chapters");
02196 }
02197 }
02198
02199
02203 function export()
02204 {
02205 require_once("./Modules/LearningModule/classes/class.ilContObjectExport.php");
02206 $cont_exp = new ilContObjectExport($this->object);
02207 $cont_exp->buildExportFile();
02208 $this->ctrl->redirect($this, "exportList");
02209 }
02210
02214 function exportMenu()
02215 {
02216
02217 $this->tpl->setCurrentBlock("btn_cell");
02218 $this->tpl->setVariable("BTN_LINK", $this->ctrl->getLinkTarget($this, "export"));
02219 $this->tpl->setVariable("BTN_TXT", $this->lng->txt("cont_create_export_file_xml"));
02220 $this->tpl->parseCurrentBlock();
02221
02222
02223 $this->tpl->setCurrentBlock("btn_cell");
02224 $this->tpl->setVariable("BTN_LINK", $this->ctrl->getLinkTarget($this, "exportHTML"));
02225 $this->tpl->setVariable("BTN_TXT", $this->lng->txt("cont_create_export_file_html"));
02226 $this->tpl->parseCurrentBlock();
02227
02228
02229 $this->tpl->setCurrentBlock("btn_cell");
02230 $this->tpl->setVariable("BTN_LINK", $this->ctrl->getLinkTarget($this, "exportSCORM"));
02231 $this->tpl->setVariable("BTN_TXT", $this->lng->txt("cont_create_export_file_scorm"));
02232 $this->tpl->parseCurrentBlock();
02233
02234
02235 if (is_file($this->object->getExportDirectory()."/export.log"))
02236 {
02237 $this->tpl->setCurrentBlock("btn_cell");
02238 $this->tpl->setVariable("BTN_LINK", $this->ctrl->getLinkTarget($this, "viewExportLog"));
02239 $this->tpl->setVariable("BTN_TXT", $this->lng->txt("cont_view_last_export_log"));
02240 $this->tpl->parseCurrentBlock();
02241 }
02242
02243 }
02244
02245
02246
02247
02248 function exportList()
02249 {
02250 global $tree;
02251
02252 $this->setTabs();
02253
02254
02255 $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
02256
02257 $this->exportMenu();
02258
02259 $export_files = $this->object->getExportFiles();
02260
02261
02262 require_once("./Services/Table/classes/class.ilTableGUI.php");
02263 $tbl = new ilTableGUI();
02264
02265
02266 $this->tpl->addBlockfile("ADM_CONTENT", "adm_content", "tpl.table.html");
02267
02268
02269 $this->tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.export_file_row.html", "Modules/LearningModule");
02270
02271 $num = 0;
02272
02273 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
02274
02275 $tbl->setTitle($this->lng->txt("cont_export_files"));
02276
02277 $tbl->setHeaderNames(array("", $this->lng->txt("type"),
02278 $this->lng->txt("cont_file"),
02279 $this->lng->txt("cont_size"), $this->lng->txt("date") ));
02280
02281 $cols = array("", "type", "file", "size", "date");
02282 $header_params = array("ref_id" => $_GET["ref_id"], "baseClass" => $_GET["baseClass"],
02283 "cmd" => "exportList", "cmdClass" => strtolower(get_class($this)));
02284 $tbl->setHeaderVars($cols, $header_params);
02285 $tbl->setColumnWidth(array("1%", "9%", "40%", "25%", "25%"));
02286
02287
02288 $tbl->setOrderColumn($_GET["sort_by"]);
02289 $tbl->setOrderDirection($_GET["sort_order"]);
02290 $tbl->setLimit($_GET["limit"]);
02291 $tbl->setOffset($_GET["offset"]);
02292 $tbl->setMaxCount($this->maxcount);
02293 $tbl->disable("sort");
02294
02295
02296 $this->tpl->setVariable("COLUMN_COUNTS", 5);
02297
02298
02299 $this->tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.gif"));
02300 $this->tpl->setCurrentBlock("tbl_action_btn");
02301 $this->tpl->setVariable("BTN_NAME", "confirmDeleteExportFile");
02302 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("delete"));
02303 $this->tpl->parseCurrentBlock();
02304
02305 $this->tpl->setCurrentBlock("tbl_action_btn");
02306 $this->tpl->setVariable("BTN_NAME", "downloadExportFile");
02307 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("download"));
02308 $this->tpl->parseCurrentBlock();
02309
02310 $this->tpl->setCurrentBlock("tbl_action_btn");
02311 $this->tpl->setVariable("BTN_NAME", "publishExportFile");
02312 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("cont_public_access"));
02313 $this->tpl->parseCurrentBlock();
02314
02315
02316 $tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
02317
02318
02319 $tbl->setMaxCount(count($export_files));
02320 $export_files = array_slice($export_files, $_GET["offset"], $_GET["limit"]);
02321 $tbl->render();
02322 if(count($export_files) > 0)
02323 {
02324 $i=0;
02325 foreach($export_files as $exp_file)
02326 {
02327 $this->tpl->setCurrentBlock("tbl_content");
02328 $this->tpl->setVariable("TXT_FILENAME", $exp_file["file"]);
02329
02330 $css_row = ilUtil::switchColor($i++, "tblrow1", "tblrow2");
02331 $this->tpl->setVariable("CSS_ROW", $css_row);
02332
02333 $this->tpl->setVariable("TXT_SIZE", $exp_file["size"]);
02334 $public_str = ($exp_file["file"] == $this->object->getPublicExportFile($exp_file["type"]))
02335 ? " <b>(".$this->lng->txt("public").")<b>"
02336 : "";
02337 $this->tpl->setVariable("TXT_TYPE", $exp_file["type"].$public_str);
02338 $this->tpl->setVariable("CHECKBOX_ID", $exp_file["type"].":".$exp_file["file"]);
02339
02340 $file_arr = explode("__", $exp_file["file"]);
02341 $this->tpl->setVariable("TXT_DATE", date("Y-m-d H:i:s",$file_arr[0]));
02342
02343 $this->tpl->parseCurrentBlock();
02344 }
02345 }
02346 else
02347 {
02348 $this->tpl->setCurrentBlock("notfound");
02349 $this->tpl->setVariable("TXT_OBJECT_NOT_FOUND", $this->lng->txt("obj_not_found"));
02350 $this->tpl->setVariable("NUM_COLS", 4);
02351 $this->tpl->parseCurrentBlock();
02352 }
02353
02354 $this->tpl->parseCurrentBlock();
02355 }
02356
02357
02358
02359
02360 function viewExportLog()
02361 {
02362 global $tree;
02363
02364 $this->setTabs();
02365
02366
02367 $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
02368
02369 $this->exportMenu();
02370
02371
02372 $this->tpl->setVariable("ADM_CONTENT",
02373 nl2br(file_get_contents($this->object->getExportDirectory()."/export.log")));
02374
02375 $this->tpl->parseCurrentBlock();
02376 }
02377
02381 function downloadExportFile()
02382 {
02383 if(!isset($_POST["file"]))
02384 {
02385 $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
02386 }
02387
02388 if (count($_POST["file"]) > 1)
02389 {
02390 $this->ilias->raiseError($this->lng->txt("cont_select_max_one_item"),$this->ilias->error_obj->MESSAGE);
02391 }
02392
02393 $file = explode(":", $_POST["file"][0]);
02394 $export_dir = $this->object->getExportDirectory($file[0]);
02395 ilUtil::deliverFile($export_dir."/".$file[1],
02396 $file[1]);
02397 }
02398
02402 function publishExportFile()
02403 {
02404 if(!isset($_POST["file"]))
02405 {
02406 $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
02407 }
02408 if (count($_POST["file"]) > 1)
02409 {
02410 $this->ilias->raiseError($this->lng->txt("cont_select_max_one_item"),$this->ilias->error_obj->MESSAGE);
02411 }
02412
02413 $file = explode(":", $_POST["file"][0]);
02414 $export_dir = $this->object->getExportDirectory($file[0]);
02415
02416 if ($this->object->getPublicExportFile($file[0]) ==
02417 $file[1])
02418 {
02419 $this->object->setPublicExportFile($file[0], "");
02420 }
02421 else
02422 {
02423 $this->object->setPublicExportFile($file[0], $file[1]);
02424 }
02425 $this->object->update();
02426 $this->ctrl->redirect($this, "exportList");
02427 }
02428
02432 function downloadPDFFile()
02433 {
02434 if(!isset($_POST["file"]))
02435 {
02436 $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
02437 }
02438
02439 if (count($_POST["file"]) > 1)
02440 {
02441 $this->ilias->raiseError($this->lng->txt("cont_select_max_one_item"),$this->ilias->error_obj->MESSAGE);
02442 }
02443
02444
02445 $export_dir = $this->object->getOfflineDirectory();
02446 ilUtil::deliverFile($export_dir."/".$_POST["file"][0],
02447 $_POST["file"][0]);
02448 }
02449
02453 function confirmDeleteExportFile()
02454 {
02455 if(!isset($_POST["file"]))
02456 {
02457 $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
02458 }
02459
02460 $this->setTabs();
02461
02462
02463 $_SESSION["ilExportFiles"] = $_POST["file"];
02464
02465 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.confirm_deletion.html", "Modules/LearningModule");
02466
02467 ilUtil::sendInfo($this->lng->txt("info_delete_sure"));
02468
02469 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
02470
02471
02472 $this->tpl->setCurrentBlock("table_header");
02473 $this->tpl->setVariable("TEXT",$this->lng->txt("objects"));
02474 $this->tpl->parseCurrentBlock();
02475
02476
02477 $counter = 0;
02478 foreach($_POST["file"] as $file)
02479 {
02480 $file = explode(":", $file);
02481 $this->tpl->setCurrentBlock("table_row");
02482 $this->tpl->setVariable("CSS_ROW",ilUtil::switchColor(++$counter,"tblrow1","tblrow2"));
02483 $this->tpl->setVariable("TEXT_CONTENT", $file[1]." (".$file[0].")");
02484 $this->tpl->parseCurrentBlock();
02485 }
02486
02487
02488 $this->tpl->setVariable("IMG_ARROW",ilUtil::getImagePath("arrow_downright.gif"));
02489 $buttons = array( "cancelDeleteExportFile" => $this->lng->txt("cancel"),
02490 "deleteExportFile" => $this->lng->txt("confirm"));
02491 foreach ($buttons as $name => $value)
02492 {
02493 $this->tpl->setCurrentBlock("operation_btn");
02494 $this->tpl->setVariable("BTN_NAME",$name);
02495 $this->tpl->setVariable("BTN_VALUE",$value);
02496 $this->tpl->parseCurrentBlock();
02497 }
02498 }
02499
02500
02504 function cancelDeleteExportFile()
02505 {
02506 session_unregister("ilExportFiles");
02507 $this->ctrl->redirect($this, "exportList");
02508 }
02509
02510
02514 function deleteExportFile()
02515 {
02516 foreach($_SESSION["ilExportFiles"] as $file)
02517 {
02518 $file = explode(":", $file);
02519 $export_dir = $this->object->getExportDirectory($file[0]);
02520
02521 $exp_file = $export_dir."/".$file[1];
02522 $exp_dir = $export_dir."/".substr($file[1], 0, strlen($file[1]) - 4);
02523 if (@is_file($exp_file))
02524 {
02525 unlink($exp_file);
02526 }
02527 if (@is_dir($exp_dir))
02528 {
02529 ilUtil::delDir($exp_dir);
02530 }
02531 }
02532 $this->ctrl->redirect($this, "exportList");
02533 }
02534
02539 function fixTreeConfirm()
02540 {
02541 $this->setTabs();
02542
02543 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.confirm.html");
02544
02545 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
02546
02547
02548 $this->tpl->setVariable("TXT_CONFIRM", $this->lng->txt("confirmation"));
02549 $this->tpl->setVariable("TXT_CONTENT", $this->lng->txt("cont_fix_tree_confirm"));
02550 $this->tpl->setVariable("CMD_CANCEL", "cancelFixTree");
02551 $this->tpl->setVariable("CMD_OK", "fixTree");
02552 $this->tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
02553 $this->tpl->setVariable("TXT_OK", $this->lng->txt("cont_fix_tree"));
02554 }
02555
02561 function cancelObject($in_rep = false)
02562 {
02563 ilUtil::sendInfo($this->lng->txt("msg_cancel"),true);
02564 ilUtil::redirect("repository.php?cmd=frameset&ref_id=".$_GET["ref_id"]);
02565
02566 }
02567
02571 function cancelFixTree()
02572 {
02573 $this->ctrl->redirect($this, "properties");
02574 }
02575
02579 function fixTree()
02580 {
02581 $this->object->fixTree();
02582 ilUtil::sendInfo($this->lng->txt("cont_tree_fixed"), true);
02583 $this->ctrl->redirect($this, "properties");
02584 }
02585
02589 function setilLMMenu($a_offline = false, $a_export_format = "",
02590 $a_active = "content", $a_use_global_tabs = false)
02591 {
02592 global $ilCtrl,$ilUser, $ilAccess, $ilTabs;
02593
02594 $active[$a_active] = true;
02595
02596 if (!$this->object->isActiveLMMenu())
02597 {
02598 return "";
02599 }
02600
02601 if ($a_use_global_tabs)
02602 {
02603 $tabs_gui = $ilTabs;
02604 }
02605 else
02606 {
02607 $tabs_gui = new ilTabsGUI();
02608 }
02609
02610
02611
02612
02613 $showViewInFrameset = true;
02614
02615 if ($showViewInFrameset && !$a_offline)
02616 {
02617 $buttonTarget = ilFrameTargetInfo::_getFrame("MainContent");
02618 }
02619 else
02620 {
02621 $buttonTarget = "_top";
02622 }
02623
02624 if ($a_export_format == "scorm")
02625 {
02626 $buttonTarget = "";
02627 }
02628
02629
02630 if ($a_export_format != "scorm" && !$a_offline)
02631 {
02632 if (!$a_offline)
02633 {
02634 $ilCtrl->setParameterByClass("illmpresentationgui", "obj_id", $_GET["obj_id"]);
02635 $link = $this->ctrl->getLinkTargetByClass(
02636 array("illmpresentationgui", "ilinfoscreengui"), "showSummary");
02637 }
02638 else
02639 {
02640 $link = "./info.html";
02641 }
02642
02643 $tabs_gui->addTarget("info_short", $link,
02644 "", "", $buttonTarget, $active["info"]);
02645 }
02646
02647
02648 if (!$a_offline && $ilAccess->checkAccess("read", "", $_GET["ref_id"]))
02649 {
02650 $ilCtrl->setParameterByClass("illmpresentationgui", "obj_id", $_GET["obj_id"]);
02651 $tabs_gui->addTarget("content",
02652 $ilCtrl->getLinkTargetByClass("illmpresentationgui", "layout"),
02653 "", "", $buttonTarget, $active["content"]);
02654 }
02655
02656
02657 if ($this->object->isActiveTOC() && $ilAccess->checkAccess("read", "", $_GET["ref_id"]))
02658 {
02659 if (!$a_offline)
02660 {
02661 $ilCtrl->setParameterByClass("illmpresentationgui", "obj_id", $_GET["obj_id"]);
02662 $link = $ilCtrl->getLinkTargetByClass("illmpresentationgui", "showTableOfContents");
02663 }
02664 else
02665 {
02666 $link = "./table_of_contents.html";
02667 }
02668
02669 $tabs_gui->addTarget("cont_toc", $link,
02670 "", "", $buttonTarget, $active["toc"]);
02671 }
02672
02673
02674 if ($this->object->isActivePrintView() && $ilAccess->checkAccess("read", "", $_GET["ref_id"]))
02675 {
02676 if (!$a_offline)
02677 {
02678 $ilCtrl->setParameterByClass("illmpresentationgui", "obj_id", $_GET["obj_id"]);
02679 $link = $ilCtrl->getLinkTargetByClass("illmpresentationgui", "showPrintViewSelection");
02680 $tabs_gui->addTarget("cont_print_view", $link,
02681 "", "", $buttonTarget, $active["print"]);
02682 }
02683 }
02684
02685
02686 if ($ilUser->getId() == ANONYMOUS_USER_ID)
02687 {
02688 $is_public = $this->object->isActiveDownloadsPublic();
02689 }
02690 else
02691 {
02692 $is_public = true;
02693 }
02694
02695 if ($this->object->isActiveDownloads() && !$a_offline && $is_public &&
02696 $ilAccess->checkAccess("read", "", $_GET["ref_id"]))
02697 {
02698 $ilCtrl->setParameterByClass("illmpresentationgui", "obj_id", $_GET["obj_id"]);
02699 $link = $ilCtrl->getLinkTargetByClass("illmpresentationgui", "showDownloadList");
02700 $tabs_gui->addTarget("download", $link,
02701 "", "", $buttonTarget, $active["download"]);
02702 }
02703
02704
02705 $this->__initLMMenuEditor();
02706 $entries = $this->lmme_obj->getMenuEntries(true);
02707
02708 if (count($entries) > 0 && $ilAccess->checkAccess("read", "", $_GET["ref_id"]))
02709 {
02710 foreach ($entries as $entry)
02711 {
02712
02713 if ($entry["type"] == "intern")
02714 {
02715 $entry["link"] = ILIAS_HTTP_PATH."/goto.php?target=".$entry["link"];
02716 }
02717
02718
02719 if (!strstr($entry["link"],'://') && !strstr($entry["link"],'mailto:'))
02720 {
02721 $entry["link"] = "http://".$entry["link"];
02722 }
02723
02724 if (!strstr($entry["link"],'mailto:'))
02725 {
02726 $entry["link"] = ilUtil::appendUrlParameterString($entry["link"], "ref_id=".$this->ref_id."&structure_id=".$this->obj_id);
02727 }
02728 $tabs_gui->addTarget($entry["title"],
02729 $entry["link"],
02730 "", "", "_blank", "", true);
02731 }
02732 }
02733
02734 return $tabs_gui->getHTML();
02735 }
02736
02740 function createPDF()
02741 {
02742 require_once("./Modules/LearningModule/classes/class.ilContObjectExport.php");
02743 $cont_exp = new ilContObjectExport($this->object, "pdf");
02744 $cont_exp->buildExportFile();
02745 $this->offlineList();
02746 }
02747
02751 function exportHTML()
02752 {
02753 require_once("./Modules/LearningModule/classes/class.ilContObjectExport.php");
02754 $cont_exp = new ilContObjectExport($this->object, "html");
02755 $cont_exp->buildExportFile();
02756
02757 $this->ctrl->redirect($this, "exportList");
02758 }
02759
02763 function exportSCORM()
02764 {
02765 require_once("./Modules/LearningModule/classes/class.ilContObjectExport.php");
02766 $cont_exp = new ilContObjectExport($this->object, "scorm");
02767 $cont_exp->buildExportFile();
02768
02769 $this->ctrl->redirect($this, "exportList");
02770 }
02771
02777 function addLocations($a_omit_obj_id = false)
02778 {
02779 global $lng, $tree, $ilLocator;
02780
02781
02782
02783 $this->ctrl->addLocation(
02784 "...",
02785 "");
02786
02787 $par_id = $tree->getParentId($_GET["ref_id"]);
02788 $this->ctrl->addLocation(
02789 ilObject::_lookupTitle(ilObject::_lookupObjId($par_id)),
02790 "repository.php?cmd=frameset&ref_id=".$par_id,
02791 ilFrameTargetInfo::_getFrame("MainContent"), $par_id);
02792 if (!$a_omit_obj_id)
02793 {
02794 $obj_id = $_GET["obj_id"];
02795 }
02796 $lmtree =& $this->object->getTree();
02797
02798 if (($obj_id != 0) && $lmtree->isInTree($obj_id))
02799 {
02800 $path = $lmtree->getPathFull($obj_id);
02801 }
02802 else
02803 {
02804 $path = $lmtree->getPathFull($lmtree->getRootId());
02805 if ($obj_id != 0)
02806 {
02807 $path[] = array("type" => "pg", "child" => $this->obj_id,
02808 "title" => ilLMPageObject::_getPresentationTitle($this->obj_id));
02809 }
02810 }
02811
02812 $modifier = 1;
02813
02814 foreach ($path as $key => $row)
02815 {
02816 if ($row["child"] == 1)
02817 {
02818 $this->ctrl->setParameter($this, "obj_id", "");
02819 $this->ctrl->addLocation(
02820 $this->object->getTitle(),
02821 $this->ctrl->getLinkTarget($this, "properties"), "", $_GET["ref_id"]);
02822 }
02823 else
02824 {
02825 $title = $row["title"];
02826 switch($row["type"])
02827 {
02828 case "st":
02829 $this->ctrl->setParameterByClass("ilstructureobjectgui", "obj_id", $row["child"]);
02830 $this->ctrl->addLocation(
02831 $title,
02832 $this->ctrl->getLinkTargetByClass("ilstructureobjectgui", "view"));
02833 break;
02834
02835 case "pg":
02836 $this->ctrl->setParameterByClass("illmpageobjectgui", "obj_id", $row["child"]);
02837 $this->ctrl->addLocation(
02838 $title,
02839 $this->ctrl->getLinkTargetByClass("illmpageobjectgui", "view"));
02840 break;
02841 }
02842 }
02843 }
02844 if (!$a_omit_obj_id)
02845 {
02846 $this->ctrl->setParameter($this, "obj_id", $_GET["obj_id"]);
02847 }
02848 }
02849
02850
02854 function setTabs()
02855 {
02856
02857 #include_once("classes/class.ilTabsGUI.php");
02858 #$tabs_gui =& new ilTabsGUI();
02859 $this->getTabs($this->tabs_gui);
02860 $this->tpl->setCurrentBlock("header_image");
02861 $this->tpl->setVariable("IMG_HEADER", ilUtil::getImagePath("icon_lm_b.gif"));
02862 $this->tpl->parseCurrentBlock();
02863 $this->tpl->setCurrentBlock("content");
02864 #$this->tpl->setVariable("TABS", $tabs_gui->getHTML());
02865 $this->tpl->setVariable("HEADER", $this->object->getTitle());
02866 }
02867
02873 function getTabs(&$tabs_gui)
02874 {
02875 global $rbacsystem,$ilUser;
02876
02877
02878
02879
02880
02881 $tabs_gui->addTarget("info_short",
02882 $this->ctrl->getLinkTargetByClass("ilinfoscreengui",'showSummary'),
02883 "", "ilinfoscreengui");
02884
02885
02886 $tabs_gui->addTarget("properties",
02887 $this->ctrl->getLinkTarget($this,'properties'),
02888 "properties", get_class($this));
02889
02890
02891 $tabs_gui->addTarget("meta_data",
02892 $this->ctrl->getLinkTargetByClass('ilmdeditorgui',''),
02893 "", "ilmdeditorgui");
02894
02895
02896 $tabs_gui->addTarget("cont_chapters",
02897 $this->ctrl->getLinkTarget($this, "chapters"),
02898 "chapters", get_class($this));
02899
02900
02901 $tabs_gui->addTarget("cont_all_pages",
02902 $this->ctrl->getLinkTarget($this, "pages"),
02903 "pages", get_class($this));
02904
02905 if ($this->object->getType() == "lm")
02906 {
02907
02908 $tabs_gui->addTarget("export",
02909 $this->ctrl->getLinkTarget($this, "exportList"),
02910 array("exportList", "viewExportLog"), get_class($this));
02911
02912
02913 if(@include_once('HTTP/Request.php'))
02914 {
02915
02916 $tabs_gui->addTarget("link_check",
02917 $this->ctrl->getLinkTarget($this, "linkChecker"),
02918 array("linkChecker", "refreshLinkCheck"), get_class($this));
02919 }
02920 }
02921 else
02922 {
02923
02924 $tabs_gui->addTarget("bib_data",
02925 $this->ctrl->getLinkTarget($this, "editBibItem"),
02926 "editBibItem", get_class($this));
02927 }
02928
02929 include_once("Services/Tracking/classes/class.ilObjUserTracking.php");
02930 if(ilObjUserTracking::_enabledLearningProgress() and ($this->object->getType() == 'lm') and $ilUser->getId() != ANONYMOUS_USER_ID)
02931 {
02932 $tabs_gui->addTarget('learning_progress',
02933 $this->ctrl->getLinkTargetByClass(array('illearningprogressgui'),''),
02934 '',
02935 array('illplistofobjectsgui','illplistofsettingsgui','illearningprogressgui','illplistofprogressgui','illmstatisticsgui'));
02936 }
02937
02938 $tabs_gui->addTarget("history", $this->ctrl->getLinkTarget($this, "history")
02939 , "history", get_class($this));
02940
02941
02942
02943 if ($rbacsystem->checkAccess('edit_permission',$this->object->getRefId()))
02944 {
02945 $tabs_gui->addTarget("perm_settings",
02946 $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"), array("perm","info","owner"), 'ilpermissiongui');
02947 }
02948 }
02949
02950 function editPublicSection()
02951 {
02952 $this->setTabs();
02953
02954 switch ($this->object->getType())
02955 {
02956 case "lm":
02957 $gui_class = "ilobjlearningmodulegui";
02958 break;
02959
02960 case "dlb":
02961 $gui_class = "ilobjdlbookgui";
02962 break;
02963 }
02964
02965
02966 $this->lm_obj =& new ilObjLearningModule($this->ref_id, true);
02967
02968 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.lm_public_selector.html");
02969
02970
02971 require_once ("./Modules/LearningModule/classes/class.ilPublicSectionSelector.php");
02972 $exp = new ilPublicSectionSelector($this->ctrl->getLinkTarget($this, "view"),
02973 $this->object, $gui_class);
02974
02975 $exp->setTargetGet("obj_id");
02976
02977
02978 $exp->setOutput(0);
02979 $output = $exp->getOutput();
02980
02981
02982 foreach ($exp->format_options as $node)
02983 {
02984 if (!$node["container"])
02985 {
02986 $pages[] = $node["child"];
02987 }
02988 }
02989
02990 $js_pages = ilUtil::array_php2js($pages);
02991
02992
02993
02994
02995 $this->tpl->setVariable("TXT_SET_PUBLIC_MODE", $this->lng->txt("set_public_mode"));
02996 $this->tpl->setVariable("TXT_CHOOSE_PUBLIC_MODE", $this->lng->txt("choose_public_mode"));
02997 $modes = array("complete" => $this->lng->txt("all_pages"), "selected" => $this->lng->txt("selected_pages_only"));
02998 $select_public_mode = ilUtil::formSelect ($this->object->getPublicAccessMode(),"lm_public_mode",$modes, false, true);
02999 $this->tpl->setVariable("SELECT_PUBLIC_MODE", $select_public_mode);
03000
03001 $this->tpl->setVariable("TXT_EXPLORER_HEADER", $this->lng->txt("choose_public_pages"));
03002 $this->tpl->setVariable("EXP_REFRESH", $this->lng->txt("refresh"));
03003 $this->tpl->setVariable("EXPLORER",$output);
03004 $this->tpl->setVariable("ONCLICK",$js_pages);
03005 $this->tpl->setVariable("TXT_CHECKALL", $this->lng->txt("check_all"));
03006 $this->tpl->setVariable("TXT_UNCHECKALL", $this->lng->txt("uncheck_all"));
03007 $this->tpl->setVariable("TXT_SAVE", $this->lng->txt("save"));
03008 $this->tpl->setVariable("FORMACTION", $this->ctrl->getLinkTarget($this, "savePublicSection"));
03009
03010
03011 }
03012
03013 function savePublicSection()
03014 {
03015
03016 $this->object->setPublicAccessMode($_POST["lm_public_mode"]);
03017 $this->object->updateProperties();
03018 ilLMObject::_writePublicAccessStatus($_POST["pages"],$this->object->getId());
03019 ilUtil::sendInfo($this->lng->txt("msg_obj_modified"), true);
03020 $this->ctrl->redirect($this, "editPublicSection");
03021 }
03022
03028 function history()
03029 {
03030 $this->setTabs();
03031
03032 require_once("classes/class.ilHistoryGUI.php");
03033 $hist_gui =& new ilHistoryGUI($this->object->getId() ,
03034 $this->object->getType());
03035 $hist_html = $hist_gui->getHistoryTable(
03036 $this->ctrl->getParameterArray($this, "history"),
03037 $this->object->isActiveHistoryUserComments()
03038 );
03039
03040 $this->tpl->setVariable("ADM_CONTENT", $hist_html);
03041 }
03042
03043
03044 function linkChecker()
03045 {
03046 global $ilias,$ilUser;
03047
03048 $this->__initLinkChecker();
03049
03050 $invalid_links = $this->link_checker_obj->getInvalidLinksFromDB();
03051
03052
03053 $this->setTabs();
03054
03055 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.link_check.html", "Modules/LearningModule");
03056
03057 if($last_access = $this->link_checker_obj->getLastCheckTimestamp())
03058 {
03059 $this->tpl->setCurrentBlock("LAST_MODIFIED");
03060 $this->tpl->setVariable("AS_OF",$this->lng->txt('last_change').": ");
03061 $this->tpl->setVariable("LAST_CHECK",date('Y-m-d H:i:s',$last_access));
03062 $this->tpl->parseCurrentBlock();
03063 }
03064
03065
03066 $this->tpl->setVariable("F_ACTION",$this->ctrl->getFormAction($this));
03067
03068 $this->tpl->setVariable("TYPE_IMG",ilUtil::getImagePath('icon_lm.gif'));
03069 $this->tpl->setVariable("ALT_IMG",$this->lng->txt('learning_module'));
03070 $this->tpl->setVariable("TITLE",$this->object->getTitle().' ('.$this->lng->txt('link_check').')');
03071 $this->tpl->setVariable("PAGE_TITLE",$this->lng->txt('cont_pg_title'));
03072 $this->tpl->setVariable("URL",$this->lng->txt('url'));
03073 $this->tpl->setVariable("OPTIONS",$this->lng->txt('edit'));
03074
03075 if(!count($invalid_links))
03076 {
03077 $this->tpl->setCurrentBlock("no_invalid");
03078 $this->tpl->setVariable("TXT_NO_INVALID",$this->lng->txt('no_invalid_links'));
03079 $this->tpl->parseCurrentBlock();
03080 }
03081 else
03082 {
03083 $counter = 0;
03084 foreach($invalid_links as $invalid)
03085 {
03086 $this->tpl->setCurrentBlock("invalid_row");
03087 $this->tpl->setVariable("ROW_COLOR",ilUtil::switchColor(++$counter,'tblrow1','tblrow2'));
03088 $this->tpl->setVariable("ROW_PAGE_TITLE",
03089 ilLMPageObject::_getPresentationTitle($invalid['page_id'],$this->object->getPageHeader()));
03090 $this->tpl->setVariable("ROW_URL",$invalid['url']);
03091
03092
03093
03094 $this->ctrl->setParameterByClass('ilLMPageObjectGUI','obj_id',$invalid['page_id']);
03095 $this->tpl->setVariable("ROW_EDIT_LINK",$this->ctrl->getLinkTargetByClass('ilLMPageObjectGUI','view'));
03096
03097 $this->tpl->setVariable("ROW_IMG",ilUtil::getImagePath('edit.gif'));
03098 $this->tpl->setVariable("ROW_ALT_IMG",$this->lng->txt('edit'));
03099 $this->tpl->parseCurrentBlock();
03100 }
03101 }
03102 if((bool) $ilias->getSetting('cron_link_check'))
03103 {
03104 include_once './classes/class.ilLinkCheckNotify.php';
03105
03106
03107 $this->tpl->setCurrentBlock("MESSAGE_BLOCK");
03108 $this->tpl->setVariable("INFO_MESSAGE",$this->lng->txt('link_check_message_a'));
03109 $this->tpl->setVariable("CHECK_MESSAGE",ilUtil::formCheckbox(
03110 ilLinkCheckNotify::_getNotifyStatus($ilUser->getId(),$this->object->getId()),
03111 'link_check_message',
03112 1));
03113 $this->tpl->setVariable("INFO_MESSAGE_LONG",$this->lng->txt('link_check_message_b'));
03114 $this->tpl->parseCurrentBlock();
03115
03116
03117 $this->tpl->setCurrentBlock("CRON_ENABLED");
03118 $this->tpl->setVariable("DOWNRIGHT_IMG",ilUtil::getImagePath('arrow_downright.gif'));
03119 $this->tpl->setVariable("BTN_SUBMIT_LINK_CHECK",$this->lng->txt('save'));
03120 $this->tpl->parseCurrentBlock();
03121 }
03122 $this->tpl->setVariable("BTN_REFRESH",$this->lng->txt('refresh'));
03123
03124 return true;
03125
03126 }
03127 function saveLinkCheck()
03128 {
03129 global $ilDB,$ilUser;
03130
03131 include_once './classes/class.ilLinkCheckNotify.php';
03132
03133 $link_check_notify =& new ilLinkCheckNotify($ilDB);
03134 $link_check_notify->setUserId($ilUser->getId());
03135 $link_check_notify->setObjId($this->object->getId());
03136
03137 if($_POST['link_check_message'])
03138 {
03139 ilUtil::sendInfo($this->lng->txt('link_check_message_enabled'));
03140 $link_check_notify->addNotifier();
03141 }
03142 else
03143 {
03144 ilUtil::sendInfo($this->lng->txt('link_check_message_disabled'));
03145 $link_check_notify->deleteNotifier();
03146 }
03147 $this->linkChecker();
03148
03149 return true;
03150 }
03151
03152
03153
03154 function refreshLinkCheck()
03155 {
03156 $this->__initLinkChecker();
03157
03158 if(!$this->link_checker_obj->checkPear())
03159 {
03160 ilUtil::sendInfo($this->lng->txt('missing_pear_library'));
03161 $this->linkChecker();
03162
03163 return false;
03164 }
03165
03166 $this->link_checker_obj->checkLinks();
03167 ilUtil::sendInfo($this->lng->txt('link_checker_refreshed'));
03168
03169 $this->linkChecker();
03170
03171 return true;
03172 }
03173
03174 function __initLinkChecker()
03175 {
03176 global $ilDB;
03177
03178 include_once './classes/class.ilLinkChecker.php';
03179
03180 $this->link_checker_obj =& new ilLinkChecker($ilDB,false);
03181 $this->link_checker_obj->setObjId($this->object->getId());
03182
03183 return true;
03184 }
03185
03186 function __initLMMenuEditor()
03187 {
03188 include_once './Modules/LearningModule/classes/class.ilLMMenuEditor.php';
03189
03190 $this->lmme_obj =& new ilLMMenuEditor();
03191 $this->lmme_obj->setObjId($this->object->getId());
03192
03193 return true;
03194 }
03195
03199 function addMenuEntry()
03200 {
03201 $this->setTabs();
03202
03203 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.lm_menu_entry_form.html","Modules/LearningModule");
03204
03205 if (isset($_GET["link_ref_id"]))
03206 {
03207 $obj_type = ilObject::_lookupType($_GET["link_ref_id"],true);
03208 $obj_id = ilObject::_lookupObjectId($_GET["link_ref_id"]);
03209 $title = ilObject::_lookupTitle($obj_id);
03210
03211 $target_link = $obj_type."_".$_GET["link_ref_id"];
03212 $this->tpl->setVariable("TITLE", $title);
03213 $this->tpl->setVariable("TARGET", $target_link);
03214 $this->tpl->setVariable("LINK_REF_ID", $_GET["link_ref_id"]);
03215 }
03216
03217
03218 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this, "saveMenuEntry"));
03219 $this->tpl->setVariable("TXT_NEW_ENTRY", $this->lng->txt("lm_menu_new_entry"));
03220 $this->tpl->setVariable("TXT_TARGET", $this->lng->txt("lm_menu_entry_target"));
03221 $this->tpl->setVariable("TXT_TITLE", $this->lng->txt("lm_menu_entry_title"));
03222 $this->tpl->setVariable("BTN_NAME", "saveMenuEntry");
03223 $this->tpl->setVariable("BTN_TEXT", $this->lng->txt("save"));
03224 $this->tpl->setVariable("BTN_NAME2", "showEntrySelector");
03225 $this->tpl->setVariable("BTN_TEXT2", $this->lng->txt("lm_menu_select_internal_object"));
03226
03227
03228 }
03229
03233 function saveMenuEntry()
03234 {
03235
03236 if (empty($_POST["title"]))
03237 {
03238 $this->ilias->raiseError($this->lng->txt("please_enter_title"),$this->ilias->error_obj->MESSAGE);
03239 }
03240 if (empty($_POST["target"]))
03241 {
03242 $this->ilias->raiseError($this->lng->txt("please_enter_target"),$this->ilias->error_obj->MESSAGE);
03243 }
03244
03245 $this->__initLMMenuEditor();
03246 $this->lmme_obj->setTitle($_POST["title"]);
03247 $this->lmme_obj->setTarget($_POST["target"]);
03248 $this->lmme_obj->setLinkRefId($_POST["link_ref_id"]);
03249
03250 if ($_POST["link_ref_id"])
03251 {
03252 $this->lmme_obj->setLinkType("intern");
03253 }
03254
03255 $this->lmme_obj->create();
03256
03257 ilUtil::sendInfo($this->lng->txt("msg_entry_added"), true);
03258 $this->ctrl->redirect($this, "properties");
03259 }
03260
03264 function deleteMenuEntry()
03265 {
03266 if (empty($_GET["menu_entry"]))
03267 {
03268 $this->ilias->raiseError($this->lng->txt("no_menu_entry_id"),$this->ilias->error_obj->MESSAGE);
03269 }
03270
03271 $this->__initLMMenuEditor();
03272 $this->lmme_obj->delete($_GET["menu_entry"]);
03273
03274 ilUtil::sendInfo($this->lng->txt("msg_entry_removed"), true);
03275 $this->ctrl->redirect($this, "properties");
03276 }
03277
03281 function editMenuEntry()
03282 {
03283 if (empty($_GET["menu_entry"]))
03284 {
03285 $this->ilias->raiseError($this->lng->txt("no_menu_entry_id"),$this->ilias->error_obj->MESSAGE);
03286 }
03287
03288 $this->__initLMMenuEditor();
03289 $this->lmme_obj->readEntry($_GET["menu_entry"]);
03290
03291 $this->setTabs();
03292
03293 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.lm_menu_entry_form.html","Modules/LearningModule");
03294
03295 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
03296 $this->tpl->setVariable("TXT_NEW_ENTRY", $this->lng->txt("lm_menu_edit_entry"));
03297 $this->tpl->setVariable("TXT_TARGET", $this->lng->txt("lm_menu_entry_target"));
03298 $this->tpl->setVariable("TXT_TITLE", $this->lng->txt("lm_menu_entry_title"));
03299 $this->tpl->setVariable("TITLE", $this->lmme_obj->getTitle());
03300 $this->tpl->setVariable("TARGET", $this->lmme_obj->getTarget());
03301 $this->tpl->setVariable("ENTRY_ID", $this->lmme_obj->getEntryId());
03302 $this->tpl->setVariable("BTN_NAME", "updateMenuEntry");
03303 $this->tpl->setVariable("BTN_TEXT", $this->lng->txt("save"));
03304 $this->tpl->setVariable("BTN_NAME2", "showEntrySelector");
03305 $this->tpl->setVariable("BTN_TEXT2", $this->lng->txt("lm_menu_select_internal_object"));
03306
03307 }
03308
03312 function updateMenuEntry()
03313 {
03314 if (empty($_POST["menu_entry"]))
03315 {
03316 $this->ilias->raiseError($this->lng->txt("no_menu_entry_id"),$this->ilias->error_obj->MESSAGE);
03317 }
03318
03319
03320 if (empty($_POST["title"]))
03321 {
03322 $this->ilias->raiseError($this->lng->txt("please_enter_title"),$this->ilias->error_obj->MESSAGE);
03323 }
03324 if (empty($_POST["target"]))
03325 {
03326 $this->ilias->raiseError($this->lng->txt("please_enter_target"),$this->ilias->error_obj->MESSAGE);
03327 }
03328
03329 $this->__initLMMenuEditor();
03330 $this->lmme_obj->readEntry($_POST["menu_entry"]);
03331 $this->lmme_obj->setTitle($_POST["title"]);
03332 $this->lmme_obj->setTarget($_POST["target"]);
03333 $this->lmme_obj->update();
03334
03335 ilUtil::sendInfo($this->lng->txt("msg_entry_updated"), true);
03336 $this->ctrl->redirect($this, "properties");
03337 }
03338
03339 function showEntrySelector()
03340 {
03341 $this->setTabs();
03342
03343 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.lm_menu_object_selector.html","Modules/LearningModule");
03344
03345 ilUtil::sendInfo($this->lng->txt("lm_menu_select_object_to_add"));
03346
03347 require_once ("./Modules/LearningModule/classes/class.ilLMMenuObjectSelector.php");
03348 $exp = new ilLMMenuObjectSelector($this->ctrl->getLinkTarget($this,'test'),$this);
03349
03350 $exp->setExpand($_GET["lm_menu_expand"] ? $_GET["lm_menu_expand"] : $this->tree->readRootId());
03351 $exp->setExpandTarget($this->ctrl->getLinkTarget($this,'showEntrySelector'));
03352 $exp->setTargetGet("ref_id");
03353 $exp->setRefId($this->cur_ref_id);
03354
03355 $sel_types = array('lm','dbk','glo','frm','exc','tst','svy');
03356 $exp->setSelectableTypes($sel_types);
03357
03358
03359
03360
03361 $exp->setOutput(0);
03362 $output = $exp->getOutput();
03363
03364
03365 foreach ($exp->format_options as $node)
03366 {
03367 if (!$node["container"])
03368 {
03369 $pages[] = $node["child"];
03370 }
03371 }
03372
03373
03374
03375
03376 $this->tpl->setVariable("TXT_SET_PUBLIC_MODE", $this->lng->txt("set_public_mode"));
03377 $this->tpl->setVariable("TXT_CHOOSE_PUBLIC_MODE", $this->lng->txt("choose_public_mode"));
03378 $modes = array("complete" => $this->lng->txt("all_pages"), "selected" => $this->lng->txt("selected_pages_only"));
03379 $select_public_mode = ilUtil::formSelect ($this->object->getPublicAccessMode(),"lm_public_mode",$modes, false, true);
03380 $this->tpl->setVariable("SELECT_PUBLIC_MODE", $select_public_mode);
03381
03382 $this->tpl->setVariable("TXT_EXPLORER_HEADER", $this->lng->txt("choose_public_pages"));
03383 $this->tpl->setVariable("EXP_REFRESH", $this->lng->txt("refresh"));
03384 $this->tpl->setVariable("EXPLORER",$output);
03385 $this->tpl->setVariable("ONCLICK",$js_pages);
03386 $this->tpl->setVariable("TXT_CHECKALL", $this->lng->txt("check_all"));
03387 $this->tpl->setVariable("TXT_UNCHECKALL", $this->lng->txt("uncheck_all"));
03388 $this->tpl->setVariable("TXT_SAVE", $this->lng->txt("save"));
03389 $this->tpl->setVariable("FORMACTION", $this->ctrl->getLinkTarget($this, "savePublicSection"));
03390
03391 }
03392
03396 function selectHeader()
03397 {
03398 if(!isset($_POST["id"]))
03399 {
03400 $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
03401 }
03402 if(count($_POST["id"]) > 1)
03403 {
03404 $this->ilias->raiseError($this->lng->txt("cont_select_max_one_item"),$this->ilias->error_obj->MESSAGE);
03405 }
03406 if ($_POST["id"][0] != $this->object->getHeaderPage())
03407 {
03408 $this->object->setHeaderPage($_POST["id"][0]);
03409 }
03410 else
03411 {
03412 $this->object->setHeaderPage(0);
03413 }
03414 $this->object->updateProperties();
03415 $this->ctrl->redirect($this, "pages");
03416 }
03417
03421 function selectFooter()
03422 {
03423 if(!isset($_POST["id"]))
03424 {
03425 $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
03426 }
03427 if(count($_POST["id"]) > 1)
03428 {
03429 $this->ilias->raiseError($this->lng->txt("cont_select_max_one_item"),$this->ilias->error_obj->MESSAGE);
03430 }
03431 if ($_POST["id"][0] != $this->object->getFooterPage())
03432 {
03433 $this->object->setFooterPage($_POST["id"][0]);
03434 }
03435 else
03436 {
03437 $this->object->setFooterPage(0);
03438 }
03439 $this->object->updateProperties();
03440 $this->ctrl->redirect($this, "pages");
03441 }
03442
03448 function _goto($a_target)
03449 {
03450 global $ilAccess, $ilErr, $lng;
03451
03452 if ($ilAccess->checkAccess("read", "", $a_target))
03453 {
03454 $_GET["baseClass"] = "ilLMPresentationGUI";
03455 $_GET["ref_id"] = $a_target;
03456 include("ilias.php");
03457 exit;
03458 } else if ($ilAccess->checkAccess("visible", "", $a_target))
03459 {
03460 $_GET["baseClass"] = "ilLMPresentationGUI";
03461 $_GET["ref_id"] = $a_target;
03462 $_GET["cmd"] = "infoScreen";
03463 include("ilias.php");
03464 exit;
03465 }
03466 else if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID))
03467 {
03468 $_GET["cmd"] = "frameset";
03469 $_GET["target"] = "";
03470 $_GET["ref_id"] = ROOT_FOLDER_ID;
03471 ilUtil::sendInfo(sprintf($lng->txt("msg_no_perm_read_item"),
03472 ilObject::_lookupTitle(ilObject::_lookupObjId($a_target))), true);
03473 include("repository.php");
03474 exit;
03475 }
03476
03477
03478 $ilErr->raiseError($lng->txt("msg_no_perm_read_lm"), $ilErr->FATAL);
03479 }
03480
03481 }
03482 ?>