diff --git a/mod/scorm/lang/en/scorm.php b/mod/scorm/lang/en/scorm.php
index 001315a31b227..2a3f6afead490 100644
--- a/mod/scorm/lang/en/scorm.php
+++ b/mod/scorm/lang/en/scorm.php
@@ -15,7 +15,7 @@
// along with Moodle. If not, see .
/**
- * Strings for component 'scorm', language 'en', branch 'MOODLE_20_STABLE'
+ * Strings for component 'scorm', language 'en'
*
* @package scorm
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
diff --git a/mod/scorm/report.php b/mod/scorm/report.php
index c9e71a4ae8cc2..ca6618f77903c 100644
--- a/mod/scorm/report.php
+++ b/mod/scorm/report.php
@@ -22,24 +22,18 @@
require_once($CFG->dirroot.'/mod/scorm/reportsettings_form.php');
require_once($CFG->dirroot.'/mod/scorm/report/reportlib.php');
require_once($CFG->libdir.'/formslib.php');
-include_once("report/default.php"); // Parent class
+require_once($CFG->dirroot.'/mod/scorm/report/default.php'); // Parent class
define('SCORM_REPORT_DEFAULT_PAGE_SIZE', 20);
define('SCORM_REPORT_ATTEMPTS_ALL_STUDENTS', 0);
define('SCORM_REPORT_ATTEMPTS_STUDENTS_WITH', 1);
define('SCORM_REPORT_ATTEMPTS_STUDENTS_WITH_NO', 2);
$id = required_param('id', PARAM_INT);// Course Module ID, or
-
-$action = optional_param('action', '', PARAM_ALPHA);
-$attemptids = optional_param('attemptid', array(), PARAM_RAW);
$download = optional_param('download', '', PARAM_RAW);
$mode = optional_param('mode', '', PARAM_ALPHA); // Report mode
$url = new moodle_url('/mod/scorm/report.php');
-if ($action !== '') {
- $url->param('action', $action);
-}
if ($mode !== '') {
$url->param('mode', $mode);
}
@@ -48,7 +42,7 @@
$cm = get_coursemodule_from_id('scorm', $id, 0, false, MUST_EXIST);
$course = $DB->get_record('course', array('id'=>$cm->course), '*', MUST_EXIST);
$scorm = $DB->get_record('scorm', array('id'=>$cm->instance), '*', MUST_EXIST);
-
+
$PAGE->set_url($url);
require_login($course->id, false, $cm);
@@ -57,6 +51,11 @@
require_capability('mod/scorm:viewreport', $contextmodule);
+$reportlist = scorm_report_list($contextmodule);
+if (count($reportlist) < 1) {
+ print_error('erroraccessingreport', 'scorm');
+}
+
add_to_log($course->id, 'scorm', 'report', 'report.php?id='.$cm->id, $scorm->id, $cm->id);
$userdata = null;
if (!empty($download)) {
@@ -64,7 +63,6 @@
}
/// Print the page header
if (empty($noheader)) {
-
$strreport = get_string('report', 'scorm');
$strattempt = get_string('attempt', 'scorm');
@@ -78,51 +76,16 @@
echo $OUTPUT->heading(format_string($scorm->name));
}
-if ($action == 'delete' && has_capability('mod/scorm:deleteresponses', $contextmodule) && confirm_sesskey()) {
- if (scorm_delete_responses($attemptids, $scorm)) { //delete responses.
- add_to_log($course->id, 'scorm', 'delete attempts', 'report.php?id=' . $cm->id, implode(",", $attemptids), $cm->id);
- echo $OUTPUT->notification(get_string('scormresponsedeleted', 'scorm'), 'notifysuccess');
- }
-}
-$reportlist = scorm_report_list($contextmodule);
-if (count($reportlist)==0){
- print_error('erroraccessingreport', 'scorm');
-}
-
if (empty($mode)) {
-// Default to listing of plugins.
- foreach ($reportlist as $reportname) {
- $reportclassname = "scorm_{$reportname}_report";
- $report = new $reportclassname();
- $html = $report->canview($id,$contextmodule);
- if (!empty($html)) {
- echo '
';
- echo $html;
- echo '
';
- }
- }
-//end of default mode condition.
-} else if (!in_array($mode, $reportlist)){
+ $mode = reset($reportlist);
+} else if (!in_array($mode, $reportlist)) {
print_error('erroraccessingreport', 'scorm');
}
-// Open the selected Scorm report and display it
-// DISPLAY PLUGIN REPORT
-if(!empty($mode))
-{
- $reportclassname = "scorm_{$mode}_report";
- if (!class_exists($reportclassname)) {
- print_error('reportnotfound', 'scorm', '', $mode);
- }
- $report = new $reportclassname();
-
- if (!$report->display($scorm, $cm, $course, $attemptids, $action, $download)) { // Run the report!
- print_error("preprocesserror", 'scorm');
- }
- if (!$report->settings($scorm, $cm, $course)) { // Run the report!
- print_error("preprocesserror", 'scorm');
- }
-}
+// Open the selected Scorm report and display it
+$reportclassname = "scorm_{$mode}_report";
+$report = new $reportclassname();
+$report->display($scorm, $cm, $course, $download); // Run the report!
// Print footer
diff --git a/mod/scorm/report/basic/lang/en/scorm_basic.php b/mod/scorm/report/basic/lang/en/scorm_basic.php
index 8d89e6333ef8d..76eb35a8ef4b7 100644
--- a/mod/scorm/report/basic/lang/en/scorm_basic.php
+++ b/mod/scorm/report/basic/lang/en/scorm_basic.php
@@ -15,12 +15,12 @@
// along with Moodle. If not, see .
/**
- * Strings for component 'scorm_basic', language 'en', branch 'MOODLE_20_STABLE'
+ * Strings for component 'scorm_basic' report plugin
*
* @package scorm_basic
* @author Ankit Kumar Agarwal
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-$string['pluginname'] = 'Basic Reporting';
+$string['pluginname'] = 'Basic Report';
diff --git a/mod/scorm/report/basic/report.php b/mod/scorm/report/basic/report.php
index 5cc7b548aa552..836eb56096674 100644
--- a/mod/scorm/report/basic/report.php
+++ b/mod/scorm/report/basic/report.php
@@ -20,29 +20,35 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-if (!defined('MOODLE_INTERNAL')) {
- die('Direct access to this script is forbidden.');// It must be included from a Moodle page
-}
+defined('MOODLE_INTERNAL') || die();
+
class scorm_basic_report extends scorm_default_report {
/**
- * Displays the report.
+ * displays the full report
+ * @param stdClass $scorm full SCORM object
+ * @param stdClass $cm - full course_module object
+ * @param stdClass $course - full course object
+ * @param string $download - type of download being requested
*/
- function display($scorm, $cm, $course, $attemptids, $action, $download) {
- global $CFG, $DB, $OUTPUT;
+ function display($scorm, $cm, $course, $download) {
+ global $CFG, $DB, $OUTPUT, $PAGE;
$contextmodule= get_context_instance(CONTEXT_MODULE, $cm->id);
+ $action = optional_param('action', '', PARAM_ALPHA);
+ $attemptids = optional_param('attemptid', array(), PARAM_RAW);
- // No options, show the global scorm report
- $pageoptions = array();
- $pageoptions['id'] = $cm->id;
- $pageoptions['mode'] = "basic";
- $reporturl = new moodle_url($CFG->wwwroot.'/mod/scorm/report.php', $pageoptions);
+ if ($action == 'delete' && has_capability('mod/scorm:deleteresponses', $contextmodule) && confirm_sesskey()) {
+ if (scorm_delete_responses($attemptids, $scorm)) { //delete responses.
+ add_to_log($course->id, 'scorm', 'delete attempts', 'report.php?id=' . $cm->id, implode(",", $attemptids), $cm->id);
+ echo $OUTPUT->notification(get_string('scormresponsedeleted', 'scorm'), 'notifysuccess');
+ }
+ }
// detailed report
- $mform = new mod_scorm_report_settings( $reporturl, compact('currentgroup') );
+ $mform = new mod_scorm_report_settings($PAGE->url, compact('currentgroup'));
if ($fromform = $mform->get_data()) {
$detailedrep = $fromform->detailedrep;
$pagesize = $fromform->pagesize;
- $attemptsmode = $fromform->attemptsmode;
+ $attemptsmode = !empty($fromform->attemptsmode) ? $fromform->attemptsmode : SCORM_REPORT_ATTEMPTS_ALL_STUDENTS;
set_user_preference('scorm_report_detailed', $detailedrep);
set_user_preference('scorm_report_pagesize', $pagesize);
} else {
@@ -55,15 +61,10 @@ function display($scorm, $cm, $course, $attemptids, $action, $download) {
}
// select group menu
- $displayoptions = array();
- $displayoptions['id'] = $cm->id;
- $displayoptions['mode'] = "basic";
- $displayoptions['attemptsmode'] = $attemptsmode;
- $reporturlwithdisplayoptions = new moodle_url($CFG->wwwroot.'/mod/scorm/report.php', $displayoptions);
-
+ $PAGE->url->param('attemptsmode', $attemptsmode);
if ($groupmode = groups_get_activity_groupmode($cm)) { // Groups are being used
if (!$download) {
- groups_print_activity_menu($cm, $reporturlwithdisplayoptions->out());
+ groups_print_activity_menu($cm, $PAGE->url);
}
}
@@ -141,7 +142,7 @@ function display($scorm, $cm, $course, $attemptids, $action, $download) {
$table->define_columns($columns);
$table->define_headers($headers);
- $table->define_baseurl($reporturlwithdisplayoptions->out());
+ $table->define_baseurl($PAGE->url);
$table->sortable(true);
$table->collapsible(true);
@@ -338,12 +339,12 @@ function display($scorm, $cm, $course, $attemptids, $action, $download) {
if ($candelete) {
// Start form
$strreallydel = addslashes_js(get_string('deleteattemptcheck', 'scorm'));
- echo '