MDL-45943: Replacement for publisher icons
[moodle.git] / mod / scorm / tabs.php
blob45cf9fe2d802db8f22db63aa113b81f92eb3ea40
1 <?php
2 // This file is part of Moodle - http://moodle.org/
3 //
4 // Moodle is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // Moodle is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
17 /**
18 * Sets up the tabs used by the scorm pages based on the users capabilities.
20 * @author Dan Marsden and others.
21 * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
22 * @package scorm
25 if (empty($scorm)) {
26 error('You cannot call this script in that way');
28 if (!isset($currenttab)) {
29 $currenttab = '';
31 if (!isset($cm)) {
32 $cm = get_coursemodule_from_instance('scorm', $scorm->id);
35 $contextmodule = context_module::instance($cm->id);
37 $tabs = array();
38 $row = array();
39 $inactive = array();
40 $activated = array();
42 if (has_capability('mod/scorm:savetrack', $contextmodule)) {
43 $row[] = new tabobject('info', "$CFG->wwwroot/mod/scorm/view.php?id=$cm->id", get_string('info', 'scorm'));
45 if (has_capability('mod/scorm:viewreport', $contextmodule)) {
46 $row[] = new tabobject('reports', "$CFG->wwwroot/mod/scorm/report.php?id=$cm->id", get_string('reports', 'scorm'));
49 if ($currenttab == 'info' && count($row) == 1) {
50 // Don't show only an info tab (e.g. to students).
51 } else {
52 $tabs[] = $row;
55 if ($currenttab == 'reports' && !empty($reportlist) && count($reportlist) > 1) {
56 $row2 = array();
57 foreach ($reportlist as $rep) {
58 $row2[] = new tabobject('scorm_'.$rep, $CFG->wwwroot."/mod/scorm/report.php?id=$cm->id&mode=$rep", get_string('pluginname', 'scormreport_'.$rep));
60 $tabs[] = $row2;
63 print_tabs($tabs, $currenttab, $inactive, $activated);