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