From: pilpi Date: Tue, 16 Dec 2008 22:36:29 +0000 (+0000) Subject: quiz editing: MDL-17417 added logging for random question creating X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=93cc3ea45eeaeaec5fb3cd0f9f3739d6188c67de;p=moodle.git quiz editing: MDL-17417 added logging for random question creating --- diff --git a/mod/quiz/addrandom.php b/mod/quiz/addrandom.php index 66696b8d94..2973128afe 100644 --- a/mod/quiz/addrandom.php +++ b/mod/quiz/addrandom.php @@ -32,9 +32,16 @@ //TODO: process if returns false? $newquestioninfo=quiz_process_randomquestion_formdata($qcobject); if($newquestioninfo){ - redirect($CFG->wwwroot."/mod/quiz/edit.php?cmid=$cmid&addonpage=$newquestioninfo->addonpage&addrandom=1&categoryid=$newquestioninfo->newrandomcategory&randomcount=1&sesskey=".sesskey()); + $newrandomcategory=$newquestioninfo->newrandomcategory; + if (!$newrandomcategory){ + print_r($newquestioninfo); + print_error("cannotcreatecategory"); + }else{ + add_to_log($quiz->course, 'quiz', 'addcategory', + "view.php?id=$cm->id", "$newrandomcategory", $cm->id); + redirect($CFG->wwwroot."/mod/quiz/edit.php?cmid=$cmid&addonpage=$newquestioninfo->addonpage&addrandom=1&categoryid=$newquestioninfo->newrandomcategory&randomcount=1&sesskey=".sesskey()); + } } - //these params are only passed from page request to request while we stay on this page //otherwise they would go in question_edit_setup $quiz_page = optional_param('quiz_page', 0, PARAM_SEQUENCE); diff --git a/mod/quiz/edit.php b/mod/quiz/edit.php index 0a2606bc69..00d2fe9e1b 100644 --- a/mod/quiz/edit.php +++ b/mod/quiz/edit.php @@ -249,6 +249,9 @@ if($newquestioninfo){ if (!$newrandomcategory){ print_r($newquestioninfo); print_error("cannotcreatecategory"); + }else{ + add_to_log($quiz->course, 'quiz', 'addcategory', + "view.php?id=$cm->id", "$newrandomcategory", $cm->id); } }