/** * Init * * @param ilTemplate $a_tpl template object */ function init($a_tpl = null) { global $tpl; if ($a_tpl == null) { $a_tpl = $tpl; } foreach (ilUIFramework::getJSFiles() as $f) { $a_tpl->addJavaScript($f, true, 1); } foreach (ilUIFramework::getCssFiles() as $f) { $a_tpl->addCss($f); } }
/** * generates frame layout */ function layout($a_xml = "main.xml", $doShow = true) { global $tpl, $ilSetting, $ilCtrl, $ilUser; $layout = $this->determineLayout(); // xmldocfile is deprecated! Use domxml_open_file instead. // But since using relative pathes with domxml under windows don't work, // we need another solution: $xmlfile = file_get_contents("./Modules/LearningModule/layouts/lm/" . $layout . "/" . $a_xml); if (!($doc = domxml_open_mem($xmlfile))) { include_once "./Modules/LearningModule/exceptions/class.ilLMPresentationException.php"; throw new ilLMPresentationException("ilLMPresentation: XML File invalid. Error reading " . $layout . "/" . $a_xml . "."); } $this->layout_doc = $doc; //echo ":".htmlentities($xmlfile).":$layout:$a_xml:"; // get current frame node $xpc = xpath_new_context($doc); $path = empty($_GET["frame"]) || $_GET["frame"] == "_blank" ? "/ilLayout/ilFrame[1]" : "//ilFrame[@name='" . $_GET["frame"] . "']"; $result = xpath_eval($xpc, $path); $found = $result->nodeset; if (count($found) != 1) { include_once "./Modules/LearningModule/exceptions/class.ilLMPresentationException.php"; throw new ilLMPresentationException("ilLMPresentation: XML File invalid. Found " . count($found) . " nodes for " . " path " . $path . " in " . $layout . "/" . $a_xml . ". LM Layout is " . $this->lm->getLayout()); } $node = $found[0]; // ProcessFrameset // node is frameset, if it has cols or rows attribute $attributes = $this->attrib2arr($node->attributes()); $this->frames = array(); if (!empty($attributes["rows"]) || !empty($attributes["cols"])) { $content .= $this->buildTag("start", "frameset", $attributes); //$this->frames = array(); $this->processNodes($content, $node); $content .= $this->buildTag("end", "frameset"); $this->tpl = new ilTemplate("tpl.frameset.html", true, true, "Modules/LearningModule"); $this->renderPageTitle(); $this->tpl->setVariable("FS_CONTENT", $content); if (!$doshow) { $content = $this->tpl->get(); } } else { // ProcessContentTag //if ((empty($attributes["template"]) || !empty($_GET["obj_type"]))) if ((empty($attributes["template"]) || !empty($_GET["obj_type"])) && ($_GET["frame"] != "_blank" || $_GET["obj_type"] != "MediaObject")) { // we got a variable content frame (can display different // object types (PageObject, MediaObject, GlossarItem) // and contains elements for them) // determine object type if (empty($_GET["obj_type"])) { $obj_type = "PageObject"; } else { $obj_type = $_GET["obj_type"]; } // get object specific node $childs = $node->child_nodes(); $found = false; foreach ($childs as $child) { if ($child->node_name() == $obj_type) { $found = true; $attributes = $this->attrib2arr($child->attributes()); $node = $child; //echo "<br>2node:".$node->node_name(); break; } } if (!$found) { echo "ilLMPresentation: No template specified for frame '" . $_GET["frame"] . "' and object type '" . $obj_type . "'."; exit; } } // get template $in_module = $attributes["template_location"] == "module" ? true : false; if ($in_module) { $this->tpl = new ilTemplate($attributes["template"], true, true, $in_module); $this->tpl->setBodyClass(""); } else { $this->tpl = $tpl; } // set style sheets if (!$this->offlineMode()) { $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation()); } else { $style_name = $ilUser->getPref("style") . ".css"; $this->tpl->setVariable("LOCATION_STYLESHEET", "./style/" . $style_name); } include_once "./Services/jQuery/classes/class.iljQueryUtil.php"; iljQueryUtil::initjQuery($this->tpl); iljQueryUtil::initjQueryUI($this->tpl); include_once "./Services/UICore/classes/class.ilUIFramework.php"; ilUIFramework::init($this->tpl); // to make e.g. advanced seletions lists work: $GLOBALS["tpl"] = $this->tpl; $childs = $node->child_nodes(); foreach ($childs as $child) { $child_attr = $this->attrib2arr($child->attributes()); switch ($child->node_name()) { case "ilMainMenu": $this->ilMainMenu(); $this->renderPageTitle(); break; case "ilTOC": $this->ilTOC($child_attr["target_frame"]); break; case "ilPage": switch ($this->lm->getType()) { case "lm": unset($_SESSION["tr_id"]); unset($_SESSION["bib_id"]); unset($_SESSION["citation"]); $content = $this->ilPage($child); break; } break; case "ilGlossary": $content = $this->ilGlossary($child); break; case "ilLMNavigation": $this->ilLMNavigation(); break; case "ilMedia": $this->ilMedia(); break; case "ilLocator": $this->ilLocator(); break; case "ilJavaScript": $this->ilJavaScript($child_attr["inline"], $child_attr["file"], $child_attr["location"]); break; case "ilLMMenu": $this->ilLMMenu(); break; case "ilLMHead": $this->ilLMHead(); break; case "ilLMSubMenu": $this->ilLMSubMenu(); break; case "ilLMNotes": $this->ilLMNotes(); break; } } // TODO: Very dirty hack to force the import of JavaScripts in learning content in the FAQ frame (e.g. if jsMath is in the content) // Unfortunately there is no standardized way to do this somewhere else. Calling fillJavaScripts always in ilTemplate causes multiple additions of the the js files. // 19.7.2014: outcommented, since fillJavaScriptFiles is called in the next blocks, and the // following lines would add the js files two times // if (strcmp($_GET["frame"], "topright") == 0) $this->tpl->fillJavaScriptFiles(); // if (strcmp($_GET["frame"], "right") == 0) $this->tpl->fillJavaScriptFiles(); // if (strcmp($_GET["frame"], "botright") == 0) $this->tpl->fillJavaScriptFiles(); if (!$this->offlineMode()) { include_once "./Services/Accordion/classes/class.ilAccordionGUI.php"; ilAccordionGUI::addJavaScript(); ilAccordionGUI::addCss(); $this->tpl->addJavascript("./Modules/LearningModule/js/LearningModule.js"); include_once "./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php"; $close_call = "il.LearningModule.setCloseHTML('" . ilGlyphGUI::get(ilGlyphGUI::CLOSE) . "');"; $this->tpl->addOnLoadCode($close_call); //$store->set("cf_".$this->lm->getId()); // handle initial content if ($_GET["frame"] == "") { include_once "./Services/Authentication/classes/class.ilSessionIStorage.php"; $store = new ilSessionIStorage("lm"); $last_frame_url = $store->get("cf_" . $this->lm->getId()); if ($last_frame_url != "") { $this->tpl->addOnLoadCode("il.LearningModule.setLastFrameUrl('" . $last_frame_url . "', 'center_bottom');"); } if (in_array($layout, array("toc2windyn"))) { $this->tpl->addOnLoadCode("il.LearningModule.setSaveUrl('" . $ilCtrl->getLinkTarget($this, "saveFrameUrl", "", false, false) . "');\n\t\t\t\t\t\t\til.LearningModule.openInitFrames();\n\t\t\t\t\t\t\t"); } $this->tpl->addOnLoadCode("il.LearningModule.setTocRefreshUrl('" . $ilCtrl->getLinkTarget($this, "refreshToc", "", false, false) . "');\n\t\t\t\t\t\t\t"); } // from main menu // $this->tpl->addJavascript("./Services/JavaScript/js/Basic.js"); $this->tpl->addJavascript("./Services/Navigation/js/ServiceNavigation.js"); $this->tpl->fillJavaScriptFiles(); $this->tpl->fillScreenReaderFocus(); $this->tpl->fillCssFiles(); } else { // reset standard css files $this->tpl->resetJavascript(); $this->tpl->resetCss(); include_once "./Modules/LearningModule/classes/class.ilObjContentObject.php"; foreach (ilObjContentObject::getSupplyingExportFiles() as $f) { if ($f["type"] == "js") { $this->tpl->addJavascript($f["target"]); } if ($f["type"] == "css") { $this->tpl->addCSS($f["target"]); } } $this->tpl->fillJavaScriptFiles(true); $this->tpl->fillCssFiles(true); } $this->tpl->fillBodyClass(); } if ($doShow) { // (horrible) workaround for preventing template engine // from hiding paragraph text that is enclosed // in curly brackets (e.g. "{a}", see ilPageObjectGUI::showPage()) $this->tpl->fillTabs(); if ($this->fill_on_load_code) { $this->tpl->fillOnLoadCode(); } $content = $this->tpl->get(); $content = str_replace("{", "{", $content); $content = str_replace("}", "}", $content); header('Content-type: text/html; charset=UTF-8'); echo $content; } else { $this->tpl->fillLeftNav(); $this->tpl->fillOnLoadCode(); $content = $this->tpl->get(); } return $content; }
function getStandardTemplate() { // always load jQuery include_once "./Services/jQuery/classes/class.iljQueryUtil.php"; iljQueryUtil::initjQuery(); // always load ui framework include_once "./Services/UICore/classes/class.ilUIFramework.php"; ilUIFramework::init(); // always load Basic js // $this->addJavaScript("./Services/JavaScript/js/Basic.js", // true, 1); $this->addBlockFile("CONTENT", "content", "tpl.adm_content.html"); $this->addBlockFile("STATUSLINE", "statusline", "tpl.statusline.html"); }
/** * This method enriches the global template with some user interface elements (language selection, headlines, back buttons, ...) for public service views * @param mixed $a_tmpl The template file as a string of as an array (index 0: template file, index 1: template directory) * @param bool $a_show_back * @param bool $a_show_logout */ public static function initStartUpTemplate($a_tmpl, $a_show_back = false, $a_show_logout = false) { /** * @var $tpl ilTemplate * @var $lng ilLanguage * @var $ilCtrl ilCtrl * @var $ilSetting ilSetting * @var $ilAccess ilAccessHandler */ global $tpl, $lng, $ilCtrl, $ilSetting, $ilAccess; // #13574 - basic.js is included with ilTemplate, so jQuery is needed, too include_once "./Services/jQuery/classes/class.iljQueryUtil.php"; iljQueryUtil::initjQuery(); // framework is needed for language selection include_once "./Services/UICore/classes/class.ilUIFramework.php"; ilUIFramework::init(); $tpl->addBlockfile('CONTENT', 'content', 'tpl.startup_screen.html', 'Services/Init'); $tpl->setVariable('HEADER_ICON', ilUtil::getImagePath('HeaderIcon.svg')); if ($a_show_back) { // #13400 $param = 'client_id=' . $_COOKIE['ilClientId'] . '&lang=' . $lng->getLangKey(); $tpl->setCurrentBlock('link_item_bl'); $tpl->setVariable('LINK_TXT', $lng->txt('login_to_ilias')); $tpl->setVariable('LINK_URL', 'login.php?cmd=force_login&' . $param); $tpl->parseCurrentBlock(); if ($ilSetting->get('pub_section') && $ilAccess->checkAccessOfUser(ANONYMOUS_USER_ID, 'read', '', ROOT_FOLDER_ID)) { $tpl->setVariable('LINK_URL', 'index.php?' . $param); $tpl->setVariable('LINK_TXT', $lng->txt('home')); $tpl->parseCurrentBlock(); } } else { if ($a_show_logout) { $tpl->setCurrentBlock('link_item_bl'); $tpl->setVariable('LINK_TXT', $lng->txt('logout')); $tpl->setVariable('LINK_URL', ILIAS_HTTP_PATH . '/logout.php'); $tpl->parseCurrentBlock(); } } if (is_array($a_tmpl)) { $template_file = $a_tmpl[0]; $template_dir = $a_tmpl[1]; } else { $template_file = $a_tmpl; $template_dir = 'Services/Init'; } //Header Title include_once "./Modules/SystemFolder/classes/class.ilObjSystemFolder.php"; $header_top_title = ilObjSystemFolder::_getHeaderTitle(); if (trim($header_top_title) != "" && $tpl->blockExists("header_top_title")) { $tpl->setCurrentBlock("header_top_title"); $tpl->setVariable("TXT_HEADER_TITLE", $header_top_title); $tpl->parseCurrentBlock(); } // language selection $selection = self::getLanguageSelection(); if ($selection) { $tpl->setCurrentBlock("lang_select"); $tpl->setVariable("TXT_LANGSELECT", $lng->txt("language")); $tpl->setVariable("LANG_SELECT", $selection); $tpl->parseCurrentBlock(); } $tpl->addBlockFile('STARTUP_CONTENT', 'startup_content', $template_file, $template_dir); }
/** * Constructor * */ function ilSetupGUI() { global $tpl, $lng; $this->tpl = $tpl; $this->lng = $lng; // note: this is currently only used for subtabs, alex 8.1.2012 include_once "./Services/UIComponent/Tabs/classes/class.ilTabsGUI.php"; $this->tabs = new ilTabsGUI(); $this->tabs->setSetupMode(true); include_once "./Services/jQuery/classes/class.iljQueryUtil.php"; iljQueryUtil::initjQuery($this->tpl); include_once "./Services/YUI/classes/class.ilYuiUtil.php"; ilYuiUtil::initDomEvent(); $tpl->addJavaScript("./Services/JavaScript/js/Basic.js", 0); include_once "./Services/UICore/classes/class.ilUIFramework.php"; ilUIFramework::init($this->tpl); // CVS - REVISION - DO NOT MODIFY $this->revision = '$Revision$'; $this->version = "2 " . substr(substr($this->revision, 1), 0, -2); $this->lang = $this->lng->lang_key; // init setup $this->setup = new ilSetup($_SESSION["auth"], $_SESSION["access_mode"]); // init client object if exists $client_id = $_GET["client_id"] ? $_GET["client_id"] : $_SESSION["ClientId"]; if ($_POST["client_id"] != "") { $client_id = $_POST["client_id"]; } /*if ($_POST["client_id"] == "") { echo "<br>+".$_GET["client_id"]; echo "<br>+".$_POST["client_id"]; echo "<br>+".$_SESSION["ClientId"]; echo "<br>+".$client_id; }*/ // for security if (!$this->setup->isAdmin() and $client_id != $_SESSION["ClientId"]) { $client_id = $_SESSION["ClientId"]; } $this->client_id = $client_id; $this->setup->ini_client_exists = $this->setup->newClient($client_id); if (is_object($this->setup->getClient())) { $this->setup->getClient()->status = $this->setup->getStatus($client_id); } // determine command if (($this->cmd = $_GET["cmd"]) == "gateway") { // surpress warning if POST is not set @($this->cmd = key($_POST["cmd"])); } // determine display mode here // TODO: depending on previous setting (session) // OR switch to 'setup'-mode if someone logs in as client and client's setup wasn't finished (-> entry in settings table does not exist) if ($this->setup->isAuthenticated() and !$this->setup->getClient()->status["finish"]["status"] and $this->cmd != "clientlist" and $this->cmd != "") { $this->setDisplayMode("setup"); } else { $this->setDisplayMode($_SESSION["display_mode"]); } // output starts here // main cmd handling if (!$this->setup->isAuthenticated() or !$this->setup->isInstalled()) { // check for first time installation or migrate an old one first if (!$this->setup->isInstalled() or !$this->setup->ini->readVariable("clients", "path")) { $this->cmdInstall(); } else { if ($this->cmd == "performLogin" || $this->cmd == "performMLogin") { $cmd = $this->cmd; $this->{$cmd}(); } else { $this->displayLogin(); } } } else { if ($this->setup->isAdmin()) { $this->cmdAdmin(); } else { $this->cmdClient(); } } // display header $this->displayHeader(); if (DEBUG) { echo "cmd: " . $this->cmd . " | access: " . $this->setup->access_mode . " | display: " . $this->display_mode; var_dump($this->setup->getClient()->status); } // display footer $this->displayFooter(); // end output }
public function executeCommand() { if ($_GET["type"] == "search_res") { $this->ctrl->setParameterByClass("ilmailformgui", "cmd", "searchResults"); $this->ctrl->redirectByClass("ilmailformgui"); } if ($_GET["type"] == "attach") { ilMailFormCall::storeReferer($_GET); $this->ctrl->setParameterByClass("ilmailformgui", "cmd", "mailAttachment"); $this->ctrl->redirectByClass("ilmailformgui"); } if ($_GET["type"] == "new") { $_SESSION['rcp_to'] = $_GET['rcp_to']; $_SESSION['rcp_cc'] = $_GET['rcp_cc']; $_SESSION['rcp_bcc'] = $_GET['rcp_bcc']; ilMailFormCall::storeReferer($_GET); $this->ctrl->setParameterByClass("ilmailformgui", "cmd", "mailUser"); $this->ctrl->redirectByClass("ilmailformgui"); } if ($_GET["type"] == "reply") { $_SESSION['mail_id'] = $_GET['mail_id']; $this->ctrl->setParameterByClass("ilmailformgui", "cmd", "replyMail"); $this->ctrl->redirectByClass("ilmailformgui"); } if ($_GET["type"] == "read") { $_SESSION['mail_id'] = $_GET['mail_id']; $this->ctrl->setParameterByClass("ilmailfoldergui", "cmd", "showMail"); $this->ctrl->redirectByClass("ilmailfoldergui"); } if ($_GET["type"] == "deliverFile") { $_SESSION['mail_id'] = $_GET['mail_id']; $_SESSION['filename'] = $_POST["filename"] ? $_POST["filename"] : $_GET["filename"]; $this->ctrl->setParameterByClass("ilmailfoldergui", "cmd", "deliverFile"); $this->ctrl->redirectByClass("ilmailfoldergui"); } if ($_GET["type"] == "message_sent") { ilUtil::sendInfo($this->lng->txt('mail_message_send'), true); $this->ctrl->redirectByClass("ilmailfoldergui"); } if ($_GET["type"] == "role") { if (is_array($_POST['roles'])) { $_SESSION['mail_roles'] = $_POST['roles']; } else { if ($_GET["role"]) { $_SESSION['mail_roles'] = array($_GET["role"]); } } ilMailFormCall::storeReferer($_GET); $this->ctrl->setParameterByClass("ilmailformgui", "cmd", "mailRole"); $this->ctrl->redirectByClass("ilmailformgui"); } if ($_GET["view"] == "my_courses") { $_SESSION['search_crs'] = $_GET['search_crs']; $this->ctrl->setParameterByClass("ilmailformgui", "cmd", "searchCoursesTo"); $this->ctrl->redirectByClass("ilmailformgui"); } if (isset($_GET["viewmode"])) { ilSession::set(self::VIEWMODE_SESSION_KEY, $_GET["viewmode"]); $this->ctrl->setCmd("setViewMode"); } $this->forwardClass = $this->ctrl->getNextClass($this); $this->showHeader(); if ('tree' == ilSession::get(self::VIEWMODE_SESSION_KEY) && $this->ctrl->getCmd() != "showExplorer") { $this->showExplorer(); } include_once "Services/jQuery/classes/class.iljQueryUtil.php"; iljQueryUtil::initjQuery(); // always load ui framework include_once "./Services/UICore/classes/class.ilUIFramework.php"; ilUIFramework::init(); switch ($this->forwardClass) { case 'ilmailformgui': include_once 'Services/Mail/classes/class.ilMailFormGUI.php'; $this->ctrl->forwardCommand(new ilMailFormGUI()); break; case 'ilmailaddressbookgui': include_once 'Services/Contact/classes/class.ilMailAddressbookGUI.php'; $this->ctrl->forwardCommand(new ilMailAddressbookGUI()); break; case 'ilmailoptionsgui': include_once 'Services/Mail/classes/class.ilMailOptionsGUI.php'; $this->ctrl->forwardCommand(new ilMailOptionsGUI()); break; case 'ilmailfoldergui': include_once 'Services/Mail/classes/class.ilMailFolderGUI.php'; $this->ctrl->forwardCommand(new ilMailFolderGUI()); break; default: if (!($cmd = $this->ctrl->getCmd())) { $cmd = "setViewMode"; } $this->{$cmd}(); break; } return true; }