You are here

function quiz_access_to_score in Quiz 7.4

Same name and namespace in other branches
  1. 8.4 quiz.module \quiz_access_to_score()
  2. 6.4 quiz.module \quiz_access_to_score()
  3. 7.6 quiz.module \quiz_access_to_score()
  4. 7 quiz.module \quiz_access_to_score()
  5. 7.5 quiz.module \quiz_access_to_score()

Helper function to determine if a user has access to score a quiz.

Parameters

$quiz_creator: uid of the quiz creator.

6 calls to quiz_access_to_score()
LongAnswerResponse::getReportFormAnswerFeedback in question_types/long_answer/long_answer.classes.inc
LongAnswerResponse::getReportFormScore in question_types/long_answer/long_answer.classes.inc
Implementation of getReportFormScore
ShortAnswerResponse::getReportFormAnswerFeedback in question_types/short_answer/short_answer.classes.inc
ShortAnswerResponse::getReportFormScore in question_types/short_answer/short_answer.classes.inc
Implementation of getReportFormScore
ShortAnswerResponse::getReportFormSubmit in question_types/short_answer/short_answer.classes.inc
Implementation of getReportFormSubmit

... See full list

File

./quiz.module, line 303
Quiz Module

Code

function quiz_access_to_score($quiz_creator = NULL) {
  global $user;
  if ($quiz_creator == NULL && ($quiz = quiz_get_quiz_from_menu())) {
    $quiz_creator = $quiz->uid;
  }
  if (user_access('score any quiz')) {
    return TRUE;
  }
  if (user_access('score own quiz') && $user->uid == $quiz_creator) {
    return TRUE;
  }
  if (user_access('score taken quiz answer')) {
    return TRUE;
  }
}