You are here

function results_export_as_full_view in Quiz 6.5

Same name and namespace in other branches
  1. 6.6 includes/results_export/results_export.admin.inc \results_export_as_full_view()
1 string reference to 'results_export_as_full_view'
results_export_menu in includes/results_export/results_export.module
Implementation of hook_menu

File

includes/results_export/results_export.admin.inc, line 4

Code

function results_export_as_full_view($rid, $export_type) {
  module_load_include('inc', 'quiz', 'quiz.admin');
  $sql = "SELECT n.title FROM {node} n LEFT JOIN {quiz_node_results} as qnr ON n.nid = qnr.nid WHERE qnr.result_id = %d";
  $quiz_title = $quiz_nid ? check_plain(t('Quiz Result')) : db_result(db_query($sql, $rid));
  switch ($export_type) {
    case 'html':
      $output = qp(QueryPath::HTML_STUB)
        ->find('title')
        ->text($quiz_title)
        ->find(':root body')
        ->append(str_replace(' ', '', quiz_admin_results($rid)))
        ->find('table')
        ->attr('border', 1)
        ->top()
        ->html();
      break;
  }
  $filename = str_replace(' ', '-', "{$quiz_title} Result ID {$rid}.{$export_type}");
  results_export_invoke_file_transfer($filename, $output);
}