You are here

function _ajax_quiz_get_questions in Quiz 7.6

Same name and namespace in other branches
  1. 8.4 modules/ajax_quiz/ajax_quiz.admin.inc \_ajax_quiz_get_questions()
  2. 6.6 includes/ajax_quiz/ajax_quiz.admin.inc \_ajax_quiz_get_questions()
  3. 6.4 includes/ajax_quiz/ajax_quiz.admin.inc \_ajax_quiz_get_questions()
  4. 7 includes/ajax_quiz/ajax_quiz.admin.inc \_ajax_quiz_get_questions()
  5. 7.4 includes/ajax_quiz/ajax_quiz.admin.inc \_ajax_quiz_get_questions()
1 call to _ajax_quiz_get_questions()
ajax_quiz_instruction in modules/ajax_quiz/ajax_quiz.admin.inc
@todo Please document this function.

File

modules/ajax_quiz/ajax_quiz.admin.inc, line 33

Code

function _ajax_quiz_get_questions($node) {
  $output = '';
  foreach (drupal_get_messages() as $type) {
    foreach ($type as $message) {
      $output .= '<script type="text/javascript"> alert("' . "{$type} : {$message}" . '"); </script>';
    }
  }
  $output .= node_view($node, FALSE, TRUE);
  $result = array(
    'content' => $output,
    // Put the Javascript callback you will use here.
    // You can if you wish leave out this line and instead
    // call your callback directly in your Javascript. See
    // comments in ajax_load_example.js.
    '__callbacks' => array(
      'Drupal.AjaxLoadExample.formCallback',
    ),
  );

  // Call drupal_alter('ajax_data', ...). This is what allows ajax_load to
  // add its data and register its Javascript callback.
  // The second argument is the data to be altered.
  // The third argument is a unique identifier for this AJAX data operation.
  // The fourth and optional argument is the original data that was the subject
  // of the ajax operation--in this case, a form ID.
  drupal_alter('ajax_data', $result, 'ajax_load_example', 'node_view');
  drupal_json_output($result);
}