range = $range; // check if logged in if (User::findCurrent()) { $coursetext = _('Veranstaltungen'); $courseinfo = _('Meine Veranstaltungen & Einrichtungen'); $courselink = 'dispatch.php/my_courses'; } else { $coursetext = _('Freie Veranstaltungen'); $courseinfo = _('Freie Veranstaltungen'); $courselink = 'dispatch.php/public_courses'; } parent::__construct($coursetext, $courselink); if (User::findCurrent()) { $this->setImage(Icon::create('seminar', Icon::ROLE_NAVIGATION, ['title' => $courseinfo])); } } /** * Add an array of navigation items to the subnavigation of this * object. The new items are inserted at the appropriate position * for this tool according to the order defined in tools_activated. * * @param int $plugin_id id of the module * @param array $navigations navigation items to add */ public function addToolNavigation($plugin_id, array $navigations) { $found = null; $where = null; foreach ($this->range->context_tools as $tool) { if ($found && $tool->metadata['navigation']) { $where = $tool->metadata['navigation']; break; } if ($tool->plugin_id == $plugin_id) { $tool->metadata['navigation'] = key($navigations); $found = $tool; } } if ($found) { foreach ($navigations as $key => $nav) { if ( $this->range instanceof Institute || Seminar_Perm::get()->have_studip_perm($found->getVisibilityPermission(), $this->range->id) ) { if (isset($found->metadata['displayname'])) { $nav->setTitle($found->getDisplayname()); } $this->insertSubNavigation($key, $nav, $where); } } } } }