Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MDL-35000 quiz: Complete activity report broken by bad require.

Fix the stupid error that caused this. Also, make all the other
require_once calls in the file consistent.
  • Loading branch information...
commit fa0ed51c0afd17a47c64470b987fa7b1e6135574 1 parent 7033316
@timhunt timhunt authored
Showing with 9 additions and 12 deletions.
  1. +9 −12 mod/quiz/lib.php
View
21 mod/quiz/lib.php
@@ -373,7 +373,7 @@ function quiz_has_grades($quiz) {
*/
function quiz_user_outline($course, $user, $mod, $quiz) {
global $DB, $CFG;
- require_once("$CFG->libdir/gradelib.php");
+ require_once($CFG->libdir . '/gradelib.php');
$grades = grade_get_grades($course->id, 'mod', 'quiz', $quiz->id, $user->id);
if (empty($grades->items[0]->grades)) {
@@ -411,7 +411,7 @@ function quiz_user_outline($course, $user, $mod, $quiz) {
function quiz_user_complete($course, $user, $mod, $quiz) {
global $DB, $CFG, $OUTPUT;
require_once($CFG->libdir . '/gradelib.php');
- require_once($CFG->libdir . '/mod/quiz/locallib.php');
+ require_once($CFG->dirroot . '/mod/quiz/locallib.php');
$grades = grade_get_grades($course->id, 'mod', 'quiz', $quiz->id, $user->id);
if (!empty($grades->items[0]->grades)) {
@@ -603,7 +603,7 @@ function quiz_format_question_grade($quiz, $grade) {
*/
function quiz_update_grades($quiz, $userid = 0, $nullifnone = true) {
global $CFG, $DB;
- require_once($CFG->libdir.'/gradelib.php');
+ require_once($CFG->libdir . '/gradelib.php');
if ($quiz->grade == 0) {
quiz_grade_item_update($quiz);
@@ -661,7 +661,7 @@ function quiz_upgrade_grades() {
function quiz_grade_item_update($quiz, $grades = null) {
global $CFG, $OUTPUT;
require_once($CFG->dirroot . '/mod/quiz/locallib.php');
- require_once($CFG->libdir.'/gradelib.php');
+ require_once($CFG->libdir . '/gradelib.php');
if (array_key_exists('cmidnumber', $quiz)) { // May not be always present.
$params = array('itemname' => $quiz->name, 'idnumber' => $quiz->cmidnumber);
@@ -792,7 +792,7 @@ function quiz_refresh_events($courseid = 0) {
function quiz_get_recent_mod_activity(&$activities, &$index, $timestart,
$courseid, $cmid, $userid = 0, $groupid = 0) {
global $CFG, $COURSE, $USER, $DB;
- require_once('locallib.php');
+ require_once($CFG->dirroot . '/mod/quiz/locallib.php');
if ($COURSE->id == $courseid) {
$course = $COURSE;
@@ -1308,15 +1308,13 @@ function quiz_reset_gradebook($courseid, $type='') {
*/
function quiz_reset_userdata($data) {
global $CFG, $DB;
- require_once($CFG->libdir.'/questionlib.php');
+ require_once($CFG->libdir . '/questionlib.php');
$componentstr = get_string('modulenameplural', 'quiz');
$status = array();
// Delete attempts.
if (!empty($data->reset_quiz_attempts)) {
- require_once($CFG->libdir . '/questionlib.php');
-
question_engine::delete_questions_usage_by_activities(new qubaid_join(
'{quiz_attempts} quiza JOIN {quiz} quiz ON quiza.quiz = quiz.id',
'quiza.uniqueid', 'quiz.course = :quizcourseid',
@@ -1364,8 +1362,7 @@ function quiz_reset_userdata($data) {
*/
function quiz_check_file_access($attemptuniqueid, $questionid, $context = null) {
global $USER, $DB, $CFG;
- require_once(dirname(__FILE__).'/attemptlib.php');
- require_once(dirname(__FILE__).'/locallib.php');
+ require_once($CFG->dirroot . '/mod/quiz/locallib.php');
$attempt = $DB->get_record('quiz_attempts', array('uniqueid' => $attemptuniqueid));
$attemptobj = quiz_attempt::create($attempt->id);
@@ -1570,7 +1567,7 @@ function quiz_supports($feature) {
*/
function quiz_get_extra_capabilities() {
global $CFG;
- require_once($CFG->libdir.'/questionlib.php');
+ require_once($CFG->libdir . '/questionlib.php');
$caps = question_get_all_capabilities();
$caps[] = 'moodle/site:accessallgroups';
return $caps;
@@ -1599,7 +1596,7 @@ function quiz_extend_navigation($quiznode, $course, $module, $cm) {
}
if (has_any_capability(array('mod/quiz:viewreports', 'mod/quiz:grade'), $context)) {
- require_once($CFG->dirroot.'/mod/quiz/report/reportlib.php');
+ require_once($CFG->dirroot . '/mod/quiz/report/reportlib.php');
$reportlist = quiz_report_list($context);
$url = new moodle_url('/mod/quiz/report.php',
Please sign in to comment.
Something went wrong with that request. Please try again.