/** * Outputs the navigation. * * @param block_xp_manager $manager The manager. * @param string $page The page we are on. * @return string The navigation. */ public function navigation($manager, $page) { $tabs = array(); $courseid = $manager->get_courseid(); if ($manager->can_view_infos_page()) { $tabs[] = new tabobject('infos', new moodle_url('/blocks/xp/infos.php', array('courseid' => $courseid)), get_string('navinfos', 'block_xp')); } if ($manager->can_view_infos_page()) { $tabs[] = new tabobject('ladder', new moodle_url('/blocks/xp/ladder.php', array('courseid' => $courseid)), get_string('navladder', 'block_xp')); } if ($manager->can_manage()) { $tabs[] = new tabobject('report', new moodle_url('/blocks/xp/report.php', array('courseid' => $courseid)), get_string('navreport', 'block_xp')); $tabs[] = new tabobject('log', new moodle_url('/blocks/xp/log.php', array('courseid' => $courseid)), get_string('navlog', 'block_xp')); $tabs[] = new tabobject('levels', new moodle_url('/blocks/xp/levels.php', array('courseid' => $courseid)), get_string('navlevels', 'block_xp')); $tabs[] = new tabobject('rules', new moodle_url('/blocks/xp/rules.php', array('courseid' => $courseid)), get_string('navrules', 'block_xp')); $tabs[] = new tabobject('visuals', new moodle_url('/blocks/xp/visuals.php', array('courseid' => $courseid)), get_string('navvisuals', 'block_xp')); $tabs[] = new tabobject('config', new moodle_url('/blocks/xp/config.php', array('courseid' => $courseid)), get_string('navsettings', 'block_xp')); } // If there is only one page, then that is the page we are on. if (count($tabs) == 1) { return ''; } return $this->tabtree($tabs, $page); }
/** * Outputs the navigation. * * @param block_xp_manager $manager The manager. * @param string $page The page we are on. * @return string The navigation. */ public function navigation($manager, $page) { $tabs = array(); $courseid = $manager->get_courseid(); $context = context_course::instance($courseid); $canedit = has_capability('block/xp:addinstance', $context); if ($manager->get_config('enableinfos') || $canedit) { $tabs[] = new tabobject('infos', new moodle_url('/blocks/xp/infos.php', array('courseid' => $courseid)), get_string('navinfos', 'block_xp')); } if ($manager->get_config('enableladder') || $canedit) { $tabs[] = new tabobject('ladder', new moodle_url('/blocks/xp/ladder.php', array('courseid' => $courseid)), get_string('navladder', 'block_xp')); } if ($canedit) { $tabs[] = new tabobject('report', new moodle_url('/blocks/xp/report.php', array('courseid' => $courseid)), get_string('navreport', 'block_xp')); $tabs[] = new tabobject('log', new moodle_url('/blocks/xp/log.php', array('courseid' => $courseid)), get_string('navlog', 'block_xp')); $tabs[] = new tabobject('levels', new moodle_url('/blocks/xp/levels.php', array('courseid' => $courseid)), get_string('navlevels', 'block_xp')); $tabs[] = new tabobject('rules', new moodle_url('/blocks/xp/rules.php', array('courseid' => $courseid)), get_string('navrules', 'block_xp')); $tabs[] = new tabobject('visuals', new moodle_url('/blocks/xp/visuals.php', array('courseid' => $courseid)), get_string('navvisuals', 'block_xp')); $tabs[] = new tabobject('config', new moodle_url('/blocks/xp/config.php', array('courseid' => $courseid)), get_string('navsettings', 'block_xp')); } // If there is only one page, then that is the page we are on. if (count($tabs) == 1) { return ''; } return $this->tabtree($tabs, $page); }