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 require_once("./Modules/LearningModule/classes/class.ilObjLearningModule.php");
00025 require_once("./classes/class.ilMainMenuGUI.php");
00026 require_once("./classes/class.ilObjStyleSheet.php");
00027
00040 class ilLMPresentationGUI
00041 {
00042 var $ilias;
00043 var $lm;
00044 var $tpl;
00045 var $lng;
00046 var $layout_doc;
00047 var $offline;
00048 var $offline_directory;
00049
00050 function ilLMPresentationGUI()
00051 {
00052 global $ilias, $lng, $tpl, $rbacsystem, $ilCtrl, $ilAccess;
00053
00054
00055 $lng->loadLanguageModule("content");
00056
00057 $this->ilias =& $ilias;
00058 $this->lng =& $lng;
00059 $this->tpl =& $tpl;
00060 $this->offline = false;
00061 $this->frames = array();
00062 $this->ctrl =& $ilCtrl;
00063 $this->ctrl->saveParameter($this, array("ref_id"));
00064
00065 # include_once './classes/class.ilSearch.php';
00066
00067 # if(!ilSearch::_checkParentConditions($_GET['ref_id']))
00068 # {
00069 # $ilias->error_obj->raiseError($lng->txt('access_denied'),$ilias->error_obj->WARNING);
00070 # }
00071
00072 $type = $this->ilias->obj_factory->getTypeByRefId($_GET["ref_id"]);
00073
00074
00075 switch($type)
00076 {
00077 case "dbk":
00078 include_once("./Modules/LearningModule/classes/class.ilObjDlBookGUI.php");
00079
00080 $this->lm_gui = new ilObjDlBookGUI($data,$_GET["ref_id"],true,false);
00081 break;
00082 case "lm":
00083 include_once("./Modules/LearningModule/classes/class.ilObjLearningModuleGUI.php");
00084
00085 $this->lm_gui = new ilObjLearningModuleGUI($data,$_GET["ref_id"],true,false);
00086
00087 break;
00088 }
00089 $this->lm =& $this->lm_gui->object;
00090
00091
00092 if (!$rbacsystem->checkAccess("write", $_GET["ref_id"]))
00093 {
00094 if (!$this->lm->getOnline())
00095 {
00096 $ilias->raiseError($lng->txt("permission_denied"), $ilias->error_obj->WARNING);
00097 }
00098 }
00099
00100 $this->lm_tree = new ilTree($this->lm->getId());
00101 $this->lm_tree->setTableNames('lm_tree','lm_data');
00102 $this->lm_tree->setTreeTablePK("lm_id");
00103
00104
00105 if ($type == "dbk")
00106 {
00107 $this->abstract = true;
00108 $this->setSessionVars();
00109 if((count($_POST["tr_id"]) > 1) or
00110 (!$_POST["target"] and ($_POST["action"] == "show" or $_POST["action"] == "show_citation")))
00111 {
00112 $this->abstract = true;
00113 }
00114 else if($_GET["obj_id"] or ($_POST["action"] == "show") or ($_POST["action"] == "show_citation"))
00115 {
00116 $this->abstract = false;
00117 }
00118 }
00119
00120 }
00121
00122
00126 function &executeCommand()
00127 {
00128 global $ilNavigationHistory, $ilAccess, $ilias, $lng;
00129
00130
00131
00132 if (!$ilAccess->checkAccess("read", "", $_GET["ref_id"]) &&
00133 (!(($this->ctrl->getCmd() == "infoScreen" || $this->ctrl->getNextClass() == "ilinfoscreengui")
00134 && $ilAccess->checkAccess("visible", "", $_GET["ref_id"]))))
00135 {
00136 $ilias->raiseError($lng->txt("permission_denied"), $ilias->error_obj->WARNING);
00137 }
00138
00139 $next_class = $this->ctrl->getNextClass($this);
00140 $cmd = $this->ctrl->getCmd("layout");
00141
00142 $cmd = (isset($_POST['cmd']['citation']))
00143 ? "ilCitation"
00144 : $cmd;
00145
00146
00147 $this->lmAccess($this->ilias->account->getId(),$_GET["ref_id"],$_GET["obj_id"]);
00148
00149 $obj_id = $_GET["obj_id"];
00150 $this->ctrl->setParameter($this, "obj_id", $_GET["obj_id"]);
00151 $ilNavigationHistory->addItem($_GET["ref_id"], $this->ctrl->getLinkTarget($this),"lm");
00152 $this->ctrl->setParameter($this, "obj_id", $obj_id);
00153
00154 switch($next_class)
00155 {
00156 case "ilnotegui":
00157 $ret =& $this->layout();
00158 break;
00159
00160 case "ilinfoscreengui":
00161 $ret =& $this->outputInfoScreen();
00162 break;
00163
00164 case 'ilpaymentpurchasegui':
00165 $this->tpl->getStandardTemplate();
00166 $this->ilLocator();
00167
00168 include_once("./payment/classes/class.ilPaymentPurchaseGUI.php");
00169 $pa =& new ilPaymentPurchaseGUI((int) $_GET['ref_id']);
00170 $ret =& $this->ctrl->forwardCommand($pa);
00171 $this->tpl->show();
00172 break;
00173
00174 default:
00175 include_once './payment/classes/class.ilPaymentObject.php';
00176
00177 if(!ilPaymentObject::_hasAccess($_GET['ref_id']))
00178 {
00179 $this->tpl->getStandardTemplate();
00180 $this->ilLocator();
00181
00182
00183 include_once("./payment/classes/class.ilPaymentPurchaseGUI.php");
00184 $pa =& new ilPaymentPurchaseGUI((int) $_GET['ref_id']);
00185 $this->ctrl->setCmd("showDetails");
00186 $ret =& $this->ctrl->forwardCommand($pa);
00187 $this->tpl->show();
00188 return true;
00189 }
00190
00191 $ret =& $this->$cmd();
00192 break;
00193 }
00194 }
00195
00196
00200 function setOfflineMode($a_offline = true)
00201 {
00202 $this->offline = $a_offline;
00203 }
00204
00205
00209 function offlineMode()
00210 {
00211 return $this->offline;
00212 }
00213
00219 function setExportFormat($a_format)
00220 {
00221 $this->export_format = $a_format;
00222 }
00223
00229 function getExportFormat()
00230 {
00231 return $this->export_format;
00232 }
00233
00237 function nop()
00238 {
00239 }
00240
00241
00248 function lmAccess($usr_id,$lm_id,$obj_id)
00249 {
00250 global $ilDB;
00251
00252
00253 $q = "DELETE FROM lo_access ".
00254 "WHERE usr_id = ".$ilDB->quote($usr_id)." ".
00255 "AND lm_id = ".$ilDB->quote($lm_id);
00256 $this->ilias->db->query($q);
00257 $title = (is_object($this->lm))?$this->lm->getTitle():"- no title -";
00258
00259 $pg_title = "";
00260 $q = "INSERT INTO lo_access ".
00261 "(timestamp,usr_id,lm_id,obj_id,lm_title) ".
00262 "VALUES ".
00263 "(now(),".$ilDB->quote($usr_id).",".$ilDB->quote($lm_id).",".
00264 $ilDB->quote($obj_id).",".$ilDB->quote($title).")";
00265 $this->ilias->db->query($q);
00266 }
00267
00276 function export()
00277 {
00278 switch($this->lm->getType())
00279 {
00280 case "dbk":
00281 $this->lm_gui->export();
00282 break;
00283 }
00284 }
00285
00293 function offlineexport()
00294 {
00295 global $ilDB;
00296
00297 if ($_POST["cmd"]["cancel"] != "")
00298 {
00299 $this->ctrl->setParameter($this, "frame", "maincontent");
00300 $this->ctrl->redirect($this, "layout");
00301 }
00302
00303 switch($this->lm->getType())
00304 {
00305 case "dbk":
00306
00307 $_GET["frame"] = "maincontent";
00308
00309 $query = "SELECT * FROM object_reference,object_data WHERE object_reference.ref_id=".
00310 $ilDB->quote($_GET["ref_id"])." AND object_reference.obj_id=object_data.obj_id ";
00311 $result = $this->ilias->db->query($query);
00312 $objRow = $result->fetchRow(DB_FETCHMODE_ASSOC);
00313 $_GET["obj_id"] = $objRow["obj_id"];
00314
00315 $query = "SELECT * FROM lm_data WHERE lm_id = ".$ilDB->quote($objRow["obj_id"]).
00316 " AND type='pg' ";
00317 $result = $this->ilias->db->query($query);
00318
00319 $page = 0;
00320 $showpage = 0;
00321 while (is_array($row = $result->fetchRow(DB_FETCHMODE_ASSOC)) )
00322 {
00323
00324 $page++;
00325
00326 if ($_POST["pages"]=="all" || ($_POST["pages"]=="fromto" && $page>=$_POST["pagefrom"] && $page<=$_POST["pageto"] ))
00327 {
00328
00329 if ($showpage>0)
00330 {
00331 if($_POST["type"] == "pdf") $output .= "<hr BREAK >\n";
00332 if($_POST["type"] == "print") $output .= "<p style=\"page-break-after:always\" />";
00333 if($_POST["type"] == "html") $output .= "<br><br><br><br>";
00334 }
00335 $showpage++;
00336
00337 $_GET["obj_id"] = $row["obj_id"];
00338 $o = $this->layout("main.xml",false);
00339
00340 $output .= "<div xmlns:xhtml=\"http://www.w3.org/1999/xhtml\" class=\"ilc_PageTitle\">".$this->lm->title."</div><p>";
00341 $output .= $o;
00342
00343 $output .= "\n<table cellpadding=0 cellspacing=0 border=0 width=100%><tr><td valign=top align=center>- ".$page." -</td></tr></table>\n";
00344
00345 }
00346 }
00347
00348 $printTpl = new ilTemplate("tpl.print.html", true, true, "Modules/LearningModule");
00349
00350 if($_POST["type"] == "print")
00351 {
00352 $printTpl->touchBlock("printreq");
00353 $css1 = ilObjStyleSheet::getContentStylePath($this->lm->getStyleSheetId());
00354 $css2 = ilUtil::getStyleSheetLocation();
00355 }
00356 else
00357 {
00358 $css1 = "./css/delos.css";
00359 $css2 = "./css/content.css";
00360 }
00361 $printTpl->setVariable("LOCATION_CONTENT_STYLESHEET", $css1 );
00362
00363 $printTpl->setVariable("LOCATION_STYLESHEET", $css2);
00364 $printTpl->setVariable("CONTENT",$output);
00365
00366
00367 $printTpl->setCurrentBlock("SyntaxStyle");
00368 $printTpl->setVariable("LOCATION_SYNTAX_STYLESHEET",
00369 ilObjStyleSheet::getSyntaxStylePath());
00370 $printTpl->parseCurrentBlock();
00371
00372
00373 $html = $printTpl->get();
00374
00378 $this->lm->createExportDirectory();
00379 $export_dir = $this->lm->getExportDirectory();
00380
00384 $fileName = "offline";
00385 $fileName = str_replace(" ","_",$fileName);
00386
00387 if (!file_exists($export_dir."/".$fileName))
00388 {
00389 @mkdir($export_dir."/".$fileName);
00390 @chmod($export_dir."/".$fileName, 0755);
00391
00392 @mkdir($export_dir."/".$fileName."/css");
00393 @chmod($export_dir."/".$fileName."/css", 0755);
00394
00395 }
00396
00397 if($_POST["type"] == "xml")
00398 {
00399
00400 $tmp_obj =& $this->ilias->obj_factory->getInstanceByRefId($_GET["ref_id"]);
00401
00402 if ($tmp_obj->getType() == "dbk" )
00403 {
00404 require_once "./Modules/LearningModule/classes/class.ilObjDlBook.php";
00405 $dbk =& new ilObjDlBook($_GET["ref_id"]);
00406 $dbk->export();
00407 }
00408
00409 }
00410 else if($_POST["type"] == "print")
00411 {
00412 echo $html;
00413 }
00414 else if ($_POST["type"]=="html")
00415 {
00416
00422 $css1 = file("./templates/default/delos.css");
00423 $css1 = implode($css1,"");
00424
00425 $fp = fopen($export_dir."/".$fileName."/css/delos.css","wb");
00426 fwrite($fp,$css1);
00427 fclose($fp);
00428
00429 $fp = fopen($export_dir."/".$fileName."/".$fileName.".html","wb");
00430 fwrite($fp,$html);
00431 fclose($fp);
00432
00433 ilUtil::zip($export_dir."/".$fileName, $export_dir."/".$fileName.".zip");
00434
00435 ilUtil::deliverFile($export_dir."/".$fileName.".zip", $fileName.".zip");
00436
00437 }
00438 else if ($_POST["type"]=="pdf")
00439 {
00440
00441 ilUtil::html2pdf($html, $export_dir."/".$fileName.".pdf");
00442
00443 ilUtil::deliverFile($export_dir."/".$fileName.".pdf", $fileName.".pdf");
00444
00445 }
00446
00447 exit;
00448 }
00449
00450 }
00451
00459 function offlineexportform()
00460 {
00461
00462 switch($this->lm->getType())
00463 {
00464 case "dbk":
00465 $this->lm_gui->offlineexportform();
00466 break;
00467 }
00468
00469 }
00470
00471
00479 function exportbibinfo()
00480 {
00481 global $ilDB;
00482
00483 $query = "SELECT * FROM object_reference,object_data WHERE object_reference.ref_id= ".
00484 $ilDB->quote($_GET["ref_id"])." AND object_reference.obj_id=object_data.obj_id ";
00485 $result = $this->ilias->db->query($query);
00486
00487 $objRow = $result->fetchRow(DB_FETCHMODE_ASSOC);
00488
00489 $filename = preg_replace('/[^a-z0-9_]/i', '_', $objRow["title"]);
00490
00491 $C = $this->lm_gui->showAbstract(array(1));
00492
00493 if ($_GET["print"]==1)
00494 {
00495 $printTpl = new ilTemplate("tpl.print.html", true, true, "Modules/LearningModule");
00496 $printTpl->touchBlock("printreq");
00497 $css1 = ilObjStyleSheet::getContentStylePath($this->lm->getStyleSheetId());
00498 $css2 = ilUtil::getStyleSheetLocation();
00499 $printTpl->setVariable("LOCATION_CONTENT_STYLESHEET", $css1 );
00500
00501 $printTpl->setVariable("LOCATION_STYLESHEET", $css2);
00502
00503
00504 $printTpl->setCurrentBlock("SyntaxStyle");
00505 $printTpl->setVariable("LOCATION_SYNTAX_STYLESHEET",
00506 ilObjStyleSheet::getSyntaxStylePath());
00507 $printTpl->parseCurrentBlock();
00508
00509 $printTpl->setVariable("CONTENT",$C);
00510
00511 echo $printTpl->get();
00512 exit;
00513 }
00514 else
00515 {
00516 ilUtil::deliverData($C, $filename.".html");
00517 exit;
00518 }
00519
00520 }
00521
00522
00523
00524
00525 function attrib2arr($a_attributes)
00526 {
00527 $attr = array();
00528 if(!is_array($a_attributes))
00529 {
00530 return $attr;
00531 }
00532 foreach ($a_attributes as $attribute)
00533 {
00534 $attr[$attribute->name()] = $attribute->value();
00535 }
00536 return $attr;
00537 }
00538
00542 function getCurrentFrameSet()
00543 {
00544 return $this->frames;
00545 }
00546
00550 function layout($a_xml = "main.xml", $doShow = true)
00551 {
00552 global $tpl, $ilBench, $ilSetting;
00553
00554 $ilBench->start("ContentPresentation", "layout");
00555
00556
00557 if ($this->getExportFormat() == "scorm")
00558 {
00559 $layout = "1window";
00560 }
00561 else
00562 {
00563 $layout = $this->lm->getLayout();
00564 }
00565
00566
00567
00568 $xmlfile = file_get_contents("./Modules/LearningModule/layouts/lm/".$layout."/".$a_xml);
00569
00570 if (!$doc = domxml_open_mem($xmlfile)) { echo "ilLMPresentation: XML File invalid"; exit; }
00571 $this->layout_doc =& $doc;
00572
00573
00574
00575 $ilBench->start("ContentPresentation", "layout_getFrameNode");
00576 $xpc = xpath_new_context($doc);
00577 $path = (empty($_GET["frame"]) || ($_GET["frame"] == "_blank"))
00578 ? "/ilLayout/ilFrame[1]"
00579 : "//ilFrame[@name='".$_GET["frame"]."']";
00580 $result = xpath_eval($xpc, $path);
00581 $found = $result->nodeset;
00582 if (count($found) != 1) { echo "ilLMPresentation: XML File invalid"; exit; }
00583 $node = $found[0];
00584
00585 $ilBench->stop("ContentPresentation", "layout_getFrameNode");
00586
00587
00588
00589 $attributes = $this->attrib2arr($node->attributes());
00590 $this->frames = array();
00591 if((!empty($attributes["rows"])) || (!empty($attributes["cols"])))
00592 {
00593 $ilBench->start("ContentPresentation", "layout_processFrameset");
00594 $content .= $this->buildTag("start", "frameset", $attributes);
00595
00596
00597 $this->processNodes($content, $node);
00598 $content .= $this->buildTag("end", "frameset");
00599 $this->tpl = new ilTemplate("tpl.frameset.html", true, true, "Modules/LearningModule");
00600 $this->tpl->setVariable("PAGETITLE", "- ".$this->lm->getTitle());
00601 $this->tpl->setVariable("FS_CONTENT", $content);
00602 $ilBench->stop("ContentPresentation", "layout_processFrameset");
00603 if (!$doshow)
00604 {
00605 $content = $this->tpl->get();
00606 }
00607 }
00608 else
00609 {
00610
00611 $ilBench->start("ContentPresentation", "layout_processContentTag");
00612
00613 if ((empty($attributes["template"]) || !empty($_GET["obj_type"]))
00614 && ($_GET["frame"] != "_blank" || $_GET["obj_type"] != "MediaObject"))
00615 {
00616
00617
00618
00619
00620
00621 if(empty($_GET["obj_type"]))
00622 {
00623 $obj_type = "PageObject";
00624 }
00625 else
00626 {
00627 $obj_type = $_GET["obj_type"];
00628 }
00629
00630
00631 $childs = $node->child_nodes();
00632 $found = false;
00633 foreach($childs as $child)
00634 {
00635 if ($child->node_name() == $obj_type)
00636 {
00637 $found = true;
00638 $attributes = $this->attrib2arr($child->attributes());
00639 $node =& $child;
00640
00641 break;
00642 }
00643 }
00644 if (!$found) { echo "ilLMPresentation: No template specified for frame '".
00645 $_GET["frame"]."' and object type '".$obj_type."'."; exit; }
00646 }
00647
00648
00649 $in_module = ($attributes["template_location"] == "module")
00650 ? true
00651 : false;
00652 if ($in_module)
00653 {
00654 $this->tpl = new ilTemplate($attributes["template"], true, true, $in_module);
00655 }
00656 else
00657 {
00658 $this->tpl =& $tpl;
00659 }
00660
00661
00662 if (!$this->offlineMode())
00663 {
00664 $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
00665 }
00666 else
00667 {
00668 $style_name = $this->ilias->account->prefs["style"].".css";
00669 $this->tpl->setVariable("LOCATION_STYLESHEET","./".$style_name);
00670 }
00671
00672 $childs = $node->child_nodes();
00673
00674 $ilBench->start("ContentPresentation", "layout_processContentNodes");
00675 foreach($childs as $child)
00676 {
00677
00678 $child_attr = $this->attrib2arr($child->attributes());
00679
00680 switch ($child->node_name())
00681 {
00682 case "ilMainMenu":
00683 $ilBench->start("ContentPresentation", "layout_mainmenu");
00684 $this->ilMainMenu();
00685 $ilBench->stop("ContentPresentation", "layout_mainmenu");
00686 break;
00687
00688 case "ilTOC":
00689 $this->ilTOC($child_attr["target_frame"]);
00690 break;
00691
00692 case "ilPage":
00693 switch($this->lm->getType())
00694 {
00695 case "lm":
00696 unset($_SESSION["tr_id"]);
00697 unset($_SESSION["bib_id"]);
00698 unset($_SESSION["citation"]);
00699 $content = $this->ilPage($child);
00700 break;
00701
00702 case "dbk":
00703 $this->setSessionVars();
00704 if($this->abstract)
00705 {
00706 $content = $this->lm_gui->showAbstract($_POST["target"]);
00707 }
00708 else
00709 {
00710
00711 $content = $this->ilPage($child);
00712
00713 if($_SESSION["tr_id"])
00714 {
00715 $translation_content = $this->ilTranslation($child);
00716 }
00717 }
00718 break;
00719 }
00720 break;
00721
00722 case "ilGlossary":
00723 $content = $this->ilGlossary($child);
00724 break;
00725
00726 case "ilLMNavigation":
00727
00728
00729 if($_GET["obj_id"] or
00730 ((count($_POST["tr_id"]) < 2) and $_POST["target"] and
00731 ($_POST["action"] == "show" or $_POST["action"] == "show_citation")) or
00732 $this->lm->getType() == 'lm')
00733 {
00734 $ilBench->start("ContentPresentation", "layout_lmnavigation");
00735 $this->ilLMNavigation();
00736 $ilBench->stop("ContentPresentation", "layout_lmnavigation");
00737 }
00738 break;
00739
00740 case "ilMedia":
00741 $this->ilMedia();
00742 break;
00743
00744 case "ilLocator":
00745 $ilBench->start("ContentPresentation", "layout_locator");
00746 $this->ilLocator();
00747 $ilBench->stop("ContentPresentation", "layout_locator");
00748 break;
00749
00750 case "ilLMMenu":
00751 $ilBench->start("ContentPresentation", "layout_lmmenu");
00752 $this->ilLMMenu();
00753 $ilBench->stop("ContentPresentation", "layout_lmmenu");
00754 break;
00755
00756 case "ilLMHead":
00757 $this->ilLMHead();
00758 break;
00759
00760 case "ilLMSubMenu":
00761 $ilBench->start("ContentPresentation", "layout_lmsubmenu");
00762 $this->ilLMSubMenu();
00763 $ilBench->stop("ContentPresentation", "layout_lmsubmenu");
00764 break;
00765
00766 case "ilLMNotes":
00767 if (!$this->ilias->getSetting('disable_notes'))
00768 {
00769 $ilBench->start("ContentPresentation", "layout_lmnotes");
00770 $this->ilLMNotes();
00771 $ilBench->stop("ContentPresentation", "layout_lmnotes");
00772 }
00773 break;
00774 }
00775 }
00776 $ilBench->stop("ContentPresentation", "layout_processContentNodes");
00777
00778 $ilBench->stop("ContentPresentation", "layout_processContentTag");
00779 }
00780
00781
00782 if (strcmp($_GET["frame"], "topright") == 0) $this->tpl->fillJavaScriptFiles();
00783 if (strcmp($_GET["frame"], "right") == 0) $this->tpl->fillJavaScriptFiles();
00784 if (strcmp($_GET["frame"], "botright") == 0) $this->tpl->fillJavaScriptFiles();
00785
00786 $content = $this->tpl->get();
00787
00788 if ($doShow)
00789 {
00790
00791
00792
00793
00794 $this->tpl->fillTabs();
00795 $content = $this->tpl->get();
00796 $content = str_replace("{", "{", $content);
00797 $content = str_replace("}", "}", $content);
00798
00799 header('Content-type: text/html; charset=UTF-8');
00800 echo $content;
00801 }
00802
00803 $ilBench->stop("ContentPresentation", "layout");
00804
00805 return($content);
00806 }
00807
00808 function fullscreen()
00809 {
00810 return $this->layout("fullscreen.xml", !$this->offlineMode());
00811 }
00812
00813 function media()
00814 {
00815 if ($_GET["frame"] != "_blank")
00816 {
00817 return $this->layout("main.xml", !$this->offlineMode());
00818 }
00819 else
00820 {
00821 return $this->layout("fullscreen.xml", !$this->offlineMode());
00822 }
00823 }
00824
00825 function glossary()
00826 {
00827 if ($_GET["frame"] != "_blank")
00828 {
00829 $this->layout();
00830 }
00831 else
00832 {
00833 $this->tpl = new ilTemplate("tpl.glossary_term_output.html", true, true, true);
00834 $this->tpl->setVariable("PAGETITLE", " - ".$this->lm->getTitle());
00835
00836
00837 if (!$this->offlineMode())
00838 {
00839 $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
00840 }
00841 else
00842 {
00843 $style_name = $this->ilias->account->prefs["style"].".css";;
00844 $this->tpl->setVariable("LOCATION_STYLESHEET","./".$style_name);
00845 }
00846
00847 $this->ilGlossary($child);
00848 if (!$this->offlineMode())
00849 {
00850 $this->tpl->show();
00851 }
00852 else
00853 {
00854 return $this->tpl->get();
00855 }
00856 }
00857 }
00858
00862 function ilMainMenu()
00863 {
00864 global $ilBench, $ilMainMenu;
00865
00866 if ($this->offlineMode())
00867 {
00868 return;
00869 }
00870
00871 $ilBench->start("ContentPresentation", "ilMainMenu");
00872
00873 if ($this->lm->getLayout() == "2window" ||
00874 $this->lm->getLayout() == "3window")
00875 {
00876 $ilMainMenu->setSmallMode(true);
00877 }
00878 else
00879 {
00880 $ilMainMenu->setSmallMode(false);
00881 }
00882
00883 $this->tpl->setVariable("MAINMENU", $ilMainMenu->getHTML());
00884 $this->tpl->addJavascript("./Services/Javascript/js/Basic.js");
00885 $this->tpl->addJavascript("./Services/Navigation/js/ServiceNavigation.js");
00886 $this->tpl->fillJavaScriptFiles();
00887
00888
00889
00890
00891
00892 $ilBench->stop("ContentPresentation", "ilMainMenu");
00893 }
00894
00898 function ilTOC($a_target)
00899 {
00900 global $ilBench;
00901
00902 $ilBench->start("ContentPresentation", "ilTOC");
00903 require_once("./Modules/LearningModule/classes/class.ilLMTOCExplorer.php");
00904 if ($this->lm->cleanFrames())
00905 {
00906 $a_target = "";
00907 }
00908 $exp = new ilLMTOCExplorer($this->getLink($this->lm->getRefId(), "layout", "", $a_target),$this->lm);
00909 $exp->setExpandTarget($this->getLink($this->lm->getRefId(), $_GET["cmd"], $_GET["obj_id"], $_GET["frame"]));
00910 $exp->setTargetGet("obj_id");
00911 if ($this->lm->cleanFrames())
00912 {
00913 if ($this->offlineMode())
00914 {
00915 $exp->setFrameTarget("_top");
00916 }
00917 else
00918 {
00919 $exp->setFrameTarget(ilFrameTargetInfo::_getFrame("MainContent"));
00920 }
00921 }
00922 else
00923 {
00924 $exp->setFrameTarget($a_target);
00925 }
00926 $exp->addFilter("du");
00927 $exp->addFilter("st");
00928
00929
00930 if ($this->lm->cleanFrames())
00931 {
00932 $page_id = $this->getCurrentPageId();
00933 if ($page_id > 0)
00934 {
00935 $path = $this->lm_tree->getPathId($page_id);
00936 $exp->setForceOpenPath($path);
00937 }
00938 if (!$this->offlineMode())
00939 {
00940 $exp->highlightNode($page_id);
00941 }
00942 }
00943
00944 $exp->setOfflineMode($this->offlineMode());
00945 if ($this->lm->getTOCMode() == "pages")
00946 {
00947 $exp->addFilter("pg");
00948 }
00949 $exp->setFiltered(true);
00950 $exp->setFilterMode(IL_FM_POSITIVE);
00951
00952 if ($_GET["lmexpand"] == "")
00953 {
00954 $expanded = $this->lm_tree->readRootId();
00955 }
00956 else
00957 {
00958 $expanded = $_GET["lmexpand"];
00959 }
00960 $exp->setExpand($expanded);
00961
00962
00963 $exp->setOutput(0);
00964 $output = $exp->getOutput();
00965
00966 $this->tpl->setVariable("PAGETITLE", " - ".$this->lm->getTitle());
00967
00968
00969 if (!$this->offlineMode())
00970 {
00971 $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
00972 }
00973 else
00974 {
00975 $style_name = $this->ilias->account->prefs["style"].".css";;
00976 $this->tpl->setVariable("LOCATION_STYLESHEET","./".$style_name);
00977 }
00978
00979 if (!$this->offlineMode())
00980 {
00981 $this->tpl->addBlockFile("EXPL_TOP", "exp_top", "tpl.explorer_top.html");
00982
00983 $this->tpl->setVariable("IMG_SPACE", ilUtil::getImagePath("spacer.gif", false));
00984 }
00985 $this->tpl->setVariable("TXT_EXPLORER_HEADER", $this->lng->txt("cont_toc"));
00986 $this->tpl->setVariable("EXPLORER",$output);
00987 $this->tpl->setVariable("ACTION",
00988 $this->getLink($this->lm->getRefId(), $_GET["cmd"], "", $_GET["frame"]).
00989 "&lmexpand=".$_GET["lmexpand"]);
00990 $this->tpl->parseCurrentBlock();
00991 $ilBench->stop("ContentPresentation", "ilTOC");
00992 }
00993
00997 function ilLMMenu()
00998 {
00999 $this->tpl->setVariable("MENU", $this->lm_gui->setilLMMenu($this->offlineMode()
01000 ,$this->getExportFormat()));
01001 }
01002
01006 function ilLMHead()
01007 {
01008 $this->tpl->setCurrentBlock("header_image");
01009 if ($this->offlineMode())
01010 {
01011 $this->tpl->setVariable("IMG_HEADER", "./images/icon_lm.gif");
01012 }
01013 else
01014 {
01015 $this->tpl->setVariable("IMG_HEADER", ilUtil::getImagePath("icon_lm.gif"));
01016 }
01017 $this->tpl->parseCurrentBlock();
01018 $this->tpl->setCurrentBlock("lm_head");
01019 $this->tpl->setVariable("HEADER", $this->lm->getTitle());
01020 $this->tpl->parseCurrentBlock();
01021 }
01022
01026 function ilLMSubMenu()
01027 {
01028 global $rbacsystem;
01029
01030
01031 if ($this->lm->getType() == "dbk" && $this->abstract)
01032 {
01033 return;
01034 }
01035
01036
01037 $showViewInFrameset = true;
01038
01039 if ($showViewInFrameset)
01040 {
01041 $buttonTarget = ilFrameTargetInfo::_getFrame("MainContent");
01042 }
01043 else
01044 {
01045 $buttonTarget = "_top";
01046 }
01047
01048
01049 include_once("./classes/class.ilTemplate.php");
01050 $tpl_menu =& new ilTemplate("tpl.lm_sub_menu.html", true, true, true);
01051
01052 $pg_id = $this->getCurrentPageId();
01053 if ($pg_id == 0)
01054 {
01055 return;
01056 }
01057
01058
01059 if (!$this->offlineMode())
01060 {
01061 if ($rbacsystem->checkAccess("write", $_GET["ref_id"]))
01062 {
01063 $tpl_menu->setCurrentBlock("edit_page");
01064 $page_id = $this->getCurrentPageId();
01065 $tpl_menu->setVariable("EDIT_LINK", ILIAS_HTTP_PATH."/ilias.php?baseClass=ilLMEditorGUI&ref_id=".$_GET["ref_id"].
01066 "&obj_id=".$page_id."&to_page=1");
01067 $tpl_menu->setVariable("EDIT_TXT", $this->lng->txt("edit_page"));
01068 $tpl_menu->setVariable("EDIT_TARGET", $buttonTarget);
01069 $tpl_menu->parseCurrentBlock();
01070 }
01071
01072 $tpl_menu->setCurrentBlock("perma_link");
01073 $page_id = $this->getCurrentPageId();
01074 $tpl_menu->setVariable("PERMA_LINK", ILIAS_HTTP_PATH.
01075 "/goto.php?target=pg_".$page_id."_".$this->lm->getRefId()."&client_id=".CLIENT_ID);
01076 $tpl_menu->setVariable("TXT_PERMA_LINK", $this->lng->txt("perma_link"));
01077 $tpl_menu->setVariable("PERMA_TARGET", "_top");
01078 $tpl_menu->parseCurrentBlock();
01079
01080 }
01081
01082 $this->tpl->setVariable("SUBMENU", $tpl_menu->get());
01083 }
01084
01085
01089 function ilLMNotes()
01090 {
01091 global $ilAccess;
01092
01093
01094 if ($this->lm->getType() == "dbk" && $this->abstract)
01095 {
01096 return;
01097 }
01098
01099
01100
01101 if ($this->offlineMode())
01102 {
01103 return;
01104 }
01105
01106
01107 $next_class = $this->ctrl->getNextClass($this);
01108
01109 include_once("Services/Notes/classes/class.ilNoteGUI.php");
01110 $pg_id = $this->getCurrentPageId();
01111 if ($pg_id == 0)
01112 {
01113 return;
01114 }
01115
01116 $notes_gui = new ilNoteGUI($this->lm->getId(), $this->getCurrentPageId(), "pg");
01117 if ($ilAccess->checkAccess("write", "", $_GET["ref_id"]))
01118 {
01119 $notes_gui->enablePublicNotesDeletion(true);
01120 }
01121
01122 $this->ctrl->setParameter($this, "frame", $_GET["frame"]);
01123 $this->ctrl->setParameter($this, "obj_id", $_GET["obj_id"]);
01124
01125 $notes_gui->enablePrivateNotes();
01126 if ($this->lm->publicNotes())
01127 {
01128 $notes_gui->enablePublicNotes();
01129 }
01130
01131 if ($next_class == "ilnotegui")
01132 {
01133 $html = $this->ctrl->forwardCommand($notes_gui);
01134 }
01135 else
01136 {
01137 $html = $notes_gui->getNotesHTML();
01138 }
01139 $this->tpl->setVariable("NOTES", $html);
01140 }
01141
01142
01146 function ilLocator()
01147 {
01148 global $ilLocator, $tree;
01149
01150 require_once("./Modules/LearningModule/classes/class.ilStructureObject.php");
01151
01152 if (empty($_GET["obj_id"]))
01153 {
01154 $a_id = $this->lm_tree->getRootId();
01155 }
01156 else
01157 {
01158 $a_id = $_GET["obj_id"];
01159 }
01160
01161 $this->tpl->addBlockFile("STATUSLINE", "statusline", "tpl.statusline.html");
01162
01163 if (!$this->lm->cleanFrames())
01164 {
01165 $frame_param = $_GET["frame"];
01166 $frame_target = "";
01167 }
01168 else if (!$this->offlineMode())
01169 {
01170 $frame_param = "";
01171 $frame_target = ilFrameTargetInfo::_getFrame("MainContent");
01172 }
01173 else
01174 {
01175 $frame_param = "";
01176 $frame_target = "_top";
01177 }
01178
01179 if (!$this->offlineMode())
01180 {
01181 $ilLocator->addItem("...", "");
01182
01183 $par_id = $tree->getParentId($_GET["ref_id"]);
01184 $ilLocator->addItem(
01185 ilObject::_lookupTitle(ilObject::_lookupObjId($par_id)),
01186 "repository.php?cmd=frameset&ref_id=".$par_id,
01187 ilFrameTargetInfo::_getFrame("MainContent"), $par_id);
01188 }
01189 else
01190 {
01191 $ilLocator->setOffline(true);
01192 }
01193
01194 if($this->lm_tree->isInTree($a_id))
01195 {
01196 $path = $this->lm_tree->getPathFull($a_id);
01197
01198 foreach ($path as $key => $row)
01199 {
01200 if ($row["type"] != "pg")
01201 {
01202 if($row["child"] != $this->lm_tree->getRootId())
01203 {
01204 $ilLocator->addItem(
01205 ilUtil::shortenText(
01206 ilStructureObject::_getPresentationTitle($row["child"],
01207 $this->lm->isActiveNumbering()),50,true),
01208 $this->getLink($_GET["ref_id"], "layout", $row["child"], $frame_param, "StructureObject"),
01209 $frame_target);
01210 }
01211 else
01212 {
01213 $ilLocator->addItem(
01214 ilUtil::shortenText($this->lm->getTitle(),50,true),
01215 $this->getLink($_GET["ref_id"], "layout", "", $frame_param),
01216 $frame_target, $_GET["ref_id"]);
01217 }
01218 }
01219 }
01220 }
01221 else
01222 {
01223
01224 $ilLocator->addItem(
01225 $this->lm->getTitle(),
01226 $this->getLink($_GET["ref_id"], "layout", "", $_GET["frame"]));
01227
01228 require_once("./Modules/LearningModule/classes/class.ilLMObjectFactory.php");
01229 $lm_obj =& ilLMObjectFactory::getInstance($this->lm, $a_id);
01230
01231 $ilLocator->addItem(
01232 $lm_obj->getTitle(),
01233 $this->getLink($_GET["ref_id"], "layout", $a_id, $frame_param),
01234 $frame_target);
01235 }
01236
01237 if (DEBUG)
01238 {
01239 $debug = "DEBUG: <font color=\"red\">".$this->type."::".$this->id."::".$_GET["cmd"]."</font><br/>";
01240 }
01241
01242
01243
01244
01245 $this->tpl->setLocator();
01246 }
01247
01248 function getCurrentPageId()
01249 {
01250 global $ilUser;
01251
01252
01253 if(empty($_GET["obj_id"]))
01254 {
01255 $obj_id = $this->lm_tree->getRootId();
01256 }
01257 else
01258 {
01259 $obj_id = $_GET["obj_id"];
01260 }
01261
01262
01263 if (!$this->lm_tree->isInTree($obj_id))
01264 {
01265 return $obj_id;
01266 }
01267
01268 $curr_node = $this->lm_tree->getNodeData($obj_id);
01269
01270 if ($curr_node["type"] == "pg" &&
01271 ilLMPageObject::_lookupActive($obj_id))
01272 {
01273 $page_id = $curr_node["obj_id"];
01274 }
01275 else
01276 {
01277 $succ_node = true;
01278 $active = false;
01279 $page_id = $obj_id;
01280 while($succ_node && !$active)
01281 {
01282 $succ_node = $this->lm_tree->fetchSuccessorNode($page_id, "pg");
01283 $page_id = $succ_node["obj_id"];
01284 $active = ilLMPageObject::_lookupActive($page_id);
01285 }
01286
01287 if ($succ_node["type"] != "pg")
01288 {
01289 return 0;
01290 $this->tpl = new ilTemplate("tpl.main.html", true, true);
01291 $this->ilias->raiseError($this->lng->txt("cont_no_page"),$this->ilias->error_obj->FATAL);
01292 $this->tpl->show();
01293 exit;
01294 }
01295
01296
01297 if ($ilUser->getId() == ANONYMOUS_USER_ID and $this->lm_gui->object->getPublicAccessMode() == "selected")
01298 {
01299 $public = ilLMObject::_isPagePublic($page_id);
01300
01301 while ($public === false && $page_id > 0)
01302 {
01303 $succ_node = $this->lm_tree->fetchSuccessorNode($page_id, "pg");
01304 $page_id = $succ_node["obj_id"];
01305 $public = ilLMObject::_isPagePublic($page_id);
01306 }
01307 }
01308 }
01309
01310 return $page_id;
01311 }
01312
01313 function mapCurrentPageId($current_page_id)
01314 {
01315 $subtree = $this->lm_tree->getSubTree($this->lm_tree->getNodeData(1));
01316 $node = $this->lm_tree->getNodeData($current_page_id);
01317 $pos = array_search($node,$subtree);
01318
01319 $this->tr_obj =& $this->ilias->obj_factory->getInstanceByRefId($_SESSION["tr_id"]);
01320
01321 $lmtree = new ilTree($this->tr_obj->getId());
01322 $lmtree->setTableNames('lm_tree','lm_data');
01323 $lmtree->setTreeTablePK("lm_id");
01324
01325 $subtree = $lmtree->getSubTree($lmtree->getNodeData(1));
01326
01327 return $subtree[$pos]["child"];
01328 }
01329
01330 function ilTranslation(&$a_page_node)
01331 {
01332 global $ilUser;
01333
01334 require_once("./Services/COPage/classes/class.ilPageObjectGUI.php");
01335 require_once("./Modules/LearningModule/classes/class.ilLMPageObject.php");
01336
01337 $page_id = $this->mapCurrentPageId($this->getCurrentPageId());
01338
01339 if(!$page_id)
01340 {
01341 $this->tpl->setVariable("TRANSLATION_CONTENT","NO TRNSLATION FOUND");
01342 return false;
01343 }
01344
01345 $page_object =& new ilPageObject($this->lm->getType(), $page_id);
01346 $page_object_gui =& new ilPageObjectGUI($page_object);
01347
01348
01349 $this->ilias->account->setDesktopItemParameters($_SESSION["tr_id"], $this->lm->getType(),$page_id);
01350
01351
01352 include_once './Modules/Course/classes/class.ilCourseLMHistory.php';
01353
01354 ilCourseLMHistory::_updateLastAccess($ilUser->getId(),$this->lm->getRefId(),$page_id);
01355
01356
01357 $targets = $this->getLayoutLinkTargets();
01358
01359 $lm_pg_obj =& new ilLMPageObject($this->lm, $page_id);
01360 $lm_pg_obj->setLMId($_SESSION["tr_id"]);
01361
01362 #$page_object_gui->setLayoutLinkTargets($targets);
01363
01364
01365 $page_object_gui->setBibId($_SESSION["bib_id"]);
01366
01367
01368
01369 $page_object_gui->setLinkFrame($_GET["frame"]);
01370 $page_object_gui->setOutputMode("presentation");
01371 $page_object_gui->setOutputSubmode("translation");
01372
01373 $page_object_gui->setPresentationTitle(
01374 ilLMPageObject::_getPresentationTitle($lm_pg_obj->getId(),
01375 $this->lm->getPageHeader(), $this->lm->isActiveNumbering()));
01376 # $page_object_gui->setLinkParams("ref_id=".$this->lm->getRefId());
01377 $page_object_gui->setLinkParams("ref_id=".$_SESSION["tr_id"]);
01378 $page_object_gui->setTemplateTargetVar("PAGE_CONTENT");
01379 $page_object_gui->setTemplateOutputVar("TRANSLATION_CONTENT");
01380
01381
01382 return $page_object_gui->presentation();
01383
01384 }
01385
01386 function ilCitation()
01387 {
01388 $page_id = $this->getCurrentPageId();
01389 $this->tpl = new ilTemplate("tpl.page.html",true,true,true);
01390 $this->ilLocator();
01391 $this->tpl->setVariable("MENU",$this->lm_gui->setilCitationMenu());
01392
01393 include_once("./Services/COPage/classes/class.ilPageObject.php");
01394
01395 $this->pg_obj =& new ilPageObject($this->lm->getType(),$page_id);
01396 $xml = $this->pg_obj->getXMLContent();
01397 $this->lm_gui->showCitation($xml);
01398 $this->tpl->show();
01399 }
01400
01401
01402 function getLayoutLinkTargets()
01403 {
01404
01405 if (!is_object($this->layout_doc))
01406 return array ();
01407
01408 $xpc = xpath_new_context($this->layout_doc);
01409
01410 $path = "/ilLayout/ilLinkTargets/LinkTarget";
01411 $res = xpath_eval($xpc, $path);
01412 $targets = array();
01413 for ($i = 0; $i < count($res->nodeset); $i++)
01414 {
01415 $type = $res->nodeset[$i]->get_attribute("Type");
01416 $frame = $res->nodeset[$i]->get_attribute("Frame");
01417 $targets[$type] = array("Type" => $type, "Frame" => $frame);
01418 }
01419 return $targets;
01420 }
01421
01425 function ilPage(&$a_page_node, $a_page_id = 0)
01426 {
01427 global $ilBench,$ilUser;
01428
01429 if ($ilUser->getId() == ANONYMOUS_USER_ID and $this->lm_gui->object->getPublicAccessMode() == "selected")
01430 {
01431 $public = ilLMObject::_isPagePublic($this->getCurrentPageId());
01432
01433 if (!$public)
01434 return $this->showNoPublicAccess($this->getCurrentPageId());
01435 }
01436
01437 if (!ilObjContentObject::_checkPreconditionsOfPage($this->lm->getRefId(),$this->lm->getId(), $this->getCurrentPageId()))
01438 {
01439 return $this->showPreconditionsOfPage($this->getCurrentPageId());
01440 }
01441
01442 $ilBench->start("ContentPresentation", "ilPage");
01443
01444 require_once("./Services/COPage/classes/class.ilPageObjectGUI.php");
01445 require_once("./Modules/LearningModule/classes/class.ilLMPageObject.php");
01446
01447
01448 if ($a_page_id == 0)
01449 {
01450 $ilBench->start("ContentPresentation", "ilPage_getCurrentPageId");
01451 $page_id = $this->getCurrentPageId();
01452 $ilBench->stop("ContentPresentation", "ilPage_getCurrentPageId");
01453 }
01454 else
01455 {
01456 $page_id = $a_page_id;
01457 }
01458
01459
01460 if ($page_id == 0)
01461 {
01462 $cont = $this->lng->txt("cont_no_page");
01463 $this->tpl->setVariable("PAGE_CONTENT", $cont);
01464 return $cont;
01465 }
01466
01467 $ilBench->start("ContentPresentation", "ilPage_getPageObject");
01468 $page_object =& new ilPageObject($this->lm->getType(), $page_id);
01469 $page_object->buildDom();
01470 $page_object->registerOfflineHandler($this);
01471 $ilBench->stop("ContentPresentation", "ilPage_getPageObject");
01472
01473 $ilBench->start("ContentPresentation", "ilPage_getInternalLinks");
01474 $int_links = $page_object->getInternalLinks();
01475 $ilBench->stop("ContentPresentation", "ilPage_getInternalLinks");
01476
01477 $ilBench->start("ContentPresentation", "ilPage_getPageObjectGUI");
01478 $page_object_gui =& new ilPageObjectGUI($page_object);
01479 $page_object_gui->setTemplateOutput(false);
01480 $ilBench->stop("ContentPresentation", "ilPage_getPageObjectGUI");
01481
01482
01483 $this->ilias->account->setDesktopItemParameters($this->lm->getRefId(), $this->lm->getType(), $page_id);
01484
01485
01486 $ilBench->start("ContentPresentation", "ilPage_updateCourseItems");
01487 include_once './Modules/Course/classes/class.ilCourseLMHistory.php';
01488 ilCourseLMHistory::_updateLastAccess($ilUser->getId(),$this->lm->getRefId(),$page_id);
01489 $ilBench->stop("ContentPresentation", "ilPage_updateCourseItems");
01490
01491
01492 $link_xml = $this->getLinkXML($int_links, $this->getLayoutLinkTargets());
01493
01494
01495
01496 $ilBench->start("ContentPresentation", "ilPage_getLMPageObject");
01497 $lm_pg_obj =& new ilLMPageObject($this->lm, $page_id);
01498 $lm_pg_obj->setLMId($this->lm->getId());
01499
01500 $page_object_gui->setLinkXML($link_xml);
01501 $ilBench->stop("ContentPresentation", "ilPage_getLMPageObject");
01502
01503 $ilBench->start("ContentPresentation", "ilPage_preparePage");
01504
01505
01506 $page_object_gui->setBibId($_SESSION["bib_id"]);
01507 $page_object_gui->enableCitation((bool) $_SESSION["citation"]);
01508
01509
01510
01511 $page_object_gui->setLinkFrame($_GET["frame"]);
01512 if (!$this->offlineMode())
01513 {
01514 $page_object_gui->setOutputMode("presentation");
01515 }
01516 else
01517 {
01518 $page_object_gui->setOutputMode("offline");
01519 $page_object_gui->setOfflineDirectory($this->getOfflineDirectory());
01520 }
01521 $page_object_gui->setFileDownloadLink($this->getLink($_GET["ref_id"], "downloadFile"));
01522 $page_object_gui->setFullscreenLink($this->getLink($_GET["ref_id"], "fullscreen"));
01523
01524
01525
01526 if ($page_id == 0 || ($page_id != $this->lm->getHeaderPage() &&
01527 $page_id != $this->lm->getFooterPage()))
01528 {
01529 $page_object_gui->setPresentationTitle(
01530 ilLMPageObject::_getPresentationTitle($lm_pg_obj->getId(),
01531 $this->lm->getPageHeader(), $this->lm->isActiveNumbering()));
01532 }
01533
01534
01535 $page_object_gui->setLinkParams("ref_id=".$this->lm->getRefId());
01536 $page_object_gui->setTemplateTargetVar("PAGE_CONTENT");
01537 $page_object_gui->setSourcecodeDownloadScript($this->getSourcecodeDownloadLink());
01538
01539 if($_SESSION["tr_id"])
01540 {
01541 $page_object_gui->setOutputSubmode("translation");
01542 }
01543
01544
01545 $this->tpl->setCurrentBlock("ContentStyle");
01546 if (!$this->offlineMode())
01547 {
01548 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET",
01549 ilObjStyleSheet::getContentStylePath($this->lm->getStyleSheetId()));
01550 }
01551 else
01552 {
01553 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", "content.css");
01554 }
01555 $this->tpl->parseCurrentBlock();
01556
01557
01558 $this->tpl->setCurrentBlock("SyntaxStyle");
01559 if (!$this->offlineMode())
01560 {
01561 $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET",
01562 ilObjStyleSheet::getSyntaxStylePath());
01563 }
01564 else
01565 {
01566 $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET",
01567 "syntaxhighlight.css");
01568 }
01569 $this->tpl->parseCurrentBlock();
01570
01571 $ilBench->stop("ContentPresentation", "ilPage_preparePage");
01572
01573
01574 $ilBench->start("ContentPresentation", "ilPage_trackUserAccess");
01575 include_once "Services/Tracking/classes/class.ilTracking.php";
01576 ilTracking::_trackAccess($this->lm->getId(), $this->lm->getType(),
01577 $page_id, "pg", "read");
01578 $ilBench->stop("ContentPresentation", "ilPage_trackUserAccess");
01579
01580 $ilBench->start("ContentPresentation", "ilPage_getPageContent");
01581 $ret = $page_object_gui->presentation($page_object_gui->getOutputMode());
01582 $ilBench->stop("ContentPresentation", "ilPage_getPageContent");
01583
01584 $ilBench->stop("ContentPresentation", "ilPage");
01585
01586
01587 if ($this->lm->getHeaderPage() > 0 &&
01588 $page_id != $this->lm->getHeaderPage() &&
01589 ($page_id == 0 || $page_id != $this->lm->getFooterPage()))
01590 {
01591 if (ilLMObject::_exists($this->lm->getHeaderPage()))
01592 {
01593 $head = $this->ilPage($a_page_node, $this->lm->getHeaderPage());
01594 }
01595 }
01596
01597
01598 if ($this->lm->getFooterPage() > 0 &&
01599 $page_id != $this->lm->getFooterPage() &&
01600 ($page_id == 0 || $page_id != $this->lm->getHeaderPage()))
01601 {
01602 if (ilLMObject::_exists($this->lm->getFooterPage()))
01603 {
01604 $foot = $this->ilPage($a_page_node, $this->lm->getFooterPage());
01605 }
01606 }
01607 $this->tpl->setVariable("PAGE_CONTENT", $head.$ret.$foot);
01608
01609 return $head.$ret.$foot;
01610
01611 }
01612
01616 function showPreconditionsOfPage()
01617 {
01618 global $ilBench;
01619
01620 $ilBench->start("ContentPresentation", "showPagePreconditions");
01621 $conds = ilObjContentObject::_getMissingPreconditionsOfPage($this->lm->getRefId(),$this->lm->getId(), $this->getCurrentPageId());
01622 $topchap = ilObjContentObject::_getMissingPreconditionsTopChapter($this->lm->getRefId(),$this->lm->getId(), $this->getCurrentPageId());
01623
01624 $page_id = $this->getCurrentPageId();
01625
01626
01627 $this->tpl->setCurrentBlock("ContentStyle");
01628 if (!$this->offlineMode())
01629 {
01630 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET",
01631 ilObjStyleSheet::getContentStylePath($this->lm->getStyleSheetId()));
01632 }
01633 else
01634 {
01635 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", "content.css");
01636 }
01637 $this->tpl->parseCurrentBlock();
01638
01639 $this->tpl->addBlockFile("PAGE_CONTENT", "pg_content", "tpl.page_preconditions.html", true);
01640
01641
01642 include_once("classes/class.ilRepositoryExplorer.php");
01643 foreach($conds as $cond)
01644 {
01645 $obj_link = ilRepositoryExplorer::buildLinkTarget($cond["trigger_ref_id"],$cond["trigger_type"]);
01646 $obj_frame = ilRepositoryExplorer::buildFrameTarget($cond["trigger_type"],$cond["trigger_ref_id"],$cond["trigger_obj_id"]);
01647 $this->tpl->setCurrentBlock("condition");
01648 $this->tpl->setVariable("ROWCOL", $rc = ($rc != "tblrow2") ? "tblrow2" : "tblrow1");
01649 $this->tpl->setVariable("VAL_ITEM", ilObject::_lookupTitle($cond["trigger_obj_id"]));
01650 $this->tpl->setVariable("LINK_ITEM", $obj_link);
01651 $this->tpl->setVariable("FRAME_ITEM", $obj_frame);
01652 if ($cond["operator"] == "passed")
01653 {
01654 $cond_str = $this->lng->txt("passed");
01655 }
01656 else
01657 {
01658 $cond_str = $cond["operator"];
01659 }
01660 $this->tpl->setVariable("VAL_CONDITION", $cond_str." ".$cond["value"]);
01661 $this->tpl->parseCurrentBlock();
01662 }
01663 $this->tpl->setCurrentBlock("pg_content");
01664
01665 $this->tpl->setVariable("TXT_MISSING_PRECONDITIONS",
01666 sprintf($this->lng->txt("cont_missing_preconditions"),
01667 ilLMObject::_lookupTitle($topchap)));
01668 $this->tpl->setVariable("TXT_ITEM", $this->lng->txt("item"));
01669 $this->tpl->setVariable("TXT_CONDITION", $this->lng->txt("condition"));
01670
01671
01672 $parent = $this->lm_tree->getParentId($topchap);
01673 $childs = $this->lm_tree->getChildsByType($parent, "st");
01674 $next = "";
01675 $j=-2; $i=1;
01676 foreach($childs as $child)
01677 {
01678 if ($child["child"] == $topchap)
01679 {
01680 $j = $i;
01681 }
01682 if ($i++ == ($j+1))
01683 {
01684 $succ_node = $this->lm_tree->fetchSuccessorNode($child["child"], "pg");
01685 }
01686 }
01687 if($succ_node != "")
01688 {
01689 $framestr = (!empty($_GET["frame"]))
01690 ? "frame=".$_GET["frame"]."&"
01691 : "";
01692
01693 $showViewInFrameset = true;
01694 $link = "<br /><a href=\"".
01695 $this->getLink($this->lm->getRefId(), "layout", $succ_node["obj_id"], $_GET["frame"]).
01696 "\">".$this->lng->txt("cont_skip_chapter")."</a>";
01697 $this->tpl->setVariable("LINK_SKIP_CHAPTER", $link);
01698 }
01699
01700 $this->tpl->parseCurrentBlock();
01701
01702 $ilBench->stop("ContentPresentation", "showPagePreconditions");
01703 }
01704
01708 function getLinkXML($a_int_links, $a_layoutframes)
01709 {
01710
01711
01712
01713 $showViewInFrameset = true;
01714
01715 if ($a_layoutframes == "")
01716 {
01717 $a_layoutframes = array();
01718 }
01719 $link_info = "<IntLinkInfos>";
01720 foreach ($a_int_links as $int_link)
01721 {
01722 $target = $int_link["Target"];
01723 if (substr($target, 0, 4) == "il__")
01724 {
01725 $target_arr = explode("_", $target);
01726 $target_id = $target_arr[count($target_arr) - 1];
01727 $type = $int_link["Type"];
01728 $targetframe = ($int_link["TargetFrame"] != "")
01729 ? $int_link["TargetFrame"]
01730 : "None";
01731
01732 switch($type)
01733 {
01734 case "PageObject":
01735 case "StructureObject":
01736 $lm_id = ilLMObject::_lookupContObjID($target_id);
01737 if ($lm_id == $this->lm->getId() ||
01738 ($targetframe != "None" && $targetframe != "New"))
01739 {
01740 $ltarget = $a_layoutframes[$targetframe]["Frame"];
01741
01742
01743
01744 $nframe = ($ltarget == "")
01745 ? ""
01746 : $ltarget;
01747 if ($ltarget == "")
01748 {
01749 if ($showViewInFrameset) {
01750 $ltarget="_parent";
01751 } else {
01752 $ltarget="_top";
01753 }
01754 }
01755
01756
01757 if ($this->getExportFormat() == "scorm" &&
01758 $this->offlineMode())
01759 {
01760 $ltarget = "";
01761 }
01762 $href =
01763 $this->getLink($_GET["ref_id"], "layout", $target_id, $nframe, $type);
01764 }
01765 else
01766 {
01767 if (!$this->offlineMode())
01768 {
01769 if ($type == "PageObject")
01770 {
01771 $href = "./goto.php?target=pg_".$target_id;
01772 }
01773 else
01774 {
01775 $href = "./goto.php?target=st_".$target_id;
01776 }
01777 }
01778 else
01779 {
01780 if ($type == "PageObject")
01781 {
01782 $href = ILIAS_HTTP_PATH."/goto.php?target=pg_".$target_id."&client_id=".CLIENT_ID;
01783 }
01784 else
01785 {
01786 $href = ILIAS_HTTP_PATH."/goto.php?target=st_".$target_id."&client_id=".CLIENT_ID;
01787 }
01788 }
01789 $ltarget = ilFrameTargetInfo::_getFrame("MainContent");
01790 }
01791 break;
01792
01793 case "GlossaryItem":
01794 if ($targetframe == "None")
01795 {
01796 $targetframe = "Glossary";
01797 }
01798 $ltarget = $a_layoutframes[$targetframe]["Frame"];
01799 $nframe = ($ltarget == "")
01800 ? $_GET["frame"]
01801 : $ltarget;
01802 $href =
01803 $this->getLink($_GET["ref_id"], $a_cmd = "glossary", $target_id, $nframe, $type);
01804 break;
01805
01806 case "MediaObject":
01807 $ltarget = $a_layoutframes[$targetframe]["Frame"];
01808 $nframe = ($ltarget == "")
01809 ? $_GET["frame"]
01810 : $ltarget;
01811 $href =
01812 $this->getLink($_GET["ref_id"], $a_cmd = "media", $target_id, $nframe, $type);
01813 break;
01814
01815 case "RepositoryItem":
01816 $obj_type = ilObject::_lookupType($target_id, true);
01817 $obj_id = ilObject::_lookupObjId($target_id);
01818 if (!$this->offlineMode())
01819 {
01820 $href = "./goto.php?target=".$obj_type."_".$target_id;
01821 }
01822 else
01823 {
01824 $href = ILIAS_HTTP_PATH."/goto.php?target=".$obj_type."_".$target_id."&client_id=".CLIENT_ID;
01825 }
01826 $ltarget = ilFrameTargetInfo::_getFrame("MainContent");
01827 break;
01828
01829 }
01830 $link_info.="<IntLinkInfo Target=\"$target\" Type=\"$type\" ".
01831 "TargetFrame=\"$targetframe\" LinkHref=\"$href\" LinkTarget=\"$ltarget\" />";
01832
01833
01834
01835
01836
01837
01838
01839
01840 }
01841 }
01842 $link_info.= "</IntLinkInfos>";
01843
01844 return $link_info;
01845 }
01846
01847
01851 function ilGlossary()
01852 {
01853 global $ilBench;
01854
01855 $ilBench->start("ContentPresentation", "ilGlossary");
01856
01857 require_once("./Modules/Glossary/classes/class.ilGlossaryTermGUI.php");
01858 $term_gui =& new ilGlossaryTermGUI($_GET["obj_id"]);
01859
01860
01861 $this->tpl->setCurrentBlock("ContentStyle");
01862 if (!$this->offlineMode())
01863 {
01864 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET",
01865 ilObjStyleSheet::getContentStylePath($this->lm->getStyleSheetId()));
01866 }
01867 else
01868 {
01869 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", "content.css");
01870 }
01871 $this->tpl->parseCurrentBlock();
01872
01873
01874 $this->tpl->setCurrentBlock("SyntaxStyle");
01875
01876 if (!$this->offlineMode())
01877 {
01878 $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET",
01879 ilObjStyleSheet::getSyntaxStylePath());
01880 }
01881 else
01882 {
01883 $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET",
01884 "syntaxhighlight.css");
01885 }
01886 $this->tpl->parseCurrentBlock();
01887
01888 $int_links = $term_gui->getInternalLinks();
01889 $link_xml = $this->getLinkXML($int_links, $this->getLayoutLinkTargets());
01890 $term_gui->setLinkXML($link_xml);
01891
01892 $term_gui->setOfflineDirectory($this->getOfflineDirectory());
01893 $term_gui->output($this->offlineMode());
01894
01895
01896
01897 $ilBench->stop("ContentPresentation", "ilGlossary");
01898 }
01899
01903 function ilMedia()
01904 {
01905 global $ilBench;
01906
01907 $ilBench->start("ContentPresentation", "ilMedia");
01908
01909 $this->tpl->setCurrentBlock("ContentStyle");
01910 if (!$this->offlineMode())
01911 {
01912 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET",
01913 ilObjStyleSheet::getContentStylePath($this->lm->getStyleSheetId()));
01914 }
01915 else
01916 {
01917 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", "content.css");
01918 }
01919 $this->tpl->parseCurrentBlock();
01920
01921 $this->tpl->setVariable("PAGETITLE", " - ".$this->lm->getTitle());
01922
01923
01924 if (!$this->offlineMode())
01925 {
01926 $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
01927 }
01928 else
01929 {
01930 $style_name = $this->ilias->account->prefs["style"].".css";;
01931 $this->tpl->setVariable("LOCATION_STYLESHEET","./".$style_name);
01932 }
01933
01934 $this->tpl->setCurrentBlock("ilMedia");
01935
01936
01937 $med_links = ilMediaItem::_getMapAreasIntLinks($_GET["mob_id"]);
01938 $link_xml = $this->getLinkXML($med_links, $this->getLayoutLinkTargets());
01939
01940 require_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
01941 $media_obj =& new ilObjMediaObject($_GET["mob_id"]);
01942 if (!empty ($_GET["pg_id"]))
01943 {
01944 require_once("./Services/COPage/classes/class.ilPageObject.php");
01945 $pg_obj =& new ilPageObject($this->lm->getType(), $_GET["pg_id"]);
01946 $pg_obj->buildDom();
01947
01948 $xml = "<dummy>";
01949
01950
01951 $xml.= $pg_obj->getMediaAliasElement($_GET["mob_id"]);
01952 $xml.= $media_obj->getXML(IL_MODE_OUTPUT);
01953 $xml.= $link_xml;
01954 $xml.="</dummy>";
01955 }
01956 else
01957 {
01958 $xml = "<dummy>";
01959
01960
01961 $xml.= $media_obj->getXML(IL_MODE_ALIAS);
01962 $xml.= $media_obj->getXML(IL_MODE_OUTPUT);
01963 $xml.= $link_xml;
01964 $xml.="</dummy>";
01965 }
01966
01967
01968
01969
01970
01971
01972 $xsl = file_get_contents("./Services/COPage/xsl/page.xsl");
01973 $args = array( '/_xml' => $xml, '/_xsl' => $xsl );
01974 $xh = xslt_create();
01975
01976
01977
01978
01979 if (!$this->offlineMode())
01980 {
01981 $wb_path = ilUtil::getWebspaceDir("output");
01982 }
01983 else
01984 {
01985 $wb_path = ".";
01986 }
01987
01988 $mode = ($_GET["cmd"] == "fullscreen")
01989 ? "fullscreen"
01990 : "media";
01991 $enlarge_path = ilUtil::getImagePath("enlarge.gif", false, "output", $this->offlineMode());
01992 $fullscreen_link =
01993 $this->getLink($this->lm->getRefId(), "fullscreen");
01994 $params = array ('mode' => $mode, 'enlarge_path' => $enlarge_path,
01995 'link_params' => "ref_id=".$this->lm->getRefId(),'fullscreen_link' => $fullscreen_link,
01996 'ref_id' => $this->lm->getRefId(), 'pg_frame' => $pg_frame, 'webspace_path' => $wb_path);
01997 $output = xslt_process($xh,"arg:/_xml","arg:/_xsl",NULL,$args, $params);
01998 echo xslt_error($xh);
01999 xslt_free($xh);
02000
02001
02002 $this->tpl->setVariable("MEDIA_CONTENT", $output);
02003
02004 $ilBench->stop("ContentPresentation", "ilMedia");
02005 }
02006
02007
02012 function ilLMNavigation()
02013 {
02014 global $ilBench,$ilUser;
02015
02016 $ilBench->start("ContentPresentation", "ilLMNavigation");
02017
02018 $page_id = $this->getCurrentPageId();
02019
02020 if(empty($page_id))
02021 {
02022 return;
02023 }
02024
02025
02026 if(!$this->lm_tree->isInTree($page_id))
02027 {
02028 if ($this->offlineMode() || $_GET["back_pg"] == "")
02029 {
02030 return;
02031 }
02032 $limpos = strpos($_GET["back_pg"], ":");
02033 if ($limpos > 0)
02034 {
02035 $back_pg = substr($_GET["back_pg"], 0, $limpos);
02036 }
02037 else
02038 {
02039 $back_pg = $_GET["back_pg"];
02040 }
02041 if (!$this->lm->cleanFrames())
02042 {
02043 $back_href =
02044 $this->getLink($this->lm->getRefId(), "layout", $back_pg, $_GET["frame"],
02045 "", "reduce");
02046 $back_target = "";
02047 }
02048 else
02049 {
02050 $back_href =
02051 $this->getLink($this->lm->getRefId(), "layout", $back_pg, "",
02052 "", "reduce");
02053 $back_target = 'target="'.ilFrameTargetInfo::_getFrame("MainContent").'" ';
02054 }
02055 $back_img =
02056 ilUtil::getImagePath("nav_arr2_L.gif", false, "output", $this->offlineMode());
02057 $this->tpl->setCurrentBlock("ilLMNavigation_Prev");
02058 $this->tpl->setVariable("IMG_PREV", $back_img);
02059 $this->tpl->setVariable("HREF_PREV", $back_href);
02060 $this->tpl->setVariable("FRAME_PREV", $back_target);
02061 $this->tpl->setVariable("TXT_PREV", $this->lng->txt("back"));
02062 $this->tpl->setVariable("ALT_PREV", $this->lng->txt("back"));
02063 $this->tpl->parseCurrentBlock();
02064 $this->tpl->setCurrentBlock("ilLMNavigation_Prev2");
02065 $this->tpl->setVariable("IMG_PREV2", $back_img);
02066 $this->tpl->setVariable("HREF_PREV2", $back_href);
02067 $this->tpl->setVariable("FRAME_PREV2", $back_target);
02068 $this->tpl->setVariable("TXT_PREV2", $this->lng->txt("back"));
02069 $this->tpl->setVariable("ALT_PREV2", $this->lng->txt("back"));
02070 $this->tpl->parseCurrentBlock();
02071 return;
02072 }
02073
02074
02075 $ilBench->start("ContentPresentation", "ilLMNavigation_fetchSuccessor");
02076 $found = false;
02077 $c_id = $page_id;
02078 while (!$found)
02079 {
02080 $succ_node = $this->lm_tree->fetchSuccessorNode($c_id, "pg");
02081 $c_id = $succ_node["obj_id"];
02082 if ($succ_node["obj_id"] > 0 &&
02083 $ilUser->getId() == ANONYMOUS_USER_ID &&
02084 ( $this->lm->getPublicAccessMode() == "selected" &&
02085 !ilLMObject::_isPagePublic($succ_node["obj_id"])))
02086 {
02087 $found = false;
02088 }
02089 else if ($succ_node["obj_id"] > 0 &&
02090 !ilLMObject::_lookupActive($succ_node["obj_id"]))
02091 {
02092 $found = false;
02093 }
02094 else
02095 {
02096 $found = true;
02097 }
02098 }
02099 $ilBench->stop("ContentPresentation", "ilLMNavigation_fetchSuccessor");
02100
02101 $succ_str = ($succ_node !== false)
02102 ? " -> ".$succ_node["obj_id"]."_".$succ_node["type"]
02103 : "";
02104
02105
02106 $ilBench->start("ContentPresentation", "ilLMNavigation_fetchPredecessor");
02107 $found = false;
02108 $c_id = $page_id;
02109 while (!$found)
02110 {
02111 $pre_node = $this->lm_tree->fetchPredecessorNode($c_id, "pg");
02112 $c_id = $pre_node["obj_id"];
02113 if ($pre_node["obj_id"] > 0 &&
02114 $ilUser->getId() == ANONYMOUS_USER_ID &&
02115 ($this->lm->getPublicAccessMode() == "selected" &&
02116 !ilLMObject::_isPagePublic($pre_node["obj_id"])))
02117 {
02118 $found = false;
02119 }
02120 else if ($pre_node["obj_id"] > 0 &&
02121 !ilLMObject::_lookupActive($pre_node["obj_id"]))
02122 {
02123 $found = false;
02124 }
02125 else
02126 {
02127 $found = true;
02128 }
02129 }
02130 $ilBench->stop("ContentPresentation", "ilLMNavigation_fetchPredecessor");
02131
02132 $pre_str = ($pre_node !== false)
02133 ? $pre_node["obj_id"]."_".$pre_node["type"]." -> "
02134 : "";
02135
02136
02137 $framestr = (!empty($_GET["frame"]))
02138 ? "frame=".$_GET["frame"]."&"
02139 : "";
02140
02141
02142
02143
02144
02145 $showViewInFrameset = true;
02146
02147 if($pre_node != "")
02148 {
02149 $ilBench->start("ContentPresentation", "ilLMNavigation_outputPredecessor");
02150
02151
02152
02153
02154
02155
02156
02157
02158 $ilBench->start("ContentPresentation", "ilLMNavigation_getPresentationTitle");
02159 $prev_title = ilLMPageObject::_getPresentationTitle($pre_node["obj_id"],
02160 $this->lm->getPageHeader(), $this->lm->isActiveNumbering());
02161 $prev_title = ilUtil::shortenText($prev_title, 50, true);
02162 $prev_img =
02163 ilUtil::getImagePath("nav_arr_L.gif", false, "output", $this->offlineMode());
02164
02165 if (!$this->lm->cleanFrames())
02166 {
02167 $prev_href =
02168 $this->getLink($this->lm->getRefId(), "layout", $pre_node["obj_id"], $_GET["frame"]);
02169 $prev_target = "";
02170 }
02171 else if ($showViewInFrameset && !$this->offlineMode())
02172 {
02173 $prev_href =
02174 $this->getLink($this->lm->getRefId(), "layout", $pre_node["obj_id"]);
02175 $prev_target = 'target="'.ilFrameTargetInfo::_getFrame("MainContent").'" ';
02176 }
02177 else
02178 {
02179 $prev_href =
02180 $this->getLink($this->lm->getRefId(), "layout", $pre_node["obj_id"]);
02181 $prev_target = 'target="_top" ';
02182 }
02183
02184 if ($ilUser->getId() == ANONYMOUS_USER_ID and ($this->lm->getPublicAccessMode() == "selected" and !ilLMObject::_isPagePublic($pre_node["obj_id"])))
02185 {
02186 $output = $this->lng->txt("msg_page_not_public");
02187 }
02188
02189 $ilBench->stop("ContentPresentation", "ilLMNavigation_getPresentationTitle");
02190
02191 $this->tpl->setCurrentBlock("ilLMNavigation_Prev");
02192 $this->tpl->setVariable("IMG_PREV", $prev_img);
02193 $this->tpl->setVariable("HREF_PREV", $prev_href);
02194 $this->tpl->setVariable("FRAME_PREV", $prev_target);
02195 $this->tpl->setVariable("TXT_PREV", $prev_title);
02196 $this->tpl->setVariable("ALT_PREV", $this->lng->txt("previous"));
02197 $this->tpl->parseCurrentBlock();
02198 $this->tpl->setCurrentBlock("ilLMNavigation_Prev2");
02199 $this->tpl->setVariable("IMG_PREV2", $prev_img);
02200 $this->tpl->setVariable("HREF_PREV2", $prev_href);
02201 $this->tpl->setVariable("FRAME_PREV2", $prev_target);
02202 $this->tpl->setVariable("TXT_PREV2", $prev_title);
02203 $this->tpl->setVariable("ALT_PREV2", $this->lng->txt("previous"));
02204 $this->tpl->parseCurrentBlock();
02205 $ilBench->stop("ContentPresentation", "ilLMNavigation_outputPredecessor");
02206 }
02207 if($succ_node != "")
02208 {
02209 $ilBench->start("ContentPresentation", "ilLMNavigation_outputSuccessor");
02210
02211
02212 $ilBench->start("ContentPresentation", "ilLMNavigation_getPresentationTitle");
02213 $succ_title = ilLMPageObject::_getPresentationTitle($succ_node["obj_id"],
02214 $this->lm->getPageHeader(), $this->lm->isActiveNumbering());
02215 $succ_title = ilUtil::shortenText($succ_title,50,true);
02216 $succ_img =
02217 ilUtil::getImagePath("nav_arr_R.gif", false, "output", $this->offlineMode());
02218 if (!$this->lm->cleanFrames())
02219 {
02220 $succ_href =
02221 $this->getLink($this->lm->getRefId(), "layout", $succ_node["obj_id"], $_GET["frame"]);
02222 $succ_target = "";
02223 }
02224 else if ($showViewInFrameset && !$this->offlineMode())
02225 {
02226 $succ_href =
02227 $this->getLink($this->lm->getRefId(), "layout", $succ_node["obj_id"]);
02228 $succ_target = ' target="'.ilFrameTargetInfo::_getFrame("MainContent").'" ';
02229 }
02230 else
02231 {
02232 $succ_href =
02233 $this->getLink($this->lm->getRefId(), "layout", $succ_node["obj_id"]);
02234 $succ_target = ' target="_top" ';
02235 }
02236
02237 if ($ilUser->getId() == ANONYMOUS_USER_ID and ($this->lm->getPublicAccessMode() == "selected" and !ilLMObject::_isPagePublic($succ_node["obj_id"])))
02238 {
02239 $output = $this->lng->txt("msg_page_not_public");
02240 }
02241
02242 $ilBench->stop("ContentPresentation", "ilLMNavigation_getPresentationTitle");
02243
02244 $this->tpl->setCurrentBlock("ilLMNavigation_Next");
02245 $this->tpl->setVariable("IMG_SUCC", $succ_img);
02246 $this->tpl->setVariable("HREF_SUCC", $succ_href);
02247 $this->tpl->setVariable("FRAME_SUCC", $succ_target);
02248 $this->tpl->setVariable("TXT_SUCC", $succ_title);
02249 $this->tpl->setVariable("ALT_SUCC", $this->lng->txt("next"));
02250 $this->tpl->parseCurrentBlock();
02251 $this->tpl->setCurrentBlock("ilLMNavigation_Next2");
02252 $this->tpl->setVariable("IMG_SUCC2", $succ_img);
02253 $this->tpl->setVariable("HREF_SUCC2", $succ_href);
02254 $this->tpl->setVariable("FRAME_SUCC2", $succ_target);
02255 $this->tpl->setVariable("TXT_SUCC2", $succ_title);
02256 $this->tpl->setVariable("ALT_SUCC2", $this->lng->txt("next"));
02257 $this->tpl->parseCurrentBlock();
02258 $ilBench->stop("ContentPresentation", "ilLMNavigation_outputSuccessor");
02259 }
02260
02261 $ilBench->stop("ContentPresentation", "ilLMNavigation");
02262 }
02263
02264
02265 function processNodes(&$a_content, &$a_node)
02266 {
02267 $child_nodes = $a_node->child_nodes();
02268 foreach ($child_nodes as $child)
02269 {
02270 if($child->node_name() == "ilFrame")
02271 {
02272 $attributes = $this->attrib2arr($child->attributes());
02273
02274 if ((!empty($attributes["rows"])) || (!empty($attrubtes["cols"])))
02275 {
02276
02277
02278 if(!empty($attributes["name"]))
02279 {
02280 unset($attributes["template"]);
02281 unset($attributes["template_location"]);
02282 $attributes["src"] =
02283 $this->getLink($this->lm->getRefId(), "layout", $_GET["obj_id"], $attributes["name"],
02284 "", "keep");
02285 $attributes["title"] = $this->lng->txt("cont_frame_".$attributes["name"]);
02286 $a_content .= $this->buildTag("", "frame", $attributes);
02287 $this->frames[$attributes["name"]] = $attributes["name"];
02288
02289 }
02290 else
02291 {
02292 $a_content .= $this->buildTag("start", "frameset", $attributes);
02293 $this->processNodes($a_content, $child);
02294 $a_content .= $this->buildTag("end", "frameset");
02295 }
02296 }
02297 else
02298 {
02299 unset($attributes["template"]);
02300 unset($attributes["template_location"]);
02301 $attributes["src"] =
02302 $this->getLink($this->lm->getRefId(), "layout", $_GET["obj_id"], $attributes["name"],
02303 "", "keep");
02304 $attributes["title"] = $this->lng->txt("cont_frame_".$attributes["name"]);
02305 if ($attributes["name"] == "toc")
02306 {
02307 $attributes["src"].= "#".$_GET["obj_id"];
02308 }
02309 $a_content .= $this->buildTag("", "frame", $attributes);
02310 $this->frames[$attributes["name"]] = $attributes["name"];
02311 }
02312 }
02313 }
02314 }
02315
02323 function buildTag ($type, $name, $attr="")
02324 {
02325 $tag = "<";
02326
02327 if ($type == "end")
02328 $tag.= "/";
02329
02330 $tag.= $name;
02331
02332 if (is_array($attr))
02333 {
02334 while (list($k,$v) = each($attr))
02335 $tag.= " ".$k."=\"$v\"";
02336 }
02337
02338 if ($type == "")
02339 $tag.= "/";
02340
02341 $tag.= ">\n";
02342
02343 return $tag;
02344 }
02345
02346
02350 function showTableOfContents()
02351 {
02352 global $ilBench;
02353
02354 $ilBench->start("ContentPresentation", "TableOfContents");
02355
02356
02357 $this->tpl->setCurrentBlock("ContentStyle");
02358 if (!$this->offlineMode())
02359 {
02360 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET",
02361 ilObjStyleSheet::getContentStylePath($this->lm->getStyleSheetId()));
02362 }
02363 else
02364 {
02365 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", "content.css");
02366 }
02367 $this->tpl->parseCurrentBlock();
02368
02369 $this->tpl->setVariable("PAGETITLE", " - ".$this->lm->getTitle());
02370
02371
02372 if (!$this->offlineMode())
02373 {
02374 $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
02375 }
02376 else
02377 {
02378 $style_name = $this->ilias->account->prefs["style"].".css";;
02379 $this->tpl->setVariable("LOCATION_STYLESHEET","./".$style_name);
02380 }
02381
02382
02383 $this->tpl->getStandardTemplate();
02384 $this->ilLocator();
02385
02386 $this->tpl->setVariable("TABS", $this->lm_gui->setilLMMenu($this->offlineMode()
02387 ,$this->getExportFormat(), "toc", true));
02388
02389 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.lm_toc.html", true);
02390
02391
02392 $this->tpl->setVariable("TXT_TOC", $this->lng->txt("cont_toc"));
02393 $this->tpl->setTitle($this->lm->getTitle());
02394 $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_lm_b.gif"));
02395
02396
02397
02398
02399
02400
02401
02402
02403
02404
02405
02406
02407 include_once ("./Modules/LearningModule/classes/class.ilLMTableOfContentsExplorer.php");
02408 $exp = new ilTableOfContentsExplorer(
02409 $this->getLink($this->lm->getRefId(), ""),
02410 $this->lm, $this->getExportFormat());
02411 $exp->setExpandTarget($this->getLink($this->lm->getRefId(), $_GET["cmd"], "", $_GET["frame"]));
02412 $exp->setTargetGet("obj_id");
02413 $exp->setOfflineMode($this->offlineMode());
02414 $exp->forceExpandAll(true, false);
02415
02416
02417 if (!$this->offlineMode())
02418 {
02419 $page_id = $this->getCurrentPageId();
02420 $exp->highlightNode($page_id);
02421 }
02422
02423 $tree =& $this->lm->getTree();
02424 if ($_GET["lmtocexpand"] == "")
02425 {
02426 $expanded = $tree->readRootId();
02427 }
02428 else
02429 {
02430 $expanded = $_GET["lmtocexpand"];
02431 }
02432
02433 $exp->setExpand($expanded);
02434
02435
02436 $exp->setOutput(0);
02437 $output = $exp->getOutput();
02438
02439 $this->tpl->setVariable("EXPLORER", $output);
02440 $this->tpl->parseCurrentBlock();
02441
02442 if ($this->offlineMode())
02443 {
02444 return $this->tpl->get();
02445 }
02446 else
02447 {
02448 $this->tpl->show();
02449 }
02450
02451 $ilBench->stop("ContentPresentation", "TableOfContents");
02452 }
02453
02454
02460 function infoScreen()
02461 {
02462 $this->ctrl->setCmd("showSummary");
02463 $this->ctrl->setCmdClass("ilinfoscreengui");
02464 $this->outputInfoScreen();
02465 }
02466
02470 function showInfoScreen()
02471 {
02472 $this->outputInfoScreen(true);
02473 }
02474
02478 function outputInfoScreen($a_standard_locator = false)
02479 {
02480 global $ilBench, $ilLocator, $ilAccess;
02481
02482 $this->tpl->setHeaderPageTitle("PAGETITLE", " - ".$this->lm->getTitle());
02483
02484
02485 if (!$this->offlineMode())
02486 {
02487 $this->tpl->setStyleSheetLocation(ilUtil::getStyleSheetLocation());
02488 }
02489 else
02490 {
02491 $style_name = $this->ilias->account->prefs["style"].".css";;
02492 $this->tpl->setStyleSheetLocation("./".$style_name);
02493 }
02494
02495 $this->tpl->getStandardTemplate();
02496 $this->tpl->setTitle($this->lm->getTitle());
02497 $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_lm_b.gif"));
02498
02499 $this->tpl->setVariable("TABS", $this->lm_gui->setilLMMenu($this->offlineMode()
02500 ,$this->getExportFormat(), "info", true));
02501
02502
02503 if ($ilAccess->checkAccess("read", "", $_GET["ref_id"]))
02504 {
02505 $this->ilLocator();
02506 }
02507 else
02508 {
02509 $ilLocator->addRepositoryItems();
02510 $this->tpl->setLocator();
02511 }
02512
02513 $this->lng->loadLanguageModule("meta");
02514
02515 include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
02516
02517 $info = new ilInfoScreenGUI($this->lm_gui);
02518 $info->enablePrivateNotes();
02519 $info->enableLearningProgress();
02520
02521 $info->enableNews();
02522 if ($ilAccess->checkAccess("write", "", $_GET["ref_id"]))
02523 {
02524 $news_set = new ilSetting("news");
02525 $enable_internal_rss = $news_set->get("enable_rss_for_internal");
02526
02527 $info->enableNewsEditing();
02528
02529 if ($enable_internal_rss)
02530 {
02531 $info->setBlockProperty("news", "settings", true);
02532 }
02533 }
02534
02535
02536
02537
02538
02539
02540
02541
02542
02543
02544
02545
02546
02547
02548
02549
02550
02551
02552
02553 $info->addMetaDataSections($this->lm->getId(),0, $this->lm->getType());
02554
02555 if ($this->offlineMode())
02556 {
02557 $this->tpl->setContent($info->getHTML());
02558 return $this->tpl->get();
02559 }
02560 else
02561 {
02562
02563 $this->ctrl->forwardCommand($info);
02564
02565 $this->tpl->show();
02566 }
02567 }
02568
02572 function showPrintViewSelection()
02573 {
02574 global $ilBench,$ilUser;
02575
02576 if (!$this->lm->isActivePrintView())
02577 {
02578 return;
02579 }
02580
02581 include_once("./Modules/LearningModule/classes/class.ilStructureObject.php");
02582
02583 $ilBench->start("ContentPresentation", "PrintViewSelection");
02584
02585
02586 $this->tpl->setCurrentBlock("ContentStyle");
02587 if (!$this->offlineMode())
02588 {
02589 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET",
02590 ilObjStyleSheet::getContentStylePath($this->lm->getStyleSheetId()));
02591 }
02592 else
02593 {
02594 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", "content.css");
02595 }
02596 $this->tpl->parseCurrentBlock();
02597
02598 $this->tpl->setVariable("PAGETITLE", " - ".$this->lm->getTitle());
02599 $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
02600 $this->tpl->getStandardTemplate();
02601
02602 $this->tpl->setVariable("TABS", $this->lm_gui->setilLMMenu($this->offlineMode()
02603 ,$this->getExportFormat(), "print", true));
02604
02605 $this->ilLocator();
02606 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content",
02607 "tpl.lm_print_selection.html", true);
02608
02609
02610 $this->tpl->setTitle($this->lm->getTitle());
02611 $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_lm_b.gif"));
02612 $this->tpl->setVariable("TXT_SHOW_PRINT", $this->lng->txt("cont_show_print_view"));
02613
02614
02615
02616
02617
02618
02619 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormaction($this));
02620
02621 $nodes = $this->lm_tree->getSubtree($this->lm_tree->getNodeData($this->lm_tree->getRootId()));
02622
02623 if (!is_array($_POST["item"]))
02624 {
02625 if ($_GET["obj_id"] != "")
02626 {
02627 $_POST["item"][$_GET["obj_id"]] = "y";
02628 }
02629 else
02630 {
02631 $_POST["item"][1] = "y";
02632 }
02633 }
02634
02635 foreach ($nodes as $node)
02636 {
02637
02638
02639 if ($node["type"] == "pg" &&
02640 !ilLMPageObject::_lookupActive($node["obj_id"]))
02641 {
02642 continue;
02643 }
02644
02645
02646 for ($i=0; $i<$node["depth"]; $i++)
02647 {
02648 $this->tpl->setCurrentBlock("indent");
02649 $this->tpl->setVariable("IMG_BLANK", ilUtil::getImagePath("browser/blank.gif"));
02650 $this->tpl->parseCurrentBlock();
02651 }
02652
02653
02654 $this->tpl->setCurrentBlock("lm_item");
02655
02656 switch ($node["type"])
02657 {
02658
02659 case "pg":
02660 $this->tpl->setVariable("TXT_TITLE",
02661 ilLMPageObject::_getPresentationTitle($node["obj_id"],
02662 $this->lm->getPageHeader(), $this->lm->isActiveNumbering()));
02663
02664 if ($ilUser->getId() == ANONYMOUS_USER_ID and $this->lm_gui->object->getPublicAccessMode() == "selected")
02665 {
02666 if (!ilLMObject::_isPagePublic($node["obj_id"]))
02667 {
02668 $this->tpl->setVariable("DISABLED", "disabled=\"disabled\"");
02669 $this->tpl->setVariable("TXT_NO_ACCESS", "(".$this->lng->txt("cont_no_access").")");
02670 }
02671 }
02672 $this->tpl->setVariable("IMG_TYPE", ilUtil::getImagePath("icon_pg.gif"));
02673 break;
02674
02675
02676 case "du":
02677 $this->tpl->setVariable("TXT_TITLE", "<b>".$this->lm->getTitle()."</b>");
02678 $this->tpl->setVariable("IMG_TYPE", ilUtil::getImagePath("icon_lm.gif"));
02679 break;
02680
02681
02682 case "st":
02683
02684
02685
02686
02687
02688 $this->tpl->setVariable("TXT_TITLE", "<b>".
02689 ilStructureObject::_getPresentationTitle($node["obj_id"],
02690 $this->lm->isActiveNumbering())
02691 ."</b>");
02692 if ($ilUser->getId() == ANONYMOUS_USER_ID and $this->lm_gui->object->getPublicAccessMode() == "selected")
02693 {
02694 if (!ilLMObject::_isPagePublic($node["obj_id"]))
02695 {
02696 $this->tpl->setVariable("DISABLED", "disabled=\"disabled\"");
02697 $this->tpl->setVariable("TXT_NO_ACCESS", "(".$this->lng->txt("cont_no_access").")");
02698 }
02699 }
02700 $this->tpl->setVariable("IMG_TYPE", ilUtil::getImagePath("icon_st.gif"));
02701
02702 break;
02703 }
02704
02705 if (!ilObjContentObject::_checkPreconditionsOfPage($this->lm->getRefId(),$this->lm->getId(), $node["obj_id"]))
02706 {
02707 $this->tpl->setVariable("TXT_NO_ACCESS", "(".$this->lng->txt("cont_no_access").")");
02708 }
02709
02710 $this->tpl->setVariable("ITEM_ID", $node["obj_id"]);
02711
02712 if ($_POST["item"][$node["obj_id"]] == "y")
02713 {
02714 $this->tpl->setVariable("CHECKED", "checked=\"checked\"");
02715 }
02716
02717 $this->tpl->parseCurrentBlock();
02718 }
02719
02720
02721 if ($_GET["obj_id"] > 0 && !$this->lm_tree->isInTree($_GET["obj_id"]))
02722 {
02723 $this->tpl->setCurrentBlock("indent");
02724 $this->tpl->setVariable("IMG_BLANK", ilUtil::getImagePath("browser/blank.gif"));
02725 $this->tpl->parseCurrentBlock();
02726 $this->tpl->setCurrentBlock("indent");
02727 $this->tpl->setVariable("IMG_BLANK", ilUtil::getImagePath("browser/blank.gif"));
02728 $this->tpl->parseCurrentBlock();
02729
02730 $this->tpl->setCurrentBlock("lm_item");
02731 $this->tpl->setVariable("TXT_TITLE",
02732 ilLMPageObject::_getPresentationTitle($_GET["obj_id"],
02733 $this->lm->getPageHeader(), $this->lm->isActiveNumbering()));
02734
02735 if ($ilUser->getId() == ANONYMOUS_USER_ID and $this->lm_gui->object->getPublicAccessMode() == "selected")
02736 {
02737 if (!ilLMObject::_isPagePublic($_GET["obj_id"]))
02738 {
02739 $this->tpl->setVariable("DISABLED", "disabled=\"disabled\"");
02740 $this->tpl->setVariable("TXT_NO_ACCESS", "(".$this->lng->txt("cont_no_access").")");
02741 }
02742 }
02743 $this->tpl->setVariable("IMG_TYPE", ilUtil::getImagePath("icon_pg.gif"));
02744 $this->tpl->setVariable("ITEM_ID", $_GET["obj_id"]);
02745
02746 $this->tpl->setVariable("CHECKED", "checked=\"checked\"");
02747
02748 $this->tpl->parseCurrentBlock();
02749 }
02750
02751
02752 $this->tpl->show();
02753
02754 $ilBench->stop("ContentPresentation", "PrintViewSelection");
02755 }
02756
02760 function showPrintView($a_free_page = 0)
02761 {
02762 global $ilBench,$ilUser;
02763
02764 if (!$this->lm->isActivePrintView())
02765 {
02766 return;
02767 }
02768
02769 $ilBench->start("ContentPresentation", "PrintView");
02770
02771 $this->tpl->setVariable("PAGETITLE", " - ".$this->lm->getTitle());
02772
02773
02774 if (!$this->offlineMode())
02775 {
02776 $this->tpl->setVariable("LOCATION_STYLESHEET", ilObjStyleSheet::getContentPrintStyle());
02777 }
02778 else
02779 {
02780 $style_name = $this->ilias->account->prefs["style"].".css";;
02781 $this->tpl->setVariable("LOCATION_STYLESHEET","./".$style_name);
02782 }
02783
02784
02785 $this->tpl->setCurrentBlock("ContentStyle");
02786 if (!$this->offlineMode())
02787 {
02788 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET",
02789 ilObjStyleSheet::getContentStylePath($this->lm->getStyleSheetId()));
02790 }
02791 else
02792 {
02793 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", "content.css");
02794 }
02795 $this->tpl->parseCurrentBlock();
02796
02797
02798 $this->tpl->setCurrentBlock("SyntaxStyle");
02799 $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET",
02800 ilObjStyleSheet::getSyntaxStylePath());
02801 $this->tpl->parseCurrentBlock();
02802
02803
02804 $this->tpl->addBlockFile("CONTENT", "content", "tpl.lm_print_view.html", true);
02805
02806
02807 $this->tpl->setVariable("HEADER", $this->lm->getTitle());
02808
02809 $nodes = $this->lm_tree->getSubtree($this->lm_tree->getNodeData($this->lm_tree->getRootId()));
02810
02811 include_once("./Services/COPage/classes/class.ilPageObjectGUI.php");
02812 include_once("./Modules/LearningModule/classes/class.ilLMPageObject.php");
02813 include_once("./Modules/LearningModule/classes/class.ilStructureObject.php");
02814
02815 $act_level = 99999;
02816 $activated = false;
02817
02818 $glossary_links = array();
02819 $output_header = false;
02820 $media_links = array();
02821
02822
02823 if ($this->lm->getFooterPage() > 0)
02824 {
02825 if (ilLMObject::_exists($this->lm->getFooterPage()))
02826 {
02827 $page_object =& new ilPageObject($this->lm->getType(), $this->lm->getFooterPage());
02828 $page_object_gui =& new ilPageObjectGUI($page_object);
02829
02830
02831 $page_object_gui->setLinkFrame($_GET["frame"]);
02832 $page_object_gui->setOutputMode("print");
02833 $page_object_gui->setPresentationTitle("");
02834 $footer_page_content = $page_object_gui->showPage();
02835 }
02836 }
02837 if ($this->lm->getHeaderPage() > 0)
02838 {
02839 if (ilLMObject::_exists($this->lm->getHeaderPage()))
02840 {
02841 $page_object =& new ilPageObject($this->lm->getType(), $this->lm->getHeaderPage());
02842 $page_object_gui =& new ilPageObjectGUI($page_object);
02843
02844
02845 $page_object_gui->setLinkFrame($_GET["frame"]);
02846 $page_object_gui->setOutputMode("print");
02847 $page_object_gui->setPresentationTitle("");
02848 $header_page_content = $page_object_gui->showPage();
02849 }
02850 }
02851
02852
02853 foreach($_POST["item"] as $k => $item)
02854 {
02855 if ($item == "y" && $k > 0 && !$this->lm_tree->isInTree($k))
02856 {
02857 if (ilLMObject::_lookupType($k) == "pg")
02858 {
02859 $nodes[] = array("obj_id" => $k, "type" => "pg", "free" => true);
02860 }
02861 }
02862 }
02863
02864 foreach ($nodes as $node_key => $node)
02865 {
02866
02867 if ($node["type"] == "pg" &&
02868 !ilLMPageObject::_lookupActive($node["obj_id"]))
02869 {
02870 continue;
02871 }
02872
02873
02874
02875 if ($node["depth"] <= $act_level)
02876 {
02877 if ($_POST["item"][$node["obj_id"]] == "y")
02878 {
02879 $act_level = $node["depth"];
02880 $activated = true;
02881 }
02882 else
02883 {
02884 $act_level = 99999;
02885 $activated = false;
02886 }
02887 }
02888
02889 if ($activated &&
02890 ilObjContentObject::_checkPreconditionsOfPage($this->lm->getRefId(),$this->lm->getId(), $node["obj_id"]))
02891 {
02892
02893 if ($node["type"] == "du")
02894 {
02895 $output_header = true;
02896 }
02897
02898
02899 if ($node["type"] == "st")
02900 {
02901 if ($ilUser->getId() == ANONYMOUS_USER_ID and $this->lm_gui->object->getPublicAccessMode() == "selected")
02902 {
02903 if (!ilLMObject::_isPagePublic($node["obj_id"]))
02904 {
02905 continue;
02906 }
02907 }
02908
02909 $chap =& new ilStructureObject($this->lm, $node["obj_id"]);
02910 $this->tpl->setCurrentBlock("print_chapter");
02911
02912 $chapter_title = $chap->_getPresentationTitle($node["obj_id"],
02913 $this->lm->isActiveNumbering());
02914 $this->tpl->setVariable("CHAP_TITLE",
02915 $chapter_title);
02916
02917 if ($this->lm->getPageHeader() == IL_CHAPTER_TITLE)
02918 {
02919 if ($nodes[$node_key + 1]["type"] == "pg")
02920 {
02921 $this->tpl->setVariable("CHAP_HEADER",
02922 $header_page_content);
02923 $did_chap_page_header = true;
02924 }
02925 }
02926
02927 $this->tpl->parseCurrentBlock();
02928 $this->tpl->setCurrentBlock("print_block");
02929 $this->tpl->parseCurrentBlock();
02930 }
02931
02932
02933 if ($node["type"] == "pg")
02934 {
02935 if ($ilUser->getId() == ANONYMOUS_USER_ID and $this->lm_gui->object->getPublicAccessMode() == "selected")
02936 {
02937 if (!ilLMObject::_isPagePublic($node["obj_id"]))
02938 {
02939 continue;
02940 }
02941 }
02942
02943 $this->tpl->setCurrentBlock("print_item");
02944
02945
02946 $page_id = $node["obj_id"];
02947 $page_object =& new ilPageObject($this->lm->getType(), $page_id);
02948 $page_object_gui =& new ilPageObjectGUI($page_object);
02949
02950
02951 $lm_pg_obj =& new ilLMPageObject($this->lm, $page_id);
02952 $lm_pg_obj->setLMId($this->lm->getId());
02953
02954
02955 $page_object_gui->setLinkFrame($_GET["frame"]);
02956 $page_object_gui->setOutputMode("print");
02957 $page_object_gui->setPresentationTitle("");
02958
02959 if ($this->lm->getPageHeader() == IL_PAGE_TITLE || $node["free"] === true)
02960 {
02961 $page_title = ilLMPageObject::_getPresentationTitle($lm_pg_obj->getId(),
02962 $this->lm->getPageHeader(), $this->lm->isActiveNumbering());
02963
02964
02965
02966 if ($this->lm->isActiveNumbering())
02967 {
02968 $chapter_title = trim(substr($chapter_title,
02969 strpos($chapter_title, " ")));
02970 }
02971
02972 if ($page_title != $chapter_title)
02973 {
02974 $page_object_gui->setPresentationTitle($page_title);
02975 }
02976 }
02977
02978
02979 $hcont = $header_page_content;
02980 $fcont = $footer_page_content;
02981
02982 if ($this->lm->getPageHeader() == IL_CHAPTER_TITLE)
02983 {
02984 if ($did_chap_page_header)
02985 {
02986 $hcont = "";
02987 }
02988 if ($nodes[$node_key + 1]["type"] == "pg" &&
02989 !($nodes[$node_key + 1]["depth"] <= $act_level
02990 && $_POST["item"][$nodes[$node_key + 1]["obj_id"]] != "y"))
02991 {
02992 $fcont = "";
02993 }
02994 }
02995
02996 $page_content = $page_object_gui->showPage();
02997 if ($this->lm->getPageHeader() != IL_PAGE_TITLE)
02998 {
02999 $this->tpl->setVariable("CONTENT",
03000 $hcont.$page_content.$fcont);
03001 }
03002 else
03003 {
03004 $this->tpl->setVariable("CONTENT",
03005 $hcont.$page_content.$fcont."<br />");
03006 }
03007 $chapter_title = "";
03008 $this->tpl->parseCurrentBlock();
03009 $this->tpl->setCurrentBlock("print_block");
03010 $this->tpl->parseCurrentBlock();
03011
03012
03013 $int_links = ilInternalLink::_getTargetsOfSource($this->lm->getType().":pg", $node["obj_id"]);
03014
03015 $got_mobs = false;
03016
03017 foreach ($int_links as $key => $link)
03018 {
03019 if ($link["type"] == "git" &&
03020 ($link["inst"] == IL_INST_ID || $link["inst"] == 0))
03021 {
03022 $glossary_links[$key] = $link;
03023 }
03024 if ($link["type"] == "mob" &&
03025 ($link["inst"] == IL_INST_ID || $link["inst"] == 0))
03026 {
03027 $got_mobs = true;
03028 $mob_links[$key] = $link;
03029 }
03030 }
03031
03032
03033
03034
03035
03036
03037 if ($got_mobs)
03038 {
03039 $page_object->buildDom();
03040 $links = $page_object->getInternalLinks();
03041 foreach($links as $link)
03042 {
03043 if ($link["Type"] == "MediaObject"
03044 && $link["TargetFrame"] != ""
03045 && $link["TargetFrame"] != "None")
03046 {
03047 $media_links[] = $link;
03048 }
03049 }
03050 }
03051 }
03052 }
03053 }
03054
03055 $annex_cnt = 0;
03056 $annexes = array();
03057
03058
03059 if (count($glossary_links) > 0)
03060 {
03061 include_once("./Modules/Glossary/classes/class.ilGlossaryTerm.php");
03062 include_once("./Modules/Glossary/classes/class.ilGlossaryDefinition.php");
03063
03064
03065 $terms = array();
03066
03067 foreach($glossary_links as $key => $link)
03068 {
03069 $term = ilGlossaryTerm::_lookGlossaryTerm($link["id"]);
03070 $terms[$term.":".$key] = $link;
03071 }
03072 ksort($terms);
03073
03074 foreach($terms as $key => $link)
03075 {
03076 $defs = ilGlossaryDefinition::getDefinitionList($link["id"]);
03077 $def_cnt = 1;
03078
03079
03080 foreach($defs as $def)
03081 {
03082
03083 if (count($defs) > 1)
03084 {
03085 $this->tpl->setCurrentBlock("def_title");
03086 $this->tpl->setVariable("TXT_DEFINITION",
03087 $this->lng->txt("cont_definition")." ".($def_cnt++));
03088 $this->tpl->parseCurrentBlock();
03089 }
03090 $page =& new ilPageObject("gdf", $def["id"]);
03091 $page_gui =& new ilPageObjectGUI($page);
03092 $page_gui->setTemplateOutput(false);
03093 $page_gui->setOutputMode("print");
03094
03095 $this->tpl->setCurrentBlock("definition");
03096 $output = $page_gui->showPage();
03097 $this->tpl->setVariable("VAL_DEFINITION", $output);
03098 $this->tpl->parseCurrentBlock();
03099 }
03100
03101
03102 $this->tpl->setCurrentBlock("term");
03103 $this->tpl->setVariable("VAL_TERM",
03104 $term = ilGlossaryTerm::_lookGlossaryTerm($link["id"]));
03105 $this->tpl->parseCurrentBlock();
03106 }
03107
03108
03109 $annex_cnt++;
03110 $this->tpl->setCurrentBlock("glossary");
03111 $annex_title = $this->lng->txt("cont_annex")." ".
03112 chr(64+$annex_cnt).": ".$this->lng->txt("glo");
03113 $this->tpl->setVariable("TXT_GLOSSARY", $annex_title);
03114 $this->tpl->parseCurrentBlock();
03115
03116 $annexes[] = $annex_title;
03117 }
03118
03119
03120 if (count($media_links) > 0)
03121 {
03122 include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
03123 include_once("./Services/MediaObjects/classes/class.ilMediaItem.php");
03124
03125 foreach($media_links as $media)
03126 {
03127 if (substr($media["Target"],0,4) == "il__")
03128 {
03129 $arr = explode("_",$media["Target"]);
03130 $id = $arr[count($arr) - 1];
03131
03132 $med_obj = new ilObjMediaObject($id);
03133 $med_item =& $med_obj->getMediaItem("Standard");
03134 if (is_object($med_item))
03135 {
03136 if (is_int(strpos($med_item->getFormat(), "image")))
03137 {
03138 $this->tpl->setCurrentBlock("ref_image");
03139
03140
03141 if ($med_item->getLocationType() == "LocalFile")
03142 {
03143 $this->tpl->setVariable("IMG_SOURCE",
03144 ilUtil::getWebspaceDir("output")."/mobs/mm_".$id.
03145 "/".$med_item->getLocation());
03146 }
03147 else
03148 {
03149 $this->tpl->setVariable("IMG_SOURCE",
03150 $med_item->getLocation());
03151 }
03152
03153 if ($med_item->getCaption() != "")
03154 {
03155 $this->tpl->setVariable("IMG_TITLE", $med_item->getCaption());
03156 }
03157 else
03158 {
03159 $this->tpl->setVariable("IMG_TITLE", $med_obj->getTitle());
03160 }
03161 $this->tpl->parseCurrentBlock();
03162 }
03163 }
03164 }
03165 }
03166
03167
03168 $annex_cnt++;
03169 $this->tpl->setCurrentBlock("ref_images");
03170 $annex_title = $this->lng->txt("cont_annex")." ".
03171 chr(64+$annex_cnt).": ".$this->lng->txt("cont_ref_images");
03172 $this->tpl->setVariable("TXT_REF_IMAGES", $annex_title);
03173 $this->tpl->parseCurrentBlock();
03174
03175 $annexes[] = $annex_title;
03176 }
03177
03178
03179 if ($output_header)
03180 {
03181 $this->tpl->setCurrentBlock("print_header");
03182 $this->tpl->setVariable("LM_TITLE", $this->lm->getTitle());
03183 if ($this->lm->getDescription() != "none")
03184 {
03185 include_once("Services/MetaData/classes/class.ilMD.php");
03186 $md = new ilMD($this->lm->getId(), 0, $this->lm->getType());
03187 $md_gen = $md->getGeneral();
03188 foreach($md_gen->getDescriptionIds() as $id)
03189 {
03190 $md_des = $md_gen->getDescription($id);
03191 $description = $md_des->getDescription();
03192 }
03193
03194 $this->tpl->setVariable("LM_DESCRIPTION",
03195 $description);
03196 }
03197 $this->tpl->parseCurrentBlock();
03198
03199
03200 $nodes2 = $nodes;
03201 foreach ($nodes2 as $node2)
03202 {
03203 if ($node2["type"] == "st"
03204 && ilObjContentObject::_checkPreconditionsOfPage($this->lm->getRefId(),$this->lm->getId(), $node2["obj_id"]))
03205 {
03206 for ($j=1; $j < $node2["depth"]; $j++)
03207 {
03208 $this->tpl->setCurrentBlock("indent");
03209 $this->tpl->setVariable("IMG_BLANK", ilUtil::getImagePath("browser/blank.gif"));
03210 $this->tpl->parseCurrentBlock();
03211 }
03212 $this->tpl->setCurrentBlock("toc_entry");
03213 $this->tpl->setVariable("TXT_TOC_TITLE",
03214 ilStructureObject::_getPresentationTitle($node2["obj_id"],
03215 $this->lm->isActiveNumbering()));
03216 $this->tpl->parseCurrentBlock();
03217 }
03218 }
03219
03220
03221 foreach ($annexes as $annex)
03222 {
03223 $this->tpl->setCurrentBlock("indent");
03224 $this->tpl->setVariable("IMG_BLANK", ilUtil::getImagePath("browser/blank.gif"));
03225 $this->tpl->parseCurrentBlock();
03226 $this->tpl->setCurrentBlock("toc_entry");
03227 $this->tpl->setVariable("TXT_TOC_TITLE", $annex);
03228 $this->tpl->parseCurrentBlock();
03229 }
03230
03231 $this->tpl->setCurrentBlock("toc");
03232 $this->tpl->setVariable("TXT_TOC", $this->lng->txt("cont_toc"));
03233 $this->tpl->parseCurrentBlock();
03234
03235 $this->tpl->setCurrentBlock("print_start_block");
03236 $this->tpl->parseCurrentBlock();
03237 }
03238
03239
03240 include_once 'Services/MetaData/classes/class.ilMD.php';
03241 $md = new ilMD($this->lm->getId(),0, $this->lm->getType());
03242 if(is_object($lifecycle = $md->getLifecycle()))
03243 {
03244 $sep = $author = "";
03245 foreach(($ids = $lifecycle->getContributeIds()) as $con_id)
03246 {
03247 $md_con = $lifecycle->getContribute($con_id);
03248 if ($md_con->getRole() == "Author")
03249 {
03250 foreach($ent_ids = $md_con->getEntityIds() as $ent_id)
03251 {
03252 $md_ent = $md_con->getEntity($ent_id);
03253 $author = $author.$sep.$md_ent->getEntity();
03254 $sep = ", ";
03255 }
03256 }
03257 }
03258 if ($author != "")
03259 {
03260 $this->lng->loadLanguageModule("meta");
03261 $this->tpl->setCurrentBlock("author");
03262 $this->tpl->setVariable("TXT_AUTHOR", $this->lng->txt("meta_author"));
03263 $this->tpl->setVariable("LM_AUTHOR", $author);
03264 $this->tpl->parseCurrentBlock();
03265 }
03266 }
03267
03268
03269
03270 if (is_object($md_rights = $md->getRights()))
03271 {
03272 $copyright = $md_rights->getDescription();
03273 include_once('Services/MetaData/classes/class.ilMDUtils.php');
03274 $copyright = ilMDUtils::_parseCopyright($copyright);
03275
03276 if ($copyright != "")
03277 {
03278 $this->lng->loadLanguageModule("meta");
03279 $this->tpl->setCurrentBlock("copyright");
03280 $this->tpl->setVariable("TXT_COPYRIGHT", $this->lng->txt("meta_copyright"));
03281 $this->tpl->setVariable("LM_COPYRIGHT", $copyright);
03282 $this->tpl->parseCurrentBlock();
03283 }
03284 }
03285
03286 $this->tpl->show(false);
03287
03288 $ilBench->stop("ContentPresentation", "PrintView");
03289 }
03290
03291
03292 function setSessionVars()
03293 {
03294 if($_POST["action"] == "show" or $_POST["action"] == "show_citation")
03295 {
03296 if($_POST["action"] == "show_citation")
03297 {
03298
03299 if(count($_POST["target"]) != 1)
03300 {
03301 ilUtil::sendInfo($this->lng->txt("cont_citation_err_one"));
03302 $_POST["action"] = "";
03303 $_POST["target"] = 0;
03304 return false;
03305 }
03306 $_SESSION["citation"] = 1;
03307 }
03308 else
03309 {
03310 unset($_SESSION["citation"]);
03311 }
03312 if(isset($_POST["tr_id"]))
03313 {
03314 $_SESSION["tr_id"] = $_POST["tr_id"][0];
03315 }
03316 else
03317 {
03318 unset($_SESSION["tr_id"]);
03319 }
03320 if(is_array($_POST["target"]))
03321 {
03322 $_SESSION["bib_id"] = ",".implode(',',$_POST["target"]).",";
03323 }
03324 else
03325 {
03326 $_SESSION["bib_id"] = ",0,";
03327 }
03328 }
03329 return true;
03330 }
03331
03335 function downloadFile()
03336 {
03337 $file = explode("_", $_GET["file_id"]);
03338 require_once("./Modules/File/classes/class.ilObjFile.php");
03339 $fileObj =& new ilObjFile($file[count($file) - 1], false);
03340 $fileObj->sendFile();
03341 exit;
03342 }
03343
03347 function download_paragraph ()
03348 {
03349 require_once("./Services/COPage/classes/class.ilPageObject.php");
03350 $pg_obj =& new ilPageObject($this->lm->getType(), $_GET["pg_id"]);
03351 $pg_obj->send_paragraph ($_GET["par_id"], $_GET["downloadtitle"]);
03352 }
03353
03357 function showDownloadList()
03358 {
03359 global $ilBench;
03360
03361
03362 $this->tpl->setCurrentBlock("ContentStyle");
03363 if (!$this->offlineMode())
03364 {
03365 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET",
03366 ilObjStyleSheet::getContentStylePath($this->lm->getStyleSheetId()));
03367 }
03368 else
03369 {
03370 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", "content.css");
03371 }
03372 $this->tpl->parseCurrentBlock();
03373
03374 $this->tpl->setVariable("PAGETITLE", " - ".$this->lm->getTitle());
03375 $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
03376 $this->tpl->getStandardTemplate();
03377
03378 $this->tpl->setVariable("TABS", $this->lm_gui->setilLMMenu($this->offlineMode()
03379 ,$this->getExportFormat(), "download", true));
03380
03381 $this->ilLocator();
03382
03383 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.lm_download_list.html", "Modules/LearningModule");
03384
03385
03386 $this->tpl->setTitle($this->lm->getTitle());
03387 $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_lm_b.gif"));
03388
03389
03390
03391
03392
03393
03394
03395
03396 include_once 'Services/MetaData/classes/class.ilMD.php';
03397 $md = new ilMD($this->lm->getId(),0, $this->lm->getType());
03398 if (is_object($md_rights = $md->getRights()))
03399 {
03400 $copyright = $md_rights->getDescription();
03401 if ($copyright != "")
03402 {
03403 $this->lng->loadLanguageModule("meta");
03404 $this->tpl->setCurrentBlock("copyright");
03405 $this->tpl->setVariable("TXT_COPYRIGHT", $this->lng->txt("meta_copyright"));
03406 $this->tpl->setVariable("LM_COPYRIGHT", $copyright);
03407 $this->tpl->parseCurrentBlock();
03408 }
03409 }
03410
03411
03412 require_once("./Services/Table/classes/class.ilTableGUI.php");
03413 $tbl = new ilTableGUI();
03414
03415
03416 $this->tpl->addBlockfile("DOWNLOAD_TABLE", "download_table", "tpl.table.html");
03417
03418
03419 $this->tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.download_file_row.html", "Modules/LearningModule");
03420
03421 $export_files = array();
03422 $types = array("xml", "html");
03423 foreach($types as $type)
03424 {
03425 if ($this->lm->getPublicExportFile($type) != "")
03426 {
03427 if (is_file($this->lm->getExportDirectory($type)."/".
03428 $this->lm->getPublicExportFile($type)))
03429 {
03430 $dir = $this->lm->getExportDirectory($type);
03431 $size = filesize($this->lm->getExportDirectory($type)."/".
03432 $this->lm->getPublicExportFile($type));
03433 $export_files[] = array("type" => $type,
03434 "file" => $this->lm->getPublicExportFile($type),
03435 "size" => $size);
03436 }
03437 }
03438 }
03439
03440 $num = 0;
03441
03442 $tbl->setTitle($this->lng->txt("download"));
03443
03444 $tbl->setHeaderNames(array($this->lng->txt("cont_format"),
03445 $this->lng->txt("cont_file"),
03446 $this->lng->txt("size"), $this->lng->txt("date"),
03447 ""));
03448
03449 $cols = array("format", "file", "size", "date", "download");
03450 $header_params = array("ref_id" => $_GET["ref_id"], "obj_id" => $_GET["obj_id"],
03451 "cmd" => "showDownloadList", "cmdClass" => strtolower(get_class($this)));
03452 $tbl->setHeaderVars($cols, $header_params);
03453 $tbl->setColumnWidth(array("10%", "30%", "20%", "20%","20%"));
03454 $tbl->disable("sort");
03455
03456
03457 $tbl->setOrderColumn($_GET["sort_by"]);
03458 $tbl->setOrderDirection($_GET["sort_order"]);
03459 $tbl->setLimit($_GET["limit"]);
03460 $tbl->setOffset($_GET["offset"]);
03461 $tbl->setMaxCount($this->maxcount);
03462
03463
03464
03465
03466
03467 $tbl->disable("footer");
03468
03469 $tbl->setMaxCount(count($export_files));
03470 $export_files = array_slice($export_files, $_GET["offset"], $_GET["limit"]);
03471
03472 $tbl->render();
03473 if(count($export_files) > 0)
03474 {
03475 $i=0;
03476 foreach($export_files as $exp_file)
03477 {
03478 if (!$exp_file["size"] > 0)
03479 {
03480 continue;
03481 }
03482
03483 $this->tpl->setCurrentBlock("tbl_content");
03484 $this->tpl->setVariable("TXT_FILENAME", $exp_file["file"]);
03485
03486 $css_row = ilUtil::switchColor($i++, "tblrow1", "tblrow2");
03487 $this->tpl->setVariable("CSS_ROW", $css_row);
03488
03489 $this->tpl->setVariable("TXT_SIZE", $exp_file["size"]);
03490 $this->tpl->setVariable("TXT_FORMAT", strtoupper($exp_file["type"]));
03491 $this->tpl->setVariable("CHECKBOX_ID", $exp_file["type"].":".$exp_file["file"]);
03492
03493 $file_arr = explode("__", $exp_file["file"]);
03494 $this->tpl->setVariable("TXT_DATE", date("Y-m-d H:i:s",$file_arr[0]));
03495
03496 $this->tpl->setVariable("TXT_DOWNLOAD", $this->lng->txt("download"));
03497 $this->ctrl->setParameter($this, "type", $exp_file["type"]);
03498 $this->tpl->setVariable("LINK_DOWNLOAD",
03499 $this->ctrl->getLinkTarget($this, "downloadExportFile"));
03500
03501 $this->tpl->parseCurrentBlock();
03502 }
03503 }
03504 else
03505 {
03506 $this->tpl->setCurrentBlock("notfound");
03507 $this->tpl->setVariable("TXT_OBJECT_NOT_FOUND", $this->lng->txt("obj_not_found"));
03508 $this->tpl->setVariable("NUM_COLS", 5);
03509 $this->tpl->parseCurrentBlock();
03510 }
03511
03512 $this->tpl->show();
03513 }
03514
03515
03519 function downloadExportFile()
03520 {
03521 $file = $this->lm->getPublicExportFile($_GET["type"]);
03522 if ($this->lm->getPublicExportFile($_GET["type"]) != "")
03523 {
03524 $dir = $this->lm->getExportDirectory($_GET["type"]);
03525 if (is_file($dir."/".$file))
03526 {
03527 ilUtil::deliverFile($dir."/".$file, $file);
03528 exit;
03529 }
03530 }
03531 $this->ilias->raiseError($this->lng->txt("file_not_found"),$this->ilias->error_obj->MESSAGE);
03532 }
03533
03537 function getLink($a_ref_id, $a_cmd = "", $a_obj_id = "", $a_frame = "", $a_type = "",
03538 $a_back_link = "append")
03539 {
03540 global $ilCtrl;
03541
03542 if ($a_cmd == "")
03543 {
03544 $a_cmd = "layout";
03545 }
03546
03547
03548 $cur_page_id = $this->getCurrentPageId();
03549 $back_pg = $_GET["back_pg"];
03550 if ($a_obj_id != "" && !$this->lm_tree->isInTree($a_obj_id) && $cur_page_id != "" &&
03551 $a_back_link == "append")
03552 {
03553 if ($back_pg != "")
03554 {
03555 $back_pg = $cur_page_id.":".$back_pg;
03556 }
03557 else
03558 {
03559 $back_pg = $cur_page_id;
03560 }
03561 }
03562 else
03563 {
03564 if ($a_back_link == "reduce")
03565 {
03566 $limpos = strpos($_GET["back_pg"], ":");
03567
03568 if ($limpos > 0)
03569 {
03570 $back_pg = substr($back_pg, strpos($back_pg, ":") + 1);
03571 }
03572 else
03573 {
03574 $back_pg = "";
03575 }
03576 }
03577 else if ($a_back_link != "keep")
03578 {
03579 $back_pg = "";
03580 }
03581 }
03582
03583
03584 if (!$this->offlineMode())
03585 {
03586 switch ($a_cmd)
03587 {
03588 case "fullscreen":
03589 $link = $this->ctrl->getLinkTarget($this, "fullscreen");
03590 break;
03591
03592 default:
03593
03594 if ($back_pg != "")
03595 {
03596 $this->ctrl->setParameter($this, "back_pg", $back_pg);
03597 }
03598 if ($a_frame != "")
03599 {
03600 $this->ctrl->setParameter($this, "frame", $a_frame);
03601 }
03602 if ($a_obj_id != "")
03603 {
03604 switch ($a_type)
03605 {
03606 case "MediaObject":
03607 $this->ctrl->setParameter($this, "mob_id", $a_obj_id);
03608 break;
03609
03610 default:
03611 $this->ctrl->setParameter($this, "obj_id", $a_obj_id);
03612 $link.= "&obj_id=".$a_obj_id;
03613 break;
03614 }
03615 }
03616 if ($a_type != "")
03617 {
03618 $this->ctrl->setParameter($this, "obj_type", $a_type);
03619 }
03620 $link = $this->ctrl->getLinkTarget($this, $a_cmd);
03621 $link = str_replace("&", "&", $link);
03622
03623 $this->ctrl->setParameter($this, "frame", "");
03624 $this->ctrl->setParameter($this, "obj_id", "");
03625 $this->ctrl->setParameter($this, "mob_id", "");
03626 break;
03627 }
03628 }
03629 else
03630 {
03631 switch ($a_cmd)
03632 {
03633 case "downloadFile":
03634 break;
03635
03636 case "fullscreen":
03637 $link = "fullscreen.html";
03638 break;
03639
03640 case "layout":
03641
03642 if ($a_obj_id == "")
03643 {
03644 $a_obj_id = $this->lm_tree->getRootId();
03645 $pg_node = $this->lm_tree->fetchSuccessorNode($a_obj_id, "pg");
03646 $a_obj_id = $pg_node["obj_id"];
03647 }
03648 if ($a_type == "StructureObject")
03649 {
03650 $pg_node = $this->lm_tree->fetchSuccessorNode($a_obj_id, "pg");
03651 $a_obj_id = $pg_node["obj_id"];
03652 }
03653 if ($a_frame != "" && $a_frame != "_blank")
03654 {
03655 if ($a_frame != "toc")
03656 {
03657 $link = "frame_".$a_obj_id."_".$a_frame.".html";
03658 }
03659 else
03660 {
03661 $link = "frame_".$a_frame.".html";
03662 }
03663 }
03664 else
03665 {
03666 if ($nid = ilLMObject::_lookupNID($this->lm->getId(), $a_obj_id, "pg"))
03667 {
03668 $link = "lm_pg_".$nid.".html";
03669 }
03670 else
03671 {
03672 $link = "lm_pg_".$a_obj_id.".html";
03673 }
03674 }
03675 break;
03676
03677 case "glossary":
03678 $link = "term_".$a_obj_id.".html";
03679 break;
03680
03681 case "media":
03682 $link = "media_".$a_obj_id.".html";
03683 break;
03684
03685 default:
03686 break;
03687 }
03688 }
03689
03690 $this->ctrl->clearParameters($this);
03691
03692 return $link;
03693 }
03694
03695
03696
03697 function showNoPublicAccess()
03698 {
03699 $page_id = $this->getCurrentPageId();
03700
03701
03702 $this->tpl->setCurrentBlock("ContentStyle");
03703
03704 if (!$this->offlineMode())
03705 {
03706 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET",
03707 ilObjStyleSheet::getContentStylePath($this->lm->getStyleSheetId()));
03708 }
03709 else
03710 {
03711 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", "content.css");
03712 }
03713
03714 $this->tpl->parseCurrentBlock();
03715 $this->tpl->addBlockFile("PAGE_CONTENT", "pg_content", "tpl.page_nopublicaccess.html", "Modules/LearningModule");
03716 $this->tpl->setCurrentBlock("pg_content");
03717 $this->tpl->setVariable("TXT_PAGE_NO_PUBLIC_ACCESS",$this->lng->txt("msg_page_no_public_access"));
03718 $this->tpl->parseCurrentBlock();
03719 }
03720
03721 function getSourcecodeDownloadLink() {
03722 if (!$this->offlineMode())
03723 {
03724
03725 $target = $this->ctrl->getLinkTarget($this, "");
03726 $target = ilUtil::appendUrlParameterString($target, session_name()."=".session_id());
03727 return $this->ctrl->getLinkTarget($this, "");
03728 }
03729 else
03730 {
03731 return "";
03732 }
03733 }
03734
03742 function setOfflineDirectory ($offdir) {
03743 $this->offline_directory = $offdir;
03744 }
03745
03746
03753 function getOfflineDirectory () {
03754 return $this->offline_directory;
03755 }
03756
03761 function handleCodeParagraph ($page_id, $paragraph_id, $title, $text) {
03762 $directory = $this->getOfflineDirectory()."/codefiles/".$page_id."/".$paragraph_id;
03763 ilUtil::makeDirParents ($directory);
03764 $file = $directory."/".$title;
03765 if (!($fp = @fopen($file,"w+")))
03766 {
03767 die ("<b>Error</b>: Could not open \"".$file."\" for writing".
03768 " in <b>".__FILE__."</b> on line <b>".__LINE__."</b><br />");
03769 }
03770 chmod($file, 0770);
03771 fwrite($fp, $text);
03772 fclose($fp);
03773 }
03774 }
03775 ?>