ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
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 
5 include_once 'Services/Mail/classes/class.ilMailGlobalServices.php';
6 
14 {
20  var $ilias;
21  var $tpl;
22  var $target;
24 
25 
31  function ilMainMenuGUI($a_target = "_top", $a_use_start_template = false)
32  {
33  global $ilias, $rbacsystem, $ilUser;
34 
35  $this->tpl = new ilTemplate("tpl.main_menu.html", true, true,
36  "Services/MainMenu");
37  $this->ilias =& $ilias;
38  $this->target = $a_target;
39  $this->start_template = $a_use_start_template;
40  $this->small = false;
41 
42  $this->mail = false;
43  if($ilUser->getId() != ANONYMOUS_USER_ID)
44  {
45  if($rbacsystem->checkAccess('internal_mail', ilMailGlobalServices::getMailObjectRefId()))
46  {
47  $this->mail = true;
48  }
49  }
50  }
51 
52  function setSmallMode($a_small)
53  {
54  $this->small = $a_small;
55  }
56 
60  function setActive($a_active)
61  {
62  $this->active = $a_active;
63  }
64 
68  function setTemplate(&$tpl)
69  {
70  echo "ilMainMenu->setTemplate is deprecated. Use getHTML instead.";
71  return;
72  $this->tpl =& $tpl;
73  }
74 
78  function getTemplate()
79  {
80  echo "ilMainMenu->getTemplate is deprecated. Use getHTML instead.";
81  return;
82  }
83 
88  public function setLoginTargetPar($a_val)
89  {
90  $this->login_target_par = $a_val;
91  }
92 
96  public function getLoginTargetPar()
97  {
98  return $this->login_target_par;
99  }
100 
101  static function getLanguageSelection($a_in_topbar = false)
102  {
103  global $lng;
104 
105  include_once("./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
106  $selection = new ilAdvancedSelectionListGUI();
107  $selection->setFormSelectMode("change_lang_to", "ilLanguageSelection", true,
108  "#", "ilNavHistory", "ilNavHistoryForm",
109  "", $lng->txt("ok"), "ilLogin");
110  //$selection->setListTitle($lng->txt("choose_language"));
111  $selection->setListTitle($lng->txt("language"));
112  $selection->setItemLinkClass("small");
113 
114  if($a_in_topbar)
115  {
116  $selection->setHeaderIcon(ilAdvancedSelectionListGUI::DOWN_ARROW_TOPBAR);
117  }
118 
119  $languages = $lng->getInstalledLanguages();
120  if(sizeof($languages) > 1) // #11237
121  {
122  foreach ($languages as $lang_key)
123  {
124  $base = substr($_SERVER["REQUEST_URI"], strrpos($_SERVER["REQUEST_URI"], "/") + 1);
125  $base = preg_replace("/&*lang=[a-z]{2}&*/", "", $base);
126  $link = ilUtil::appendUrlParameterString($base,
127  "lang=".$lang_key);
128  $link = str_replace("?&", "?", $link);
129  $selection->addItem($lng->_lookupEntry($lang_key, "meta", "meta_l_".$lang_key),
130  $lang_key, $link, "", "", "");
131  }
132  return $selection->getHTML();
133  }
134  }
135 
139  function setTemplateVars()
140  {
141  global $rbacsystem, $lng, $ilias, $tree, $ilUser, $ilSetting, $ilPluginAdmin;
142 
143  if($this->logo_only)
144  {
145  $this->tpl->setVariable("HEADER_URL", $this->getHeaderURL());
146  $this->tpl->setVariable("HEADER_ICON", ilUtil::getImagePath("HeaderIcon.png"));
147  return;
148  }
149 
150  // get user interface plugins
151  $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_SERVICE, "UIComponent", "uihk");
152 
153  // search
154  include_once 'Services/Search/classes/class.ilSearchSettings.php';
155  if($rbacsystem->checkAccess('search',ilSearchSettings::_getSearchSettingRefId()))
156  {
157  include_once './Services/Search/classes/class.ilMainMenuSearchGUI.php';
158  $main_search = new ilMainMenuSearchGUI();
159  $html = "";
160 
161  // user interface plugin slot + default rendering
162  include_once("./Services/UIComponent/classes/class.ilUIHookProcessor.php");
163  $uip = new ilUIHookProcessor("Services/MainMenu", "main_menu_search",
164  array("main_menu_gui" => $this, "main_menu_search_gui" => $main_search));
165  if (!$uip->replaced())
166  {
167  $html = $main_search->getHTML();
168  }
169  $html = $uip->getHTML($html);
170 
171  if (strlen($html))
172  {
173  $this->tpl->setVariable('SEARCHBOX',$html);
174  }
175  }
176 
177  $this->renderStatusBox($this->tpl);
178 
179  // online help
180  $this->renderHelpButtons();
181 
182  $mmle_html = "";
183 
184  // user interface plugin slot + default rendering
185  include_once("./Services/UIComponent/classes/class.ilUIHookProcessor.php");
186  $uip = new ilUIHookProcessor("Services/MainMenu", "main_menu_list_entries",
187  array("main_menu_gui" => $this));
188  if (!$uip->replaced())
189  {
190  $mmle_tpl = new ilTemplate("tpl.main_menu_list_entries.html", true, true, "Services/MainMenu");
191  $mmle_html = $this->renderMainMenuListEntries($mmle_tpl);
192  }
193  $mmle_html = $uip->getHTML($mmle_html);
194 
195  $this->tpl->setVariable("MAIN_MENU_LIST_ENTRIES", $mmle_html);
196 
197  $link_dir = (defined("ILIAS_MODULE"))
198  ? "../"
199  : "";
200 
201  if (!$this->small)
202  {
203 
204  // login stuff
205  if ($_SESSION["AccountId"] == ANONYMOUS_USER_ID)
206  {
207  include_once 'Services/Registration/classes/class.ilRegistrationSettingsGUI.php';
209  {
210  $this->tpl->setCurrentBlock("registration_link");
211  $this->tpl->setVariable("TXT_REGISTER",$lng->txt("register"));
212  $this->tpl->setVariable("LINK_REGISTER", $link_dir."register.php?client_id=".rawurlencode(CLIENT_ID)."&lang=".$ilias->account->getCurrentLanguage());
213  $this->tpl->parseCurrentBlock();
214  }
215 
216  // language selection
217  $selection = self::getLanguageSelection();
218  if($selection)
219  {
220  $this->tpl->setVariable("LANG_SELECT", $selection);
221  }
222 
223  $this->tpl->setCurrentBlock("userisanonymous");
224  $this->tpl->setVariable("TXT_NOT_LOGGED_IN",$lng->txt("not_logged_in"));
225  $this->tpl->setVariable("TXT_LOGIN",$lng->txt("log_in"));
226 
227  $target_str = "";
228  if ($this->getLoginTargetPar() != "")
229  {
230  $target_str = $this->getLoginTargetPar();
231  }
232  else if ($_GET["ref_id"] != "")
233  {
234  if ($tree->isInTree($_GET["ref_id"]) && $_GET["ref_id"] != $tree->getRootId())
235  {
236  $obj_id = ilObject::_lookupObjId($_GET["ref_id"]);
237  $type = ilObject::_lookupType($obj_id);
238  $target_str = $type."_".$_GET["ref_id"];
239  }
240  }
241  $this->tpl->setVariable("LINK_LOGIN",
242  $link_dir."login.php?target=".$target_str."&client_id=".rawurlencode(CLIENT_ID)."&cmd=force_login&lang=".$ilias->account->getCurrentLanguage());
243  $this->tpl->parseCurrentBlock();
244  }
245  else
246  {
247  $notificationSettings = new ilSetting('notifications');
248  $chatSettings = new ilSetting('chatroom');
249 
253  global $tpl;
254 
255  if($chatSettings->get('chat_enabled') && $notificationSettings->get('enable_osd'))
256  {
257  $this->tpl->touchBlock('osd_enabled');
258  $this->tpl->touchBlock('osd_container');
259 
260  include_once "Services/jQuery/classes/class.iljQueryUtil.php";
262 
263  include_once 'Services/MediaObjects/classes/class.ilPlayerUtil.php';
265 
266  $tpl->addJavaScript('Services/Notifications/templates/default/notifications.js');
267  $tpl->addCSS('Services/Notifications/templates/default/osd.css');
268 
269  require_once 'Services/Notifications/classes/class.ilNotificationOSDHandler.php';
270  $notifications = ilNotificationOSDHandler::getNotificationsForUser($ilUser->getId());
271  $this->tpl->setVariable('INITIAL_NOTIFICATIONS', json_encode($notifications));
272  $this->tpl->setVariable('OSD_POLLING_INTERVALL', $notificationSettings->get('osd_polling_intervall') ? $notificationSettings->get('osd_polling_intervall') : '5');
273  $this->tpl->setVariable(
274  'OSD_PLAY_SOUND',
275  $chatSettings->get('play_invitation_sound') && $ilUser->getPref('chat_play_invitation_sound') ? 'true' : 'false');
276  foreach($notifications as $notification)
277  {
278  if($notification['type'] == 'osd_maint')
279  {
280  continue;
281  }
282  $this->tpl->setCurrentBlock('osd_notification_item');
283 
284  $this->tpl->setVariable('NOTIFICATION_ICON_PATH', $notification['data']->iconPath);
285  $this->tpl->setVariable('NOTIFICATION_TITLE', $notification['data']->title);
286  $this->tpl->setVariable('NOTIFICATION_LINK', $notification['data']->link);
287  $this->tpl->setVariable('NOTIFICATION_LINKTARGET', $notification['data']->linktarget);
288  $this->tpl->setVariable('NOTIFICATION_ID', $notification['notification_osd_id']);
289  $this->tpl->setVariable('NOTIFICATION_SHORT_DESCRIPTION', $notification['data']->shortDescription);
290  $this->tpl->parseCurrentBlock();
291  }
292  }
293 
294  $this->tpl->setCurrentBlock("userisloggedin");
295  $this->tpl->setVariable("TXT_LOGIN_AS",$lng->txt("login_as"));
296  $this->tpl->setVariable("TXT_LOGOUT2",$lng->txt("logout"));
297  $this->tpl->setVariable("LINK_LOGOUT2", $link_dir."logout.php?lang=".$ilias->account->getCurrentLanguage());
298  $this->tpl->setVariable("USERNAME",$ilias->account->getFullname());
299  $this->tpl->parseCurrentBlock();
300  }
301 
302  include_once("./Modules/SystemFolder/classes/class.ilObjSystemFolder.php");
303  $header_top_title = ilObjSystemFolder::_getHeaderTitle();
304  if (trim($header_top_title) != "" && $this->tpl->blockExists("header_top_title"))
305  {
306  $this->tpl->setCurrentBlock("header_top_title");
307  $this->tpl->setVariable("TXT_HEADER_TITLE", $header_top_title);
308  $this->tpl->parseCurrentBlock();
309  }
310 
311  $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
312 
313  $this->tpl->setVariable("TXT_LOGOUT", $lng->txt("logout"));
314  $this->tpl->setVariable("HEADER_URL", $this->getHeaderURL());
315  $this->tpl->setVariable("HEADER_ICON", ilUtil::getImagePath("HeaderIcon.png"));
316  $this->tpl->setVariable("HEADER_BG_IMAGE", ilUtil::getImagePath("HeaderBackground.png"));
317  include_once("./Modules/SystemFolder/classes/class.ilObjSystemFolder.php");
318 
319  // set link to return to desktop, not depending on a specific position in the hierarchy
320  //$this->tpl->setVariable("SCRIPT_START", $this->getScriptTarget("start.php"));
321  }
322  else
323  {
324  $this->tpl->setVariable("HEADER_URL", $this->getHeaderURL());
325  $this->tpl->setVariable("HEADER_ICON", ilUtil::getImagePath("HeaderIcon.png"));
326  }
327 
328  $this->tpl->setVariable("TXT_MAIN_MENU", $lng->txt("main_menu"));
329 
330  $this->tpl->parseCurrentBlock();
331  }
332 
336  function renderStatusBox($a_tpl)
337  {
338  global $ilUser, $lng;
339 
340  $box = false;
341 
342  // new mails?
343  if($this->mail)
344  {
345  $new_mails = ilMailGlobalServices::getNumberOfNewMailsByUserId($ilUser->getId());
346  if($new_mails > 0)
347  {
348  $a_tpl->setCurrentBlock('status_text');
349  $a_tpl->setVariable('STATUS_TXT', $new_mails);
350  $a_tpl->parseCurrentBlock();
351  }
352  $a_tpl->setCurrentBlock('status_item');
353  $a_tpl->setVariable('STATUS_IMG', ilUtil::getImagePath('icon_mail_s.png'));
354  $a_tpl->setVariable('STATUS_IMG_ALT', $lng->txt("mail"));
355  $a_tpl->setVariable('STATUS_HREF', 'ilias.php?baseClass=ilMailGUI');
356  $a_tpl->parseCurrentBlock();
357  $box = true;
358  }
359 
360  if ($box)
361  {
362  $a_tpl->setCurrentBlock("status_box");
363  $a_tpl->parseCurrentBlock();
364  }
365  }
366 
367 
374  function renderMainMenuListEntries($a_tpl, $a_call_get = true)
375  {
376  global $rbacsystem, $lng, $ilias, $tree, $ilUser, $ilSetting, $ilAccess;
377 
378  // personal desktop
379  if ($_SESSION["AccountId"] != ANONYMOUS_USER_ID)
380  {
381  /*$this->renderEntry($a_tpl, "desktop",
382  $lng->txt("personal_desktop"),
383  $this->getScriptTarget("ilias.php?baseClass=ilPersonalDesktopGUI"),
384  $this->target);*/
385 // $this->renderDropDown($a_tpl, "desktop");
386  $this->renderEntry($a_tpl, "desktop",
387  $lng->txt("personal_desktop"), "#");
388 
389  include_once("./Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php");
390  $ov = new ilOverlayGUI("mm_desk_ov");
391  $ov->setTrigger("mm_desk_tr");
392  $ov->setAnchor("mm_desk_tr");
393  $ov->setAutoHide(false);
394  $ov->add();
395 
396  }
397 
398  // repository
399  if($ilAccess->checkAccess('visible','',ROOT_FOLDER_ID))
400  {
401  include_once('./Services/Link/classes/class.ilLink.php');
402  $nd = $tree->getNodeData(ROOT_FOLDER_ID);
403  $title = $nd["title"];
404  if ($title == "ILIAS")
405  {
406  $title = $lng->txt("repository");
407  }
408  //$this->renderEntry($a_tpl, "repository",
409  // $title,
410  // ilLink::_getStaticLink(1,'root',true),
411  // $this->target);
412  if ($_SESSION["AccountId"] != ANONYMOUS_USER_ID || IS_PAYMENT_ENABLED)
413  {
414  $this->renderEntry($a_tpl, "repository",
415  $title, "#");
416  include_once("./Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php");
417  $ov = new ilOverlayGUI("mm_rep_ov");
418  $ov->setTrigger("mm_rep_tr");
419  $ov->setAnchor("mm_rep_tr");
420  $ov->setAutoHide(false);
421  $ov->add();
422  }
423  }
424 
425  // search
426  include_once 'Services/Search/classes/class.ilSearchSettings.php';
427  if($rbacsystem->checkAccess('search',ilSearchSettings::_getSearchSettingRefId()))
428  {
429 /* $this->renderEntry($a_tpl, "search",
430  $lng->txt("search"),
431  $this->getScriptTarget('ilias.php?baseClass=ilSearchController'),
432  $this->target); */
433  }
434 
435  // webshop
436  if(IS_PAYMENT_ENABLED)
437  {
438  $title = $lng->txt("shop");
439  $this->renderEntry($a_tpl, "shop", $title, "#" );
440  include_once("./Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php");
441  $ov = new ilOverlayGUI("mm_shop_ov");
442  $ov->setTrigger("mm_shop_tr");
443  $ov->setAnchor("mm_shop_tr");
444  $ov->setAutoHide(false);
445  $ov->add();
446  }
447 
448  // administration
450  {
451  //$this->renderEntry($a_tpl, "administration",
452  // $lng->txt("administration"),
453  // $this->getScriptTarget("ilias.php?baseClass=ilAdministrationGUI"),
454  // $this->target);
455  $this->renderDropDown($a_tpl, "administration");
456  }
457 
458 
459  // navigation history
460 /* require_once("Services/Navigation/classes/class.ilNavigationHistoryGUI.php");
461  $nav_hist = new ilNavigationHistoryGUI();
462  $nav_html = $nav_hist->getHTML();
463  if ($nav_html != "")
464  {
465 
466  $a_tpl->setCurrentBlock("nav_history");
467  $a_tpl->setVariable("TXT_LAST_VISITED", $lng->txt("last_visited"));
468  $a_tpl->setVariable("NAVIGATION_HISTORY", $nav_html);
469  $a_tpl->parseCurrentBlock();
470  }*/
471 
472 
473  if ($a_call_get)
474  {
475  return $a_tpl->get();
476  }
477 
478  return "";
479  }
480 
487  function renderEntry($a_tpl, $a_id, $a_txt, $a_script, $a_target = "_top")
488  {
489  global $lng, $ilNavigationHistory, $ilSetting, $rbacsystem, $ilCtrl;
490 
491  $id = strtolower($a_id);
492  $id_up = strtoupper($a_id);
493  $a_tpl->setCurrentBlock("entry_".$id);
494 
495  include_once("./Services/UIComponent/GroupedList/classes/class.ilGroupedListGUI.php");
496 
497  // repository
498  if ($a_id == "repository")
499  {
500  $gl = new ilGroupedListGUI();
501 
502  include_once("./Services/Link/classes/class.ilLink.php");
503  $a_tpl->setVariable("ARROW_IMG", ilUtil::getImagePath("mm_down_arrow.png"));
505 
506  $gl->addEntry($icon." ".$a_txt." - ".$lng->txt("rep_main_page"), ilLink::_getStaticLink(1,'root',true),
507  "_top");
508 
509  $items = $ilNavigationHistory->getItems();
510  reset($items);
511  $cnt = 0;
512  $first = true;
513 
514  foreach($items as $k => $item)
515  {
516  if ($cnt >= 10) break;
517 
518  if (!isset($item["ref_id"]) || !isset($_GET["ref_id"]) ||
519  ($item["ref_id"] != $_GET["ref_id"] || !$first)) // do not list current item
520  {
521  if ($cnt == 0)
522  {
523  $gl->addGroupHeader($lng->txt("last_visited"), "ilLVNavEnt");
524  }
525  $obj_id = ilObject::_lookupObjId($item["ref_id"]);
526  $cnt ++;
527  $icon = ilUtil::img(ilObject::_getIcon($obj_id, "tiny"));
528  $ititle = ilUtil::shortenText(strip_tags($item["title"]), 50, true); // #11023
529  $gl->addEntry($icon." ".$ititle, $item["link"], "_top", "", "ilLVNavEnt");
530  }
531  $first = false;
532  }
533 
534  if ($cnt > 0)
535  {
536  $gl->addEntry("» ".$lng->txt("remove_entries"), "#", "",
537  "return il.MainMenu.removeLastVisitedItems('".
538  $ilCtrl->getLinkTargetByClass("ilnavigationhistorygui", "removeEntries", "", true)."');",
539  "ilLVNavEnt");
540  }
541 
542  $a_tpl->setVariable("REP_EN_OV", $gl->getHTML());
543  }
544 
545  // desktop
546  if ($a_id == "desktop")
547  {
548  $gl = new ilGroupedListGUI();
549 
550  $a_tpl->setVariable("ARROW_IMG", ilUtil::getImagePath("mm_down_arrow.png"));
551 
552  // overview
553  $gl->addEntry($lng->txt("overview"),
554  "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToSelectedItems",
555  "_top", "", "", "mm_pd_sel_items", ilHelp::getMainMenuTooltip("mm_pd_sel_items"),
556  "left center", "right center", false);
557 
558  // my groups and courses, if both is available
559  if($ilSetting->get('disable_my_offers') == 0 &&
560  $ilSetting->get('disable_my_memberships') == 0)
561  {
562  $gl->addEntry($lng->txt("my_courses_groups"),
563  "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToMemberships",
564  "_top", "", "", "mm_pd_crs_grp", ilHelp::getMainMenuTooltip("mm_pd_crs_grp"),
565  "left center", "right center", false);
566  }
567 
568  // bookmarks
569  if (!$this->ilias->getSetting("disable_bookmarks"))
570  {
571  $gl->addEntry($lng->txt("bookmarks"), "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToBookmarks",
572  "_top", "", "", "mm_pd_bookm", ilHelp::getMainMenuTooltip("mm_pd_bookm"),
573  "left center", "right center", false);
574  }
575 
576  // private notes
577  if (!$this->ilias->getSetting("disable_notes"))
578  {
579  $gl->addEntry($lng->txt("notes_and_comments"), "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToNotes",
580  "_top", "", "", "mm_pd_notes", ilHelp::getMainMenuTooltip("mm_pd_notes"),
581  "left center", "right center", false);
582  }
583 
584  // news
585  if ($ilSetting->get("block_activated_news"))
586  {
587  $gl->addEntry($lng->txt("news"), "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToNews",
588  "_top", "", "", "mm_pd_news", ilHelp::getMainMenuTooltip("mm_pd_news"),
589  "left center", "right center", false);
590  }
591 
592  // overview is always active
593  $gl->addSeparator();
594 
595  $separator = false;
596 
597  if(!$ilSetting->get("disable_personal_workspace"))
598  {
599  // workspace
600  $gl->addEntry($lng->txt("personal_workspace"), "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToWorkspace",
601  "_top", "", "", "mm_pd_wsp", ilHelp::getMainMenuTooltip("mm_pd_wsp"),
602  "left center", "right center", false);
603 
604  $separator = true;
605  }
606 
607  // portfolio
608  if ($ilSetting->get('user_portfolios'))
609  {
610  $gl->addEntry($lng->txt("portfolio"), "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToPortfolio",
611  "_top", "", "", "mm_pd_port", ilHelp::getMainMenuTooltip("mm_pd_port"),
612  "left center", "right center", false);
613 
614  $separator = true;
615  }
616 
617  // skills
618  $skmg_set = new ilSetting("skmg");
619  if ($skmg_set->get("enable_skmg"))
620  {
621  $gl->addEntry($lng->txt("skills"), "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToSkills",
622  "_top", "", "", "mm_pd_skill", ilHelp::getMainMenuTooltip("mm_pd_skill"),
623  "left center", "right center", false);
624 
625  $separator = true;
626  }
627 
628  // Learning Progress
629  include_once("Services/Tracking/classes/class.ilObjUserTracking.php");
633  {
634  //$ilTabs->addTarget("learning_progress", $this->ctrl->getLinkTargetByClass("ilLearningProgressGUI"));
635  $gl->addEntry($lng->txt("learning_progress"), "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToLP",
636  "_top", "", "", "mm_pd_lp", ilHelp::getMainMenuTooltip("mm_pd_lp"),
637  "left center", "right center", false);
638 
639  $separator = true;
640  }
641 
642  if($separator)
643  {
644  $gl->addSeparator();
645  }
646 
647  $separator = false;
648 
649  // calendar
650  include_once('./Services/Calendar/classes/class.ilCalendarSettings.php');
651  $settings = ilCalendarSettings::_getInstance();
652  if($settings->isEnabled())
653  {
654  $gl->addEntry($lng->txt("calendar"), "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToCalendar",
655  "_top", "", "", "mm_pd_cal", ilHelp::getMainMenuTooltip("mm_pd_cal"),
656  "left center", "right center", false);
657 
658  $separator = true;
659  }
660 
661  // mail
662  if($this->mail)
663  {
664  $gl->addEntry($lng->txt('mail'), 'ilias.php?baseClass=ilMailGUI', '_top',
665  "", "", "mm_pd_mail", ilHelp::getMainMenuTooltip("mm_pd_mail"),
666  "left center", "right center", false);
667 
668  $separator = true;
669  }
670 
671  // contacts
672  if(!$this->ilias->getSetting('disable_contacts') &&
673  ($this->ilias->getSetting('disable_contacts_require_mail') ||
674  $rbacsystem->checkAccess('internal_mail', ilMailGlobalServices::getMailObjectRefId())))
675  {
676  $gl->addEntry($lng->txt('mail_addressbook'),
677  'ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToContacts', '_top'
678  , "", "", "mm_pd_contacts", ilHelp::getMainMenuTooltip("mm_pd_contacts"),
679  "left center", "right center", false);
680 
681  $separator = true;
682  }
683 
684  if($separator)
685  {
686  $gl->addSeparator();
687  }
688 
689  // profile
690  $gl->addEntry($lng->txt("personal_profile"), "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToProfile",
691  "_top", "", "", "mm_pd_profile", ilHelp::getMainMenuTooltip("mm_pd_profile"),
692  "left center", "right center", false);
693 
694  // settings
695  $gl->addEntry($lng->txt("personal_settings"), "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToSettings",
696  "_top", "", "", "mm_pd_sett", ilHelp::getMainMenuTooltip("mm_pd_sett"),
697  "left center", "right center", false);
698 
699  $a_tpl->setVariable("DESK_CONT_OV", $gl->getHTML());
700  }
701 
702  if(IS_PAYMENT_ENABLED)
703  {
704  // shop
705  if ($a_id == "shop")
706  {
707  $gl = new ilGroupedListGUI();
708  $a_tpl->setVariable("ARROW_IMG", ilUtil::getImagePath("mm_down_arrow.png"));
709 
710  // shop_content
711  $gl->addEntry($lng->txt("content"),
712  "ilias.php?baseClass=ilShopController&amp;cmd=firstpage",
713  "_top");
714 
715  // shoppingcart
716  include_once 'Services/Payment/classes/class.ilPaymentShoppingCart.php';
717  global $ilUser;
718  $objShoppingCart = new ilPaymentShoppingCart($ilUser);
719  $items = $objShoppingCart->getEntries();
720 
721  if(count($items) > 0 )
722  {
723  $gl->addEntry($lng->txt("shoppingcart").' ('.count($items).')',
724  "ilias.php?baseClass=ilShopController&amp;cmdClass=ilshopshoppingcartgui",
725  "_top");
726  }
727  $a_tpl->setVariable("SHOP_CONT_OV", $gl->getHTML());
728  }
729  }
730  $a_tpl->setVariable("TXT_".$id_up, $a_txt);
731  $a_tpl->setVariable("SCRIPT_".$id_up, $a_script);
732  $a_tpl->setVariable("TARGET_".$id_up, $a_target);
733  if ($this->active == $a_id || ($this->active == "" && $a_id == "repository"))
734  {
735  $a_tpl->setVariable("MM_CLASS", "MMActive");
736  $a_tpl->setVariable("SEL", '<span class="ilAccHidden">('.$lng->txt("stat_selected").')</span>');
737  }
738  else
739  {
740  $a_tpl->setVariable("MM_CLASS", "MMInactive");
741  }
742 
743  if($a_id == "repository")
744  {
745  include_once("./Services/Accessibility/classes/class.ilAccessKey.php");
747  {
748  $a_tpl->setVariable("ACC_KEY_REPOSITORY", 'accesskey="'.
750  }
751  }
752  if($a_id == "desktop")
753  {
754  include_once("./Services/Accessibility/classes/class.ilAccessKey.php");
756  {
757  $a_tpl->setVariable("ACC_KEY_DESKTOP", 'accesskey="'.
759  }
760  }
761 
762 
763  $a_tpl->parseCurrentBlock();
764  }
765 
766 
770  function getScriptTarget($a_script)
771  {
772  global $ilias;
773 
774  $script = "./".$a_script;
775 
776  //if ($this->start_template == true)
777  //{
778  //if(is_file("./templates/".$ilias->account->skin."/tpl.start.html"))
779  //{
780  // $script = "./start.php?script=".rawurlencode($script);
781  //}
782  //}
783  if (defined("ILIAS_MODULE"))
784  {
785  $script = ".".$script;
786  }
787  return $script;
788  }
789 
791  {
792  global $rbacsystem;
793 
794  //if($rbacsystem->checkAccess("visible,read", SYSTEM_FOLDER_ID))
795  if($rbacsystem->checkAccess("visible", SYSTEM_FOLDER_ID))
796  {
797  return true;
798  }
799  return false;
800  }
801 
802  function getHTML()
803  {
804  include_once './Services/Container/classes/class.ilMemberViewSettings.php';
806 
807  if($set->isActive())
808  {
809  return $this->getMemberViewHTML();
810  }
811 
812 
813  $this->setTemplateVars();
814 
815  return $this->tpl->get();
816  }
817 
818  protected function getMemberViewHTML()
819  {
820  global $lng;
821 
822  $this->tpl = new ilTemplate('tpl.member_view_main_menu.html',true,true,'Services/MainMenu');
823 
824  $this->tpl->setVariable('TXT_MM_HEADER',$lng->txt('mem_view_long'));
825  $this->tpl->setVariable('TXT_MM_CLOSE_PREVIEW',$lng->txt('mem_view_close'));
826  $this->tpl->setVariable('MM_CLOSE_IMG',ilUtil::getImagePath('cancel.png'));
827 
828  include_once './Services/Link/classes/class.ilLink.php';
829 
830  $this->tpl->setVariable(
831  'HREF_CLOSE_MM',
833  (int) $_GET['ref_id'],
834  ilObject::_lookupType(ilObject::_lookupObjId((int) $_GET['ref_id'])),
835  array('mv' => 0)));
836 
837  return $this->tpl->get();
838  }
839 
846  function renderDropDown($a_tpl, $a_id)
847  {
848  global $lng, $ilSetting, $rbacsystem;
849 
850  $id = strtolower($a_id);
851  $id_up = strtoupper($a_id);
852  $a_tpl->setCurrentBlock("entry_".$id);
853  include_once("./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
854  $selection = new ilAdvancedSelectionListGUI();
855  if ($this->active == $a_id || ($this->active == "" && $a_id == "repository"))
856  {
857  $selection->setSelectionHeaderClass("MMActive");
858  $a_tpl->setVariable("SEL", '<span class="ilAccHidden">('.$lng->txt("stat_selected").')</span>');
859  }
860  else
861  {
862  $selection->setSelectionHeaderClass("MMInactive");
863  }
864 
865  $selection->setSelectionHeaderSpanClass("MMSpan");
866 
867  $selection->setHeaderIcon(ilAdvancedSelectionListGUI::DOWN_ARROW_LIGHT);
868  $selection->setItemLinkClass("small");
869  $selection->setUseImages(false);
870 
871  switch ($id)
872  {
873  // desktop drop down
874  case "desktop":
875  $selection->setListTitle($lng->txt("personal_desktop"));
876  $selection->setId("dd_pd");
877 
878  // overview
879  $selection->addItem($lng->txt("overview"), "", "ilias.php?baseClass=ilPersonalDesktopGUI",
880  "", "", "_top");
881 
882  if(!$ilSetting->get("disable_personal_workspace"))
883  {
884  // workspace
885  $selection->addItem($lng->txt("personal_workspace"), "", "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToWorkspace",
886  "", "", "_top");
887  }
888 
889  // profile
890  $selection->addItem($lng->txt("personal_profile"), "", "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToProfile",
891  "", "", "_top");
892 
893  // skills
894  $skmg_set = new ilSetting("skmg");
895  if ($skmg_set->get("enable_skmg"))
896  {
897  $selection->addItem($lng->txt("skills"), "", "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToSkills",
898  "", "", "_top");
899  }
900 
901  // portfolio
902  if ($ilSetting->get('user_portfolios'))
903  {
904  $selection->addItem($lng->txt("portfolio"), "", "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToPortfolio",
905  "", "", "_top");
906  }
907 
908  // news
909  if ($ilSetting->get("block_activated_news"))
910  {
911  $selection->addItem($lng->txt("news"), "", "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToNews",
912  "", "", "_top");
913  }
914 
915  // Learning Progress
916  include_once("Services/Tracking/classes/class.ilObjUserTracking.php");
918  {
919  //$ilTabs->addTarget("learning_progress", $this->ctrl->getLinkTargetByClass("ilLearningProgressGUI"));
920  $selection->addItem($lng->txt("learning_progress"), "", "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToLP",
921  "", "", "_top");
922  }
923 
924  // calendar
925  include_once('./Services/Calendar/classes/class.ilCalendarSettings.php');
926  $settings = ilCalendarSettings::_getInstance();
927  if($settings->isEnabled())
928  {
929  $selection->addItem($lng->txt("calendar"), "", "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToCalendar",
930  "", "", "_top");
931  }
932 
933  // mail
934  if($this->mail)
935  {
936  $selection->addItem($lng->txt('mail'), '', 'ilias.php?baseClass=ilMailGUI', '', '', '_top');
937  }
938 
939  // contacts
940  if (!$this->ilias->getSetting('disable_contacts') &&
941  ($this->ilias->getSetting('disable_contacts_require_mail') ||
942  $rbacsystem->checkAccess('internal_mail', ilMailGlobalServices::getMailObjectRefId())))
943  {
944  $selection->addItem($lng->txt('mail_addressbook'), '', 'ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToContacts', '', '', '_top');
945  }
946 
947  // private notes
948  if (!$this->ilias->getSetting("disable_notes"))
949  {
950  $selection->addItem($lng->txt("notes_and_comments"), "", "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToNotes",
951  "", "", "_top");
952  }
953 
954  // bookmarks
955  if (!$this->ilias->getSetting("disable_bookmarks"))
956  {
957  $selection->addItem($lng->txt("bookmarks"), "", "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToBookmarks",
958  "", "", "_top");
959  }
960 
961  // settings
962  $selection->addItem($lng->txt("personal_settings"), "", "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToSettings",
963  "", "", "_top");
964 
965  break;
966 
967  // shop
968  case 'shop':
969  $selection->setListTitle($lng->txt("shop"));
970  $selection->setId("dd_shp");
971  $selection->addItem($lng->txt("shop"), "", "ilias.php?baseClass=ilShopController&cmd=firstpage",
972  "", "", "_top");
973  break;
974 
975  // administration
976  case "administration":
977  $selection->setListTitle($lng->txt("administration"));
978  $selection->setId("dd_adm");
979  $selection->setAsynch(true);
980  $selection->setAsynchUrl("ilias.php?baseClass=ilAdministrationGUI&cmd=getDropDown&cmdMode=asynch");
981  //$this->renderEntry($a_tpl, "administration",
982  // $lng->txt("administration"),
983  // $this->getScriptTarget("ilias.php?baseClass=ilAdministrationGUI"),
984  // $this->target);
985 
986  break;
987 
988  }
989 
990 // $selection->setTriggerEvent("mouseover");
991 // $selection->setAutoHide(true);
992 
993  $html = $selection->getHTML();
994  $a_tpl->setVariable($id_up."_DROP_DOWN", $html);
995  $a_tpl->parseCurrentBlock();
996  }
997 
1005  {
1006  global $ilHelp, $lng, $ilCtrl, $tpl, $ilSetting, $ilUser;
1007 
1008  // screen id
1009  if (defined("OH_REF_ID") && OH_REF_ID > 0)
1010  {
1011  if ($ilHelp->getScreenId() != "")
1012  {
1013  $this->tpl->setCurrentBlock("screen_id");
1014  $this->tpl->setVariable("SCREEN_ID", $ilHelp->getScreenId());
1015  $this->tpl->parseCurrentBlock();
1016  }
1017  }
1018 
1019  $help_active = false;
1020 
1021  if ($ilHelp->hasSections())
1022  {
1023  $help_active = true;
1024 
1025  $lng->loadLanguageModule("help");
1026  $this->tpl->setCurrentBlock("help_icon");
1027 
1028  // add javascript needed by help (to do: move to help class)
1029  $tpl->addJavascript("./Services/Help/js/ilHelp.js");
1030  include_once("./Services/Accordion/classes/class.ilAccordionGUI.php");
1031  $acc = new ilAccordionGUI();
1032  $acc->addJavascript();
1033  $acc->addCss();
1034 
1035  $this->tpl->setVariable("IMG_HELP", ilUtil::getImagePath("icon_help.png"));
1036  $this->tpl->parseCurrentBlock();
1037 
1038  include_once("./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php");
1039  ilTooltipGUI::addTooltip("help_tr", $lng->txt("help_open_online_help"), "",
1040  "bottom center", "top center", false);
1041  }
1042 
1043  $module_id = (int) $ilSetting->get("help_module");
1044  if ((OH_REF_ID > 0 || $module_id > 0) && $ilUser->getLanguage() == "de" &&
1045  $ilSetting->get("help_mode") != "1")
1046  {
1047  $help_active = true;
1048 
1049  $lng->loadLanguageModule("help");
1050  $tpl->addJavascript("./Services/Help/js/ilHelp.js");
1051  $this->tpl->setCurrentBlock("help_tt_icon");
1052  $this->tpl->setVariable("IMG_TT_ON", ilUtil::getImagePath("icon_tt.png"));
1053  $this->tpl->setVariable("IMG_TT_OFF", ilUtil::getImagePath("icon_tt_off.png"));
1054  $this->tpl->parseCurrentBlock();
1055 
1056  include_once("./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php");
1057  ilTooltipGUI::addTooltip("help_tt", $lng->txt("help_toggle_tooltips"), "",
1058  "bottom center", "top center", false);
1059  }
1060 
1061  if($help_active)
1062  {
1063  // always set ajax url
1064  $ts = $ilCtrl->getTargetScript();
1065  $ilCtrl->setTargetScript("ilias.php");
1066 
1067  $ilHelp->setCtrlPar();
1068  $tpl->addOnLoadCode("il.Help.setAjaxUrl('".
1069  $ilCtrl->getLinkTargetByClass("ilhelpgui", "", "", true)
1070  ."');");
1071  $ilCtrl->setTargetScript($ts);
1072  }
1073  }
1074 
1082  function showLogoOnly($a_value)
1083  {
1084  $this->logo_only = (bool)$a_value;
1085  }
1086 
1087  protected function getHeaderURL()
1088  {
1089  include_once './Services/User/classes/class.ilUserUtil.php';
1091 
1092  if(!$url)
1093  {
1094  $url = "./goto.php?target=root_1";
1095  }
1096 
1097  return $url;
1098  }
1099 }
1100 
1101 ?>