You are here

class QuizDirectionsResponse in Quiz 6.4

Same name and namespace in other branches
  1. 6.6 question_types/quiz_directions/quiz_directions.classes.inc \QuizDirectionsResponse
  2. 6.3 question_types/quiz_directions/quiz_directions.classes.inc \QuizDirectionsResponse
  3. 6.5 question_types/quiz_directions/quiz_directions.classes.inc \QuizDirectionsResponse
  4. 7.6 question_types/quiz_directions/quiz_directions.classes.inc \QuizDirectionsResponse
  5. 7 question_types/quiz_directions/quiz_directions.classes.inc \QuizDirectionsResponse
  6. 7.4 question_types/quiz_directions/quiz_directions.classes.inc \QuizDirectionsResponse
  7. 7.5 question_types/quiz_directions/quiz_directions.classes.inc \QuizDirectionsResponse

Extension of QuizQuestionResponse

Hierarchy

Expanded class hierarchy of QuizDirectionsResponse

1 string reference to 'QuizDirectionsResponse'
quiz_directions_quiz_question_info in question_types/quiz_directions/quiz_directions.module
Implementation of hook_quiz_question_info().

File

question_types/quiz_directions/quiz_directions.classes.inc, line 97
quiz_directions.classes

View source
class QuizDirectionsResponse extends QuizQuestionResponse {

  /**
   * Implementation of save
   *
   * @see QuizQuestionResponse#save()
   */
  public function save() {
  }

  /**
   * Implementation of delete
   *
   * @see QuizQuestionResponse#delete()
   */
  public function delete() {
  }

  /**
   * Implementation of score
   *
   * @see QuizQuestionResponse#score()
   */
  public function score() {

    // First, due to popular demand, if the directions are at the beginning of
    // the quiz, we restart the timer after the user has read the question.
    $quiz_nid = arg(1);
    $quiz_key = 'quiz_' . $quiz_nid;
    if (isset($_SESSION[$quiz_key]['previous_quiz_questions']) && count($_SESSION[$quiz_key]['previous_quiz_questions']) === 1) {

      // reset the timer.
      $sql = 'UPDATE {quiz_node_results} SET time_start=%d WHERE result_id = %d';
      db_query($sql, time(), $this->rid);
    }

    // Set the score
    $this->score = 0;
    return 0;
  }

  /**
   * Implementation of isCorrect
   *
   * @see QuizQuestionResponse#isCorrect()
   */
  public function isCorrect() {
    return TRUE;
  }

  /**
   * Implementation of getResponse
   *
   * @see QuizQuestionResponse#getResponse()
   */
  public function getResponse() {
    return $this->answer;
  }

  /**
   * Implementation of getReportForm
   *
   * @see QuizQuestionResponse#getReportForm($showpoints, $showfeedback, $allow_scoring)
   */
  public function getReportForm($showpoints = TRUE, $showfeedback = TRUE, $allow_scoring = FALSE) {
    return array(
      '#no_report' => TRUE,
    );
  }

}

Members

Namesort descending Modifiers Type Description Overrides
QuizDirectionsResponse::delete public function Implementation of delete Overrides QuizQuestionResponse::delete
QuizDirectionsResponse::getReportForm public function Implementation of getReportForm Overrides QuizQuestionResponse::getReportForm
QuizDirectionsResponse::getResponse public function Implementation of getResponse Overrides QuizQuestionResponse::getResponse
QuizDirectionsResponse::isCorrect public function Implementation of isCorrect Overrides QuizQuestionResponse::isCorrect
QuizDirectionsResponse::save public function Implementation of save Overrides QuizQuestionResponse::save
QuizDirectionsResponse::score public function Implementation of score Overrides QuizQuestionResponse::score
QuizQuestionResponse::$answer protected property
QuizQuestionResponse::$evaluated protected property
QuizQuestionResponse::$is_correct protected property
QuizQuestionResponse::$is_skipped public property
QuizQuestionResponse::$question public property
QuizQuestionResponse::$rid protected property
QuizQuestionResponse::$score protected property 7
QuizQuestionResponse::getMaxScore public function Returns stored max score if it exists, if not the max score is calculated and returned.
QuizQuestionResponse::getReport public function Get data suitable for reporting a user's score on the question. This expects an object with the following attributes:
QuizQuestionResponse::getReportFormAnswerFeedback public function 2
QuizQuestionResponse::getReportFormQuestion public function get the question part of the reportForm
QuizQuestionResponse::getReportFormResponse public function Get the response part of the report form 6
QuizQuestionResponse::getReportFormScore public function Get the score part of the report form 2
QuizQuestionResponse::getReportFormSubmit public function Get the submit function for the reportForm 2
QuizQuestionResponse::getReportFormTheme public function Get the theme key for the reportForm
QuizQuestionResponse::getReportFormValidate public function Get the validate function for the reportForm 2
QuizQuestionResponse::getScore function Returns stored score if it exists, if not the score is calculated and returned.
QuizQuestionResponse::isEvaluated public function Indicate whether the response has been evaluated (scored) yet. Questions that require human scoring (e.g. essays) may need to manually toggle this.
QuizQuestionResponse::isValid public function Validates response from a quiz taker. If the response isn't valid the quiz taker won't be allowed to proceed. 6
QuizQuestionResponse::refreshQuestionNode public function Used to refresh this instances question node in case drupal has changed it.
QuizQuestionResponse::saveResult public function Saves the quiz result. This is not used when a question is skipped!
QuizQuestionResponse::toBareObject function Represent the response as a stdClass object.
QuizQuestionResponse::__construct public function Create a new user response. 6