. /** * Defines and prints the workshop navigation tabs * * Can be included from within a workshop script only * * @package mod-workshop * @copyright 2009 David Mudrak * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); if (empty($workshop) or !is_a($workshop, 'workshop')) { print_error('cannotcallscript'); } if (!isset($currenttab)) { $currenttab = 'info'; } $tabs = array(); $row = array(); $inactive = array(); $activated = array(); // top level tabs if (has_capability('mod/workshop:view', $PAGE->context)) { $row[] = new tabobject('info', $workshop->view_url()->out(), get_string('info', 'workshop')); } if (has_capability('mod/workshop:editdimensions', $PAGE->context)) { $row[] = new tabobject('editform', $workshop->editform_url()->out(), get_string('editassessmentform', 'workshop')); } if ($currenttab == 'example' and has_any_capability(array('mod/workshop:submit', 'mod/workshop:manageexamples'), $PAGE->context)) { $row[] = new tabobject('example', '', get_string('example', 'workshop')); } if (has_capability('mod/workshop:submit', $PAGE->context)) { $row[] = new tabobject('submission', $workshop->submission_url()->out(), get_string('submission', 'workshop')); } if (has_capability('mod/workshop:allocate', $PAGE->context)) { $row[] = new tabobject('allocation', $workshop->allocation_url()->out(), get_string('allocate', 'workshop')); } if (has_capability('moodle/user:loginas', get_system_context())) { // todo remove these tools from a production release $row[] = new tabobject('loginas', "loginas.php?cmid={$cm->id}", 'Login as a random participant'); } $tabs[] = $row; if ($currenttab == 'allocation' and !empty($allocators)) { // this is included from allocation.php so we rely of some variables defined there $activated[] = 'allocation'; $row = array(); foreach ($allocators as $methodid => $methodname) { $row[] = new tabobject($methodid, "allocation.php?cmid={$cmid}&method={$methodid}", $methodname); if ($methodid == $method) { $currenttab = $methodid; } } $tabs[] = $row; } print_tabs($tabs, $currenttab, $inactive, $activated);