The todos in mod/quiz/addrandom.php:
//setting the second parameter of process_randomquestion_formdata to true causes it to redirect on success
//TODO: process if returns false?
quiz_process_randomquestion_formdata($qcobject,true, $cmid);
The correct way to handle the error condition if the function returns false is to call print_error with appropriate arguments.
And I think it is pretty bad that quiz_process_randomquestion_formdata sometimes redirects and sometimes does not. It would be better if it always returned, and the redirect, which is only needed by addrandom.php, was there.
Actually, I think you can skip logging when the add category form is displayed, but you should log when the category is actually added.
The todos in mod/quiz/addrandom.php:
//setting the second parameter of process_randomquestion_formdata to true causes it to redirect on success
//TODO: process if returns false?
quiz_process_randomquestion_formdata($qcobject,true, $cmid);
The correct way to handle the error condition if the function returns false is to call print_error with appropriate arguments.
And I think it is pretty bad that quiz_process_randomquestion_formdata sometimes redirects and sometimes does not. It would be better if it always returned, and the redirect, which is only needed by addrandom.php, was there.
Actually, I think you can skip logging when the add category form is displayed, but you should log when the category is actually added.