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