mirror of
https://github.com/ACSPRI/queXS
synced 2024-04-02 12:12:16 +00:00
New page look and layout,
Features: sample data block, disabled "create appointment" for saces with missing sample id, "delete" protection, modal "change call outcome", * "deidentify" currently blocked
This commit is contained in:
@@ -1,33 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* View cases referred to the supervisor and add notes/assign outcomes
|
* View cases referred to the supervisor and add notes/assign outcomes
|
||||||
*
|
|
||||||
*
|
|
||||||
* This file is part of queXS
|
|
||||||
*
|
|
||||||
* queXS is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* queXS is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with queXS; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @author Adam Zammit <adam.zammit@deakin.edu.au>
|
|
||||||
* @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
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -65,6 +38,24 @@ include("../functions/functions.operator.php");
|
|||||||
*/
|
*/
|
||||||
include("../functions/functions.input.php");
|
include("../functions/functions.input.php");
|
||||||
|
|
||||||
|
$css = array(
|
||||||
|
"../include/bootstrap-3.3.2/css/bootstrap.min.css",
|
||||||
|
"../include/bootstrap-3.3.2/css/bootstrap-theme.min.css",
|
||||||
|
"../include/font-awesome-4.3.0/css/font-awesome.css",
|
||||||
|
//"../include/iCheck/skins/square/blue.css",
|
||||||
|
"../css/custom.css"
|
||||||
|
);
|
||||||
|
$js_head = array(
|
||||||
|
"../js/jquery-2.1.3.min.js",
|
||||||
|
"../include/bootstrap-3.3.2/js/bootstrap.min.js"
|
||||||
|
);
|
||||||
|
$js_foot = array(
|
||||||
|
"../js/bootstrap-confirmation.js",
|
||||||
|
"../include/iCheck/icheck.min.js",
|
||||||
|
"../js/window.js",
|
||||||
|
"../js/custom.js"
|
||||||
|
);
|
||||||
|
|
||||||
global $db;
|
global $db;
|
||||||
|
|
||||||
$operator_id = get_operator_id();
|
$operator_id = get_operator_id();
|
||||||
@@ -72,7 +63,7 @@ $operator_id = get_operator_id();
|
|||||||
$case_id = false;
|
$case_id = false;
|
||||||
if (isset($_GET['case_id'])) $case_id = bigintval($_GET['case_id']);
|
if (isset($_GET['case_id'])) $case_id = bigintval($_GET['case_id']);
|
||||||
|
|
||||||
if (isset($_GET['deidentify']))
|
if (isset($_GET['deidentify-confirm-btn']))
|
||||||
{
|
{
|
||||||
//remove all sample vars
|
//remove all sample vars
|
||||||
$db->StartTrans();
|
$db->StartTrans();
|
||||||
@@ -115,8 +106,6 @@ if (isset($_GET['deidentify']))
|
|||||||
$db->CompleteTrans();
|
$db->CompleteTrans();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (isset($_GET['case_note_id']))
|
if (isset($_GET['case_note_id']))
|
||||||
{
|
{
|
||||||
$case_note_id = bigintval($_GET['case_note_id']);
|
$case_note_id = bigintval($_GET['case_note_id']);
|
||||||
@@ -128,10 +117,19 @@ if (isset($_GET['case_note_id']))
|
|||||||
$db->Execute($sql);
|
$db->Execute($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
xhtml_head(T_("Supervisor functions"),true,array("../css/table.css"),array("../js/window.js"));
|
xhtml_head(T_("Assign outcomes to cases"),true,$css,$js_head);//array("../css/table.css"),array("../js/window.js")
|
||||||
|
|
||||||
print "<h1>" . T_("Enter a case id or select a case from the list below:") . "</h1>";
|
?>
|
||||||
|
|
||||||
|
<form action="" method="get" class="form-inline">
|
||||||
|
<div class="form-group pull-left">
|
||||||
|
<label for="case_id" class="control-label text-right"><?php echo T_("Case id:"); ?> </label>
|
||||||
|
<input type="text" class="form-control" name="case_id" id="case_id" value="<?php echo $case_id; ?>" placeholder="<?php echo T_("Enter a case id"); ?>"></input>
|
||||||
|
<button type="submit" class=" btn btn-default " name="case_form" value=""><i class="fa fa-check-square-o fa-fw fa-lg text-primary"></i> <?php echo T_("Select case"); ?></button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
$sql = "SELECT c.case_id as value, c.case_id as description, CASE WHEN c.case_id = '$case_id' THEN 'selected=\'selected\'' ELSE '' END AS selected
|
$sql = "SELECT c.case_id as value, c.case_id as description, CASE WHEN c.case_id = '$case_id' THEN 'selected=\'selected\'' ELSE '' END AS selected
|
||||||
FROM `case` as c, `outcome` as o
|
FROM `case` as c, `outcome` as o
|
||||||
WHERE c.current_outcome_id = o.outcome_id
|
WHERE c.current_outcome_id = o.outcome_id
|
||||||
@@ -141,18 +139,57 @@ $rs = $db->GetAll($sql);
|
|||||||
|
|
||||||
if (!empty($rs))
|
if (!empty($rs))
|
||||||
{
|
{
|
||||||
print "<div><label for=\"case\">". T_("Select case from list of cases referred to the supervisor:") . " </label>";
|
print "<form class='form-inline '><div class='form-group'> <b>" . T_("or") . "</b> <label for='case' class='control-label text-right text-warning' >". T_("Select case from list of cases referred to the supervisor:") . " </label>";
|
||||||
display_chooser($rs,"case","case_id");
|
display_chooser($rs,"case","case_id",true,false,true,false);
|
||||||
print "</div>";
|
print "</div></form>";
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<form action="" method="get">
|
<div class="modal fade" id="call_outcome_change" tabindex="-1" role="dialog" aria-labelledby="calloutcome" aria-hidden="true">
|
||||||
<p>
|
<div class="modal-dialog modal-lg">
|
||||||
<label for="case_id"><?php echo T_("Case id:"); ?> </label><input type="text" name="case_id" id="case_id" value="<?php echo $case_id; ?>"/>
|
<div class="modal-content">
|
||||||
<input type="submit" name="case_form" value="<?php echo T_("Select case"); ?>"/></p>
|
<div class="modal-header">
|
||||||
</form>
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||||
|
<h3 class="modal-title" id="calloutcome"><?php echo T_("Set an outcome for this call");?></h3>
|
||||||
|
</div><form method="get" action="?" class="form-inline ">
|
||||||
|
<div class="modal-body">
|
||||||
|
<?php
|
||||||
|
$call_id = bigintval($_GET['call_id']);
|
||||||
|
$sql = "SELECT o.outcome_id as value,description, CASE WHEN o.outcome_id = c.outcome_id THEN 'selected=\'selected\'' ELSE '' END AS selected
|
||||||
|
FROM outcome as o, `call` as c
|
||||||
|
WHERE c.call_id = '$call_id'";
|
||||||
|
$rs2 = $db->GetAll($sql);
|
||||||
|
translate_array($rs2,array("description"));
|
||||||
|
display_chooser($rs2, "set_outcome_id", "set_outcome_id",true,false,false,false); ?>
|
||||||
|
<input type="hidden" name="call_id" value="<?php echo $call_id;?>"/><input type="hidden" name="case_id" value="<?php echo $case_id;?>"/>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-default" data-dismiss="modal"><?php echo T_("Cancel"); ?></button>
|
||||||
|
<button type="submit" name="submit" class="submitclass btn btn-primary"><?php echo T_("Set outcome"); ?></button>
|
||||||
|
</div></form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="modal fade" id="deidentify-confirm" name="deidentify-confirm" tabindex="-1" role="dialog" aria-labelledby="deidentify-confirm" aria-hidden="true">
|
||||||
|
<div class="modal-dialog">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||||
|
<h4 class="modal-title text-danger " ><?php echo T_("WARNING !");?></h4>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<p><?php echo T_("Are you shure you want to delete") . " " . T_("Sample ID") . " <b class='text-danger'>" . "</b>?";?></p>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-default pull-left" data-dismiss="modal"><?php echo T_("NOOOO...");?></button>
|
||||||
|
<button class="btn btn-danger submitclass" href=" " type="submit" name="deidentify-confirm-btn" ><?php echo T_("Yes"),", ",T_("Delete");?></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
//name="deidentify"
|
||||||
|
|
||||||
if (isset($_GET['call_id']))
|
if (isset($_GET['call_id']))
|
||||||
{
|
{
|
||||||
@@ -163,7 +200,6 @@ if (isset($_GET['call_id']))
|
|||||||
|
|
||||||
if ($outcome_id > 0)
|
if ($outcome_id > 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
$sql = "UPDATE `call`
|
$sql = "UPDATE `call`
|
||||||
SET outcome_id = '$outcome_id'
|
SET outcome_id = '$outcome_id'
|
||||||
WHERE call_id = '$call_id'";
|
WHERE call_id = '$call_id'";
|
||||||
@@ -173,23 +209,10 @@ if (isset($_GET['call_id']))
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print "<h3>" . T_("Set an outcome for this call") . "</h3>";
|
print "<script type='text/javascript' > $(function() { $('#call_outcome_change').modal('show'); }); </script>";
|
||||||
|
|
||||||
?>
|
|
||||||
<form method="get" action="?">
|
|
||||||
<?php
|
|
||||||
$sql = "SELECT o.outcome_id as value,description, CASE WHEN o.outcome_id = c.outcome_id THEN 'selected=\'selected\'' ELSE '' END AS selected
|
|
||||||
FROM outcome as o, `call` as c
|
|
||||||
WHERE c.call_id = '$call_id'";
|
|
||||||
|
|
||||||
$rs2 = $db->GetAll($sql);
|
|
||||||
translate_array($rs2,array("description"));
|
|
||||||
display_chooser($rs2, "set_outcome_id", "set_outcome_id",true,false,false);
|
|
||||||
?>
|
|
||||||
<p><input type="hidden" name="call_id" value="<?php echo $call_id;?>"/><input type="hidden" name="case_id" value="<?php echo $case_id;?>"/><input class="submitclass" type="submit" name="submit" value="<?php echo T_("Set outcome"); ?>"/></p>
|
|
||||||
</form>
|
|
||||||
<?php
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//unset($_GET['call_id']);
|
||||||
}
|
}
|
||||||
if ($case_id != false)
|
if ($case_id != false)
|
||||||
{
|
{
|
||||||
@@ -270,20 +293,69 @@ if ($case_id != false)
|
|||||||
|
|
||||||
if (!empty($rs))
|
if (!empty($rs))
|
||||||
{
|
{
|
||||||
print "<h1>" . T_("Project") . ": {$rs['qd']}</h1>";
|
print " <div class='clearfix'></div>
|
||||||
print "<h1>" . T_("Sample") . ": {$rs['sd']}</h1>";
|
<h3 class='pull-right'> " . T_("Project") . ": <span class='text-primary'>{$rs['qd']} </span></h3>
|
||||||
|
<h3 class='pull-right'> " . T_("Sample") . ": <span class='text-primary'>{$rs['sd']} </span></h3>
|
||||||
print "<h2>". T_("Current outcome:") ." " . T_($rs['description']) . "</h2>";
|
<h2 class=''>". T_("Current outcome:") ."<span class='text-info'> " . T_($rs['description']) . "</span></h2>";
|
||||||
|
|
||||||
$current_outcome_id = $rs['outcome_id'];
|
$current_outcome_id = $rs['outcome_id'];
|
||||||
|
|
||||||
|
// view sample details
|
||||||
|
print "<div class='panel-body'><h4 class=''><i class='fa fa-book'></i> " . T_("Sample details")."</h4>";
|
||||||
|
|
||||||
print "<h3>" . T_("Appointments")."</h3>";
|
$sql = "SELECT sv.sample_id, c.case_id , s.Time_zone_name,
|
||||||
|
TIME_FORMAT(CONVERT_TZ(NOW(),@@session.time_zone,s.Time_zone_name),'". TIME_FORMAT ."') as time
|
||||||
|
FROM sample_var AS sv
|
||||||
|
LEFT JOIN (`case` AS c , sample as s) ON ( c.sample_id = sv.sample_id AND s.sample_id = c.sample_id ) WHERE c.case_id = '$case_id'
|
||||||
|
GROUP BY sv.sample_id";
|
||||||
|
$r = $db->GetAll($sql);
|
||||||
|
if ($r){
|
||||||
|
$fnames = array("sample_id", "Time_zone_name", "time");
|
||||||
|
$fdesc = array(T_("Sample id"),T_("Timezone"),T_("Time NOW"));
|
||||||
|
|
||||||
|
$sql = "SELECT var
|
||||||
|
FROM sample_var
|
||||||
|
WHERE sample_id = {$r[0]['sample_id']} AND type IN (2,3,6,7)
|
||||||
|
ORDER by var DESC";
|
||||||
|
$rs = $db->GetAll($sql);
|
||||||
|
|
||||||
|
foreach($rs as $rsw)
|
||||||
|
{
|
||||||
|
$fnames[] = $rsw['var'];
|
||||||
|
$fdesc[] = $rsw['var'];
|
||||||
|
}
|
||||||
|
foreach($r as &$rw)
|
||||||
|
{
|
||||||
|
$sql = "SELECT var,val
|
||||||
|
FROM sample_var
|
||||||
|
WHERE sample_id = {$rw['sample_id']} AND type IN (2,3,6,7)";
|
||||||
|
$rs = $db->GetAll($sql);
|
||||||
|
foreach($rs as $rsw){
|
||||||
|
$rw[$rsw['var']] = $rsw['val'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
xhtml_table($r,$fnames,$fdesc,"tclass");
|
||||||
|
}else{
|
||||||
|
print "<p class='alert text-danger'>" . T_("No sample data for this case") . "</p>";
|
||||||
|
}
|
||||||
|
print "</div>";
|
||||||
|
|
||||||
//View appointments
|
//View appointments
|
||||||
$sql = "SELECT q.description, CONVERT_TZ(a.start,'UTC',o.Time_zone_name) as start, CONVERT_TZ(a.end,'UTC',o.Time_zone_name) as end, r.firstName, r.lastName, IFNULL(ou.description,'" . T_("Not yet called") . "') as outcome, oo.firstName as makerName, ooo.firstName as callerName, CONCAT('<a href=\'supervisor.php?case_id=', c.case_id, '\'>', c.case_id, '</a>') as case_id, CONCAT('<a href=\'displayappointments.php?case_id=', c.case_id, '&appointment_id=', a.appointment_id, '&delete=delete\'>". TQ_("Delete") . "</a>') as link, CONCAT('<a href=\'displayappointments.php?case_id=', c.case_id, '&appointment_id=', a.appointment_id, '\'>". TQ_("Edit") . "</a>') as edit
|
print "<div class='panel-body'><h4 class=''><i class='fa fa-clock-o'></i> " . T_("Appointments")."</h4>";
|
||||||
|
|
||||||
|
$sql = "SELECT
|
||||||
|
CONVERT_TZ(a.start,'UTC',@@session.time_zone) as start,
|
||||||
|
CONVERT_TZ(a.end,'UTC',@@session.time_zone) as end,
|
||||||
|
CONCAT(r.firstName,' ', r.lastName) as resp,
|
||||||
|
IFNULL(ou.description,'" . T_("Not yet called") . "') as outcome,
|
||||||
|
CONCAT (oo.firstName,' ', oo.lastName) as makerName,
|
||||||
|
CONCAT (ooo.firstName,' ', ooo.lastName) as callerName,
|
||||||
|
CONCAT('<a href=\'supervisor.php?case_id=', c.case_id, '\'>', c.case_id, '</a>') as case_id,
|
||||||
|
CONCAT(' <a href=\'\' data-toggle=\'confirmation\' data-placement=\'left\' data-href=\'displayappointments.php?case_id=', c.case_id, '&appointment_id=', a.appointment_id, '&delete=delete\'><i class=\'fa fa-trash fa-lg text-danger\' data-toggle=\'tooltip\' title=\'" . TQ_("Delete") . "\'></i></a> ') as link,
|
||||||
|
CONCAT(' <a href=\'displayappointments.php?case_id=', c.case_id, '&appointment_id=', a.appointment_id, '\' data-toggle=\'tooltip\' title=\'" . TQ_("Edit") . "\' ><i class=\'fa fa-edit fa-lg\'></i></a> ') as edit
|
||||||
FROM appointment as a
|
FROM appointment as a
|
||||||
JOIN (`case` as c, respondent as r, questionnaire as q, operator as o, operator as oo, call_attempt as cc) on (a.case_id = c.case_id and a.respondent_id = r.respondent_id and q.questionnaire_id = c.questionnaire_id and a.call_attempt_id = cc.call_attempt_id and cc.operator_id = oo.operator_id)
|
JOIN (`case` as c, respondent as r, questionnaire as q, operator as oo, call_attempt as cc) on (a.case_id = c.case_id and a.respondent_id = r.respondent_id and q.questionnaire_id = c.questionnaire_id and a.call_attempt_id = cc.call_attempt_id and cc.operator_id = oo.operator_id)
|
||||||
LEFT JOIN (`call` as ca, outcome as ou, operator as ooo) ON (ca.call_id = a.completed_call_id and ou.outcome_id = ca.outcome_id and ca.operator_id = ooo.operator_id)
|
LEFT JOIN (`call` as ca, outcome as ou, operator as ooo) ON (ca.call_id = a.completed_call_id and ou.outcome_id = ca.outcome_id and ca.operator_id = ooo.operator_id)
|
||||||
WHERE c.case_id = '$case_id'
|
WHERE c.case_id = '$case_id'
|
||||||
GROUP BY a.appointment_id
|
GROUP BY a.appointment_id
|
||||||
@@ -294,114 +366,127 @@ if ($case_id != false)
|
|||||||
if (!empty($rs))
|
if (!empty($rs))
|
||||||
{
|
{
|
||||||
translate_array($rs,array("outcome"));
|
translate_array($rs,array("outcome"));
|
||||||
xhtml_table($rs,array("description","start","end","makerName","firstName","lastName","outcome","callerName","link","edit"),array(T_("Questionnaire"),T_("Start"),T_("End"),T_("Operator Name"),T_("Respondent Name"),T_("Surname"),T_("Current outcome"),T_("Operator who called"),T_("Delete"),T_("Edit")));
|
xhtml_table($rs,array("start","end","edit","makerName","resp","outcome","callerName","link"),array(T_("Start"),T_("End")," <i class='fa fa-edit fa-lg'></i> ",T_("Operator"),T_("Respondent"),T_("Current outcome"),T_("Operator who called")," <i class='fa fa-trash fa-lg'></i> "),"table-hover table-bordered table-condensed col-sm-10");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
print "<p>" . T_("No appointments for this case") . "</p>";
|
print "<div class='alert text-danger col-sm-6' role='alert'><b>" . T_("No appointments for this case") . "</b></div>";
|
||||||
|
|
||||||
print "<p><a href='displayappointments.php?case_id=$case_id&new=new'>" . T_("Create appointment for this case") . "</a></p>";
|
// * disable appointment creation if no sample_id
|
||||||
|
if ($r[0]['sample_id']){
|
||||||
|
$rtz= $r[0]['Time_zone_name'];
|
||||||
|
print " <a href='displayappointments.php?case_id=$case_id&rtz=$rtz&new=new' class='btn btn-default'><i class='fa fa-clock-o fa-lg'></i> " . T_("Create appointment") . "</a>"; }
|
||||||
|
// *
|
||||||
|
print "</div>";
|
||||||
|
|
||||||
|
|
||||||
//view calls and outcomes
|
//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('<a href=\'?case_id=$case_id&call_id=', c.call_id, '\'>". TQ_("Edit") . "</a>') as link, cp.phone as phone
|
$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, CONCAT(op.firstName,' ',op.lastName) as firstName, o.description as des, CONCAT(' <a href=\'?case_id=$case_id&call_id=', c.call_id, '\' data-toggle=\'tooltip\' title=\'" . TQ_("Change outcome") . "\'><i class=\'fa fa-edit fa-lg \'></i></a>') as link, cp.phone as phone
|
||||||
FROM `call` as c
|
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)
|
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'
|
WHERE c.case_id = '$case_id'
|
||||||
ORDER BY c.start DESC";
|
ORDER BY c.start DESC";
|
||||||
|
|
||||||
$rs = $db->GetAll($sql);
|
$rs = $db->GetAll($sql);
|
||||||
|
|
||||||
print "<h3>" . T_("Call list")."</h3>";
|
print "<div class='panel-body col-sm-6'><h4 class=''><i class='fa fa-phone'></i> " . T_("Call list")."</h4>";
|
||||||
if (empty($rs))
|
if (empty($rs))
|
||||||
print "<p>" . T_("No calls made") . "</p>";
|
print "<div class='alert text-info' role='alert'><h4>" . T_("No calls made") . "</h4></div>";
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
translate_array($rs,array("des"));
|
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")));
|
xhtml_table($rs,array("start","phone","firstName","des","link"),array(T_("Date/Time"),T_("Phone number"),T_("Operator"),T_("Outcome")," <i class='fa fa-edit fa-lg'></i> "));
|
||||||
}
|
}
|
||||||
|
print "</div>";
|
||||||
|
|
||||||
//view timeslots
|
//view notes
|
||||||
$sql = "SELECT count(*)
|
$sql = "SELECT DATE_FORMAT(CONVERT_TZ(c.datetime,'UTC',op.Time_zone_name),'".DATE_TIME_FORMAT."') as time, CONCAT(op.firstName,' ',op.lastName) as firstName, c.note as note, CONCAT('<a href=\'\' data-toggle=\'confirmation\' data-placement=\'left\' data-href=\'?case_id=$case_id&case_note_id=', c.case_note_id, '\' class=\'btn center-block\' ><i class=\'fa fa-trash fa-lg text-danger\' data-toggle=\'tooltip\' title=\'" . TQ_("Delete") . "\'></i></a>') 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 "<div class='panel-body col-sm-6'><h4 class=''><i class='fa fa-file-text'></i> " . T_("Case notes")."</h4>";
|
||||||
|
|
||||||
|
if (empty($rs))
|
||||||
|
print "<p class='alert text-info '>" . T_("No notes") . "</p>";
|
||||||
|
else {
|
||||||
|
xhtml_table($rs,array("time","firstName","note","link"),array(T_("Date/Time"),T_("Operator"),T_("Note")," <i class='fa fa-trash fa-lg'></i> "));
|
||||||
|
print "<br/>";
|
||||||
|
}
|
||||||
|
//add a note
|
||||||
|
?>
|
||||||
|
<form method="get" action="?" class="form-inline" >
|
||||||
|
<input type="hidden" name="case_id" value="<?php echo $case_id;?>"/>
|
||||||
|
<input type="text" class="textclass form-control" name="note" id="note" style="width: 80%;"/> 
|
||||||
|
<button class="submitclass btn btn-default" type="submit" name="submit"><i class="fa fa-file-text"></i> <?php echo T_("Add note"); ?></button>
|
||||||
|
</form>
|
||||||
|
<?php
|
||||||
|
print "</div>";
|
||||||
|
|
||||||
|
//view timeslots
|
||||||
|
$sql = "SELECT count(*)
|
||||||
FROM questionnaire_timeslot as q, `case` as c
|
FROM questionnaire_timeslot as q, `case` as c
|
||||||
WHERE c.case_id = $case_id
|
WHERE c.case_id = $case_id
|
||||||
AND c.questionnaire_id = q.questionnaire_id";
|
AND c.questionnaire_id = q.questionnaire_id";
|
||||||
|
|
||||||
if ($db->GetOne($sql) >= 1)
|
if ($db->GetOne($sql) >= 1)
|
||||||
{
|
{
|
||||||
print "<h3>" . T_("Call attempts by timeslot") . "</h3>";
|
$sql = "SELECT ag.description, (SELECT COUNT(*) FROM availability as a, `call_attempt` as ca
|
||||||
|
WHERE ca.case_id = c.case_id
|
||||||
$sql = "SELECT ag.description, (SELECT COUNT(*) FROM availability as a, `call_attempt` as ca WHERE ca.case_id = c.case_id AND a.availability_group_id = ag.availability_group_id
|
AND a.availability_group_id = ag.availability_group_id
|
||||||
AND (a.day_of_week = DAYOFWEEK(CONVERT_TZ(ca.start,'UTC',s.Time_zone_name))
|
AND (a.day_of_week = DAYOFWEEK(CONVERT_TZ(ca.start,'UTC',s.Time_zone_name))
|
||||||
AND TIME(CONVERT_TZ(ca.start, 'UTC' , s.Time_zone_name)) >= a.start
|
AND TIME(CONVERT_TZ(ca.start, 'UTC' , s.Time_zone_name)) >= a.start
|
||||||
AND TIME(CONVERT_TZ(ca.start, 'UTC' , s.Time_zone_name)) <= a.end)) as cou
|
AND TIME(CONVERT_TZ(ca.start, 'UTC' , s.Time_zone_name)) <= a.end)) as cou
|
||||||
FROM availability_group as ag, `case` as c, `questionnaire_timeslot` as qt, sample as s
|
FROM availability_group as ag, `case` as c, `questionnaire_timeslot` as qt, sample as s
|
||||||
WHERE c.case_id = '$case_id'
|
WHERE c.case_id = '$case_id'
|
||||||
AND s.sample_id = c.sample_id
|
AND s.sample_id = c.sample_id
|
||||||
AND qt.questionnaire_id = c.questionnaire_id AND ag.availability_group_id = qt.availability_group_id";
|
AND qt.questionnaire_id = c.questionnaire_id AND ag.availability_group_id = qt.availability_group_id";
|
||||||
|
if ( array("cou") >=1){
|
||||||
xhtml_table($db->GetAll($sql),array('description','cou'),array(T_("Time slot"),T_("Call attempts")));
|
print "<div class='panel-body col-sm-6'><h4 class=''><i class='fa fa-list'></i> " . T_("Call attempts by timeslot") . "</h4>";
|
||||||
|
xhtml_table($db->GetAll($sql),array('description','cou'),array(T_("Time slot"),T_("Call attempts")));//,"tclass",false,array("cou")
|
||||||
}
|
print "</div>";
|
||||||
|
}
|
||||||
//view notes
|
} else { print "<b class=' text-info col-sm-6'>" . T_("Time slots NOT defined") . "</b>"; }
|
||||||
$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('<a href=\'?case_id=$case_id&case_note_id=', c.case_note_id, '\'>". TQ_("Delete") . "</a>') 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 "<div class='clearfix '></div><div class='col-sm-6'>";
|
||||||
|
|
||||||
print "<h3>" . T_("Case notes")."</h3>";
|
if ($r[0]['sample_id']){ //if sample data exists assign this to an operator for their next case
|
||||||
|
|
||||||
if (empty($rs))
|
print "<div class='panel-body'><h4><i class='fa fa-link'></i> " . T_("Assign this case to operator (will appear as next case for them)") . "</h4>";
|
||||||
print "<p>" . T_("No notes") . "</p>";
|
|
||||||
else
|
|
||||||
xhtml_table($rs,array("time","firstName","note","link"),array(T_("Date/Time"),T_("Operator"),T_("Note"),T_("Delete")));
|
|
||||||
|
|
||||||
|
|
||||||
//add a note
|
|
||||||
?>
|
?>
|
||||||
<form method="get" action="?">
|
<form method="get" action="?" class="form-inline">
|
||||||
<p>
|
|
||||||
<input type="hidden" name="case_id" value="<?php echo $case_id;?>"/><input type="text" class="textclass" name="note" id="note"/><input class="submitclass" type="submit" name="submit" value="<?php echo T_("Add note"); ?>"/>
|
|
||||||
</p>
|
|
||||||
</form>
|
|
||||||
<?php
|
<?php
|
||||||
|
$sql = "SELECT operator_id as value,CONCAT(firstName,' ', lastName) as description, CASE WHEN next_case_id = '$case_id' THEN 'selected=\'selected\'' ELSE '' END AS selected
|
||||||
|
FROM operator
|
||||||
|
WHERE enabled = 1";
|
||||||
|
|
||||||
|
$rs3 = $db->GetAll($sql);
|
||||||
|
display_chooser($rs3, "operator_id", "operator_id",true,false,false,false);
|
||||||
|
?>
|
||||||
|
<input type="hidden" name="case_id" value="<?php echo $case_id;?>"/>
|
||||||
|
<button class="submitclass btn btn-default" type="submit" name="submit" ><i class="fa fa-link fa-lg"></i> <?php echo T_("Assign this case to operator"); ?></button>
|
||||||
|
</form></div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
//Modify the case in Limesurvey
|
//Modify the case in Limesurvey
|
||||||
|
|
||||||
$sid = get_lime_sid($case_id);
|
$sid = get_lime_sid($case_id);
|
||||||
$id = get_lime_id($case_id);
|
$id = get_lime_id($case_id);
|
||||||
|
print "<div class='panel-body'>";
|
||||||
if ($id)
|
if ($id)
|
||||||
print "<h3><a href='" . LIME_URL . "admin/admin.php?action=dataentry&sid=$sid&subaction=edit&id=$id'>" . T_("Modify responses for this case") . "</a></h3>";
|
print "<h4><a href='" . LIME_URL . "admin/admin.php?action=dataentry&sid=$sid&subaction=edit&id=$id' class='btn btn-default btn-lime'><i class='fa fa-lemon-o fa-lg'></i> " . T_("Modify responses for this case") . "</a></h4>";
|
||||||
else
|
else
|
||||||
print "<h3>" . T_("Case not yet started in Limesurvey") . "</h3>";
|
print "<div class='alert text-danger' role='alert'>" . T_("Case not yet started in Limesurvey") . "</div>";
|
||||||
|
print "</div></div>";
|
||||||
|
|
||||||
//set an outcome
|
|
||||||
|
|
||||||
print "<h3>" . T_("Set a case outcome") . "</h3>";
|
|
||||||
|
|
||||||
?>
|
if ($r[0]['sample_id']){ // if sample data exists view availability
|
||||||
<form method="get" action="?">
|
|
||||||
<?php
|
|
||||||
$sql = "SELECT outcome_id as value,description, CASE WHEN outcome_id = '$current_outcome_id' THEN 'selected=\'selected\'' ELSE '' END AS selected
|
|
||||||
FROM outcome";
|
|
||||||
|
|
||||||
$rs2 = $db->GetAll($sql);
|
print "<div class='panel-body col-sm-6'><h4 class=''><i class='fa fa-calendar'></i> " . T_("Availability groups") . "</h4>";
|
||||||
translate_array($rs2,array("description"));
|
|
||||||
display_chooser($rs2, "outcome_id", "outcome_id",true,false,false);
|
|
||||||
|
|
||||||
?>
|
|
||||||
<p><input type="hidden" name="case_id" value="<?php echo $case_id;?>"/><input class="submitclass" type="submit" name="submit" value="<?php echo T_("Set outcome"); ?>"/></p>
|
|
||||||
</form>
|
|
||||||
<?php
|
|
||||||
|
|
||||||
//view availability
|
|
||||||
if (is_using_availability($case_id))
|
if (is_using_availability($case_id))
|
||||||
{
|
{
|
||||||
|
|
||||||
//List all availability group items and whether selected or not (all selected by default unless >= 1 availability group is in use for this case
|
//List all availability group items and whether selected or not (all selected by default unless >= 1 availability group is in use for this case
|
||||||
$sql = "SELECT qa.availability_group_id,ag.description,ca.availability_group_id as selected_group_id
|
$sql = "SELECT qa.availability_group_id,ag.description,ca.availability_group_id as selected_group_id
|
||||||
FROM `case` as c
|
FROM `case` as c
|
||||||
@@ -413,9 +498,8 @@ if ($case_id != false)
|
|||||||
$rs = $db->GetAll($sql);
|
$rs = $db->GetAll($sql);
|
||||||
|
|
||||||
//Display all availability groups as checkboxes
|
//Display all availability groups as checkboxes
|
||||||
|
print "<form action='?' method='get' class='form-horizontal '>";
|
||||||
print "<p>" . T_("Select groups to limit availability (Selecting none means always available)") . "</p>";
|
print "<h5 class=''>" . T_("Select groups to limit availability (Selecting none means always available)") . "</h5><div class='col-sm-8'>";
|
||||||
print "<form action='?' method='get'>";
|
|
||||||
foreach ($rs as $r)
|
foreach ($rs as $r)
|
||||||
{
|
{
|
||||||
$checked = "";
|
$checked = "";
|
||||||
@@ -424,59 +508,69 @@ if ($case_id != false)
|
|||||||
if ($r['availability_group_id'] == $r['selected_group_id'])
|
if ($r['availability_group_id'] == $r['selected_group_id'])
|
||||||
$checked = "checked='checked'";
|
$checked = "checked='checked'";
|
||||||
|
|
||||||
|
print " <input type='checkbox' name='ag{$r['availability_group_id']}' id='ag{$r['availability_group_id']}' value='{$r['availability_group_id']}' $checked />  <label class='control-label' for='ag{$r['availability_group_id']}'>{$r['description']}</label></br>";
|
||||||
print " <div><input type='checkbox' name='ag{$r['availability_group_id']}' id='ag{$r['availability_group_id']}'
|
|
||||||
value='{$r['availability_group_id']}' $checked />
|
|
||||||
<label for='ag{$r['availability_group_id']}'>{$r['description']}</label></div>";
|
|
||||||
|
|
||||||
}
|
}
|
||||||
?>
|
?> </div>
|
||||||
<p><input type="hidden" name="case_id" value="<?php echo $case_id;?>"/><input class="submitclass" type="submit" name="submitag" value="<?php echo T_("Update case availability"); ?>"/></p>
|
<input type="hidden" name="case_id" value="<?php echo $case_id;?>"/>
|
||||||
|
<button class="submitclass btn btn-default pull-right" type="submit" name="submitag"><i class="fa fa-calendar fa-lg"></i> <?php echo T_("Update case availability");?></button>
|
||||||
</form>
|
</form>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print "<p>" . T_("Availability groups not defined for this questionnaire") . "</p>";
|
print "<div class='alert text-info' role='alert'><h5>" . T_("Availability groups not defined for this questionnaire") . "</h5></div>";
|
||||||
}
|
}
|
||||||
|
print "</div>"; }
|
||||||
|
|
||||||
|
//set an outcome
|
||||||
//assign this to an operator for their next case
|
print "<div class='clearfix '></div><div class='panel-body col-sm-6 '><h4><i class='fa fa-dot-circle-o'></i> " . T_("Set a case outcome") . "</h4>";
|
||||||
print "<h3>" . T_("Assign this case to operator (will appear as next case for them)") . "</h3>";
|
|
||||||
?>
|
?>
|
||||||
<form method="get" action="?">
|
<form method="get" action="?" class="form-inline">
|
||||||
<?php
|
<?php
|
||||||
$sql = "SELECT operator_id as value,CONCAT(firstName,' ', lastName) as description, CASE WHEN next_case_id = '$case_id' THEN 'selected=\'selected\'' ELSE '' END AS selected
|
$sql = "SELECT outcome_id as value,description, CASE WHEN outcome_id = '$current_outcome_id' THEN 'selected=\'selected\'' ELSE '' END AS selected
|
||||||
FROM operator
|
FROM outcome";
|
||||||
WHERE enabled = 1";
|
|
||||||
|
|
||||||
$rs3 = $db->GetAll($sql);
|
|
||||||
display_chooser($rs3, "operator_id", "operator_id",true,false,false);
|
|
||||||
|
|
||||||
|
$rs2 = $db->GetAll($sql);
|
||||||
|
translate_array($rs2,array("description"));
|
||||||
|
display_chooser($rs2, "outcome_id", "outcome_id",true,false,false,false);
|
||||||
?>
|
?>
|
||||||
<p><input type="hidden" name="case_id" value="<?php echo $case_id;?>"/><input class="submitclass" type="submit" name="submit" value="<?php echo T_("Assign this case to operator"); ?>"/></p>
|
<input type="hidden" name="case_id" value="<?php echo $case_id;?>" /><br/><br/>
|
||||||
|
<button class="submitclass btn btn-primary" type="submit" name="submit" ><i class="fa fa-dot-circle-o fa-lg"></i> <?php echo T_("Set outcome"); ?></button>
|
||||||
</form>
|
</form>
|
||||||
<?php
|
<?php
|
||||||
|
print "</div>";
|
||||||
|
|
||||||
//deidentify record
|
if ($r[0]['sample_id']){ // if sample data exists deidentify record
|
||||||
print "<h3>" . T_("Deidentify") . "</h3>";
|
print "<div class='panel-body col-sm-6 pull-right'><h4 class ='text-danger'><i class='fa fa-trash-o fa-lg'></i> " . T_("Deidentify") . "</h4>";
|
||||||
print "<p>" . T_("Remove all sample details and contact numbers from this case") . "</p>";
|
print "<div class='well'>" . T_("Remove all sample details and contact numbers from this case") . "</div>";
|
||||||
?>
|
?>
|
||||||
<form method="get" action="?">
|
<form method="get" action="?">
|
||||||
<p>
|
|
||||||
<input type="hidden" name="case_id" value="<?php echo $case_id;?>"/>
|
<input type="hidden" name="case_id" value="<?php echo $case_id;?>"/>
|
||||||
<input class="submitclass" type="submit" name="deidentify" id="deidentify" value="<?php echo T_("Deidentify");?>"/>
|
<button class=" btn btn-danger" name="deidentify" id="deidentify"><i class="fa fa-trash fa-lg"></i> <?php echo T_("Deidentify");?></button>
|
||||||
</p>
|
</form></div>
|
||||||
</form>
|
<?php }
|
||||||
<?php
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print "<h2>" . T_("Case does not exist") . "</h2>";
|
print "<h3 class='alert alert-warning'>" . T_("Case does not exist") . "</h3>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
xhtml_foot();
|
xhtml_foot($js_foot);// deidentify data-toggle="modal" type="submit"submitclass
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
$('[data-toggle="confirmation"]').confirmation()
|
||||||
|
$("#deidentify").click(function(){
|
||||||
|
$("#deidentify-confirm").modal('show');});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
$('input').iCheck({
|
||||||
|
/* checkboxClass: 'icheckbox_square-blue', */
|
||||||
|
/* increaseArea: '15%' */
|
||||||
|
checkboxClass: 'fa fa-lg', // text-primary
|
||||||
|
checkedCheckboxClass: 'fa-check-square-o text-primary',
|
||||||
|
uncheckedCheckboxClass: 'fa-square-o'
|
||||||
|
});
|
||||||
|
</script>
|
||||||
Reference in New Issue
Block a user