public static function QuizResultController::findOldResult in Quiz 7.5
Same name and namespace in other branches
- 7.6 includes/QuizResultController.class.inc \QuizResultController::findOldResult()
Find a result that is not the same as the passed result.
Note: the Quiz result does not have an actually exist - in that case, it will return the first completed result found.
3 calls to QuizResultController::findOldResult()
- QuizResultController::save in includes/
QuizResultController.class.inc - Save the Quiz result and do any post-processing to the result.
- quiz_result_form in ./
quiz.module - Quiz result edit form.
- quiz_take_page in ./
quiz.module - Page to either resume a quiz or display a start quiz form.
File
- includes/
QuizResultController.class.inc, line 114
Class
Code
public static function findOldResult($quiz_result) {
$efq = new EntityFieldQuery();
$result = $efq
->entityCondition('entity_type', 'quiz_result')
->propertyCondition('uid', $quiz_result->uid)
->propertyCondition('nid', $quiz_result->nid)
->propertyCondition('vid', $quiz_result->vid)
->propertyCondition('result_id', isset($quiz_result->result_id) ? $quiz_result->result_id : 0, '!=')
->propertyCondition('time_start', 0, '>')
->propertyOrderBy('time_start', 'DESC')
->range(0, 1)
->execute();
if (!empty($result['quiz_result'])) {
$old_quiz_result = reset($result['quiz_result']);
return quiz_result_load($old_quiz_result->result_id);
}
return FALSE;
}