//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);
if (!$newrandomcategory){
print_r($newquestioninfo);
print_error("cannotcreatecategory");
+ }else{
+ add_to_log($quiz->course, 'quiz', 'addcategory',
+ "view.php?id=$cm->id", "$newrandomcategory", $cm->id);
}
}