function question_new_attempt_uniqueid in Quiz 6.5
Same name and namespace in other branches
- 6.6 includes/moodle/lib/questionlib.php \question_new_attempt_uniqueid()
Returns the unique id for a new attempt
Every module can keep their own attempts table with their own sequential ids but the question code needs to also have a unique id by which to identify all these attempts. Hence a module, when creating a new attempt, calls this function and stores the return value in the 'uniqueid' field of its attempts table.
File
- includes/
moodle/ lib/ questionlib.php, line 1646
Code
function question_new_attempt_uniqueid($modulename = 'quiz') {
global $CFG;
$attempt = new stdClass();
$attempt->modulename = $modulename;
if (!($id = insert_record('question_attempts', $attempt))) {
error('Could not create new entry in question_attempts table');
}
return $id;
}