* @copyright Deakin University 2007,2008 * @package queXS * @subpackage admin * @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility * @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2 * */ /** * Configuration file */ include_once(dirname(__FILE__).'/../config.inc.php'); /** * Database file */ include ("../db.inc.php"); /** * XHTML functions */ include ("../functions/functions.xhtml.php"); /** * AAPOR calculation functions */ include ("../functions/functions.aapor.php"); /** * Display functions */ include ("../functions/functions.display.php"); /** * Performance functions */ include ("../functions/functions.performance.php"); /** * Operator functions */ include ("../functions/functions.operator.php"); /** * Input functions */ include("../functions/functions.input.php"); $operator_id = get_operator_id(); $questionnaire_id = false; if (isset($_GET['questionnaire_id'])) $questionnaire_id = bigintval($_GET['questionnaire_id']); xhtml_head(T_("Questionnaire Outcomes"),true,array("../css/table.css"),array("../js/window.js")); print "

" . T_("Select a questionnaire from the list below") . "

"; display_questionnaire_chooser($questionnaire_id); if ($questionnaire_id != false) { print "

" . T_("Outcomes") . "

"; print "

" . T_("Sample status") . "

"; $sql = "SELECT CASE WHEN (c.sample_id is not null) = 1 THEN '" . T_("Drawn from sample") . "' ELSE '" . T_("Remain in sample") . "' END as drawn, count(*) as count FROM sample as s JOIN questionnaire_sample as qs ON (qs.questionnaire_id = '$questionnaire_id' and qs.sample_import_id = s.import_id) LEFT JOIN `case` as c ON (c.questionnaire_id = qs.questionnaire_id and c.sample_id = s.sample_id) GROUP BY (c.sample_id is not null)"; xhtml_table($db->GetAll($sql),array("drawn","count"),array(T_("Status"),T_("Number"))); $atime = get_average_time_questionnaire(10,$questionnaire_id); $mins = intval($atime / 60); $secs = $atime % 60; print "

" . T_("Average time on a completed questionnaire") . ": $mins " . T_("Min") . " $secs " . T_("Secs") . "

"; $sql = "SELECT o.calc, count( c.case_id ) FROM `case` AS c, `outcome` AS o WHERE c.questionnaire_id = '$questionnaire_id' AND c.current_outcome_id = o.outcome_id GROUP BY o.calc"; $a = $db->GetAssoc($sql); $a = aapor_clean($a); print ""; print ""; print ""; print ""; print ""; print "
" . T_("Outcome") . "" . T_("Rate") . "
" . T_("Response Rate 1") . "" . round(aapor_rr1($a),2) . "
" . T_("Refusal Rate 1") . "" . round(aapor_ref1($a),2) . "
" . T_("Cooperation Rate 1") . "" . round(aapor_coop1($a),2) . "
" . T_("Contact Rate 1") . "" . round(aapor_con1($a),2) . "
"; $sql = "SELECT o.description as des, o.outcome_id, count( c.case_id ) as count FROM `case` AS c, `outcome` AS o WHERE c.questionnaire_id = '$questionnaire_id' AND c.current_outcome_id = o.outcome_id GROUP BY o.outcome_id"; $rs = $db->GetAll($sql); if (!empty($rs)) xhtml_table($rs,array("des","count"),array(T_("Outcome"),T_("Count")),"tclass",array("des" => "Complete")); else print "

" . T_("No outcomes recorded for this questionnaire") . "

"; //display a list of shifts with completions and a link to either add a report or view reports print "

" . T_("Shifts") . "

"; $sql = "SELECT s.shift_id, CONCAT(DATE_FORMAT(CONVERT_TZ(s.start,'UTC',o.Time_zone_name),'" . DATE_TIME_FORMAT ."'), ' - ', DATE_FORMAT(CONVERT_TZ(s.end,'UTC',o.Time_zone_name),'" . DATE_TIME_FORMAT ."')) as description, CASE WHEN sr.shift_id IS NULL THEN CONCAT('" . T_("No shift reports: Add report") . "') ELSE CONCAT('" . T_("View shift reports") . "') END AS link, c.completions as completions, CONCAT('" . T_("View operator performance") . "') as operform FROM `shift` as s JOIN operator as o on (o.operator_id = '$operator_id') LEFT JOIN shift_report as sr on (sr.shift_id = s.shift_id) LEFT JOIN ( SELECT count(*) as completions,sh.shift_id FROM `call` as a, `case` as b, shift as sh WHERE a.outcome_id = '10' AND a.case_id = b.case_id AND b.questionnaire_id = '$questionnaire_id' AND sh.start <= a.start AND sh.end >= a.start GROUP BY sh.shift_id) as c on (s.shift_id = c.shift_id) WHERE s.questionnaire_id = '$questionnaire_id' GROUP BY shift_id ORDER BY s.start ASC"; $r = $db->GetAll($sql); if (empty($r)) print "

" . T_("No shifts defined for this questionnaire") . "

"; else xhtml_table($r,array("description","completions","link","operform"),array(T_("Shift"),T_("Completions"),T_("Shift report"),T_("Operator performance")),"tclass"); } xhtml_foot(); ?>