/** * Loads the question type specific options for the question. * * @return boolean to indicate success or failure */ function get_question_options(&$question) { // Get additional information from database // and attach it to the question object if (!($question->options = get_record('question_imagedit', 'question', $question->id))) { notify('Error: Missing question options!'); return false; } // Get data from question_answers (for feedback) parent::get_question_options($question); return true; }
/** * Loads the question type specific options for the question. * * This function loads the compare algorithm type, disallowed strings and variables * into the class from the database table in which they are stored. It first uses the * parent class method to get the database information. * * @param object $question The question object for the question. This object * should be updated to include the question type * specific information (it is passed by reference). * @return bool Indicates success or failure. */ function get_question_options(&$question) { // Get the information from the database table. If this fails then immediately bail. // Note unlike the save_question_options base class method this method DOES get the question's // answers along with any answer extensions if (!parent::get_question_options($question)) { return false; } // Check that we have answers and if not then bail since this question type requires answers if (count($question->options->answers) == 0) { notify('Failed to load question answers from the table question_answers for questionid ' . $question->id); return false; } // Now get the variables from the database as well $question->options->variables = get_records('question_algebra_variables', 'question', $question->id, 'id ASC'); // Check that we have variables and if not then bail since this question type requires variables if (count($question->options->variables) == 0) { notify('Failed to load question variables from the table question_algebra_variables ' . "for questionid {$question->id}"); return false; } // Check to see if there are any allowed functions if ($question->options->allowedfuncs != '') { // Extract the allowed functions as an array $question->options->allowedfuncs = explode(',', $question->options->allowedfuncs); } else { $question->options->allowedfuncs = array(); } // Everything worked so return true return true; }