* @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("../config.inc.php"); /** * Database file */ include ("../db.inc.php"); /** * XHTML functions */ include("../functions/functions.xhtml.php"); /** * Display functions */ include("../functions/functions.display.php"); /** * Limesurvey functions */ include("../functions/functions.limesurvey.php"); /** * Operator functions */ include("../functions/functions.operator.php"); /** * Input functions */ include("../functions/functions.input.php"); global $db; $operator_id = get_operator_id(); $case_id = false; if (isset($_GET['case_id'])) $case_id = bigintval($_GET['case_id']); if (isset($_GET['deidentify'])) { //remove all sample vars $db->StartTrans(); $sql = "SELECT sample_id FROM `case` WHERE case_id = $case_id"; $sample_id = $db->GetOne($sql); $sql = "DELETE FROM sample_var WHERE sample_id = $sample_id"; $db->Execute($sql); //clear number from sample table $sql = "UPDATE `sample` SET phone = '' WHERE sample_id = $sample_id"; $db->Execute($sql); //clear respondent table (firstName,lastName) $sql = "UPDATE `respondent` SET firstName = '', lastName = '' WHERE case_id = $case_id"; $db->Execute($sql); //clear contact phone (phone,description) $sql = "UPDATE `contact_phone` SET phone = '', description = '' WHERE case_id = $case_id"; $db->Execute($sql); $db->CompleteTrans(); } if (isset($_GET['case_note_id'])) { $case_note_id = bigintval($_GET['case_note_id']); $sql = "DELETE FROM case_note WHERE case_id = '$case_id' AND case_note_id = '$case_note_id'"; $db->Execute($sql); } xhtml_head(T_("Supervisor functions"),true,array("../css/table.css"),array("../js/window.js")); print "
" . T_("No appointments for this case") . "
"; print "" . T_("Create appointment for this case") . "
"; //view calls and outcomes $sql = "SELECT DATE_FORMAT(CONVERT_TZ(c.start,'UTC',r.Time_zone_name),'".DATE_TIME_FORMAT."') as start,CONVERT_TZ(c.end,'UTC',r.Time_zone_name) as end, op.firstName, op.lastName, o.description as des, CONCAT('". TQ_("Edit") . "') as link, cp.phone as phone FROM `call` as c JOIN (operator as op, outcome as o, respondent as r, contact_phone as cp) on (c.operator_id = op.operator_id and c.outcome_id = o.outcome_id and r.respondent_id = c.respondent_id and cp.contact_phone_id = c.contact_phone_id) WHERE c.case_id = '$case_id' ORDER BY c.start DESC"; $rs = $db->GetAll($sql); print "" . T_("No calls made") . "
"; else { translate_array($rs,array("des")); xhtml_table($rs,array("start","des","phone","link","firstName"),array(T_("Date/Time"),T_("Outcome"),T_("Phone number"),T_("Change outcome"),T_("Operator"))); } $sql = "SELECT count(*) FROM questionnaire_timeslot as q, `case` as c WHERE c.case_id = $case_id AND c.questionnaire_id = q.questionnaire_id"; if ($db->GetOne($sql) >= 1) { print "" . T_("(excludes Not attempted or worked)") . "
"; $sql = "SELECT ag.description, (SELECT COUNT(*) FROM availability as a, `call` as ca WHERE ca.outcome_id != 1 AND ca.case_id = c.case_id AND a.availability_group_id = ag.availability_group_id AND (a.day_of_week = DAYOFWEEK(CONVERT_TZ(ca.start,'UTC','Australia/Victoria')) AND TIME(CONVERT_TZ(ca.start, 'UTC' , 'Australia/Victoria')) >= a.start AND TIME(CONVERT_TZ(ca.start, 'UTC' ,'Australia/Victoria')) <= a.end)) as cou FROM availability_group as ag, `case` as c, `questionnaire_timeslot` as qt WHERE c.case_id = 24 AND qt.questionnaire_id = c.questionnaire_id AND ag.availability_group_id = qt.availability_group_id"; xhtml_table($db->GetAll($sql),array('description','cou'),array(T_("Time slot"),T_("Calls"))); } //view notes $sql = "SELECT DATE_FORMAT(CONVERT_TZ(c.datetime,'UTC',op.Time_zone_name),'".DATE_TIME_FORMAT."') as time, op.firstName, op.lastName, c.note as note, CONCAT('". TQ_("Delete") . "') as link FROM `case_note` as c JOIN (operator as op) on (c.operator_id = op.operator_id) WHERE c.case_id = '$case_id' ORDER BY c.datetime DESC"; $rs = $db->GetAll($sql); print "
" . T_("No notes") . "
"; else xhtml_table($rs,array("time","firstName","note","link"),array(T_("Date/Time"),T_("Operator"),T_("Note"),T_("Delete"))); //add a note ?> " . T_("Modify responses for this case") . ""; else print "" . T_("Select groups to limit availability (Selecting none means always available)") . "
"; print " " . T_("Availability groups not defined for this questionnaire") . ""; } //assign this to an operator for their next case print "" . T_("Remove all sample details and contact numbers from this case") . "
"; ?> " . T_("Case does not exist") . ""; } } xhtml_foot(); ?>