ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilMainMenuGUI.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2012 ILIAS open source, Extended GPL, see docs/LICENSE */
4 namespace LTI;
5 
7 
8 use \ilSearchSettings;
9 use \ilMainMenuSearchGUI;
10 use \ilUIHookProcessor;
11 use \ilRegistrationSettings;
12 use \ilSetting;
13 use \iljQueryUtil;
14 use \ilPlayerUtil;
15 use \ilLink;
16 use \ilNotificationOSDHandler;
17 use \ilGlyphGUI;
18 use \ilObjSystemFolder;
19 use \ilUtil;
20 use \ilSession;
21 use \ilMemberViewSettings;
22 use \ilObject;
23 
24 include_once("Services/Mail/classes/class.ilMailGlobalServices.php");
25 require_once("Services/MainMenu/classes/class.ilMainMenuGUI.php");
26 
34 {
41  public function __construct($a_target = "_top", $a_use_start_template = false, $a_main_tpl = null)
42  {
43  global $ilias, $rbacsystem, $ilUser, $ilLog, $DIC, $lng;
44 
45  if ($a_main_tpl != null) {
46  $this->main_tpl = $a_main_tpl;
47  } else {
48  $this->main_tpl = $DIC["tpl"];
49  }
50 
51  $this->rbacsystem = $DIC->rbac()->system();
52  $this->user = $DIC->user();
53  $this->lng = $DIC->language();
54  $this->plugin_admin = $DIC["ilPluginAdmin"];
55  $this->tree = $DIC->repositoryTree();
56  $this->access = $DIC->access();
57  $this->nav_history = $DIC["ilNavigationHistory"];
58  $this->settings = $DIC->settings();
59  $this->ctrl = $DIC->ctrl();
60  $this->help = $DIC["ilHelp"];
61  $this->ui = $DIC->ui();
62  $rbacsystem = $DIC->rbac()->system();
63  $ilUser = $DIC->user();
64 
65  $this->tpl = new ilTemplate(
66  "tpl.main_menu.html",
67  true,
68  true,
69  "Services/LTI"
70  );
71 
72  $this->target = $a_target;
73  $this->start_template = $a_use_start_template;
74 
75  $this->mail = false;
76 
77  $this->setMode(self::MODE_FULL);
78 
79  // member view
80  include_once './Services/Container/classes/class.ilMemberViewSettings.php';
82  if ($set->isActive()) {
83  $ref_id = ilMemberViewSettings::getInstance()->getCurrentRefId();
84 
85  if (!$ref_id) {
86  $DIC["lti"]->member_view = false;
87  $DIC["lti"]->member_view_url = "";
88  return;
89  }
90  include_once './Services/Link/classes/class.ilLink.php';
92  $ref_id,
94  array('mv' => 0)
95  );
96  $DIC["lti"]->member_view = true;
97  $DIC["lti"]->member_view_url = $url;
98  $DIC["lti"]->member_view_close_txt = $lng->txt('mem_view_close');
99  } else {
100  $DIC["lti"]->member_view = false;
101  $DIC["lti"]->member_view_url = "";
102  }
103  }
104 
105 
106  public function getSpacerClass()
107  {
108  return "ilFixedTopSpacerBarOnly";
109  }
110 
116  public function getHTML()
117  {
118  $this->setTemplateVars();
119 
120  return $this->tpl->get();
121  }
122 
123 
127  private function setTemplateVars()
128  {
129  global $DIC, $rbacsystem, $lng, $ilias, $tree, $ilUser, $ilSetting, $ilPluginAdmin;
130  //$DIC["lti"]->log("setTemplateVars in ilMainMenu");
131  // append internal and external LTI css just before </body> end-tag
132  $view = $DIC["lti"];
133  if ($this->main_tpl->blockExists('view_append_inline_css')) {
134  $css_html = "";
135  $css = $view->appendInlineCss();
136  foreach ($css as $cssfile) {
137  $css_html .= "<style type=\"text/css\">\n";
138  $css_html .= file_get_contents($cssfile);
139  $css_html .= "</style>\n";
140  }
141  $this->main_tpl->setCurrentBlock("view_append_inline_css");
142  $this->main_tpl->setVariable("APPEND_STYLES", $css_html);
143  $this->main_tpl->parseCurrentBlock();
144  }
145  $view->render($this->tpl, 'top_bar_header');
146  if (!$view->member_view) {
147  $view->render($this->tpl, 'view_nav');
148  $view->render($this->tpl, 'user_logged_in');
149  } else {
150  $this->tpl->setVariable("TOPBAR_CLASS", " ilMemberViewMainHeader");
151  $this->tpl->setVariable("MEMBER_VIEW_INFO", $lng->txt("mem_view_long"));
152  }
153  //$view->checkMessages();
154  $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
155  include_once("./Modules/SystemFolder/classes/class.ilObjSystemFolder.php");
156  $this->tpl->setVariable("TXT_MAIN_MENU", $lng->txt("main_menu"));
157  $this->tpl->parseCurrentBlock();
158  }
159 
160  private function log($txt)
161  {
162  global $DIC;
163  $DIC->logger()->lti()->write($txt);
164  }
165 }
settings()
Definition: settings.php:2
setTemplateVars()
set all template variables (images, scripts, target frames, ...)
setMode(int $a_value)
global $DIC
Definition: saml.php:7
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user
user()
Definition: user.php:4
mail($to, $subject, $message, $additional_headers=null, $additional_parameters=null)
static _lookupObjId($a_id)
$ilUser
Definition: imgupload.php:18
$txt
Definition: error.php:11
static _lookupType($a_id, $a_reference=false)
lookup object type
Handles display of the main menu for LTI.
__construct($a_target="_top", $a_use_start_template=false, $a_main_tpl=null)
global $ilSetting
Definition: privfeed.php:17
static getInstance()
Get instance.
setTemplateVars()
Set all template variables (images, scripts, target frames, ...)
$url
special template class to simplify handling of ITX/PEAR