Example #1
0
 /**
  * add ILIAS footer
  */
 function addILIASFooter()
 {
     global $ilAuth;
     if (!$this->getAddFooter()) {
         return;
     }
     global $ilias, $ilClientIniFile, $ilCtrl, $ilDB, $ilSetting, $lng;
     $ftpl = new ilTemplate("tpl.footer.html", true, true, "Services/UICore");
     $ftpl->setVariable("ILIAS_VERSION", $ilias->getSetting("ilias_version"));
     $link_items = array();
     // imprint
     include_once "Services/Imprint/classes/class.ilImprint.php";
     if ($_REQUEST["baseClass"] != "ilImprintGUI" && ilImprint::isActive()) {
         include_once "Services/Link/classes/class.ilLink.php";
         $link_items[ilLink::_getStaticLink(0, "impr")] = array($lng->txt("imprint"), true);
     }
     $link_items["mailto:" . ilUtil::prepareFormOutput($ilSetting->get("feedback_recipient"))] = array($lng->txt("contact_sysadmin"), false);
     if (DEVMODE && version_compare(PHP_VERSION, '5', '>=')) {
         $link_items[ilUtil::appendUrlParameterString($_SERVER["REQUEST_URI"], "do_dev_validate=xhtml")] = array("Validate", true);
         $link_items[ilUtil::appendUrlParameterString($_SERVER["REQUEST_URI"], "do_dev_validate=accessibility")] = array("Accessibility", true);
     }
     // output translation link (extended language maintenance)
     if ($ilSetting->get("lang_ext_maintenance") == "1") {
         include_once "Services/Language/classes/class.ilObjLanguageAccess.php";
         if (ilObjLanguageAccess::_checkTranslate() and !ilObjLanguageAccess::_isPageTranslation()) {
             ilObjLanguageAccess::_saveUsages();
             $link_items[ilObjLanguageAccess::_getTranslationLink()] = array($lng->txt('translation'), true);
         }
     }
     $cnt = 0;
     foreach ($link_items as $url => $caption) {
         $cnt++;
         if ($caption[1]) {
             $ftpl->touchBlock("blank");
         }
         if ($cnt < sizeof($link_items)) {
             $ftpl->touchBlock("item_separator");
         }
         $ftpl->setCurrentBlock("items");
         $ftpl->setVariable("URL_ITEM", $url);
         $ftpl->setVariable("TXT_ITEM", $caption[0]);
         $ftpl->parseCurrentBlock();
     }
     if (DEVMODE) {
         // execution time
         $t1 = explode(" ", $GLOBALS['ilGlobalStartTime']);
         $t2 = explode(" ", microtime());
         $diff = $t2[0] - $t1[0] + $t2[1] - $t1[1];
         $mem_usage = array();
         if (function_exists("memory_get_usage")) {
             $mem_usage[] = "Memory Usage: " . memory_get_usage() . " Bytes";
         }
         if (function_exists("xdebug_peak_memory_usage")) {
             $mem_usage[] = "XDebug Peak Memory Usage: " . xdebug_peak_memory_usage() . " Bytes";
         }
         $mem_usage[] = round($diff, 4) . " Seconds";
         if (sizeof($mem_usage)) {
             $ftpl->setVariable("MEMORY_USAGE", "<br>" . implode(" | ", $mem_usage));
         }
         if (is_object($ilAuth) && isset($_SESSION[$ilAuth->_sessionName]) && isset($_SESSION[$ilAuth->_sessionName]["timestamp"])) {
             $ftpl->setVariable("SESS_INFO", "<br />maxlifetime: " . ini_get("session.gc_maxlifetime") . " (" . ini_get("session.gc_maxlifetime") / 60 . "), id: " . session_id() . "<br />" . "timestamp: " . date("Y-m-d H:i:s", $_SESSION[$ilAuth->_sessionName]["timestamp"]) . ", idle: " . date("Y-m-d H:i:s", $_SESSION[$ilAuth->_sessionName]["idle"]) . "<br />expire: " . ($exp = $ilClientIniFile->readVariable("session", "expire")) . " (" . $exp / 60 . "), session ends at: " . date("Y-m-d H:i:s", $_SESSION[$ilAuth->_sessionName]["idle"] + $exp));
         }
         if (!empty($_GET["do_dev_validate"]) && $ftpl->blockExists("xhtml_validation")) {
             require_once "Services/XHTMLValidator/classes/class.ilValidatorAdapter.php";
             $template2 = clone $this;
             //echo "-".ilValidatorAdapter::validate($template2->get(), $_GET["do_dev_validate"])."-";
             $ftpl->setCurrentBlock("xhtml_validation");
             $ftpl->setVariable("VALIDATION", ilValidatorAdapter::validate($template2->get("DEFAULT", false, false, false, true), $_GET["do_dev_validate"]));
             $ftpl->parseCurrentBlock();
         }
         // controller history
         if (is_object($ilCtrl) && $ftpl->blockExists("c_entry") && $ftpl->blockExists("call_history")) {
             $hist = $ilCtrl->getCallHistory();
             foreach ($hist as $entry) {
                 $ftpl->setCurrentBlock("c_entry");
                 $ftpl->setVariable("C_ENTRY", $entry["class"]);
                 if (is_object($ilDB)) {
                     $file = $ilCtrl->lookupClassPath($entry["class"]);
                     $add = $entry["mode"] . " - " . $entry["cmd"];
                     if ($file != "") {
                         $add .= " - " . $file;
                     }
                     $ftpl->setVariable("C_FILE", $add);
                 }
                 $ftpl->parseCurrentBlock();
             }
             $ftpl->setCurrentBlock("call_history");
             $ftpl->parseCurrentBlock();
             // debug hack
             $debug = $ilCtrl->getDebug();
             foreach ($debug as $d) {
                 $ftpl->setCurrentBlock("c_entry");
                 $ftpl->setVariable("C_ENTRY", $d);
                 $ftpl->parseCurrentBlock();
             }
             $ftpl->setCurrentBlock("call_history");
             $ftpl->parseCurrentBlock();
         }
         // included files
         if (is_object($ilCtrl) && $ftpl->blockExists("i_entry") && $ftpl->blockExists("included_files")) {
             $fs = get_included_files();
             $ifiles = array();
             $total = 0;
             foreach ($fs as $f) {
                 $ifiles[] = array("file" => $f, "size" => filesize($f));
                 $total += filesize($f);
             }
             $ifiles = ilUtil::sortArray($ifiles, "size", "desc", true);
             foreach ($ifiles as $f) {
                 $ftpl->setCurrentBlock("i_entry");
                 $ftpl->setVariable("I_ENTRY", $f["file"] . " (" . $f["size"] . " Bytes, " . round(100 / $total * $f["size"], 2) . "%)");
                 $ftpl->parseCurrentBlock();
             }
             $ftpl->setCurrentBlock("i_entry");
             $ftpl->setVariable("I_ENTRY", "Total (" . $total . " Bytes, 100%)");
             $ftpl->parseCurrentBlock();
             $ftpl->setCurrentBlock("included_files");
             $ftpl->parseCurrentBlock();
         }
     }
     // BEGIN Usability: Non-Delos Skins can display the elapsed time in the footer
     // The corresponding $ilBench->start invocation is in inc.header.php
     global $ilBench;
     $ilBench->stop("Core", "ElapsedTimeUntilFooter");
     $ftpl->setVariable("ELAPSED_TIME", ", " . number_format($ilBench->getMeasuredTime("Core", "ElapsedTimeUntilFooter"), 1) . ' seconds');
     // END Usability: Non-Delos Skins can display the elapsed time in the footer
     $this->setVariable("FOOTER", $ftpl->get());
 }