ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilRTEGlobalTemplate.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once("./Services/UICore/lib/html-it/IT.php");
5 include_once("./Services/UICore/lib/html-it/ITX.php");
6 
14 {
15  protected $tree_flat_link = "";
16  protected $page_form_action = "";
17  protected $permanent_link = false;
18 
19  protected $lightbox = array();
20  protected $standard_template_loaded = false;
21 
25  protected $template;
26 
36  public function __construct(
37  $file,
38  $flag1,
39  $flag2,
40  $in_module = false,
41  $vars = "DEFAULT",
42  $plugin = false,
43  $a_use_cache = true
44  ) {
45  $this->setBodyClass("std");
46  $this->template = new ilTemplate($file, $flag1, $flag2, $in_module, $vars, $plugin, $a_use_cache);
47  }
48 
52  public function printToString() : string
53  {
54  throw new ilException('not implemented');
55  }
56 
57 
58  //***********************************
59  //
60  // FOOTER
61  //
62  // Used in:
63  // * ilStartUPGUI
64  // * ilTestSubmissionReviewGUI
65  // * ilTestPlayerAbstractGUI
66  // * ilAssQuestionHintRequestGUI
67  //
68  //***********************************
69 
70  private $show_footer = true;
71 
75  public function hideFooter()
76  {
77  $this->show_footer = false;
78  }
79 
83  private function fillFooter()
84  {
85  global $DIC;
86 
87  $ilSetting = $DIC->settings();
88 
89  $lng = $DIC->language();
90 
91  $ilCtrl = $DIC->ctrl();
92  $ilDB = $DIC->database();
93 
94  if (!$this->show_footer) {
95  return;
96  }
97 
98  $ftpl = new ilTemplate("tpl.footer.html", true, true, "Services/UICore");
99 
100  $php = "";
101  if (DEVMODE) {
102  $php = ", PHP " . phpversion();
103  }
104  $ftpl->setVariable("ILIAS_VERSION", $ilSetting->get("ilias_version") . $php);
105 
106  $link_items = array();
107 
108  // imprint
109  include_once "Services/Imprint/classes/class.ilImprint.php";
110  if ($_REQUEST["baseClass"] != "ilImprintGUI" && ilImprint::isActive()) {
111  include_once "Services/Link/classes/class.ilLink.php";
112  $link_items[ilLink::_getStaticLink(0, "impr")] = array($lng->txt("imprint"), true);
113  }
114 
115  // system support contacts
116  include_once("./Modules/SystemFolder/classes/class.ilSystemSupportContactsGUI.php");
117  if (($l = ilSystemSupportContactsGUI::getFooterLink()) != "") {
118  $link_items[$l] = array(ilSystemSupportContactsGUI::getFooterText(), false);
119  }
120 
121  if (DEVMODE) {
122  if (function_exists("tidy_parse_string")) {
123  $link_items[ilUtil::appendUrlParameterString($_SERVER["REQUEST_URI"], "do_dev_validate=xhtml")] = array("Validate", true);
124  $link_items[ilUtil::appendUrlParameterString($_SERVER["REQUEST_URI"], "do_dev_validate=accessibility")] = array("Accessibility", true);
125  }
126  }
127 
128  // output translation link
129  include_once("Services/Language/classes/class.ilObjLanguageAccess.php");
131  $link_items[ilObjLanguageAccess::_getTranslationLink()] = array($lng->txt('translation'), true);
132  }
133 
134  $cnt = 0;
135  foreach ($link_items as $url => $caption) {
136  $cnt++;
137  if ($caption[1]) {
138  $ftpl->touchBlock("blank");
139  }
140  if ($cnt < sizeof($link_items)) {
141  $ftpl->touchBlock("item_separator");
142  }
143 
144  $ftpl->setCurrentBlock("items");
145  $ftpl->setVariable("URL_ITEM", ilUtil::secureUrl($url));
146  $ftpl->setVariable("TXT_ITEM", $caption[0]);
147  $ftpl->parseCurrentBlock();
148  }
149 
150  if (DEVMODE) {
151  // execution time
152  $t1 = explode(" ", $GLOBALS['ilGlobalStartTime']);
153  $t2 = explode(" ", microtime());
154  $diff = $t2[0] - $t1[0] + $t2[1] - $t1[1];
155 
156  $mem_usage = array();
157  if (function_exists("memory_get_usage")) {
158  $mem_usage[] =
159  "Memory Usage: " . memory_get_usage() . " Bytes";
160  }
161  if (function_exists("xdebug_peak_memory_usage")) {
162  $mem_usage[] =
163  "XDebug Peak Memory Usage: " . xdebug_peak_memory_usage() . " Bytes";
164  }
165  $mem_usage[] = round($diff, 4) . " Seconds";
166 
167  if (sizeof($mem_usage)) {
168  $ftpl->setVariable("MEMORY_USAGE", "<br>" . implode(" | ", $mem_usage));
169  }
170 
171  if (!empty($_GET["do_dev_validate"]) && $ftpl->blockExists("xhtml_validation")) {
172  require_once("Services/XHTMLValidator/classes/class.ilValidatorAdapter.php");
173  $template2 = clone($this);
174  $ftpl->setCurrentBlock("xhtml_validation");
175  $ftpl->setVariable(
176  "VALIDATION",
177  ilValidatorAdapter::validate($template2->get(
178  "DEFAULT",
179  false,
180  false,
181  false,
182  true
183  ), $_GET["do_dev_validate"])
184  );
185  $ftpl->parseCurrentBlock();
186  }
187 
188  // controller history
189  if (is_object($ilCtrl) && $ftpl->blockExists("c_entry") &&
190  $ftpl->blockExists("call_history")) {
191  $hist = $ilCtrl->getCallHistory();
192  foreach ($hist as $entry) {
193  $ftpl->setCurrentBlock("c_entry");
194  $ftpl->setVariable("C_ENTRY", $entry["class"]);
195  if (is_object($ilDB)) {
196  $file = $ilCtrl->lookupClassPath($entry["class"]);
197  $add = $entry["mode"] . " - " . $entry["cmd"];
198  if ($file != "") {
199  $add .= " - " . $file;
200  }
201  $ftpl->setVariable("C_FILE", $add);
202  }
203  $ftpl->parseCurrentBlock();
204  }
205  $ftpl->setCurrentBlock("call_history");
206  $ftpl->parseCurrentBlock();
207  }
208 
209  // included files
210  if (is_object($ilCtrl) && $ftpl->blockExists("i_entry") &&
211  $ftpl->blockExists("included_files")) {
212  $fs = get_included_files();
213  $ifiles = array();
214  $total = 0;
215  foreach ($fs as $f) {
216  $ifiles[] = array("file" => $f, "size" => filesize($f));
217  $total += filesize($f);
218  }
219  $ifiles = ilUtil::sortArray($ifiles, "size", "desc", true);
220  foreach ($ifiles as $f) {
221  $ftpl->setCurrentBlock("i_entry");
222  $ftpl->setVariable("I_ENTRY", $f["file"] . " (" . $f["size"] . " Bytes, " . round(100 / $total * $f["size"], 2) . "%)");
223  $ftpl->parseCurrentBlock();
224  }
225  $ftpl->setCurrentBlock("i_entry");
226  $ftpl->setVariable("I_ENTRY", "Total (" . $total . " Bytes, 100%)");
227  $ftpl->parseCurrentBlock();
228  $ftpl->setCurrentBlock("included_files");
229  $ftpl->parseCurrentBlock();
230  }
231  }
232 
233  // BEGIN Usability: Non-Delos Skins can display the elapsed time in the footer
234  // The corresponding $ilBench->start invocation is in inc.header.php
235  $ilBench = $DIC["ilBench"];
236  $ilBench->stop("Core", "ElapsedTimeUntilFooter");
237  $ftpl->setVariable(
238  "ELAPSED_TIME",
239  ", " . number_format($ilBench->getMeasuredTime("Core", "ElapsedTimeUntilFooter"), 1) . ' seconds'
240  );
241  // END Usability: Non-Delos Skins can display the elapsed time in the footer
242 
243  $this->setVariable("FOOTER", $ftpl->get());
244  }
245 
246 
247  //***********************************
248  //
249  // MAIN MENU
250  //
251  //***********************************
252 
256  protected $main_menu;
257 
261  protected $main_menu_spacer;
262 
263  private function getMainMenu()
264  {
265  global $DIC;
266 
267  $ilMainMenu = $DIC["ilMainMenu"];
268 
269  if ($this->variableExists('MAINMENU')) {
270  $ilMainMenu->setLoginTargetPar($this->getLoginTargetPar());
271  $this->main_menu = $ilMainMenu->getHTML();
272  $this->main_menu_spacer = $ilMainMenu->getSpacerClass();
273  }
274  }
275 
276  private function fillMainMenu()
277  {
278  global $DIC;
279  $tpl = $DIC["tpl"];
280  if ($this->variableExists('MAINMENU')) {
281  $tpl->setVariable("MAINMENU", $this->main_menu);
282  $tpl->setVariable("MAINMENU_SPACER", $this->main_menu_spacer);
283  }
284  }
285 
286 
287  //***********************************
288  //
289  // HELP
290  //
291  //***********************************
292 
296  private function initHelp()
297  {
298  include_once("./Services/Help/classes/class.ilHelpGUI.php");
299  //ilHelpGUI::initHelp($this);
300  }
301 
302 
303  //***********************************
304  //
305  // MESSAGES
306  //
307  // setMessage is only used in ilUtil
308  //
309  //***********************************
310 
311  const MESSAGE_TYPE_FAILURE = 'failure';
312  const MESSAGE_TYPE_INFO = "info";
313  const MESSAGE_TYPE_SUCCESS = "success";
314  const MESSAGE_TYPE_QUESTION = "question";
315 
319  protected static $message_types = array(
320  self::MESSAGE_TYPE_FAILURE,
321  self::MESSAGE_TYPE_INFO,
322  self::MESSAGE_TYPE_SUCCESS,
323  self::MESSAGE_TYPE_QUESTION,
324  );
325 
326  protected $message = array();
327 
339  public function setOnScreenMessage($a_type, $a_txt, $a_keep = false)
340  {
341  if (!in_array($a_type, self::$message_types) || $a_txt == "") {
342  return;
343  }
344  if (!$a_keep) {
345  $this->message[$a_type] = $a_txt;
346  } else {
347  $_SESSION[$a_type] = $a_txt;
348  }
349  }
350 
354  private function fillMessage()
355  {
356  global $DIC;
357 
358  $out = "";
359 
360  foreach (self::$message_types as $m) {
361  $txt = $this->getMessageTextForType($m);
362 
363  if ($txt != "") {
365  }
366 
367  $request = $DIC->http()->request();
368  $accept_header = $request->getHeaderLine('Accept');
369  if (isset($_SESSION[$m]) && $_SESSION[$m] && ($accept_header !== 'application/json')) {
370  unset($_SESSION[$m]);
371  }
372  }
373 
374  if ($out != "") {
375  $this->setVariable("MESSAGE", $out);
376  }
377  }
378 
379 
385  private function getMessageTextForType($m)
386  {
387  $txt = "";
388  if (isset($_SESSION[$m]) && $_SESSION[$m] != "") {
389  $txt = $_SESSION[$m];
390  } else {
391  if (isset($this->message[$m])) {
392  $txt = $this->message[$m];
393  }
394  }
395 
396  return $txt;
397  }
398 
399  //***********************************
400  //
401  // JAVASCRIPT files and code
402  //
403  //***********************************
404 
409  protected $js_files = array(0 => "./Services/JavaScript/js/Basic.js");
410 
415  protected $js_files_vp = array("./Services/JavaScript/js/Basic.js" => true);
416 
421  protected $js_files_batch = array("./Services/JavaScript/js/Basic.js" => 1);
422 
426  public function addJavaScript($a_js_file, $a_add_version_parameter = true, $a_batch = 2)
427  {
428  // three batches currently
429  if ($a_batch < 1 || $a_batch > 3) {
430  $a_batch = 2;
431  }
432 
433  // ensure jquery files being loaded first
434  if (is_int(strpos($a_js_file, "Services/jQuery")) ||
435  is_int(strpos($a_js_file, "/jquery.js")) ||
436  is_int(strpos($a_js_file, "/jquery-min.js"))) {
437  $a_batch = 0;
438  }
439 
440  if (!in_array($a_js_file, $this->js_files)) {
441  $this->js_files[] = $a_js_file;
442  $this->js_files_vp[$a_js_file] = $a_add_version_parameter;
443  $this->js_files_batch[$a_js_file] = $a_batch;
444  }
445  }
446 
450  public function addOnLoadCode($a_code, $a_batch = 2)
451  {
452  // three batches currently
453  if ($a_batch < 1 || $a_batch > 3) {
454  $a_batch = 2;
455  }
456  $this->on_load_code[$a_batch][] = $a_code;
457  }
458 
464  public function getOnLoadCodeForAsynch()
465  {
466  $js = "";
467  for ($i = 1; $i <= 3; $i++) {
468  if (is_array($this->on_load_code[$i])) {
469  foreach ($this->on_load_code[$i] as $code) {
470  $js .= $code . "\n";
471  }
472  }
473  }
474  if ($js) {
475  return '<script type="text/javascript">' . "\n" .
476  $js .
477  '</script>' . "\n";
478  }
479  }
480 
481  // REMOVAL CANDIDATE
482  // Usage locations:
483  // - latex.php
487  public function resetJavascript()
488  {
489  $this->js_files = array();
490  $this->js_files_vp = array();
491  $this->js_files_batch = array();
492  }
493 
494  // PRIVATE CANDIDATE
495  // Usage locations:
496  // - ilPageObjectGUI
497  // - ilStartUpGUI
498  // - ilObjPortfolioGUI
499  // - latex.php
500  public function fillJavaScriptFiles($a_force = false)
501  {
502  global $DIC;
503 
504  $ilSetting = $DIC->settings();
505 
506  if (is_object($ilSetting)) { // maybe this one can be removed
507  $vers = "vers=" . str_replace(array(".", " "), "-", $ilSetting->get("ilias_version"));
508 
509  if (DEVMODE) {
510  $vers .= '-' . time();
511  }
512  }
513  if ($this->blockExists("js_file")) {
514  // three batches
515  for ($i = 0; $i <= 3; $i++) {
516  reset($this->js_files);
517  foreach ($this->js_files as $file) {
518  if ($this->js_files_batch[$file] == $i) {
519  if (is_file($file) || substr($file, 0, 4) == "http" || substr($file, 0, 2) == "//" || $a_force) {
520  $this->fillJavascriptFile($file, $vers);
521  } elseif (substr($file, 0, 2) == './') { // #13962
522  $url_parts = parse_url($file);
523  if (is_file($url_parts['path'])) {
524  $this->fillJavascriptFile($file, $vers);
525  }
526  }
527  }
528  }
529  }
530  }
531  }
532 
536  private function fillOnLoadCode()
537  {
538  for ($i = 1; $i <= 3; $i++) {
539  if (is_array($this->on_load_code[$i])) {
540  $this->setCurrentBlock("on_load_code");
541  foreach ($this->on_load_code[$i] as $code) {
542  $this->setCurrentBlock("on_load_code_inner");
543  $this->setVariable("OLCODE", $code);
544  $this->parseCurrentBlock();
545  }
546  $this->setCurrentBlock("on_load_code");
547  $this->parseCurrentBlock();
548  }
549  }
550  }
551 
556  protected function fillJavascriptFile($file, $vers)
557  {
558  $this->setCurrentBlock("js_file");
559  if ($this->js_files_vp[$file]) {
560  $this->setVariable("JS_FILE", ilUtil::appendUrlParameterString($file, $vers));
561  } else {
562  $this->setVariable("JS_FILE", $file);
563  }
564  $this->parseCurrentBlock();
565  }
566 
567 
568  //***********************************
569  //
570  // CSS files and code
571  //
572  //***********************************
573 
578  protected $css_files = array();
579 
584  protected $inline_css = array();
585 
589  public function addCss($a_css_file, $media = "screen")
590  {
591  if (!array_key_exists($a_css_file . $media, $this->css_files)) {
592  $this->css_files[$a_css_file . $media] = array("file" => $a_css_file, "media" => $media);
593  }
594  }
595 
596  // REMOVAL CANDIDATE
597  // Usage locations:
598  // - ilDclRecordEditGUI
599  // - ilObjStyleSheetGUI
603  public function addInlineCss($a_css, $media = "screen")
604  {
605  $this->inline_css[] = array("css" => $a_css, "media" => $media);
606  }
607 
608  // PRIVATE CANDIDATE
609  // Usage locations:
610  // - ilPageObjectGUI
611  // - ilDclDetailedViewGUI
612  // - ilStartUpGUI
618  public function fillCssFiles($a_force = false)
619  {
620  if (!$this->blockExists("css_file")) {
621  return;
622  }
623  foreach ($this->css_files as $css) {
624  $filename = $css["file"];
625  if (strpos($filename, "?") > 0) {
626  $filename = substr($filename, 0, strpos($filename, "?"));
627  }
628  if (is_file($filename) || $a_force) {
629  $this->setCurrentBlock("css_file");
630  $this->setVariable("CSS_FILE", $css["file"]);
631  $this->setVariable("CSS_MEDIA", $css["media"]);
632  $this->parseCurrentBlock();
633  }
634  }
635  }
636 
637  // REMOVAL CANDIDATE:
638  // Usage locations:
639  // - ilObjMediaPoolGUI
640  // - ilAttendanceList
641  // - ilObjPortfolioGUI
642  // - ilSCORM2004ScoGUI
643  // - ilTestSubmissionReviewGUI
644  // - ilTestPlayerAbstractGUI
645  // - ilAssQuestionHintRequestGUI
646  // - ilWorkspaceFolderExplorer
647  public function setBodyClass($a_class = "")
648  {
649  $this->body_class = $a_class;
650  }
651 
652  private function fillBodyClass()
653  {
654  if ($this->body_class != "" && $this->blockExists("body_class")) {
655  $this->setCurrentBlock("body_class");
656  $this->setVariable("BODY_CLASS", $this->body_class);
657  $this->parseCurrentBlock();
658  }
659  }
660 
664  private function resetCss()
665  {
666  $this->css_files = array();
667  }
668 
674  private function fillInlineCss()
675  {
676  if (!$this->blockExists("css_inline")) {
677  return;
678  }
679  foreach ($this->inline_css as $css) {
680  $this->setCurrentBlock("css_inline");
681  $this->setVariable("CSS_INLINE", $css["css"]);
682  $this->parseCurrentBlock();
683  }
684  }
685 
689  private function fillNewContentStyle()
690  {
691  $this->setVariable(
692  "LOCATION_NEWCONTENT_STYLESHEET_TAG",
693  '<link rel="stylesheet" type="text/css" href="' .
695  . '" />'
696  );
697  }
698 
699 
700  //***********************************
701  //
702  // ILIAS STANDARD TEMPLATE
703  // which is responsible for the look
704  // i.e. a title, tabs, ...
705  //
706  //***********************************
707 
713  public function loadStandardTemplate()
714  {
715  if ($this->standard_template_loaded) {
716  return;
717  }
718 
719  // always load jQuery
720  include_once("./Services/jQuery/classes/class.iljQueryUtil.php");
723 
724  // always load ui framework
725  include_once("./Services/UICore/classes/class.ilUIFramework.php");
727 
728  $this->addBlockFile("CONTENT", "content", "tpl.adm_content.html");
729  $this->addBlockFile("STATUSLINE", "statusline", "tpl.statusline.html");
730 
731  $this->standard_template_loaded = true;
732  }
733 
734 
735  //***********************************
736  //
737  // HEADER in standard template
738  //
739  //***********************************
740 
741  protected $header_page_title = "";
742  protected $title = "";
743  protected $title_desc = "";
744  protected $title_alerts = array();
745  protected $header_action;
746 
752  public function setTitle($a_title, $hidden = false)
753  {
754  $this->title = $a_title;
755  $this->header_page_title = $a_title;
756  }
757 
761  public function setDescription($a_descr)
762  {
763  $this->title_desc = $a_descr;
764  }
765 
769  public function setTitleIcon($a_icon_path, $a_icon_desc = "")
770  {
771  $this->icon_desc = $a_icon_desc;
772  $this->icon_path = $a_icon_path;
773  }
774 
780  public function setAlertProperties(array $a_props)
781  {
782  $this->title_alerts = $a_props;
783  }
784 
788  public function clearHeader()
789  {
790  $this->setTitle("");
791  $this->setTitleIcon("");
792  $this->setDescription("");
793  $this->setAlertProperties(array());
794  }
795 
796  // REMOVAL CANDIDATE
797  // Usage locations:
798  // - ilCalendarPresentationGUI
799  // - ilContainerGUI
800  // - ilObjDataCollectionGUI
801  // - ilDashboardGUI
802  // - ilObjPortfolioTemplateGUI
803  // - ilWikiPageGUI
804  // - ilObjWikiGUI
810  public function setHeaderActionMenu($a_header)
811  {
812  $this->header_action = $a_header;
813  }
814 
815  // REMOVAL CANDIDATE
816  // Usage locations:
817  // - ilObjLanguageExtGUI
818  // - ilTestServiceGUI
819  // - ilWikiPageGUI
823  public function setHeaderPageTitle($a_title)
824  {
825  $this->header_page_title = $a_title;
826  }
827 
831  private function fillHeader()
832  {
833  global $DIC;
834 
835  $lng = $DIC->language();
836 
837  $icon = false;
838  if ($this->icon_path != "") {
839  $icon = true;
840  $this->setCurrentBlock("header_image");
841  if ($this->icon_desc != "") {
842  $this->setVariable("IMAGE_DESC", $lng->txt("icon") . " " . $this->icon_desc);
843  $this->setVariable("IMAGE_ALT", $lng->txt("icon") . " " . $this->icon_desc);
844  }
845 
846  $this->setVariable("IMG_HEADER", $this->icon_path);
847  $this->parseCurrentBlock();
848  $header = true;
849  }
850 
851  if ($this->title != "") {
852  $title = ilUtil::stripScriptHTML($this->title);
853  $this->setVariable("HEADER", $title);
854 
855  $header = true;
856  }
857 
858  if ($header) {
859  $this->setCurrentBlock("header_image");
860  $this->parseCurrentBlock();
861  }
862 
863  if ($this->title_desc != "") {
864  $this->setCurrentBlock("header_desc");
865  $this->setVariable("H_DESCRIPTION", $this->title_desc);
866  $this->parseCurrentBlock();
867  }
868 
869  $header = $this->getHeaderActionMenu();
870  if ($header) {
871  $this->setCurrentBlock("head_action_inner");
872  $this->setVariable("HEAD_ACTION", $header);
873  $this->parseCurrentBlock();
874  $this->touchBlock("head_action");
875  }
876 
877  if (count((array) $this->title_alerts)) {
878  foreach ($this->title_alerts as $alert) {
879  $this->setCurrentBlock('header_alert');
880  if (!($alert['propertyNameVisible'] === false)) {
881  $this->setVariable('H_PROP', $alert['property'] . ':');
882  }
883  $this->setVariable('H_VALUE', $alert['value']);
884  $this->parseCurrentBlock();
885  }
886  }
887 
888  // add file upload drop zone in header
889  if ($this->enable_fileupload != null) {
890  $ref_id = $this->enable_fileupload;
891  $upload_id = "dropzone_" . $ref_id;
892 
893  include_once("./Services/FileUpload/classes/class.ilFileUploadGUI.php");
894  $upload = new ilFileUploadGUI($upload_id, $ref_id, true);
895 
896  $this->setVariable("FILEUPLOAD_DROPZONE_ID", " id=\"$upload_id\"");
897 
898  $this->setCurrentBlock("header_fileupload");
899  $this->setVariable("HEADER_FILEUPLOAD_SCRIPT", $upload->getHTML());
900  $this->parseCurrentBlock();
901  }
902  }
903 
909  private function getHeaderActionMenu()
910  {
911  return $this->header_action;
912  }
913 
914 
915  //***********************************
916  //
917  // LOCATOR in standard template
918  //
919  //***********************************
920 
924  public function setLocator()
925  {
926  global $DIC;
927 
928  $ilMainMenu = $DIC["ilMainMenu"];
929  $ilLocator = $DIC["ilLocator"];
930 
931  $ilPluginAdmin = $DIC["ilPluginAdmin"];
932 
933  // blog/portfolio
934  if ($ilMainMenu->getMode() == ilMainMenuGUI::MODE_TOPBAR_REDUCED ||
935  $ilMainMenu->getMode() == ilMainMenuGUI::MODE_TOPBAR_ONLY) {
936  $this->setVariable("LOCATOR", "");
937  return;
938  }
939 
940  $html = "";
941  if (is_object($ilPluginAdmin)) {
942  include_once("./Services/UIComponent/classes/class.ilUIHookProcessor.php");
943  $uip = new ilUIHookProcessor(
944  "Services/Locator",
945  "main_locator",
946  array("locator_gui" => $ilLocator)
947  );
948  if (!$uip->replaced()) {
949  $html = $ilLocator->getHTML();
950  }
951  $html = $uip->getHTML($html);
952  } else {
953  $html = $ilLocator->getHTML();
954  }
955 
956  $this->setVariable("LOCATOR", $html);
957  }
958 
959 
960  //***********************************
961  //
962  // TABS in standard template
963  //
964  //***********************************
965 
969  protected $tabs_html = "";
970 
974  protected $sub_tabs_html = "";
975 
979  public function setTabs($a_tabs_html)
980  {
981  if ($a_tabs_html != "" && $this->blockExists("tabs_outer_start")) {
982  $this->touchBlock("tabs_outer_start");
983  $this->touchBlock("tabs_outer_end");
984  $this->touchBlock("tabs_inner_start");
985  $this->touchBlock("tabs_inner_end");
986  $this->setVariable("TABS", $a_tabs_html);
987  }
988  }
989 
993  public function setSubTabs($a_tabs_html)
994  {
995  $this->setVariable("SUB_TABS", $a_tabs_html);
996  }
997 
998  private function fillTabs()
999  {
1000  if ($this->blockExists("tabs_outer_start")) {
1001  $this->touchBlock("tabs_outer_start");
1002  $this->touchBlock("tabs_outer_end");
1003  $this->touchBlock("tabs_inner_start");
1004  $this->touchBlock("tabs_inner_end");
1005 
1006  if ($this->tabs_html != "") {
1007  $this->setVariable("TABS", $this->tabs_html);
1008  }
1009  $this->setVariable("SUB_TABS", $this->sub_tabs_html);
1010  }
1011  }
1012 
1013  private function getTabsHTML()
1014  {
1015  global $DIC;
1016 
1017  $ilTabs = $DIC["ilTabs"];
1018 
1019  if ($this->blockExists("tabs_outer_start")) {
1020  $this->sub_tabs_html = $ilTabs->getSubTabHTML();
1021  $this->tabs_html = $ilTabs->getHTML(true);
1022  }
1023  }
1024 
1025 
1026  //***********************************
1027  //
1028  // COLUMN LAYOUT in standard template
1029  //
1030  //***********************************
1031 
1035  public function setContent($a_html)
1036  {
1037  if ($a_html != "") {
1038  $this->main_content = $a_html;
1039  }
1040  }
1041 
1045  public function setLeftContent($a_html)
1046  {
1047  $this->left_content = $a_html;
1048  }
1049 
1054  {
1055  $this->left_nav_content = $a_content;
1056  }
1057 
1061  private function fillLeftNav()
1062  {
1063  if (trim($this->left_nav_content) != "") {
1064  $this->setCurrentBlock("left_nav");
1065  $this->setVariable("LEFT_NAV_CONTENT", $this->left_nav_content);
1066  $this->parseCurrentBlock();
1067  $this->touchBlock("left_nav_space");
1068  }
1069  }
1070 
1074  public function setRightContent($a_html)
1075  {
1076  $this->right_content = $a_html;
1077  }
1078 
1079  private function setCenterColumnClass()
1080  {
1081  if (!$this->blockExists("center_col_width")) {
1082  return;
1083  }
1084  $center_column_class = "";
1085  if (trim($this->right_content) != "" && trim($this->left_content) != "") {
1086  $center_column_class = "two_side_col";
1087  } elseif (trim($this->right_content) != "" || trim($this->left_content) != "") {
1088  $center_column_class = "one_side_col";
1089  }
1090 
1091  switch ($center_column_class) {
1092  case "one_side_col": $center_column_class = "col-sm-9"; break;
1093  case "two_side_col": $center_column_class = "col-sm-6"; break;
1094  default: $center_column_class = "col-sm-12"; break;
1095  }
1096  if (trim($this->left_content) != "") {
1097  $center_column_class .= " col-sm-push-3";
1098  }
1099 
1100  $this->setCurrentBlock("center_col_width");
1101  $this->setVariable("CENTER_COL", $center_column_class);
1102  $this->parseCurrentBlock();
1103  }
1104 
1105  private function fillMainContent()
1106  {
1107  if (trim($this->main_content) != "") {
1108  $this->setVariable("ADM_CONTENT", $this->main_content);
1109  }
1110  }
1111 
1112  private function fillLeftContent()
1113  {
1114  if (trim($this->left_content) != "") {
1115  $this->setCurrentBlock("left_column");
1116  $this->setVariable("LEFT_CONTENT", $this->left_content);
1117  $left_col_class = (trim($this->right_content) == "")
1118  ? "col-sm-3 col-sm-pull-9"
1119  : "col-sm-3 col-sm-pull-6";
1120  $this->setVariable("LEFT_COL_CLASS", $left_col_class);
1121  $this->parseCurrentBlock();
1122  }
1123  }
1124 
1125  private function fillRightContent()
1126  {
1127  if (trim($this->right_content) != "") {
1128  $this->setCurrentBlock("right_column");
1129  $this->setVariable("RIGHT_CONTENT", $this->right_content);
1130  $this->parseCurrentBlock();
1131  }
1132  }
1133 
1134 
1135  //***********************************
1136  //
1137  // TOOLBAR in standard template
1138  //
1139  //***********************************
1140 
1141  private function fillToolbar()
1142  {
1143  global $DIC;
1144 
1145  $ilToolbar = $DIC["ilToolbar"];
1146  ;
1147 
1148  $thtml = $ilToolbar->getHTML();
1149  if ($thtml != "") {
1150  $this->setCurrentBlock("toolbar_buttons");
1151  $this->setVariable("BUTTONS", $thtml);
1152  $this->parseCurrentBlock();
1153  }
1154  }
1155 
1156  // SPECIAL REQUIREMENTS
1157  //
1158  // Stuff that is only used by a little other classes.
1159 
1163  private function fillContentLanguage()
1164  {
1165  global $DIC;
1166 
1167  $lng = $DIC->language();
1168  $ilUser = $DIC->user();
1169 
1170  $contentLanguage = 'en';
1171  $rtl = array('ar','fa','ur','he');//, 'de'); //make a list of rtl languages
1172  /* rtl-review: add "de" for testing with ltr lang shown in rtl
1173  * and set unicode-bidi to bidi-override for mirror effect */
1174  $textdir = 'ltr';
1175  if (is_object($ilUser)) {
1176  if ($ilUser->getLanguage()) {
1177  $contentLanguage = $ilUser->getLanguage();
1178  } elseif (is_object($lng)) {
1179  $contentLanguage = $lng->getDefaultLanguage();
1180  }
1181  }
1182  $this->setVariable('META_CONTENT_LANGUAGE', $contentLanguage);
1183  if (in_array($contentLanguage, $rtl)) {
1184  $textdir = 'rtl';
1185  }
1186  $this->setVariable('LANGUAGE_DIRECTION', $textdir);
1187  return true;
1188  }
1189 
1190  // PRIVATE CANDIDATE
1191  // Usage locations:
1192  // - ilStartUpGUI
1193  public function fillWindowTitle()
1194  {
1195  global $DIC;
1196 
1197  $ilSetting = $DIC->settings();
1198 
1199  if ($this->header_page_title != "") {
1200  $title = ilUtil::stripScriptHTML($this->header_page_title);
1201  $this->setVariable("PAGETITLE", "- " . $title);
1202  }
1203 
1204  if ($ilSetting->get('short_inst_name') != "") {
1205  $this->setVariable(
1206  "WINDOW_TITLE",
1207  $ilSetting->get('short_inst_name')
1208  );
1209  } else {
1210  $this->setVariable(
1211  "WINDOW_TITLE",
1212  "ILIAS"
1213  );
1214  }
1215  }
1216 
1217  // REMOVAL CANDIDATE
1218  // Usage locations:
1219  // - ilLuceneAdvancedSearchGUI
1220  // - ilLuceneSearchGUI
1221  // - ilContainerGUI
1222  public function setPageFormAction($a_action)
1223  {
1224  $this->page_form_action = $a_action;
1225  }
1226 
1227  private function fillPageFormAction()
1228  {
1229  if ($this->page_form_action != "") {
1230  $this->setCurrentBlock("page_form_start");
1231  $this->setVariable("PAGE_FORM_ACTION", $this->page_form_action);
1232  $this->parseCurrentBlock();
1233  $this->touchBlock("page_form_end");
1234  }
1235  }
1236 
1237 
1238  // REMOVAL CANDIDATE
1239  // Usage locations:
1240  // - ilObjForumGUI
1241  // - ilObjPortfolioBaseGUI
1242  // - ilWikiPageGUI
1247  public function setLoginTargetPar($a_val)
1248  {
1249  $this->login_target_par = $a_val;
1250  }
1251 
1255  private function getLoginTargetPar()
1256  {
1257  return $this->login_target_par;
1258  }
1259 
1260 
1261  // REMOVAL CANDIDATE:
1262  // Usage locations:
1263  // - ilLPListOfObjectsGUI
1264  // - ilExport
1265  // - ilLMEditorGUI
1266  // - ilObjPortfolioGUI
1267  // - ilPortfolioHTMLExport
1268  // - ilForumExportGUI
1269  // - ilObjWikiGUI.php
1270  // - ilWikiHTMLExport
1271  // - ilScormSpecialPagesTableGUI
1272  //
1273  // Also this seems to be somehow similar to the stuff going on in printToStdout.
1274  // Maybe we could unify them.
1279  public function getSpecial(
1280  $part = "DEFAULT",
1281  $add_error_mess = false,
1282  $handle_referer = false,
1283  $add_ilias_footer = false,
1284  $add_standard_elements = false,
1285  $a_main_menu = true,
1286  $a_tabs = true
1287  ) {
1288  global $DIC;
1289 
1290  if ($add_error_mess) {
1291  $this->fillMessage();
1292  }
1293 
1294  if ($add_ilias_footer) {
1295  $this->fillFooter();
1296  }
1297 
1298  // set standard parts (tabs and title icon)
1299  if ($add_standard_elements) {
1300  if ($this->blockExists("content") && $a_tabs) {
1301  // determine default screen id
1302  $this->getTabsHTML();
1303  }
1304 
1305  // to get also the js files for the main menu
1306  $this->getMainMenu();
1307  $this->initHelp();
1308 
1309  // these fill blocks in tpl.main.html
1310  $this->fillCssFiles();
1311  $this->fillInlineCss();
1312  $this->fillBodyClass();
1313 
1314  // these fill just plain placeholder variables in tpl.main.html
1315  $this->setCurrentBlock("DEFAULT");
1316  $this->fillNewContentStyle();
1317  $this->fillContentLanguage();
1318  $this->fillWindowTitle();
1319 
1320  // these fill blocks in tpl.adm_content.html
1321  $this->fillHeader();
1322  $this->fillSideIcons();
1323  $this->fillScreenReaderFocus();
1324  $this->fillLeftContent();
1325  $this->fillLeftNav();
1326  $this->fillRightContent();
1327  $this->fillAdminPanel();
1328  $this->fillToolbar();
1329  $this->fillPermanentLink();
1330 
1331  $this->setCenterColumnClass();
1332 
1333  // late loading of javascipr files, since operations above may add files
1334  $this->fillJavaScriptFiles();
1335  $this->fillOnLoadCode();
1336 
1337  // these fill just plain placeholder variables in tpl.adm_content.html
1338  if ($this->blockExists("content")) {
1339  $this->setCurrentBlock("content");
1340  if ($a_tabs) {
1341  $this->fillTabs();
1342  }
1343  $this->fillMainContent();
1344  if ($a_main_menu) {
1345  $this->fillMainMenu();
1346  }
1347  $this->fillLightbox();
1348  $this->parseCurrentBlock();
1349  }
1350  }
1351 
1352  if ($handle_referer) {
1353  $this->handleReferer();
1354  }
1355 
1356  if ($part == "DEFAULT") {
1357  $html = $this->template->get();
1358  } else {
1359  $html = $this->template->get($part);
1360  }
1361 
1362  // save language usages as late as possible
1364 
1365  return $html;
1366  }
1367 
1373  public function printToStdout($part = "DEFAULT", $a_fill_tabs = true, $a_skip_main_menu = false)
1374  {
1375  global $DIC;
1376 
1377  $http = $DIC->http();
1378  switch ($http->request()->getHeaderLine('Accept')) {
1379  case 'application/json':
1380  $string = json_encode([
1381  self::MESSAGE_TYPE_SUCCESS => is_null($this->message[self::MESSAGE_TYPE_FAILURE]),
1382  'message' => '',
1383  ]);
1384  $stream = \ILIAS\Filesystem\Stream\Streams::ofString($string);
1385  $http->saveResponse($http->response()->withBody($stream));
1386  $http->sendResponse();
1387  exit;
1388  default:
1389  // include yahoo dom per default
1390  include_once("./Services/YUI/classes/class.ilYuiUtil.php");
1392 
1393  header('P3P: CP="CURa ADMa DEVa TAIa PSAa PSDa IVAa IVDa OUR BUS IND UNI COM NAV INT CNT STA PRE"');
1394  header("Content-type: text/html; charset=UTF-8");
1395 
1396  $this->fillMessage();
1397 
1398  // display ILIAS footer
1399  if ($part !== false) {
1400  $this->fillFooter();
1401  }
1402 
1403  // set standard parts (tabs and title icon)
1404  $this->fillBodyClass();
1405  if ($a_fill_tabs) {
1406  if ($this->blockExists("content")) {
1407  // determine default screen id
1408  $this->getTabsHTML();
1409  }
1410 
1411  // to get also the js files for the main menu
1412  if (!$a_skip_main_menu) {
1413  $this->getMainMenu();
1414  $this->initHelp();
1415  }
1416 
1417  // these fill blocks in tpl.main.html
1418  $this->fillCssFiles();
1419  $this->fillInlineCss();
1420  //$this->fillJavaScriptFiles();
1421 
1422  // these fill just plain placeholder variables in tpl.main.html
1423  $this->setCurrentBlock("DEFAULT");
1424  $this->fillNewContentStyle();
1425  $this->fillContentLanguage();
1426  $this->fillWindowTitle();
1427 
1428  // these fill blocks in tpl.adm_content.html
1429  $this->fillHeader();
1430  $this->fillSideIcons();
1431  $this->fillScreenReaderFocus();
1432  $this->fillLeftContent();
1433  $this->fillLeftNav();
1434  $this->fillRightContent();
1435  $this->fillAdminPanel();
1436  $this->fillToolbar();
1437  $this->fillPermanentLink();
1438 
1439  $this->setCenterColumnClass();
1440 
1441  // late loading of javascipr files, since operations above may add files
1442  $this->fillJavaScriptFiles();
1443  $this->fillOnLoadCode();
1444 
1445  // these fill just plain placeholder variables in tpl.adm_content.html
1446  if ($this->blockExists("content")) {
1447  $this->setCurrentBlock("content");
1448  $this->fillTabs();
1449  $this->fillMainContent();
1450  $this->fillMainMenu();
1451  $this->fillLightbox();
1452  $this->parseCurrentBlock();
1453  }
1454  }
1455 
1456  if ($part == "DEFAULT" or is_bool($part)) {
1457  $html = $this->template->getUnmodified();
1458  } else {
1459  $html = $this->template->getUnmodified($part);
1460  }
1461 
1462  // Modification of html is done inline here and can't be done
1463  // by ilTemplate, because the "phase" is template_show in this
1464  // case here.
1465  $ilPluginAdmin = $DIC["ilPluginAdmin"];
1466  $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_SERVICE, "UIComponent", "uihk");
1467  foreach ($pl_names as $pl) {
1468  $ui_plugin = ilPluginAdmin::getPluginObject(IL_COMP_SERVICE, "UIComponent", "uihk", $pl);
1469  $gui_class = $ui_plugin->getUIClassInstance();
1470 
1471  $resp = $gui_class->getHTML(
1472  "",
1473  "template_show",
1474  array("tpl_id" => $this->tplIdentifier, "tpl_obj" => $this, "html" => $html)
1475  );
1476 
1477  if ($resp["mode"] != ilUIHookPluginGUI::KEEP) {
1478  $html = $gui_class->modifyHTML($html, $resp);
1479  }
1480  }
1481 
1482  // save language usages as late as possible
1484 
1485  print $html;
1486 
1487  $this->handleReferer();
1488  break;
1489  }
1490  }
1491 
1492 
1497  private function handleReferer()
1498  {
1499  if (((substr(strrchr($_SERVER["PHP_SELF"], "/"), 1) != "error.php")
1500  && (substr(strrchr($_SERVER["PHP_SELF"], "/"), 1) != "adm_menu.php")
1501  && (substr(strrchr($_SERVER["PHP_SELF"], "/"), 1) != "chat.php"))) {
1502  $_SESSION["post_vars"] = $_POST;
1503 
1504  // referer is modified if query string contains cmd=gateway and $_POST is not empty.
1505  // this is a workaround to display formular again in case of error and if the referer points to another page
1506  $url_parts = @parse_url($_SERVER["REQUEST_URI"]);
1507  if (!$url_parts) {
1508  $protocol = (isset($_SERVER['HTTPS']) ? 'https' : 'http') . '://';
1509  $host = $_SERVER['HTTP_HOST'];
1510  $path = $_SERVER['REQUEST_URI'];
1511  $url_parts = @parse_url($protocol . $host . $path);
1512  }
1513 
1514  if (isset($url_parts["query"]) && preg_match("/cmd=gateway/", $url_parts["query"]) && (isset($_POST["cmd"]["create"]))) {
1515  foreach ($_POST as $key => $val) {
1516  if (is_array($val)) {
1517  $val = key($val);
1518  }
1519 
1520  $str .= "&" . $key . "=" . $val;
1521  }
1522 
1523  $_SESSION["referer"] = preg_replace("/cmd=gateway/", substr($str, 1), $_SERVER["REQUEST_URI"]);
1524  $_SESSION['referer_ref_id'] = (int) $_GET['ref_id'];
1525  } elseif (isset($url_parts["query"]) && preg_match("/cmd=post/", $url_parts["query"]) && (isset($_POST["cmd"]["create"]))) {
1526  foreach ($_POST as $key => $val) {
1527  if (is_array($val)) {
1528  $val = key($val);
1529  }
1530 
1531  $str .= "&" . $key . "=" . $val;
1532  }
1533 
1534  $_SESSION["referer"] = preg_replace("/cmd=post/", substr($str, 1), $_SERVER["REQUEST_URI"]);
1535  if (isset($_GET['ref_id'])) {
1536  $_SESSION['referer_ref_id'] = (int) $_GET['ref_id'];
1537  } else {
1538  $_SESSION['referer_ref_id'] = 0;
1539  }
1540  } else {
1541  $_SESSION["referer"] = $_SERVER["REQUEST_URI"];
1542  if (isset($_GET['ref_id'])) {
1543  $_SESSION['referer_ref_id'] = (int) $_GET['ref_id'];
1544  } else {
1545  $_SESSION['referer_ref_id'] = 0;
1546  }
1547  }
1548 
1549  unset($_SESSION["error_post_vars"]);
1550  }
1551  }
1552 
1553 
1557  private function fillScreenReaderFocus()
1558  {
1559  global $DIC;
1560 
1561  $ilUser = $DIC->user();
1562 
1563  if (is_object($ilUser) && $ilUser->getPref("screen_reader_optimization") && $this->blockExists("sr_focus")) {
1564  $this->touchBlock("sr_focus");
1565  }
1566  }
1567 
1571  private function fillSideIcons()
1572  {
1573  global $DIC;
1574 
1575  $ilSetting = $DIC->settings();
1576 
1577  $lng = $DIC->language();
1578 
1579  // tree/flat icon
1580  if ($this->tree_flat_link != "") {
1581  if ($this->left_nav_content != "") {
1582  $this->touchBlock("tree_lns");
1583  }
1584 
1585  $this->setCurrentBlock("tree_mode");
1586  $this->setVariable("LINK_MODE", $this->tree_flat_link);
1587  if ($ilSetting->get("tree_frame") == "right") {
1588  if ($this->tree_flat_mode == "tree") {
1589  $this->setVariable("IMG_TREE", ilUtil::getImagePath("icon_sidebar_on.svg"));
1590  $this->setVariable("RIGHT", "Right");
1591  } else {
1592  $this->setVariable("IMG_TREE", ilUtil::getImagePath("icon_sidebar_on.svg"));
1593  $this->setVariable("RIGHT", "Right");
1594  }
1595  } else {
1596  if ($this->tree_flat_mode == "tree") {
1597  $this->setVariable("IMG_TREE", ilUtil::getImagePath("icon_sidebar_on.svg"));
1598  } else {
1599  $this->setVariable("IMG_TREE", ilUtil::getImagePath("icon_sidebar_on.svg"));
1600  }
1601  }
1602  $this->setVariable("ALT_TREE", $lng->txt($this->tree_flat_mode . "view"));
1603  $this->setVariable("TARGET_TREE", ilFrameTargetInfo::_getFrame("MainContent"));
1604  include_once("./Services/Accessibility/classes/class.ilAccessKeyGUI.php");
1605  $this->setVariable(
1606  "TREE_ACC_KEY",
1607  ilAccessKeyGUI::getAttribute(($this->tree_flat_mode == "tree")
1610  );
1611  $this->parseCurrentBlock();
1612  }
1613 
1614  $this->setCurrentBlock("tree_icons");
1615  $this->parseCurrentBlock();
1616  }
1617 
1623  public function setTreeFlatIcon($a_link, $a_mode)
1624  {
1625  $this->tree_flat_link = $a_link;
1626  $this->tree_flat_mode = $a_mode;
1627  }
1628 
1629 
1633  public function addLightbox($a_html, $a_id)
1634  {
1635  $this->lightbox[$a_id] = $a_html;
1636  }
1637 
1644  private function fillLightbox()
1645  {
1646  $html = "";
1647 
1648  foreach ($this->lightbox as $lb) {
1649  $html .= $lb;
1650  }
1651  $this->setVariable("LIGHTBOX", $html);
1652  }
1653 
1654  // ADMIN PANEL
1655  //
1656  // Only used in ilContainerGUI
1657  //
1658  // An "Admin Panel" is that toolbar thingy that could be found on top and bottom
1659  // of a repository listing when editing objects in a container gui.
1660 
1662  protected $admin_panel_arrow = null;
1663  protected $admin_panel_bottom = null;
1664 
1671  public function addAdminPanelToolbar(ilToolbarGUI $toolb, $a_bottom_panel = true, $a_arrow = false)
1672  {
1673  $this->admin_panel_commands_toolbar = $toolb;
1674  $this->admin_panel_arrow = $a_arrow;
1675  $this->admin_panel_bottom = $a_bottom_panel;
1676  }
1677 
1683  private function fillAdminPanel()
1684  {
1685  global $DIC;
1686  $lng = $DIC->language();
1687 
1688  if ($this->admin_panel_commands_toolbar === null) {
1689  return;
1690  }
1691 
1693  assert($toolbar instanceof \ilToolbarGUI);
1694 
1695  // Add arrow if desired.
1696  if ($this->admin_panel_arrow) {
1697  $toolb->setLeadingImage(ilUtil::getImagePath("arrow_upright.svg"), $lng->txt("actions"));
1698  }
1699 
1700  $this->fillPageFormAction();
1701 
1702  // Add top admin bar.
1703  $this->setCurrentBlock("adm_view_components");
1704  $this->setVariable("ADM_PANEL1", $toolb->getHTML());
1705  $this->parseCurrentBlock();
1706 
1707  // Add bottom admin bar if user wants one.
1708  if ($this->admin_panel_bottom) {
1709  $this->setCurrentBlock("adm_view_components2");
1710 
1711  // Replace previously set arrow image.
1712  if ($this->admin_panel_arrow) {
1713  $toolb->setLeadingImage(ilUtil::getImagePath("arrow_downright.svg"), $lng->txt("actions"));
1714  }
1715 
1716  $this->setVariable("ADM_PANEL2", $toolb->getHTML());
1717  $this->parseCurrentBlock();
1718  }
1719  }
1720 
1721  public function setPermanentLink($a_type, $a_id, $a_append = "", $a_target = "", $a_title = "")
1722  {
1723  $this->permanent_link = array(
1724  "type" => $a_type,
1725  "id" => $a_id,
1726  "append" => $a_append,
1727  "target" => $a_target,
1728  "title" => $a_title);
1729  }
1730 
1734  private function fillPermanentLink()
1735  {
1736  if (is_array($this->permanent_link)) {
1737  include_once("./Services/PermanentLink/classes/class.ilPermanentLinkGUI.php");
1738  $plinkgui = new ilPermanentLinkGUI(
1739  $this->permanent_link["type"],
1740  $this->permanent_link["id"],
1741  $this->permanent_link["append"],
1742  $this->permanent_link["target"]
1743  );
1744  if ($this->permanent_link["title"] != "") {
1745  $plinkgui->setTitle($this->permanent_link["title"]);
1746  }
1747  $this->setVariable("PRMLINK", $plinkgui->getHTML());
1748  }
1749  }
1750 
1754  public function resetHeaderBlock($a_reset_header_action = true)
1755  {
1756  $this->setTitle(null);
1757  $this->setTitleIcon(null);
1758  $this->setDescription(null);
1759  $this->setAlertProperties(array());
1760  $this->enableDragDropFileUpload(null);
1761 
1762  // see setFullscreenHeader()
1763  if ($a_reset_header_action) {
1764  $this->setHeaderActionMenu(null);
1765  }
1766  }
1767 
1771  public function enableDragDropFileUpload($a_ref_id)
1772  {
1773  $this->enable_fileupload = $a_ref_id;
1774  }
1775 
1776 
1777  // TEMPLATING AND GLOBAL RENDERING
1778  //
1779  // Forwards to ilTemplate-member.
1780 
1785  public function get($part = "DEFAULT")
1786  {
1787  return $this->template->get($part);
1788  }
1789 
1790  public function setVariable($variable, $value = '')
1791  {
1792  return $this->template->setVariable($variable, $value);
1793  }
1794 
1795  private function variableExists($a_variablename)
1796  {
1797  return $this->template->variableExists($a_variablename);
1798  }
1799 
1805  public function setCurrentBlock($part = "DEFAULT")
1806  {
1807  return $this->template->setCurrentBlock($part);
1808  }
1809 
1816  public function touchBlock($block)
1817  {
1818  return $this->template->touchBlock($block);
1819  }
1820 
1827  public function parseCurrentBlock($part = "DEFAULT")
1828  {
1829  return $this->template->parseCurrentBlock($part);
1830  }
1831 
1841  public function addBlockFile($var, $block, $tplname, $in_module = false)
1842  {
1843  return $this->template->addBlockFile($var, $block, $tplname, $in_module);
1844  }
1845 
1852  public function blockExists($a_blockname)
1853  {
1854  return $this->template->blockExists($a_blockname);
1855  }
1856 }
static sortArray( $array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
printToStdout($part="DEFAULT", $a_fill_tabs=true, $a_skip_main_menu=false)
getOnLoadCodeForAsynch()
Get js onload code for ajax calls.
fillFooter()
Fill the footer area.
fillSideIcons()
Fill side icons (upper icon, tree icon, webfolder icon)
touchBlock($block)
overwrites ITX::touchBlock.
exit
Definition: login.php:29
addJavaScript($a_js_file, $a_add_version_parameter=true, $a_batch=2)
Add a javascript file that should be included in the header.
fillMessage()
Fill message area.
special template class to simplify handling of ITX/PEAR
setOnScreenMessage($a_type, $a_txt, $a_keep=false)
Set a message to be displayed to the user.
Class for permanent links.
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
$_SESSION["AccountId"]
setRightContent($a_html)
Sets content of right column.
static _isPageTranslation()
Check if the current request is a page translation.
getHeaderActionMenu()
Get header action menu.
fillInlineCss()
Fill in the inline css.
$_GET["client_id"]
handleReferer()
TODO: this is nice, but shouldn&#39;t be done here (-> maybe at the end of ilias.php!?, alex)
setTitleIcon($a_icon_path, $a_icon_desc="")
set title icon
addAdminPanelToolbar(ilToolbarGUI $toolb, $a_bottom_panel=true, $a_arrow=false)
Add admin panel commands as toolbar.
static getSystemMessageHTML($a_txt, $a_type="info")
Get HTML for a system message.
setTitle($a_title, $hidden=false)
Sets title in standard template.
fillCssFiles($a_force=false)
Fill in the css file tags.
addBlockFile($var, $block, $tplname, $in_module=false)
overwrites ITX::addBlockFile public
static getNewContentStyleSheetLocation($mode="output")
get full style sheet file name (path inclusive) of current user
getLoginTargetPar()
Get target parameter for login.
addCss($a_css_file, $media="screen")
Add a css file that should be included in the header.
setHeaderPageTitle($a_title)
Sets the title of the page (for browser window).
resetHeaderBlock($a_reset_header_action=true)
Reset all header properties: title, icon, description, alerts, action menu.
setLeftContent($a_html)
Sets content of left column.
setCurrentBlock($part="DEFAULT")
public
$total
Definition: Utf8Test.php:87
static stripScriptHTML($a_str, $a_allow="", $a_rm_js=true)
strip only html tags (4.0) from text $allowed contains tags to be allowed, in format tags a and b ar...
loadStandardTemplate()
This loads the standard template "tpl.adm_content.html" and "tpl.statusline.html" the CONTENT and STA...
static validate($a_html, $a_mode)
global $ilCtrl
Definition: ilias.php:18
static initDom(ilGlobalTemplateInterface $a_main_tpl=null)
Init YUI Dom.
$a_type
Definition: workflow.php:92
static appendUrlParameterString($a_url, $a_par, $xml_style=false)
append URL parameter string ("par1=value1&par2=value2...") to given URL string
setAlertProperties(array $a_props)
Set alert properties.
static _getTranslationLink()
Get the link to translate the current page.
fillScreenReaderFocus()
Accessibility focus for screen readers.
$a_content
Definition: workflow.php:93
$lng
setTreeFlatIcon($a_link, $a_mode)
set tree/flat icon
fillOnLoadCode()
Fill add on load code.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
fillLeftNav()
Fill left navigation frame.
resetJavascript()
Reset javascript files.
$_SERVER['HTTP_HOST']
Definition: raiseError.php:10
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
fillLightbox()
Fill lightbox content.
fillPermanentLink()
Fill in permanent link.
static ofString($string)
Creates a new stream with an initial value.
Definition: Streams.php:30
$ilUser
Definition: imgupload.php:18
static getPluginObject($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get Plugin Object.
addLightbox($a_html, $a_id)
Add lightbox html.
setVariable($variable, $value='')
addOnLoadCode($a_code, $a_batch=2)
Add on load code.
$http
Definition: raiseError.php:7
fillAdminPanel()
Put admin panel into template:
setPermanentLink($a_type, $a_id, $a_append="", $a_target="", $a_title="")
setLoginTargetPar($a_val)
Set target parameter for login (public sector).
$txt
Definition: error.php:13
$filename
Definition: buildRTE.php:89
static initjQueryUI($a_tpl=null)
inits and adds the jQuery-UI JS-File to the global template (see included_components.txt for included components)
blockExists($a_blockname)
check if block exists in actual template private
fillNewContentStyle()
Fill Content Style.
static secureUrl($url)
Prepare secure href attribute.
setTabs($a_tabs_html)
sets tabs in standard template
setDescription($a_descr)
Sets descripton below title in standard template.
__construct( $file, $flag1, $flag2, $in_module=false, $vars="DEFAULT", $plugin=false, $a_use_cache=true)
constructor
setLeftNavContent($a_content)
Sets content of left navigation column.
static _getFrame($a_class, $a_type='')
Get content frame name.
static initjQuery(ilGlobalTemplateInterface $a_tpl=null)
inits and adds the jQuery JS-File to the global or a passed template
global $ilSetting
Definition: privfeed.php:17
fillContentLanguage()
Add current user language to meta tags.
static init(ilGlobalTemplateInterface $a_tpl=null)
Init.
global $ilBench
Definition: ilias.php:18
global $ilDB
$DIC
Definition: xapitoken.php:46
parseCurrentBlock($part="DEFAULT")
Überladene Funktion, die auf den aktuelle Block vorher noch ein replace ausführt public...
static _saveUsages()
Store the collected language variable usages in the user session This should be called as late as pos...
hideFooter()
Make the template hide the footer.
setHeaderActionMenu($a_header)
Set header action menu.
$url
static getAttribute($a_func_id)
Get accesskey HTML attribute.
$inline_css
Stores CSS to be included directly.
setContent($a_html)
Sets content for standard template.
$_POST["username"]
addInlineCss($a_css, $media="screen")
Add a css file that should be included in the header.
const IL_COMP_SERVICE
setSubTabs($a_tabs_html)
sets subtabs in standard template
getSpecial( $part="DEFAULT", $add_error_mess=false, $handle_referer=false, $add_ilias_footer=false, $add_standard_elements=false, $a_main_menu=true, $a_tabs=true)
$i
Definition: metadata.php:24
static _checkTranslate()
Permission check for translations.
enableDragDropFileUpload($a_ref_id)
Enables the file upload into this object by dropping a file.
static isActive()