mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 17:06:53 +02:00
MDL-44902: Deprecating mod/lti/grade.php
This commit is contained in:
parent
8fa50fdd34
commit
85fc655667
1 changed files with 9 additions and 107 deletions
|
@ -44,21 +44,17 @@
|
|||
* @author Nikolas Galanis
|
||||
* @author Chris Scribner
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @deprecated since 2.8
|
||||
*/
|
||||
|
||||
require_once("../../config.php");
|
||||
require_once($CFG->dirroot.'/mod/lti/lib.php');
|
||||
require_once($CFG->libdir.'/plagiarismlib.php');
|
||||
require_once(dirname(dirname(__DIR__)).'/config.php');
|
||||
|
||||
$id = optional_param('id', 0, PARAM_INT); // Course module ID
|
||||
$l = optional_param('l', 0, PARAM_INT); // lti instance ID
|
||||
$mode = optional_param('mode', 'all', PARAM_ALPHA); // What mode are we in?
|
||||
$download = optional_param('download' , 'none', PARAM_ALPHA); //ZIP download asked for?
|
||||
$id = optional_param('id', 0, PARAM_INT);
|
||||
$l = optional_param('l', 0, PARAM_INT);
|
||||
|
||||
if ($l) { // Two ways to specify the module
|
||||
if ($l) {
|
||||
$lti = $DB->get_record('lti', array('id' => $l), '*', MUST_EXIST);
|
||||
$cm = get_coursemodule_from_instance('lti', $lti->id, $lti->course, false, MUST_EXIST);
|
||||
|
||||
} else {
|
||||
$cm = get_coursemodule_from_id('lti', $id, 0, false, MUST_EXIST);
|
||||
$lti = $DB->get_record('lti', array('id' => $cm->instance), '*', MUST_EXIST);
|
||||
|
@ -67,103 +63,9 @@ if ($l) { // Two ways to specify the module
|
|||
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
|
||||
|
||||
require_login($course, false, $cm);
|
||||
$context = context_module::instance($cm->id);
|
||||
require_capability('mod/lti:view', $context);
|
||||
require_capability('mod/lti:view', context_module::instance($cm->id));
|
||||
|
||||
debugging('This file has been deprecated. Links to this file should automatically '.
|
||||
'fallback to /mod/lti/view.php once this file has been deleted.', DEBUG_DEVELOPER);
|
||||
|
||||
// Redirecting to lti view. May need to wrap this in config.
|
||||
redirect(new moodle_url('/mod/lti/view.php', array('l' => $lti->id)));
|
||||
|
||||
$url = new moodle_url('/mod/lti/grade.php', array('id' => $cm->id));
|
||||
if ($mode !== 'all') {
|
||||
$url->param('mode', $mode);
|
||||
}
|
||||
$PAGE->set_url($url);
|
||||
|
||||
$module = array(
|
||||
'name' => 'mod_lti_submissions',
|
||||
'fullpath' => '/mod/lti/submissions.js',
|
||||
'requires' => array('base', 'yui2-datatable'),
|
||||
'strings' => array(),
|
||||
);
|
||||
|
||||
$PAGE->requires->js_init_call('M.mod_lti.submissions.init', array(), true, $module);
|
||||
|
||||
$submissionquery = '
|
||||
SELECT s.id, u.firstname, u.lastname, u.id AS userid, s.datesubmitted, s.gradepercent
|
||||
FROM {lti_submission} s
|
||||
INNER JOIN {user} u ON s.userid = u.id
|
||||
WHERE s.ltiid = :ltiid
|
||||
ORDER BY s.datesubmitted DESC
|
||||
';
|
||||
|
||||
$submissions = $DB->get_records_sql($submissionquery, array('ltiid' => $lti->id));
|
||||
|
||||
$html = '
|
||||
<noscript>
|
||||
<!-- If javascript is disabled, we need to show the table using CSS.
|
||||
The table starts out hidden to avoid flickering as it loads -->
|
||||
<style type="text/css">
|
||||
#lti_submissions_table_container { display: block !important; }
|
||||
</style>
|
||||
</noscript>
|
||||
|
||||
<div id="lti_submissions_table_container" style="display:none">
|
||||
<table id="lti_submissions_table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>User</th>
|
||||
<th>Date</th>
|
||||
<th>Grade</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<!--table body-->
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
';
|
||||
|
||||
$rowtemplate = '
|
||||
<tr>
|
||||
<td>
|
||||
<!--firstname--> <!--lastname-->
|
||||
</td>
|
||||
<td>
|
||||
<!--datesubmitted-->
|
||||
</td>
|
||||
<td>
|
||||
<!--gradepercent-->
|
||||
</td>
|
||||
</tr>
|
||||
';
|
||||
|
||||
$rows = '';
|
||||
|
||||
foreach ($submissions as $submission) {
|
||||
$row = $rowtemplate;
|
||||
|
||||
foreach ($submission as $key => $value) {
|
||||
if ($key === 'datesubmitted') {
|
||||
$value = userdate($value);
|
||||
}
|
||||
|
||||
$row = str_replace('<!--' . $key . '-->', $value, $row);
|
||||
}
|
||||
|
||||
$rows .= $row;
|
||||
}
|
||||
|
||||
$table = str_replace('<!--table body-->', $rows, $html);
|
||||
|
||||
$title = get_string('submissionsfor', 'lti', $lti->name);
|
||||
|
||||
$PAGE->set_title($title);
|
||||
$PAGE->set_heading($course->fullname);
|
||||
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading(format_string($lti->name, true, array('context' => $context)));
|
||||
echo $OUTPUT->heading(get_string('submissions', 'lti'), 3);
|
||||
|
||||
echo $table;
|
||||
|
||||
echo $OUTPUT->footer();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue