You are here

function long_answer_questions_list in Quiz 7.4

Same name and namespace in other branches
  1. 8.4 question_types/long_answer/long_answer.module \long_answer_questions_list()
  2. 6.6 question_types/long_answer/long_answer.module \long_answer_questions_list()
  3. 6.4 question_types/long_answer/long_answer.module \long_answer_questions_list()
  4. 7.6 question_types/long_answer/long_answer.module \long_answer_questions_list()
  5. 7 question_types/long_answer/long_answer.module \long_answer_questions_list()

Generate a list of long answer questions

Return value

array containing nid as key and title as value

1 call to long_answer_questions_list()
LongAnswerUnitTest::unitTestListQuestions in question_types/long_answer/long_answer.test
Check that question exists in DB.

File

question_types/long_answer/long_answer.module, line 277
This module defines a long answer question type for quizzes.

Code

function long_answer_questions_list() {
  $questions = array();
  $results = db_query('SELECT nid, title FROM {node} WHERE type = :type', array(
    ':type' => 'long_answer',
  ));
  foreach ($results as $result) {
    $questions[$result->nid] = check_plain($result->title);
  }
  return $questions;
}