ILIAS  Release_4_2_x_branch Revision 61807
 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-2010 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('mail_visible', 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) > 0)
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  // get user interface plugins
144  $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_SERVICE, "UIComponent", "uihk");
145 
146  // search
147  include_once 'Services/Search/classes/class.ilSearchSettings.php';
148  if($rbacsystem->checkAccess('search',ilSearchSettings::_getSearchSettingRefId()))
149  {
150  include_once './Services/Search/classes/class.ilMainMenuSearchGUI.php';
151  $main_search = new ilMainMenuSearchGUI();
152  $html = "";
153 
154  // user interface plugin slot + default rendering
155  include_once("./Services/UIComponent/classes/class.ilUIHookProcessor.php");
156  $uip = new ilUIHookProcessor("Services/MainMenu", "main_menu_search",
157  array("main_menu_gui" => $this, "main_menu_search_gui" => $main_search));
158  if (!$uip->replaced())
159  {
160  $html = $main_search->getHTML();
161  }
162  $html = $uip->getHTML($html);
163 
164  if (strlen($html))
165  {
166  $this->tpl->setVariable('SEARCHBOX',$html);
167  }
168  }
169 
170  $this->renderStatusBox($this->tpl);
171 
172  $mmle_html = "";
173 
174  // user interface plugin slot + default rendering
175  include_once("./Services/UIComponent/classes/class.ilUIHookProcessor.php");
176  $uip = new ilUIHookProcessor("Services/MainMenu", "main_menu_list_entries",
177  array("main_menu_gui" => $this));
178  if (!$uip->replaced())
179  {
180  $mmle_tpl = new ilTemplate("tpl.main_menu_list_entries.html", true, true, "Services/MainMenu");
181  $mmle_html = $this->renderMainMenuListEntries($mmle_tpl);
182  }
183  $mmle_html = $uip->getHTML($mmle_html);
184 
185  $this->tpl->setVariable("MAIN_MENU_LIST_ENTRIES", $mmle_html);
186 
187  $link_dir = (defined("ILIAS_MODULE"))
188  ? "../"
189  : "";
190 
191  if (!$this->small)
192  {
193 
194  // login stuff
195  if ($_SESSION["AccountId"] == ANONYMOUS_USER_ID)
196  {
197  include_once 'Services/Registration/classes/class.ilRegistrationSettingsGUI.php';
199  {
200  $this->tpl->setCurrentBlock("registration_link");
201  $this->tpl->setVariable("TXT_REGISTER",$lng->txt("register"));
202  $this->tpl->setVariable("LINK_REGISTER", $link_dir."register.php?client_id=".rawurlencode(CLIENT_ID)."&lang=".$ilias->account->getCurrentLanguage());
203  $this->tpl->parseCurrentBlock();
204  }
205 
206  // language selection
207  $selection = self::getLanguageSelection();
208  if($selection)
209  {
210  $this->tpl->setVariable("LANG_SELECT", $selection);
211  }
212 
213  $this->tpl->setCurrentBlock("userisanonymous");
214  $this->tpl->setVariable("TXT_NOT_LOGGED_IN",$lng->txt("not_logged_in"));
215  $this->tpl->setVariable("TXT_LOGIN",$lng->txt("log_in"));
216 
217  $target_str = "";
218  if ($this->getLoginTargetPar() != "")
219  {
220  $target_str = $this->getLoginTargetPar();
221  }
222  else if ($_GET["ref_id"] != "")
223  {
224  if ($tree->isInTree($_GET["ref_id"]) && $_GET["ref_id"] != $tree->getRootId())
225  {
226  $obj_id = ilObject::_lookupObjId($_GET["ref_id"]);
227  $type = ilObject::_lookupType($obj_id);
228  $target_str = $type."_".$_GET["ref_id"];
229  }
230  }
231  $this->tpl->setVariable("LINK_LOGIN",
232  $link_dir."login.php?target=".$target_str."&client_id=".rawurlencode(CLIENT_ID)."&cmd=force_login&lang=".$ilias->account->getCurrentLanguage());
233  $this->tpl->parseCurrentBlock();
234  }
235  else
236  {
240  $notificationSettings = new ilSetting('notifications');
241  $chatSettings = new ilSetting('chatroom');
242 
243  global $tpl;
244  if ($chatSettings->get('chat_enabled') && $notificationSettings->get('enable_osd')) {
245  $this->tpl->touchBlock('osd_enabled');
246  $this->tpl->touchBlock('osd_container');
247  $tpl->addJavaScript('Services/Notifications/templates/default/notifications.js');
248  $tpl->addCSS('Services/Notifications/templates/default/osd.css');
249 
250  include_once "Services/jQuery/classes/class.iljQueryUtil.php";
252 
253  require_once 'Services/Notifications/classes/class.ilNotificationOSDHandler.php';
254  $notifications = ilNotificationOSDHandler::getNotificationsForUser($ilUser->getId());
255  $this->tpl->setVariable('INITIAL_NOTIFICATIONS', json_encode($notifications));
256  $this->tpl->setVariable('OSD_POLLING_INTERVALL', $notificationSettings->get('osd_polling_intervall') ? $notificationSettings->get('osd_polling_intervall') : '5');
257  $this->tpl->setVariable('OSD_PLAY_SOUND', $chatSettings->get('play_invitation_sound') ? 'true' : 'false');
258  foreach($notifications as $notification) {
259  if ($notification['type'] == 'osd_maint') {
260  #var_dump($notification);
261  continue;
262  }
263  #var_dump($notification);
264  $this->tpl->setCurrentBlock('osd_notification_item');
265 
266  $this->tpl->setVariable('NOTIFICATION_ICON_PATH', $notification['data']->iconPath);
267  $this->tpl->setVariable('NOTIFICATION_TITLE', $notification['data']->title);
268  $this->tpl->setVariable('NOTIFICATION_LINK', $notification['data']->link);
269  $this->tpl->setVariable('NOTIFICATION_LINKTARGET', $notification['data']->linktarget);
270  $this->tpl->setVariable('NOTIFICATION_ID', $notification['notification_osd_id']);
271  $this->tpl->setVariable('NOTIFICATION_SHORT_DESCRIPTION', $notification['data']->shortDescription);
272  $this->tpl->parseCurrentBlock();
273  }
274  }
275 
276  $this->tpl->setCurrentBlock("userisloggedin");
277  $this->tpl->setVariable("TXT_LOGIN_AS",$lng->txt("login_as"));
278  $this->tpl->setVariable("TXT_LOGOUT2",$lng->txt("logout"));
279  $this->tpl->setVariable("LINK_LOGOUT2", $link_dir."logout.php?lang=".$ilias->account->getCurrentLanguage());
280  $this->tpl->setVariable("USERNAME",$ilias->account->getFullname());
281  $this->tpl->parseCurrentBlock();
282  }
283 
284  include_once("./Modules/SystemFolder/classes/class.ilObjSystemFolder.php");
285  $header_top_title = ilObjSystemFolder::_getHeaderTitle();
286  if (trim($header_top_title) != "" && $this->tpl->blockExists("header_top_title"))
287  {
288  $this->tpl->setCurrentBlock("header_top_title");
289  $this->tpl->setVariable("TXT_HEADER_TITLE", $header_top_title);
290  $this->tpl->parseCurrentBlock();
291  }
292 
293  $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
294 
295  $this->tpl->setVariable("TXT_LOGOUT", $lng->txt("logout"));
296  $this->tpl->setVariable("HEADER_URL", $this->getHeaderURL());
297  $this->tpl->setVariable("HEADER_ICON", ilUtil::getImagePath("HeaderIcon.png"));
298  $this->tpl->setVariable("HEADER_BG_IMAGE", ilUtil::getImagePath("HeaderBackground.gif"));
299  include_once("./Modules/SystemFolder/classes/class.ilObjSystemFolder.php");
300 
301  // set link to return to desktop, not depending on a specific position in the hierarchy
302  //$this->tpl->setVariable("SCRIPT_START", $this->getScriptTarget("start.php"));
303  }
304  else
305  {
306  $this->tpl->setVariable("HEADER_URL", $this->getHeaderURL());
307  $this->tpl->setVariable("HEADER_ICON", ilUtil::getImagePath("HeaderIcon.png"));
308  }
309 
310  $this->tpl->setVariable("TXT_MAIN_MENU", $lng->txt("main_menu"));
311 
312  $this->tpl->parseCurrentBlock();
313  }
314 
318  function renderStatusBox($a_tpl)
319  {
320  global $ilUser;
321 
322  $box = false;
323 
324  // new mails?
325  if($this->mail)
326  {
327  $new_mails = ilMailGlobalServices::getNumberOfNewMailsByUserId($ilUser->getId());
328  if($new_mails > 0)
329  {
330  $a_tpl->setCurrentBlock('status_text');
331  $a_tpl->setVariable('STATUS_TXT', $new_mails);
332  $a_tpl->parseCurrentBlock();
333  }
334  $a_tpl->setCurrentBlock('status_item');
335  $a_tpl->setVariable('STATUS_IMG', ilUtil::getImagePath('icon_mail_s.gif'));
336  $a_tpl->setVariable('STATUS_HREF', 'ilias.php?baseClass=ilMailGUI');
337  $a_tpl->parseCurrentBlock();
338  $box = true;
339  }
340 
341  if ($box)
342  {
343  $a_tpl->setCurrentBlock("status_box");
344  $a_tpl->parseCurrentBlock();
345  }
346  }
347 
348 
355  function renderMainMenuListEntries($a_tpl, $a_call_get = true)
356  {
357  global $rbacsystem, $lng, $ilias, $tree, $ilUser, $ilSetting, $ilAccess;
358 
359  // personal desktop
360  if ($_SESSION["AccountId"] != ANONYMOUS_USER_ID)
361  {
362  /*$this->renderEntry($a_tpl, "desktop",
363  $lng->txt("personal_desktop"),
364  $this->getScriptTarget("ilias.php?baseClass=ilPersonalDesktopGUI"),
365  $this->target);*/
366 // $this->renderDropDown($a_tpl, "desktop");
367  $this->renderEntry($a_tpl, "desktop",
368  $lng->txt("personal_desktop"), "#");
369 
370  include_once("./Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php");
371  $ov = new ilOverlayGUI("mm_desk_ov");
372  $ov->setTrigger("mm_desk_tr");
373  $ov->setAnchor("mm_desk_tr");
374  $ov->setAutoHide(false);
375  $ov->add();
376 
377  }
378 
379  // repository
380  if($ilAccess->checkAccess('visible','',ROOT_FOLDER_ID))
381  {
382  include_once('classes/class.ilLink.php');
383  $nd = $tree->getNodeData(ROOT_FOLDER_ID);
384  $title = $nd["title"];
385  if ($title == "ILIAS")
386  {
387  $title = $lng->txt("repository");
388  }
389  //$this->renderEntry($a_tpl, "repository",
390  // $title,
391  // ilLink::_getStaticLink(1,'root',true),
392  // $this->target);
393  if ($_SESSION["AccountId"] != ANONYMOUS_USER_ID || IS_PAYMENT_ENABLED)
394  {
395  $this->renderEntry($a_tpl, "repository",
396  $title, "#");
397  include_once("./Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php");
398  $ov = new ilOverlayGUI("mm_rep_ov");
399  $ov->setTrigger("mm_rep_tr");
400  $ov->setAnchor("mm_rep_tr");
401  $ov->setAutoHide(false);
402  $ov->add();
403  }
404  }
405 
406  // search
407  include_once 'Services/Search/classes/class.ilSearchSettings.php';
408  if($rbacsystem->checkAccess('search',ilSearchSettings::_getSearchSettingRefId()))
409  {
410 /* $this->renderEntry($a_tpl, "search",
411  $lng->txt("search"),
412  $this->getScriptTarget('ilias.php?baseClass=ilSearchController'),
413  $this->target); */
414  }
415 
416  // webshop
417  if(IS_PAYMENT_ENABLED)
418  {
419  $title = $lng->txt("shop");
420  $this->renderEntry($a_tpl, "shop", $title, "#" );
421  include_once("./Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php");
422  $ov = new ilOverlayGUI("mm_shop_ov");
423  $ov->setTrigger("mm_shop_tr");
424  $ov->setAnchor("mm_shop_tr");
425  $ov->setAutoHide(false);
426  $ov->add();
427  }
428 
429  // administration
431  {
432  //$this->renderEntry($a_tpl, "administration",
433  // $lng->txt("administration"),
434  // $this->getScriptTarget("ilias.php?baseClass=ilAdministrationGUI"),
435  // $this->target);
436  $this->renderDropDown($a_tpl, "administration");
437  }
438 
439 
440  // navigation history
441 /* require_once("Services/Navigation/classes/class.ilNavigationHistoryGUI.php");
442  $nav_hist = new ilNavigationHistoryGUI();
443  $nav_html = $nav_hist->getHTML();
444  if ($nav_html != "")
445  {
446 
447  $a_tpl->setCurrentBlock("nav_history");
448  $a_tpl->setVariable("TXT_LAST_VISITED", $lng->txt("last_visited"));
449  $a_tpl->setVariable("NAVIGATION_HISTORY", $nav_html);
450  $a_tpl->parseCurrentBlock();
451  }*/
452 
453 
454  if ($a_call_get)
455  {
456  return $a_tpl->get();
457  }
458 
459  return "";
460  }
461 
468  function renderEntry($a_tpl, $a_id, $a_txt, $a_script, $a_target = "_top")
469  {
470  global $lng, $ilNavigationHistory, $ilSetting, $rbacsystem;
471 
472  $id = strtolower($a_id);
473  $id_up = strtoupper($a_id);
474  $a_tpl->setCurrentBlock("entry_".$id);
475 
476  include_once("./Services/UIComponent/GroupedList/classes/class.ilGroupedListGUI.php");
477 
478  // repository
479  if ($a_id == "repository")
480  {
481  $gl = new ilGroupedListGUI();
482 
483  include_once("./classes/class.ilLink.php");
484  $a_tpl->setVariable("ARROW_IMG", ilUtil::getImagePath("mm_down_arrow.gif"));
486 
487  $gl->addEntry($icon." ".$a_txt." - ".$lng->txt("rep_main_page"), ilLink::_getStaticLink(1,'root',true),
488  "_top");
489 
490  $items = $ilNavigationHistory->getItems();
491  reset($items);
492  $cnt = 0;
493  $first = true;
494 
495  foreach($items as $k => $item)
496  {
497  if ($cnt >= 10) break;
498 
499  if (!isset($item["ref_id"]) || !isset($_GET["ref_id"]) ||
500  ($item["ref_id"] != $_GET["ref_id"] || !$first)) // do not list current item
501  {
502  if ($cnt == 0)
503  {
504  $gl->addGroupHeader($lng->txt("last_visited"));
505  }
506  $obj_id = ilObject::_lookupObjId($item["ref_id"]);
507  $cnt ++;
508  $icon = ilUtil::img(ilObject::_getIcon($obj_id, "tiny"));
509  $gl->addEntry($icon." ".ilUtil::shortenText($item["title"], 50, true), $item["link"],
510  "_top");
511 
512  }
513  $first = false;
514  }
515 
516  $a_tpl->setVariable("REP_EN_OV", $gl->getHTML());
517  }
518 
519  // desktop
520  if ($a_id == "desktop")
521  {
522  $gl = new ilGroupedListGUI();
523 
524  $a_tpl->setVariable("ARROW_IMG", ilUtil::getImagePath("mm_down_arrow.gif"));
525 
526  // overview
527  $gl->addEntry($lng->txt("overview"),
528  "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToSelectedItems",
529  "_top");
530 
531  // my groups and courses, if both is available
532  if($ilSetting->get('disable_my_offers') == 0 &&
533  $ilSetting->get('disable_my_memberships') == 0)
534  {
535  $gl->addEntry($lng->txt("my_courses_groups"),
536  "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToMemberships",
537  "_top");
538  }
539 
540  // bookmarks
541  if (!$this->ilias->getSetting("disable_bookmarks"))
542  {
543  $gl->addEntry($lng->txt("bookmarks"), "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToBookmarks",
544  "_top");
545  }
546 
547  // private notes
548  if (!$this->ilias->getSetting("disable_notes"))
549  {
550  $gl->addEntry($lng->txt("notes_and_comments"), "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToNotes",
551  "_top");
552  }
553 
554  // news
555  if ($ilSetting->get("block_activated_news"))
556  {
557  $gl->addEntry($lng->txt("news"), "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToNews",
558  "_top");
559  }
560 
561  // overview is always active
562  $gl->addSeparator();
563 
564  $separator = false;
565 
566  if(!$ilSetting->get("disable_personal_workspace"))
567  {
568  // workspace
569  $gl->addEntry($lng->txt("personal_workspace"), "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToWorkspace",
570  "_top");
571 
572  $separator = true;
573  }
574 
575  // portfolio
576  if ($ilSetting->get('user_portfolios'))
577  {
578  $gl->addEntry($lng->txt("portfolio"), "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToPortfolio",
579  "_top");
580 
581  $separator = true;
582  }
583 
584  // skills
585  $skmg_set = new ilSetting("skmg");
586  if ($skmg_set->get("enable_skmg"))
587  {
588  $gl->addEntry($lng->txt("skills"), "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToSkills",
589  "_top");
590 
591  $separator = true;
592  }
593 
594  // Learning Progress
595  include_once("Services/Tracking/classes/class.ilObjUserTracking.php");
597  {
598  //$ilTabs->addTarget("learning_progress", $this->ctrl->getLinkTargetByClass("ilLearningProgressGUI"));
599  $gl->addEntry($lng->txt("learning_progress"), "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToLP",
600  "_top");
601 
602  $separator = true;
603  }
604 
605  if($separator)
606  {
607  $gl->addSeparator();
608  }
609 
610  $separator = false;
611 
612  // calendar
613  include_once('./Services/Calendar/classes/class.ilCalendarSettings.php');
614  $settings = ilCalendarSettings::_getInstance();
615  if($settings->isEnabled())
616  {
617  $gl->addEntry($lng->txt("calendar"), "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToCalendar",
618  "_top");
619 
620  $separator = true;
621  }
622 
623  // mail
624  if($this->mail)
625  {
626  $gl->addEntry($lng->txt('mail'), 'ilias.php?baseClass=ilMailGUI', '_top');
627 
628  $separator = true;
629  }
630 
631  // contacts
632  if(!$this->ilias->getSetting('disable_contacts') &&
633  ($this->ilias->getSetting('disable_contacts_require_mail') ||
634  $rbacsystem->checkAccess('mail_visible', ilMailGlobalServices::getMailObjectRefId())))
635  {
636  $gl->addEntry($lng->txt('mail_addressbook'), 'ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToContacts', '_top');
637 
638  $separator = true;
639  }
640 
641  if($separator)
642  {
643  $gl->addSeparator();
644  }
645 
646  // profile
647  $gl->addEntry($lng->txt("personal_profile"), "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToProfile",
648  "_top");
649 
650  // settings
651  $gl->addEntry($lng->txt("personal_settings"), "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToSettings",
652  "_top");
653 
654  $a_tpl->setVariable("DESK_CONT_OV", $gl->getHTML());
655  }
656 
657  if(IS_PAYMENT_ENABLED)
658  {
659  // shop
660  if ($a_id == "shop")
661  {
662  $gl = new ilGroupedListGUI();
663  $a_tpl->setVariable("ARROW_IMG", ilUtil::getImagePath("mm_down_arrow.gif"));
664 
665  // shop_content
666  $gl->addEntry($lng->txt("content"),
667  "ilias.php?baseClass=ilShopController&amp;cmd=firstpage",
668  "_top");
669 
670  // shoppingcart
671  include_once 'Services/Payment/classes/class.ilPaymentShoppingCart.php';
672  global $ilUser;
673  $objShoppingCart = new ilPaymentShoppingCart($ilUser);
674  $items = $objShoppingCart->getEntries();
675 
676  if(count($items) > 0 )
677  {
678  $gl->addEntry($lng->txt("shoppingcart").' ('.count($items).')',
679  "ilias.php?baseClass=ilShopController&amp;cmdClass=ilshopshoppingcartgui",
680  "_top");
681  }
682  $a_tpl->setVariable("SHOP_CONT_OV", $gl->getHTML());
683  }
684  }
685  $a_tpl->setVariable("TXT_".$id_up, $a_txt);
686  $a_tpl->setVariable("SCRIPT_".$id_up, $a_script);
687  $a_tpl->setVariable("TARGET_".$id_up, $a_target);
688  if ($this->active == $a_id || ($this->active == "" && $a_id == "repository"))
689  {
690  $a_tpl->setVariable("MM_CLASS", "MMActive");
691  $a_tpl->setVariable("SEL", '<span class="ilAccHidden">('.$lng->txt("stat_selected").')</span>');
692  }
693  else
694  {
695  $a_tpl->setVariable("MM_CLASS", "MMInactive");
696  }
697 
698  if($a_id == "repository")
699  {
700  include_once("./Services/Accessibility/classes/class.ilAccessKey.php");
702  {
703  $a_tpl->setVariable("ACC_KEY_REPOSITORY", 'accesskey="'.
705  }
706  }
707  if($a_id == "desktop")
708  {
709  include_once("./Services/Accessibility/classes/class.ilAccessKey.php");
711  {
712  $a_tpl->setVariable("ACC_KEY_DESKTOP", 'accesskey="'.
714  }
715  }
716 
717 
718  $a_tpl->parseCurrentBlock();
719  }
720 
721 
725  function getScriptTarget($a_script)
726  {
727  global $ilias;
728 
729  $script = "./".$a_script;
730 
731  //if ($this->start_template == true)
732  //{
733  //if(is_file("./templates/".$ilias->account->skin."/tpl.start.html"))
734  //{
735  // $script = "./start.php?script=".rawurlencode($script);
736  //}
737  //}
738  if (defined("ILIAS_MODULE"))
739  {
740  $script = ".".$script;
741  }
742  return $script;
743  }
744 
746  {
747  global $rbacsystem;
748 
749  //if($rbacsystem->checkAccess("visible,read", SYSTEM_FOLDER_ID))
750  if($rbacsystem->checkAccess("visible", SYSTEM_FOLDER_ID))
751  {
752  return true;
753  }
754  return false;
755  }
756 
757  function getHTML()
758  {
759  include_once './Services/Container/classes/class.ilMemberViewSettings.php';
761 
762  if($set->isActive())
763  {
764  return $this->getMemberViewHTML();
765  }
766 
767 
768  $this->setTemplateVars();
769 
770  return $this->tpl->get();
771  }
772 
773  protected function getMemberViewHTML()
774  {
775  global $lng;
776 
777  $this->tpl = new ilTemplate('tpl.member_view_main_menu.html',true,true,'Services/MainMenu');
778 
779  $this->tpl->setVariable('TXT_MM_HEADER',$lng->txt('mem_view_long'));
780  $this->tpl->setVariable('TXT_MM_CLOSE_PREVIEW',$lng->txt('mem_view_close'));
781  $this->tpl->setVariable('MM_CLOSE_IMG',ilUtil::getImagePath('cancel.gif'));
782 
783  include_once './classes/class.ilLink.php';
784 
785  $this->tpl->setVariable(
786  'HREF_CLOSE_MM',
788  (int) $_GET['ref_id'],
789  ilObject::_lookupType(ilObject::_lookupObjId((int) $_GET['ref_id'])),
790  array('mv' => 0)));
791 
792  return $this->tpl->get();
793  }
794 
801  function renderDropDown($a_tpl, $a_id)
802  {
803  global $lng, $ilSetting, $rbacsystem;
804 
805  $id = strtolower($a_id);
806  $id_up = strtoupper($a_id);
807  $a_tpl->setCurrentBlock("entry_".$id);
808  include_once("./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
809  $selection = new ilAdvancedSelectionListGUI();
810  if ($this->active == $a_id || ($this->active == "" && $a_id == "repository"))
811  {
812  $selection->setSelectionHeaderClass("MMActive");
813  $a_tpl->setVariable("SEL", '<span class="ilAccHidden">('.$lng->txt("stat_selected").')</span>');
814  }
815  else
816  {
817  $selection->setSelectionHeaderClass("MMInactive");
818  }
819 
820  $selection->setSelectionHeaderSpanClass("MMSpan");
821 
822  $selection->setHeaderIcon(ilAdvancedSelectionListGUI::DOWN_ARROW_LIGHT);
823  $selection->setItemLinkClass("small");
824  $selection->setUseImages(false);
825 
826  switch ($id)
827  {
828  // desktop drop down
829  case "desktop":
830  $selection->setListTitle($lng->txt("personal_desktop"));
831  $selection->setId("dd_pd");
832 
833  // overview
834  $selection->addItem($lng->txt("overview"), "", "ilias.php?baseClass=ilPersonalDesktopGUI",
835  "", "", "_top");
836 
837  if(!$ilSetting->get("disable_personal_workspace"))
838  {
839  // workspace
840  $selection->addItem($lng->txt("personal_workspace"), "", "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToWorkspace",
841  "", "", "_top");
842  }
843 
844  // profile
845  $selection->addItem($lng->txt("personal_profile"), "", "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToProfile",
846  "", "", "_top");
847 
848  // skills
849  $skmg_set = new ilSetting("skmg");
850  if ($skmg_set->get("enable_skmg"))
851  {
852  $selection->addItem($lng->txt("skills"), "", "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToSkills",
853  "", "", "_top");
854  }
855 
856  // portfolio
857  if ($ilSetting->get('user_portfolios'))
858  {
859  $selection->addItem($lng->txt("portfolio"), "", "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToPortfolio",
860  "", "", "_top");
861  }
862 
863  // news
864  if ($ilSetting->get("block_activated_news"))
865  {
866  $selection->addItem($lng->txt("news"), "", "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToNews",
867  "", "", "_top");
868  }
869 
870  // Learning Progress
871  include_once("Services/Tracking/classes/class.ilObjUserTracking.php");
873  {
874  //$ilTabs->addTarget("learning_progress", $this->ctrl->getLinkTargetByClass("ilLearningProgressGUI"));
875  $selection->addItem($lng->txt("learning_progress"), "", "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToLP",
876  "", "", "_top");
877  }
878 
879  // calendar
880  include_once('./Services/Calendar/classes/class.ilCalendarSettings.php');
881  $settings = ilCalendarSettings::_getInstance();
882  if($settings->isEnabled())
883  {
884  $selection->addItem($lng->txt("calendar"), "", "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToCalendar",
885  "", "", "_top");
886  }
887 
888  // mail
889  if($this->mail)
890  {
891  $selection->addItem($lng->txt('mail'), '', 'ilias.php?baseClass=ilMailGUI', '', '', '_top');
892  }
893 
894  // contacts
895  if (!$this->ilias->getSetting('disable_contacts') &&
896  ($this->ilias->getSetting('disable_contacts_require_mail') ||
897  $rbacsystem->checkAccess('mail_visible', ilMailGlobalServices::getMailObjectRefId())))
898  {
899  $selection->addItem($lng->txt('mail_addressbook'), '', 'ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToContacts', '', '', '_top');
900  }
901 
902  // private notes
903  if (!$this->ilias->getSetting("disable_notes"))
904  {
905  $selection->addItem($lng->txt("notes_and_comments"), "", "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToNotes",
906  "", "", "_top");
907  }
908 
909  // bookmarks
910  if (!$this->ilias->getSetting("disable_bookmarks"))
911  {
912  $selection->addItem($lng->txt("bookmarks"), "", "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToBookmarks",
913  "", "", "_top");
914  }
915 
916  // settings
917  $selection->addItem($lng->txt("personal_settings"), "", "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToSettings",
918  "", "", "_top");
919 
920  break;
921 
922  // shop
923  case 'shop':
924  $selection->setListTitle($lng->txt("shop"));
925  $selection->setId("dd_shp");
926  $selection->addItem($lng->txt("shop"), "", "ilias.php?baseClass=ilShopController&cmd=firstpage",
927  "", "", "_top");
928  break;
929 
930  // administration
931  case "administration":
932  $selection->setListTitle($lng->txt("administration"));
933  $selection->setId("dd_adm");
934  $selection->setAsynch(true);
935  $selection->setAsynchUrl("ilias.php?baseClass=ilAdministrationGUI&cmd=getDropDown");
936  //$this->renderEntry($a_tpl, "administration",
937  // $lng->txt("administration"),
938  // $this->getScriptTarget("ilias.php?baseClass=ilAdministrationGUI"),
939  // $this->target);
940 
941  break;
942 
943  }
944 
945 // $selection->setTriggerEvent("mouseover");
946 // $selection->setAutoHide(true);
947 
948  $html = $selection->getHTML();
949  $a_tpl->setVariable($id_up."_DROP_DOWN", $html);
950  $a_tpl->parseCurrentBlock();
951  }
952 
953  protected function getHeaderURL()
954  {
955  global $ilAccess;
956 
957  $url = "#";
958  if($ilAccess->checkAccess("read", "", 1))
959  {
960  $url = "./goto.php?target=root_1";
961  }
962  return $url;
963  }
964 }
965 
966 ?>