/**
  * execute command
  */
 function &executeCommand()
 {
     global $ilHelp;
     if (!ilObjLanguageAccess::_checkMaintenance()) {
         $this->ilErr->raiseError($this->lng->txt("permission_denied"), $this->ilErr->MESSAGE);
         exit;
     }
     $cmd = $this->ctrl->getCmd("view") . "Object";
     $this->{$cmd}();
     $ilHelp->setScreenIdComponent("lng");
     //		exit;
 }
 protected function initAddNewEntryForm($a_id = null)
 {
     global $ilCtrl;
     if (!$a_id) {
         $a_id = $_POST["id"];
     }
     if (!$a_id || !in_array($a_id, ilObjLanguageAccess::_getSavedTopics())) {
         $ilCtrl->redirect($this, "view");
     }
     include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($ilCtrl->getFormAction($this, "saveNewEntry"));
     $form->setTitle($this->lng->txt("adm_missing_entry_add"));
     $mods = ilObjLanguageAccess::_getSavedModules();
     $options = array_combine($mods, $mods);
     $mod = new ilSelectInputGUI(ucfirst($this->lng->txt("module")), "mod");
     $mod->setOptions(array("" => $this->lng->txt("please_select")) + $options);
     $mod->setRequired(true);
     $form->addItem($mod);
     $id = new ilTextInputGUI(ucfirst($this->lng->txt("identifier")), "id");
     $id->setValue($a_id);
     $id->setDisabled(true);
     $form->addItem($id);
     foreach ($this->lng->getInstalledLanguages() as $lang_key) {
         $trans = new ilTextInputGUI($this->lng->txt("meta_l_" . $lang_key), "trans_" . $lang_key);
         if (in_array($lang_key, array("de", "en"))) {
             $trans->setRequired(true);
         }
         $form->addItem($trans);
     }
     $form->addCommandButton("saveNewEntry", $this->lng->txt("save"));
     $form->addCommandButton("view", $this->lng->txt("cancel"));
     return $form;
 }
 /**
  * Init filter
  */
 function initFilter()
 {
     global $lng;
     // most filters are only
     if (!ilObjLanguageAccess::_isPageTranslation()) {
         // pattern
         include_once "./Services/Form/classes/class.ilTextInputGUI.php";
         $ti = new ilTextInputGUI($lng->txt("search"), "pattern");
         $ti->setParent($this->parent_obj);
         $ti->setMaxLength(64);
         $ti->setSize(20);
         $this->addFilterItem($ti);
         $ti->readFromSession();
         // module
         $options = array();
         $options["all"] = $lng->txt("language_all_modules");
         $modules = ilObjLanguageExt::_getModules($lng->getLangKey());
         foreach ($modules as $mod) {
             $options[$mod] = $mod;
         }
         include_once "./Services/Form/classes/class.ilSelectInputGUI.php";
         $si = new ilSelectInputGUI(ucfirst($lng->txt("module")), "module");
         $si->setParent($this->parent_obj);
         $si->setOptions($options);
         $this->addFilterItem($si);
         $si->readFromSession();
         if (!$si->getValue()) {
             $si->setValue('administration');
         }
         // mode
         $options = array();
         $options["all"] = $lng->txt("language_scope_global");
         $options["changed"] = $lng->txt("language_scope_local");
         if ($this->params['langmode']) {
             $options["added"] = $lng->txt("language_scope_added");
         }
         $options["unchanged"] = $lng->txt("language_scope_unchanged");
         $options["equal"] = $lng->txt("language_scope_equal");
         $options["different"] = $lng->txt("language_scope_different");
         $options["commented"] = $lng->txt("language_scope_commented");
         if ($this->params['langmode']) {
             $options["dbremarks"] = $lng->txt("language_scope_dbremarks");
         }
         $options["conflicts"] = $lng->txt("language_scope_conflicts");
         include_once "./Services/Form/classes/class.ilSelectInputGUI.php";
         $si = new ilSelectInputGUI($lng->txt("filter"), "mode");
         $si->setParent($this->parent_obj);
         $si->setOptions($options);
         $this->addFilterItem($si);
         $si->readFromSession();
         if (!$si->getValue()) {
             $si->setValue('all');
         }
     }
     //compare
     $options = array();
     $langlist = $lng->getInstalledLanguages();
     foreach ($langlist as $lang_key) {
         $options[$lang_key] = $lng->txt("meta_l_" . $lang_key);
     }
     include_once "./Services/Form/classes/class.ilSelectInputGUI.php";
     $si = new ilSelectInputGUI($lng->txt("language_compare"), "compare");
     $si->setParent($this->parent_obj);
     $si->setOptions($options);
     $this->addFilterItem($si);
     $si->readFromSession();
     if (!$si->getValue()) {
         $si->setValue($lng->getDefaultLanguage());
     }
 }
Example #4
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());
 }
 /**
  * Set the Title and the description
  * (Overwritten from ilObjectGUI, called by prepareOutput)
  */
 function setTitleAndDescription()
 {
     if (ilObjLanguageAccess::_isPageTranslation()) {
         $this->tpl->setHeaderPageTitle($this->lng->txt("translation"));
         $this->tpl->setTitle($this->lng->txt("translation") . " " . $this->lng->txt("meta_l_" . $this->object->key));
     } else {
         $this->tpl->setTitle($this->lng->txt("meta_l_" . $this->object->key));
     }
     $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_lngf.svg"), $this->lng->txt("obj_" . $this->object->getType()));
 }