class QuizDirectionsResponse in Quiz 6.3
Same name and namespace in other branches
- 6.6 question_types/quiz_directions/quiz_directions.classes.inc \QuizDirectionsResponse
- 6.4 question_types/quiz_directions/quiz_directions.classes.inc \QuizDirectionsResponse
- 6.5 question_types/quiz_directions/quiz_directions.classes.inc \QuizDirectionsResponse
- 7.6 question_types/quiz_directions/quiz_directions.classes.inc \QuizDirectionsResponse
- 7 question_types/quiz_directions/quiz_directions.classes.inc \QuizDirectionsResponse
- 7.4 question_types/quiz_directions/quiz_directions.classes.inc \QuizDirectionsResponse
- 7.5 question_types/quiz_directions/quiz_directions.classes.inc \QuizDirectionsResponse
Class that describes a "Directions question response". For the most part, no real scoring takes place for a direction node. However, there are a few behind-the-scenes tricks that are done here to make the quiz-taking process a little easier.
Hierarchy
- class \AbstractQuizQuestionResponse implements QuizQuestionResponse
- class \QuizDirectionsResponse
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 87 - quiz_directions.classes
View source
class QuizDirectionsResponse extends AbstractQuizQuestionResponse {
public function __construct($rid, $question, $answer = NULL) {
$this->answer = $answer;
$this->question = $question;
$this->rid = $rid;
}
public function save() {
}
public function delete() {
}
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;
}
public function isCorrect() {
return TRUE;
}
public function getResponse() {
return $this->answer;
}
public function formatReport($showpoints = TRUE, $showfeedback = TRUE) {
return '';
}
}
Members
Name![]() |
Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AbstractQuizQuestionResponse:: |
protected | property | ||
AbstractQuizQuestionResponse:: |
protected | property | ||
AbstractQuizQuestionResponse:: |
public | property | ||
AbstractQuizQuestionResponse:: |
protected | property | ||
AbstractQuizQuestionResponse:: |
public | property | ||
AbstractQuizQuestionResponse:: |
public | property | ||
AbstractQuizQuestionResponse:: |
public | function |
Get data suitable for reporting a user's score on the question.
This expects an object with the following attributes: Overrides QuizQuestionResponse:: |
|
AbstractQuizQuestionResponse:: |
function |
Get the integer score. Overrides QuizQuestionResponse:: |
||
AbstractQuizQuestionResponse:: |
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. Overrides QuizQuestionResponse:: |
|
AbstractQuizQuestionResponse:: |
function |
Repesent the response as a stdClass object. Overrides QuizQuestionResponse:: |
||
QuizDirectionsResponse:: |
public | function |
Delete the response. Overrides QuizQuestionResponse:: |
|
QuizDirectionsResponse:: |
public | function |
Return an HTML marked-up report for displaying the results of this question. Overrides QuizQuestionResponse:: |
|
QuizDirectionsResponse:: |
public | function |
Get the user's response. Overrides QuizQuestionResponse:: |
|
QuizDirectionsResponse:: |
public | function |
Check to see if the answer is marked as correct. Overrides AbstractQuizQuestionResponse:: |
|
QuizDirectionsResponse:: |
public | function |
Save the current response. Overrides QuizQuestionResponse:: |
|
QuizDirectionsResponse:: |
public | function |
Calculate the score for the response.
This MUST set the $score instance variable. Overrides QuizQuestionResponse:: |
|
QuizDirectionsResponse:: |
public | function |
Create a new user response. Overrides QuizQuestionResponse:: |