|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 // This file is part of Moodle - http://moodle.org/ 00003 // 00004 // Moodle is free software: you can redistribute it and/or modify 00005 // it under the terms of the GNU General Public License as published by 00006 // the Free Software Foundation, either version 3 of the License, or 00007 // (at your option) any later version. 00008 // 00009 // Moodle is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 // GNU General Public License for more details. 00013 // 00014 // You should have received a copy of the GNU General Public License 00015 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 00016 00024 defined('MOODLE_INTERNAL') OR die('not allowed'); 00025 00026 $tabs = array(); 00027 $row = array(); 00028 $inactive = array(); 00029 $activated = array(); 00030 00031 //some pages deliver the cmid instead the id 00032 if (isset($cmid) AND intval($cmid) AND $cmid > 0) { 00033 $usedid = $cmid; 00034 } else { 00035 $usedid = $id; 00036 } 00037 00038 if (!$context = get_context_instance(CONTEXT_MODULE, $usedid)) { 00039 print_error('badcontext'); 00040 } 00041 00042 00043 $courseid = optional_param('courseid', false, PARAM_INT); 00044 // $current_tab = $SESSION->feedback->current_tab; 00045 if (!isset($current_tab)) { 00046 $current_tab = ''; 00047 } 00048 00049 $viewurl = new moodle_url('/mod/feedback/view.php', array('id'=>$usedid, 'do_show'=>'view')); 00050 $row[] = new tabobject('view', $viewurl->out(), get_string('overview', 'feedback')); 00051 00052 if (has_capability('mod/feedback:edititems', $context)) { 00053 $editurl = new moodle_url('/mod/feedback/edit.php', array('id'=>$usedid, 'do_show'=>'edit')); 00054 $row[] = new tabobject('edit', $editurl->out(), get_string('edit_items', 'feedback')); 00055 00056 $templateurl = new moodle_url('/mod/feedback/edit.php', array('id'=>$usedid, 'do_show'=>'templates')); 00057 $row[] = new tabobject('templates', $templateurl->out(), get_string('templates', 'feedback')); 00058 } 00059 00060 if (has_capability('mod/feedback:viewreports', $context)) { 00061 if ($feedback->course == SITEID) { 00062 $url_params = array('id'=>$usedid, 'courseid'=>$courseid, 'do_show'=>'analysis'); 00063 $analysisurl = new moodle_url('/mod/feedback/analysis_course.php', $url_params); 00064 $row[] = new tabobject('analysis', 00065 $analysisurl->out(), 00066 get_string('analysis', 'feedback')); 00067 00068 } else { 00069 $url_params = array('id'=>$usedid, 'courseid'=>$courseid, 'do_show'=>'analysis'); 00070 $analysisurl = new moodle_url('/mod/feedback/analysis.php', $url_params); 00071 $row[] = new tabobject('analysis', 00072 $analysisurl->out(), 00073 get_string('analysis', 'feedback')); 00074 } 00075 00076 $url_params = array('id'=>$usedid, 'do_show'=>'showentries'); 00077 $reporturl = new moodle_url('/mod/feedback/show_entries.php', $url_params); 00078 $row[] = new tabobject('showentries', 00079 $reporturl->out(), 00080 get_string('show_entries', 'feedback')); 00081 00082 if ($feedback->anonymous == FEEDBACK_ANONYMOUS_NO AND $feedback->course != SITEID) { 00083 $nonrespondenturl = new moodle_url('/mod/feedback/show_nonrespondents.php', array('id'=>$usedid)); 00084 $row[] = new tabobject('nonrespondents', 00085 $nonrespondenturl->out(), 00086 get_string('show_nonrespondents', 'feedback')); 00087 } 00088 } 00089 00090 if (count($row) > 1) { 00091 $tabs[] = $row; 00092 00093 print_tabs($tabs, $current_tab, $inactive, $activated); 00094 } 00095