2009-11-01 14:55:15 +00:00
|
|
|
<?php
|
2008-04-23 09:33:54 +00:00
|
|
|
/**
|
|
|
|
* prints the tabbed bar
|
|
|
|
*
|
|
|
|
* @author Andreas Grabs
|
|
|
|
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
|
|
|
|
* @package feedback
|
|
|
|
*/
|
2010-03-28 10:00:24 +00:00
|
|
|
defined('MOODLE_INTERNAL') OR die('not allowed');
|
2008-04-23 09:33:54 +00:00
|
|
|
|
|
|
|
$tabs = array();
|
|
|
|
$row = array();
|
|
|
|
$inactive = array();
|
|
|
|
$activated = array();
|
|
|
|
|
2010-03-28 15:29:49 +00:00
|
|
|
//some pages deliver the cmid instead the id
|
|
|
|
if(isset($cmid) AND intval($cmid) AND $cmid > 0) {
|
|
|
|
$usedid = $cmid;
|
|
|
|
}else {
|
|
|
|
$usedid = $id;
|
|
|
|
}
|
|
|
|
|
2010-04-02 11:34:28 +00:00
|
|
|
if (!$context = get_context_instance(CONTEXT_MODULE, $usedid)) {
|
|
|
|
print_error('badcontext');
|
|
|
|
}
|
|
|
|
|
2010-03-28 15:29:49 +00:00
|
|
|
|
2008-04-23 09:33:54 +00:00
|
|
|
$courseid = optional_param('courseid', false, PARAM_INT);
|
|
|
|
// $current_tab = $SESSION->feedback->current_tab;
|
|
|
|
if (!isset($current_tab)) {
|
|
|
|
$current_tab = '';
|
|
|
|
}
|
|
|
|
|
2010-03-28 15:29:49 +00:00
|
|
|
$viewurl = new moodle_url('/mod/feedback/view.php', array('id'=>$usedid, 'do_show'=>'view'));
|
|
|
|
$row[] = new tabobject('view', $viewurl->out(), get_string('overview', 'feedback'));
|
2009-11-01 14:55:15 +00:00
|
|
|
|
2010-04-02 11:34:28 +00:00
|
|
|
if(has_capability('mod/feedback:edititems', $context)) {
|
2010-03-28 15:29:49 +00:00
|
|
|
$editurl = new moodle_url('/mod/feedback/edit.php', array('id'=>$usedid, 'do_show'=>'edit'));
|
|
|
|
$row[] = new tabobject('edit', $editurl->out(), get_string('edit_items', 'feedback'));
|
|
|
|
|
|
|
|
$templateurl = new moodle_url('/mod/feedback/edit.php', array('id'=>$usedid, 'do_show'=>'templates'));
|
|
|
|
$row[] = new tabobject('templates', $templateurl->out(), get_string('templates', 'feedback'));
|
2008-04-23 09:33:54 +00:00
|
|
|
}
|
2009-11-01 14:55:15 +00:00
|
|
|
|
2010-04-02 11:34:28 +00:00
|
|
|
if(has_capability('mod/feedback:viewreports', $context)) {
|
2008-04-23 09:33:54 +00:00
|
|
|
if($feedback->course == SITEID){
|
2010-03-28 15:29:49 +00:00
|
|
|
$analysisurl = new moodle_url('/mod/feedback/analysis_course.php', array('id'=>$usedid, 'courseid'=>$courseid, 'do_show'=>'analysis'));
|
|
|
|
$row[] = new tabobject('analysis', $analysisurl->out(), get_string('analysis', 'feedback'));
|
2008-04-23 09:33:54 +00:00
|
|
|
}else {
|
2010-03-28 15:29:49 +00:00
|
|
|
$analysisurl = new moodle_url('/mod/feedback/analysis.php', array('id'=>$usedid, 'courseid'=>$courseid, 'do_show'=>'analysis'));
|
|
|
|
$row[] = new tabobject('analysis', $analysisurl->out(), get_string('analysis', 'feedback'));
|
2008-04-23 09:33:54 +00:00
|
|
|
}
|
2010-04-02 11:34:28 +00:00
|
|
|
|
2010-03-28 15:29:49 +00:00
|
|
|
$reporturl = new moodle_url('/mod/feedback/show_entries.php', array('id'=>$usedid, 'do_show'=>'showentries'));
|
|
|
|
$row[] = new tabobject('showentries', $reporturl->out(), get_string('show_entries', 'feedback'));
|
2008-04-23 09:33:54 +00:00
|
|
|
}
|
2009-11-01 14:55:15 +00:00
|
|
|
|
2008-04-23 09:33:54 +00:00
|
|
|
if(count($row) > 1) {
|
|
|
|
$tabs[] = $row;
|
|
|
|
|
|
|
|
print_tabs($tabs, $current_tab, $inactive, $activated);
|
|
|
|
}
|
2009-11-01 14:55:15 +00:00
|
|
|
|