mod-survey MDL-20262 Upgraded survey module in the following ways

* Upgraded legacy code to use PAGE and OUTPUT methods
 * Added integration with the new navigation blocks
 * Fixed up several bugs within the download script
This commit is contained in:
samhemelryk 2009-09-17 04:11:46 +00:00
parent 785669995e
commit a5cb6242ae
6 changed files with 463 additions and 240 deletions

View file

@ -1,4 +1,27 @@
<?php // $Id$
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* This file is responsible for producing the survey reports
*
* @package mod-survey
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once("../../config.php");
require_once("lib.php");
@ -23,6 +46,21 @@
print_error('coursemisconf');
}
$url = new moodle_url($CFG->wwwroot.'/mod/survey/report.php', array('id'=>$id));
if ($action !== '') {
$url->param('action', $action);
}
if ($qid !== 0) {
$url->param('qid', $qid);
}
if ($student !== 0) {
$url->param('student', $student);
}
if ($notes !== '') {
$url->param('notes', $notes);
}
$PAGE->set_url($url);
require_login($course->id, false, $cm);
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
@ -56,7 +94,28 @@
add_to_log($course->id, "survey", "view report", "report.php?id=$cm->id", "$survey->id", $cm->id);
$PAGE->navbar->add($strreport);
switch ($action) {
case 'download':
$PAGE->navbar->add(get_string('downloadresults', 'survey'));
break;
case 'summary':
case 'scales':
case 'questions':
$PAGE->navbar->add($strreport);
$PAGE->navbar->add(${'str'.$action});
break;
case 'students':
$PAGE->navbar->add($strreport);
$PAGE->navbar->add(get_string('participants'));
break;
case '':
$PAGE->navbar->add($strreport);
$PAGE->navbar->add($strsummary);
break;
default:
$PAGE->navbar->add($strreport);
break;
}
$PAGE->set_title("$course->shortname: ".format_string($survey->name));
$PAGE->set_heading($course->fullname);