More work done on the Workshop Plan UI
[moodle.git] / mod / workshop / tabs.php
CommitLineData
b761e6d9
DM
1<?php
2
3// This file is part of Moodle - http://moodle.org/
4//
5// Moodle is free software: you can redistribute it and/or modify
6// it under the terms of the GNU General Public License as published by
7// the Free Software Foundation, either version 3 of the License, or
8// (at your option) any later version.
9//
10// Moodle is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
17
18/**
19 * Defines and prints the workshop navigation tabs
20 *
21 * Can be included from within a workshop script only
22 *
23 * @package mod-workshop
24 * @copyright 2009 David Mudrak <david.mudrak@gmail.com>
25 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
26 */
27
28defined('MOODLE_INTERNAL') || die();
29
30if (empty($workshop) or !is_a($workshop, 'workshop')) {
31 print_error('cannotcallscript');
32}
33if (!isset($currenttab)) {
34 $currenttab = 'info';
35}
36
37$tabs = array();
38$row = array();
39$inactive = array();
40$activated = array();
41
42// top level tabs
da0b1f70 43if (has_capability('mod/workshop:view', $workshop->context)) {
b761e6d9
DM
44 $row[] = new tabobject('info', $workshop->view_url()->out(), get_string('info', 'workshop'));
45}
da0b1f70 46if (has_capability('mod/workshop:editdimensions', $workshop->context)) {
b761e6d9
DM
47 $row[] = new tabobject('editform', $workshop->editform_url()->out(), get_string('editassessmentform', 'workshop'));
48}
da0b1f70
DM
49if (has_capability('mod/workshop:submit', $workshop->context)) {
50 $row[] = new tabobject('submission', $workshop->submission_url()->out(), get_string('editsubmission', 'workshop'));
51}
b761e6d9
DM
52$tabs[] = $row;
53
54print_tabs($tabs, $currenttab, $inactive, $activated);