Skip to content

Commit

Permalink
MDL-27522 SCORM tidy up commit
Browse files Browse the repository at this point in the history
  • Loading branch information
danmarsden committed Jun 12, 2011
1 parent b4baa7f commit 2875714
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 14 deletions.
4 changes: 2 additions & 2 deletions mod/scorm/report.php
Expand Up @@ -427,7 +427,7 @@
$row[] = '-';
$row[] = '-';
} else {
if (!$download) $row[] = '<a href="reportuser.php?a='.$scorm->id.'&amp;user='.$scouser->userid.'&amp;attempt='.$scouser->attempt.'">'.$scouser->attempt.'</a>';
if (!$download) $row[] = '<a href="userreport.php?a='.$scorm->id.'&amp;user='.$scouser->userid.'&amp;attempt='.$scouser->attempt.'">'.$scouser->attempt.'</a>';
else $row[] = $scouser->attempt;
if ($download =='ODS' || $download =='Excel' ) $row[] = userdate($timetracks->start, get_string("strftimedatetime", "langconfig"));
else $row[] = userdate($timetracks->start);
Expand Down Expand Up @@ -463,7 +463,7 @@
}
if (!$download) {
$row[] = '<img src="'.$OUTPUT->pix_url($trackdata->status, 'scorm').'" alt="'.$strstatus.'" title="'.$strstatus.'" /><br/>
<a href="reportuser.php?b='.$sco->id.'&amp;user='.$scouser->userid.'&amp;attempt='.$scouser->attempt.
<a href="userreport.php?b='.$sco->id.'&amp;user='.$scouser->userid.'&amp;attempt='.$scouser->attempt.
'" title="'.get_string('details', 'scorm').'">'.$score.'</a>';
} else {
$row[] = $score;
Expand Down
40 changes: 28 additions & 12 deletions mod/scorm/userreport.php
@@ -1,6 +1,28 @@
<?php

// Includes and parameters from old scorm report file
// 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 page displays the user data from a single attempt
*
* @package mod
* @subpackage scorm
* @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($CFG->dirroot.'/mod/scorm/locallib.php');
Expand All @@ -12,7 +34,6 @@
$b = optional_param('b', '', PARAM_INT); // SCO ID
$attempt = optional_param('attempt', '1', PARAM_INT); // attempt number


// Building the url to use for links.+ data details buildup
$url = new moodle_url('/mod/scorm/userreport.php');
$url->param('user', $user);
Expand All @@ -21,7 +42,6 @@
$url->param('attempt', $attempt);
}


if (!empty($id)) {
$url->param('id', $id);
$cm = get_coursemodule_from_id('scorm', $id, 0, false, MUST_EXIST);
Expand All @@ -45,16 +65,16 @@

// checking login +logging +getting context
require_login($course->id, false, $cm);
$contextmodule= get_context_instance(CONTEXT_MODULE, $cm->id);
$contextmodule = get_context_instance(CONTEXT_MODULE, $cm->id);
require_capability('mod/scorm:viewreport', $contextmodule);

add_to_log($course->id, 'scorm', 'userreport', 'userreport.php?id='.$cm->id, $scorm->id, $cm->id);
$userdata = scorm_get_user_data($user);
// END of checking login +logging +getting context

// Print the page header
$strreport = get_string('report', 'scorm');
$strattempt = get_string('attempt', 'scorm');


$PAGE->set_title("$course->shortname: ".format_string($scorm->name));
$PAGE->set_heading($course->fullname);
$PAGE->navbar->add($strreport, new moodle_url('/mod/scorm/report.php', array('id'=>$cm->id)));
Expand All @@ -71,11 +91,10 @@
echo $OUTPUT->heading(format_string($scorm->name));
// End of Print the page header

//Parameter Checking +Capabality Check
//Parameter Checking
if (empty ($userdata)) {
print_error('missingparameter');
}
require_capability('mod/scorm:viewreport', $contextmodule);

//printing user details
echo $OUTPUT->box_start('generalbox boxaligncenter');
Expand All @@ -87,8 +106,6 @@
echo '</div>'."\n";
echo $OUTPUT->box_end();

// User SCORM report

if ($scoes = $DB->get_records_select('scorm_scoes', "scorm=? ORDER BY id", array($scorm->id))) {
// Print general score data
$table = new html_table();
Expand Down Expand Up @@ -137,7 +154,6 @@

if (!empty($b)) {
echo $OUTPUT->box_start('generalbox boxaligncenter');
//print_heading(format_string($sco->title));
echo $OUTPUT->heading('<a href="'.$CFG->wwwroot.'/mod/scorm/player.php?a='.$scorm->id.'&amp;mode=browse&amp;scoid='.$sco->id.'" target="_new">'.format_string($sco->title).'</a>');
echo '<div class="mdl-align">'."\n";
$scoreview = '';
Expand Down Expand Up @@ -322,4 +338,4 @@
}
// Print footer

echo $OUTPUT->footer();
echo $OUTPUT->footer();

0 comments on commit 2875714

Please sign in to comment.