abstract class QuizQuestion in OG Quiz 7
A base implementation of a quiz_question, adding a layer of abstraction between the node API, quiz API and the question types.
It is required that Question types extend this abstract class.
This class has default behaviour that all question types must have. It also handles the node API, but gives the question types oppurtunity to save, delete and provide data specific to the question types.
This abstract class also declares several abstract functions forcing question-types to implement required methods.
Hierarchy
- class \QuizQuestion
Expanded class hierarchy of QuizQuestion
File
- includes/
og_quiz_question.php, line 40 - Classes used in the Quiz Question module.
View source
abstract class QuizQuestion {
/*
* QUESTION IMPLEMENTATION FUNCTIONS
*
* This part acts as a contract(/interface) between the question-types and the rest of the system.
*
* Question types are made by extending these generic methods and abstract methods.
*/
/**
* The current node for this question.
*/
public $node = NULL;
// Extra node properties
public $nodeProperties = NULL;
/**
* QuizQuestion constructor stores the node object.
*
* @param $node
* The node object
*/
public function __construct(stdClass &$node) {
$this->node = $node;
}
/**
* Check user permissions based on the context (inside a group or global).
*
* @param $permission
*
* @return bool
*/
public function checkContextAccess($permission) {
// Must we check this node, or the parent quiz ?
if (!isset($this->checkWhat)) {
if (isset($this->node->nid) && og_is_group_content_type('node', $this->node->type)) {
$groups = og_get_entity_groups('node', $this->node);
if (!empty($groups)) {
$this->checkWhat = 'self';
}
}
// If empty, check the parent quiz.
if (!isset($this->checkWhat)) {
// Try fetching the parent quiz, if any.
$quiz = $this
->getParentQuiz();
if (isset($quiz)) {
$this->checkWhat = 'parent';
}
else {
// Use default permissions.
$this->checkWhat = 'none';
}
}
}
if ($this->checkWhat != 'none') {
// When in group context, the node permission "edit any/own type content" becomes "update any/own type content".
if (preg_match('/^edit (any|own) [a-z\\_]+ content/', $permission)) {
$permission = preg_replace('/^edit/', 'update', $permission);
}
if ($this->checkWhat == 'parent') {
$node = $this
->getParentQuiz();
}
else {
$node = clone $this->node;
}
$access = og_quiz_ogs_access($node, $permission);
}
return isset($access) ? $access : user_access($permission);
}
/**
* Fetch the parent quiz.
*
* @return stdClass|null
*/
public function getParentQuiz() {
if (isset($this->node->nid)) {
$quiz = db_select('quiz_node_relationship', 'r')
->fields('r', array(
'parent_nid',
'parent_vid',
))
->condition('child_nid', $this->node->nid)
->condition('child_vid', $this->node->vid)
->execute()
->fetchObject();
if (isset($quiz->nid)) {
return node_load($quiz->nid, $quiz->vid);
}
}
if (isset($_GET['quiz_nid']) && isset($_GET['quiz_vid'])) {
return node_load($_GET['quiz_nid'], $_GET['quiz_vid']);
}
return NULL;
}
/**
* Allow question types to override the body field title
*
* @return
* The title for the body field
*/
public function getBodyFieldTitle() {
return t('Question');
}
/**
* Returns a node form to quiz_question_form
*
* Adds default form elements, and fetches question type specific elements from their
* implementation of getCreationForm
*
* @param array $form_state
* @return unknown_type
*/
public function getNodeForm(array &$form_state = NULL) {
global $user;
$form = array();
// mark this form to be processed by quiz_form_alter. quiz_form_alter will among other things
// hide the revion fieldset if the user don't have permission to controll the revisioning manually.
$form['#quiz_check_revision_access'] = TRUE;
// Allow user to set title?
if ($this
->checkContextAccess('edit question titles')) {
$form['helper']['#theme'] = 'quiz_question_creation_form';
$form['title'] = array(
'#type' => 'textfield',
'#title' => t('Title'),
'#maxlength' => 255,
'#default_value' => $this->node->title,
'#required' => FALSE,
'#description' => t('Add a title that will help distinguish this question from other questions. This will not be seen during the quiz.'),
);
}
else {
$form['title'] = array(
'#type' => 'value',
'#value' => $this->node->title,
);
}
// Quiz id used here to tie creation of a question to a specific quiz
if (isset($_GET['quiz_nid']) && is_numeric($_GET['quiz_nid']) || isset($form_state['complete form']['quiz_nid']['#value']) && is_numeric($form_state['complete form']['quiz_nid']['#value'])) {
if (isset($_GET['quiz_nid']) && is_numeric($_GET['quiz_nid'])) {
$vid = $_GET['quiz_vid'];
$quiz = $_GET['quiz_nid'];
}
else {
$vid = $form_state['complete form']['quiz_vid']['#value'];
$quiz = $form_state['complete form']['quiz_nid']['#value'];
}
$vid = _quiz_is_int($vid, 0) ? $vid : NULL;
$quiz = node_load((int) $quiz, $vid);
// Store quiz id in the form
$form['quiz_nid'] = array(
'#type' => 'value',
'#value' => $quiz->nid,
);
$form['quiz_vid'] = array(
'#type' => 'value',
'#value' => $quiz->vid,
);
// Identify this node as a quiz question type so that it can be recognized by other modules effectively.
$form['is_quiz_question'] = array(
'#type' => 'value',
'#value' => TRUE,
);
// If coming from quiz view, go back there on submit.
if ($quiz->type == 'quiz') {
$form_state['redirect'] = 'node/' . $quiz->nid . '/questions';
$form['#cancel_button'] = TRUE;
}
}
//Add question type specific content
$form = array_merge($form, $this
->getCreationForm($form_state));
// If access to edit quizzes we add the add to quiz fieldset
$edit_access = $this
->checkContextAccess('edit any quiz content') || $this
->checkContextAccess('edit own quiz content') || user_access('administer nodes');
if ($edit_access) {
$own_filter = $this
->checkContextAccess('edit any quiz') && user_access('administer nodes') ? '' : 'AND n.uid = ' . intval($user->uid);
// Fieldset allowing question makers to add questions to multiple quizzes when creating or editing a question
$already = array();
$already_nids = array();
if (isset($this->node->nid) && is_numeric($this->node->nid)) {
// Finding quizzes this question already belongs to.
$sql = 'SELECT n.nid, r.parent_vid AS vid, n.title FROM {quiz_node_relationship} r
JOIN {node} n ON n.nid = r.parent_nid
WHERE r.child_vid = :child_vid
ORDER BY r.parent_vid DESC';
$res = db_query($sql, array(
':child_vid' => $this->node->vid,
));
// Store the results
while ($res_o = $res
->fetch()) {
if (in_array($res_o->nid, $already_nids)) {
continue;
}
// Store in simple array to use in later querries
$already_nids[] = $res_o->nid;
// Store in array to use as #options
$already[$res_o->nid . '-' . $res_o->vid] = check_plain($res_o->title);
}
}
$found = implode(', ', $already_nids);
$latest = array();
$latest_nids = array();
// Finding the last quizzes the current user has been using
$sql = "SELECT lq.quiz_nid, n.vid, n.title, lq.id FROM {quiz_question_latest_quizzes} lq\n JOIN {node} n ON n.nid = lq.quiz_nid\n JOIN {quiz_node_properties} qnp ON qnp.vid = n.vid\n WHERE lq.uid = :uid AND qnp.randomization < 3";
if (drupal_strlen($found) > 0) {
$sql .= " AND quiz_nid NOT IN ({$found})";
}
$sql .= " ORDER BY lq.id DESC";
// TODO Please convert this statement to the D7 database API syntax.
$res = db_query($sql, array(
':uid' => $user->uid,
));
while ($res_o = $res
->fetch()) {
// Array to use as #option in form element
$latest[$res_o->quiz_nid . '-' . $res_o->vid] = check_plain($res_o->title);
// Array to use in later queries
$latest_nids[] = $res_o->quiz_nid;
}
if (count($latest) < QUIZ_QUESTION_NUM_LATEST) {
// Suplementing with other available quizzes...
$found = implode(', ', array_merge($already_nids, $latest_nids));
$sql = "SELECT n.nid, n.vid, title, changed FROM {node} n\n JOIN {quiz_node_properties} qnp ON qnp.vid = n.vid\n WHERE type = 'quiz' AND qnp.randomization < 3";
if (drupal_strlen($found) > 0) {
$sql .= " AND n.nid NOT IN ({$found})";
}
//$sql .= " ORDER BY changed LIMIT %d";
// TODO Please convert this statement to the D7 database API syntax.
//$res = db_query(db_rewrite_sql($sql), QUIZ_QUESTION_NUM_LATEST - count($latest));
$res = db_query($sql);
while ($res_o = $res
->fetch()) {
// array to be used as #options in form element
$latest[$res_o->nid . '-' . $res_o->vid] = check_plain($res_o->title);
}
}
// If we came from the manage questions tab we need to mark the quiz we came from as selected.
$latest_default = array();
if (isset($quiz)) {
foreach ($latest as $key => $value) {
$latest_nid = preg_match('/^[0-9]+/', $key);
if ($latest_nid == $quiz->nid) {
unset($latest[$key]);
break;
}
}
$res = db_query('SELECT title FROM {node_revision} WHERE vid = :vid', array(
':vid' => $quiz->vid,
));
$latest[$quiz->nid . '-' . $quiz->vid] = check_plain($res
->fetchField());
// $latest_default is to be used as #default_value in form item
$latest_default[] = $quiz->nid . '-' . $quiz->vid;
}
}
if ($edit_access || ($this
->checkContextAccess('create quiz content') || user_access('administer nodes'))) {
$form['add_directly'] = array(
'#type' => 'fieldset',
'#title' => t('Add to @quiz', array(
'@quiz' => QUIZ_NAME,
)),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#weight' => -3,
'#tree' => TRUE,
'#group' => 'additional_settings',
);
}
if ($edit_access) {
if (count($already) > 0) {
$form['add_directly']['already'] = array(
'#type' => 'checkboxes',
'#title' => t('This question is already a member of'),
'#description' => t('If you uncheck any of the checkboxes this question will be removed from the corresponding @quiz. If the @quiz has been answered a new revision of the @quiz will be created automatically.', array(
'@quiz' => QUIZ_NAME,
)),
'#options' => $already,
'#default_value' => array_keys($already),
);
}
if (count($latest) > 0) {
$form['add_directly']['latest'] = array(
'#type' => 'checkboxes',
'#title' => t('The @latest latest @quiz nodes this question isn\'t a member of', array(
'@latest' => count($latest),
'@quiz' => QUIZ_NAME,
)),
'#description' => t('If you check any of the checkboxes this question will be added to the corresponding @quiz. If the @quiz has been answered a new revision will be created automatically.', array(
'@quiz' => QUIZ_NAME,
)),
'#options' => $latest,
'#default_value' => $latest_default,
);
}
}
if ($this
->checkContextAccess('create quiz content') || user_access('administer nodes')) {
$form['add_directly']['new'] = array(
'#type' => 'textfield',
'#title' => t('Title for new @quiz', array(
'@quiz' => QUIZ_NAME,
)),
'#description' => t('Write in the name of the new @quiz you want to create and add this question to.', array(
'@quiz' => QUIZ_NAME,
)),
);
}
if ($this
->hasBeenAnswered()) {
$log = t('The current revision has been answered. We create a new revision so that the reports from the existing answers stays correct.');
$this->node->revision = 1;
$this->node->log = $log;
}
return $form;
}
/**
* Retrieve information relevant for viewing the node.
*
* (This data is generally added to the node's extra field.)
*
* @return
* Content array
*/
public function getNodeView() {
$type = node_type_get_type($this->node);
$content['question_type'] = array(
'#markup' => '<div class="question_type_name">' . $type->name . '</div>',
'#weight' => -2,
);
/*
$question_body = field_get_items('node', $this->node, 'body');
$content['question'] = array(
'#markup' => '<div class="question-body">' . $question_body[0]['safe_value'] . '</div>',
'#weight' => -1,
);
*/
return $content;
}
/**
* Getter function returning properties to be loaded when the node is loaded.
*
* @see load hook in quiz_question.module (quiz_question_load)
*
* @return array
*/
public function getNodeProperties() {
if (isset($this->nodeProperties)) {
return $this->nodeProperties;
}
$props['max_score'] = db_query('SELECT max_score
FROM {quiz_question_properties}
WHERE nid = :nid AND vid = :vid', array(
':nid' => $this->node->nid,
':vid' => $this->node->vid,
))
->fetchField();
$props['is_quiz_question'] = TRUE;
$this->nodeProperties = $props;
return $props;
}
/**
* Responsible for handling insert/update of question-specific data.
* This is typically called from within the Node API, so there is no need
* to save the node.
*
* The $is_new flag is set to TRUE whenever the node is being initially
* created.
*
* A save function is required to handle the following three situations:
* - A new node is created ($is_new is TRUE)
* - A new node *revision* is created ($is_new is NOT set, because the
* node itself is not new).
* - An existing node revision is modified.
*
* @see hook_update and hook_insert in quiz_question.module
*
* @param $is_new
* TRUE when the node is initially created.
*/
public function save($is_new = FALSE) {
// We call the abstract function saveNodeProperties to save type specific data
$this
->saveNodeProperties($is_new);
db_merge('quiz_question_properties')
->key(array(
'nid' => $this->node->nid,
'vid' => $this->node->vid,
))
->fields(array(
'nid' => $this->node->nid,
'vid' => $this->node->vid,
'max_score' => $this
->getMaximumScore(),
))
->execute();
// Save what quizzes this question belongs to.
$quizzes_kept = $this
->saveRelationships();
if ($quizzes_kept && $this->node->revision) {
if (user_access('manual quiz revisioning') && !variable_get('quiz_auto_revisioning', 1)) {
unset($_GET['destination']);
unset($_REQUEST['edit']['destination']);
drupal_goto('quiz_question/' . $this->node->nid . '/' . $this->node->vid . '/revision_actions');
}
else {
$form_state = array();
$form_state['values']['op'] = t('Submit');
require_once DRUPAL_ROOT . '/' . drupal_get_path('module', 'quiz_question') . '/quiz_question.pages.inc';
drupal_form_submit('quiz_question_revision_actions', $form_state, $this->node->nid, $this->node->vid);
}
}
}
/**
* Delete question data from the database.
*
* Called by quiz_question_delete (hook_delete).
* Child classes must call super
*
* @param $only_this_version
* If the $only_this_version flag is TRUE, then only the particular
* nid/vid combo should be deleted. Otherwise, all questions with the
* current nid can be deleted.
*/
public function delete($only_this_version = FALSE) {
// Delete answeres
$delete = db_delete('quiz_node_results_answers')
->condition('question_nid', $this->node->nid);
if ($only_this_version) {
$delete
->condition('question_vid', $this->node->vid);
}
$delete
->execute();
// Delete properties
$delete = db_delete('quiz_question_properties')
->condition('nid', $this->node->nid);
if ($only_this_version) {
$delete
->condition('vid', $this->node->vid);
}
$delete
->execute();
}
/**
* Provides validation for question before it is created.
*
* When a new question is created and initially submited, this is
* called to validate that the settings are acceptible.
*
* @param $form
* The processed form.
*/
public abstract function validateNode(array &$form);
/**
* Get the form through which the user will answer the question.
*
* @param $form_state
* The FAPI form_state array
* @param $rid
* The result id.
* @return
* Must return a FAPI array. At the moment all form elements that takes
* user response must have a key named "tries". (This is a Quiz 3.x legacy AFAIK. I'm
* not thrilled about it...)
*/
public function getAnsweringForm(array $form_state = NULL, $rid) {
//echo $this->node->type;exit;
$form = array();
$form['question_nid'] = array(
'#type' => 'hidden',
'#value' => $this->node->nid,
);
/*$body = field_get_items('node', $this->node, 'body');
$form['question'] = array(
'#markup' => check_markup($body[0]['value'], $body[0]['format']),
'#prefix' => '<div class="quiz-question-body">',
'#suffix' => '</div>',
);*/
return $form;
}
/**
* Get the form used to create a new question.
*
* @param
* FAPI form state
* @return
* Must return a FAPI array.
*/
public abstract function getCreationForm(array &$form_state = NULL);
/**
* Get the maximum possible score for this question.
*/
public abstract function getMaximumScore();
/**
* Save question type specific node properties
*/
public abstract function saveNodeProperties($is_new = FALSE);
/**
* Handle the add to quiz part of the quiz_question_form
*
* @return
* TRUE if at least one of the questions were kept.
* FALSE otherwise
*/
function saveRelationships() {
$quizzes_kept = FALSE;
unset($_SESSION['quiz_question_kept']);
/*
* If the question already is part of quizzes we might have to remove some
* relationships
*/
$quizzes_to_update = array();
if (isset($this->node->add_directly['already']) && is_array($this->node->add_directly['already'])) {
foreach ($this->node->add_directly['already'] as $key => $checked) {
if ($checked == 0) {
$nid_vid = explode('-', $key);
$dummy_node = new stdClass();
$dummy_node->nid = $nid_vid[0];
$dummy_node->vid = $nid_vid[1];
if (quiz_has_been_answered($dummy_node)) {
// We need to revise the quiz node if it has been answered
$temp_quiz_node = node_load($dummy_node->nid, $dummy_node->vid);
$temp_quiz_node->revision = 1;
$temp_quiz_node->auto_created = TRUE;
node_save($temp_quiz_node);
$nid_vid[1] = $temp_quiz_node->vid;
drupal_set_message(t('New revision has been created for the @quiz %n', array(
'%n' => $temp_quiz_node->title,
'@quiz' => QUIZ_NAME,
)));
}
$quizzes_to_update[] = $nid_vid[1];
db_delete('quiz_node_relationship')
->condition('parent_nid', $nid_vid[0])
->condition('parent_vid', $nid_vid[1])
->condition('child_nid', $this->node->nid)
->condition('child_vid', $this->node->vid)
->execute();
}
else {
$quizzes_kept = TRUE;
$_SESSION['quiz_question_kept'][] = $key;
}
}
}
/*
* The quiz question might have been added to new quizzes
*/
if (isset($this->node->add_directly['latest']) && is_array($this->node->add_directly['latest'])) {
$to_insert = 'VALUES';
$insert_values = array();
foreach ($this->node->add_directly['latest'] as $nid => $checked) {
if ($checked != 0) {
$nid_vid = explode('-', $checked);
$dummy_node = new stdClass();
$dummy_node->nid = $nid_vid[0];
$dummy_node->vid = $nid_vid[1];
if (quiz_has_been_answered($dummy_node)) {
$temp_quiz_node = node_load($dummy_node->nid, $dummy_node->vid);
$temp_quiz_node->revision = 1;
$temp_quiz_node->auto_created = TRUE;
node_save($temp_quiz_node);
$nid_vid[1] = $temp_quiz_node->vid;
drupal_set_message(t('New revision has been created for the @quiz %n', array(
'%n' => $temp_quiz_node->title,
'@quiz' => QUIZ_NAME,
)));
}
$quizzes_to_update[] = $nid_vid[1];
$insert_values[$nid]['parent_nid'] = $nid_vid[0];
$insert_values[$nid]['parent_vid'] = $nid_vid[1];
$insert_values[$nid]['child_nid'] = $this->node->nid;
$insert_values[$nid]['child_vid'] = $this->node->vid;
$insert_values[$nid]['max_score'] = $this
->getMaximumScore();
$insert_values[$nid]['auto_update_max_score'] = $this
->autoUpdateMaxScore() ? 1 : 0;
$insert_values[$nid]['weight'] = 1 + db_query('SELECT MAX(weight) FROM {quiz_node_relationship} WHERE parent_vid = :vid', array(
':vid' => $nid_vid[1],
))
->fetchField();
$randomization = db_query('SELECT randomization FROM {quiz_node_properties} WHERE nid = :nid AND vid = :vid', array(
':nid' => $nid_vid[0],
':vid' => $nid_vid[1],
))
->fetchField();
$insert_values[$nid]['question_status'] = $randomization == 2 ? QUESTION_RANDOM : QUESTION_ALWAYS;
$delete_values[] = array(
'vid' => $nid_vid[1],
'nid' => $this->node->nid,
);
}
}
if (count($insert_values) > 0) {
foreach ($delete_values as $delete_value) {
$delete_qnr = db_delete('quiz_node_relationship');
$delete_qnr
->condition('parent_vid', $delete_value['vid']);
$delete_qnr
->condition('child_nid', $delete_value['nid']);
$delete_qnr
->execute();
}
$insert_qnr = db_insert('quiz_node_relationship');
$insert_qnr
->fields(array(
'parent_nid',
'parent_vid',
'child_nid',
'child_vid',
'max_score',
'weight',
'question_status',
'auto_update_max_score',
));
foreach ($insert_values as $insert_value) {
$insert_qnr
->values($insert_value);
}
$insert_qnr
->execute();
}
}
if (drupal_strlen($this->node->add_directly['new']) > 0) {
$new_node = quiz_make_new($this->node->add_directly['new']);
$id = db_insert('quiz_node_relationship')
->fields(array(
'parent_nid' => $new_node->nid,
'parent_vid' => $new_node->vid,
'child_nid' => $this->node->nid,
'child_vid' => $this->node->vid,
'max_score' => $this
->getMaximumScore(),
'auto_update_max_score' => $this
->autoUpdateMaxScore() ? 1 : 0,
))
->execute();
$quizzes_to_update[] = $new_node->vid;
}
// Update max_score for relationships if auto update max score is enabled
// for question
if (isset($this->node->nid)) {
$result = db_query('SELECT parent_vid as vid from {quiz_node_relationship} where child_nid = :nid and child_vid = :vid and auto_update_max_score=1', array(
':nid' => $this->node->nid,
':vid' => $this->node->vid,
));
foreach ($result as $record) {
$quizzes_to_update[] = $record->vid;
}
db_update('quiz_node_relationship')
->fields(array(
'max_score' => $this
->getMaximumScore(),
))
->condition('child_nid', $this->node->nid)
->condition('child_vid', $this->node->vid)
->condition('auto_update_max_score', 1)
->execute();
}
quiz_update_max_score_properties($quizzes_to_update);
return $quizzes_kept;
}
/**
* Finds out if a question has been answered or not
*
* This function also returns TRUE if a quiz that this question belongs to have been answered.
* Even if the question itself haven't been answered. This is because the question might have
* been rendered and a user is about to answer it...
*
* @return
* true if question has been answered or is about to be answered...
*/
public function hasBeenAnswered() {
if (!isset($this->node->vid)) {
return FALSE;
}
$answered = db_query_range('SELECT 1 FROM {quiz_node_results} qnres
JOIN {quiz_node_relationship} qnrel ON (qnres.vid = qnrel.parent_vid)
WHERE qnrel.child_vid = :child_vid', 0, 1, array(
':child_vid' => $this->node->vid,
))
->fetch();
return $answered ? TRUE : FALSE;
}
/**
* Determines if the user can view the correct answers
*
* @return boolean
* true iff the view may include the correct answers to the question
*/
public function viewCanRevealCorrect() {
global $user;
// permission overrides the hook
if (user_access('view any quiz question correct response') || $user->uid == $this->node->uid) {
return TRUE;
}
$results = module_invoke_all('answers_access', $this->node);
$may_view_answers = in_array(TRUE, $results);
return $may_view_answers;
}
/**
* Utility function that returns the format of the node body
*/
protected function getFormat() {
$node = isset($this->node) ? $this->node : $this->question;
$body = field_get_items('node', $node, 'body');
return isset($body[0]['format']) ? $body[0]['format'] : NULL;
}
/**
* This may be overridden in subclasses. If it returns true,
* it means the max_score is updated for all occurrences of
* this question in quizzes.
*/
protected function autoUpdateMaxScore() {
return false;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
QuizQuestion:: |
public | property | The current node for this question. | |
QuizQuestion:: |
public | property | ||
QuizQuestion:: |
protected | function | This may be overridden in subclasses. If it returns true, it means the max_score is updated for all occurrences of this question in quizzes. | |
QuizQuestion:: |
public | function | Check user permissions based on the context (inside a group or global). | |
QuizQuestion:: |
public | function | Delete question data from the database. | 1 |
QuizQuestion:: |
public | function | Get the form through which the user will answer the question. | 1 |
QuizQuestion:: |
public | function | Allow question types to override the body field title | |
QuizQuestion:: |
abstract public | function | Get the form used to create a new question. | 1 |
QuizQuestion:: |
protected | function | Utility function that returns the format of the node body | |
QuizQuestion:: |
abstract public | function | Get the maximum possible score for this question. | 1 |
QuizQuestion:: |
public | function | Returns a node form to quiz_question_form | |
QuizQuestion:: |
public | function | Getter function returning properties to be loaded when the node is loaded. | 1 |
QuizQuestion:: |
public | function | Retrieve information relevant for viewing the node. | 1 |
QuizQuestion:: |
public | function | Fetch the parent quiz. | |
QuizQuestion:: |
public | function | Finds out if a question has been answered or not | |
QuizQuestion:: |
public | function | Responsible for handling insert/update of question-specific data. This is typically called from within the Node API, so there is no need to save the node. | |
QuizQuestion:: |
abstract public | function | Save question type specific node properties | 1 |
QuizQuestion:: |
function | Handle the add to quiz part of the quiz_question_form | ||
QuizQuestion:: |
abstract public | function | Provides validation for question before it is created. | 1 |
QuizQuestion:: |
public | function | Determines if the user can view the correct answers | |
QuizQuestion:: |
public | function | QuizQuestion constructor stores the node object. |