mirror of
https://github.com/ACSPRI/queXS
synced 2024-04-02 12:12:16 +00:00
new look for pages
This commit is contained in:
@@ -73,7 +73,7 @@ $js_head = array(
|
|||||||
);
|
);
|
||||||
$js_foot = array(
|
$js_foot = array(
|
||||||
"../js/window.js",
|
"../js/window.js",
|
||||||
"../js/custom.js"
|
//"../js/custom.js"
|
||||||
);
|
);
|
||||||
global $db;
|
global $db;
|
||||||
|
|
||||||
@@ -113,29 +113,26 @@ else if (isset($_POST['availability_group']))
|
|||||||
}
|
}
|
||||||
|
|
||||||
//view groups
|
//view groups
|
||||||
$sql = "SELECT description,
|
$sql = "SELECT availability_group_id,description,
|
||||||
CONCAT('<a href=\'availability.php?availability_group=', availability_group_id, '\'>". TQ_("Modify") . "</a>') as link
|
CONCAT('<a href=\'availability.php?availability_group=', availability_group_id, '\'>". TQ_("Modify") . "</a>') as link
|
||||||
FROM availability_group";
|
FROM availability_group";
|
||||||
|
|
||||||
$rs = $db->GetAll($sql);
|
$rs = $db->GetAll($sql);
|
||||||
|
|
||||||
//print "<h3>" . T_("Time slots")."</h3>";
|
|
||||||
|
|
||||||
print "<div class='well'>" . T_("Time slots define periods of time during particular days of the week. These are used for the availability function and also the call attempt time slot function.") . "</div>";
|
print "<div class='well'>" . T_("Time slots define periods of time during particular days of the week. These are used for the availability function and also the call attempt time slot function.") . "</div>";
|
||||||
|
|
||||||
if (empty($rs))
|
if (empty($rs))
|
||||||
print "<div class='alert alert-danger'>" . T_("No time slots") . "</div>";
|
print "<div class='alert alert-danger'>" . T_("No time slots") . "</div>";
|
||||||
else{
|
else{
|
||||||
print "<div class='panel-body col-sm-4'>";
|
print "<div class='panel-body col-sm-6'>";
|
||||||
// print "<h3>" . T_("Time slots")."</h3>";
|
xhtml_table($rs,array("availability_group_id","description","link"),array(T_("ID"),T_("Time slot name"),T_("Modify")),"table table-hover");
|
||||||
xhtml_table($rs,array("description","link"),array(T_("Time slot"),T_("Modify")));
|
|
||||||
print "</div>";
|
print "</div>";
|
||||||
}
|
}
|
||||||
|
|
||||||
//add an availablity group <label for="availability_group"><?php echo T_("Time slot name"); : </label>
|
//add a time slot (ex- availablity group)
|
||||||
?>
|
?>
|
||||||
<div class=" panel-body col-sm-4"><form method="post" action="?">
|
<div class=" panel-body col-sm-4"><form method="post" action="?">
|
||||||
<h3><?php echo T_("Add time slot")," :";?></h3>
|
<h3><?php echo T_("Add new time slot")," :";?></h3>
|
||||||
<p><input type="text" class="textclass form-control" name="availability_group" id="availability_group" placeholder="<?php echo T_("Enter")," ",T_("new")," ",T_("Time slot name"); ?>"/></p>
|
<p><input type="text" class="textclass form-control" name="availability_group" id="availability_group" placeholder="<?php echo T_("Enter")," ",T_("new")," ",T_("Time slot name"); ?>"/></p>
|
||||||
<p><input class="submitclass btn btn-default" type="submit" name="submit" value="<?php echo T_("Add time slot"); ?>"/></p>
|
<p><input class="submitclass btn btn-default" type="submit" name="submit" value="<?php echo T_("Add time slot"); ?>"/></p>
|
||||||
</form></div>
|
</form></div>
|
||||||
|
|||||||
@@ -1,272 +1,289 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Generate bulk appointments from a Headered CSV file
|
* Generate bulk appointments from a Headered CSV file
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* This file is part of queXS
|
* This file is part of queXS
|
||||||
*
|
*
|
||||||
* queXS is free software; you can redistribute it and/or modify
|
* queXS is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* queXS is distributed in the hope that it will be useful,
|
* queXS is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with queXS; if not, write to the Free Software
|
* along with queXS; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @author Adam Zammit <adam.zammit@acspri.org.au>
|
* @author Adam Zammit <adam.zammit@acspri.org.au>
|
||||||
* @copyright Australian Consortium for Social and Political Research (ACSPRI) 2012
|
* @copyright Australian Consortium for Social and Political Research (ACSPRI) 2012
|
||||||
* @package queXS
|
* @package queXS
|
||||||
* @subpackage admin
|
* @subpackage admin
|
||||||
* @link http://www.acspri.org.au/software queXS was writen for ACSPRI
|
* @link http://www.acspri.org.au/software queXS was writen for ACSPRI
|
||||||
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configuration file
|
* Configuration file
|
||||||
*/
|
*/
|
||||||
include ("../config.inc.php");
|
include ("../config.inc.php");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* XHTML functions
|
* XHTML functions
|
||||||
*/
|
*/
|
||||||
include ("../functions/functions.xhtml.php");
|
include ("../functions/functions.xhtml.php");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Database functions
|
* Database functions
|
||||||
*/
|
*/
|
||||||
include ("../db.inc.php");
|
include ("../db.inc.php");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Operator functions
|
* Operator functions
|
||||||
*/
|
*/
|
||||||
include("../functions/functions.operator.php");
|
include("../functions/functions.operator.php");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validate that an uploaded CSV file contains a caseid, starttime and endtime column and generate
|
* Validate that an uploaded CSV file contains a caseid, starttime and endtime column and generate
|
||||||
* an array containing the details for confirming on screen or updating the database
|
* an array containing the details for confirming on screen or updating the database
|
||||||
*
|
*
|
||||||
* @param string $tmpfname File name of uploaded CSV file
|
* @param string $tmpfname File name of uploaded CSV file
|
||||||
*
|
*
|
||||||
* @return bool|array False if invalid otherwise an array of arrays containing caseid,starttime,endtime and note
|
* @return bool|array False if invalid otherwise an array of arrays containing caseid,starttime,endtime and note
|
||||||
* @author Adam Zammit <adam.zammit@acspri.org.au>
|
* @author Adam Zammit <adam.zammit@acspri.org.au>
|
||||||
* @since 2012-11-02
|
* @since 2012-11-02
|
||||||
*/
|
*/
|
||||||
function validate_bulk_appointment($tmpfname)
|
function validate_bulk_appointment($tmpfname)
|
||||||
{
|
{
|
||||||
$handle = fopen($tmpfname, "r");
|
$handle = fopen($tmpfname, "r");
|
||||||
$row = 1;
|
$row = 1;
|
||||||
$cols = array("caseid" => -1,"starttime" => -1,"endtime" => -1);
|
$cols = array("caseid" => -1,"starttime" => -1,"endtime" => -1);
|
||||||
$index = array();
|
$index = array();
|
||||||
$optcols = array("note" => -1);
|
$optcols = array("note" => -1);
|
||||||
|
|
||||||
$todo = array();
|
$todo = array();
|
||||||
|
|
||||||
while (($data = fgetcsv($handle)) !== FALSE)
|
while (($data = fgetcsv($handle)) !== FALSE)
|
||||||
{
|
{
|
||||||
//data contains an array of elements in the csv
|
//data contains an array of elements in the csv
|
||||||
//selected contains an indexed array of elements to import with the type attached
|
//selected contains an indexed array of elements to import with the type attached
|
||||||
|
|
||||||
|
|
||||||
if ($row == 1) //validate
|
if ($row == 1) //validate
|
||||||
{
|
{
|
||||||
$colcount = 0;
|
$colcount = 0;
|
||||||
$ic = 0;
|
$ic = 0;
|
||||||
foreach($data as $col)
|
foreach($data as $col)
|
||||||
{
|
{
|
||||||
if (array_key_exists(strtolower($col),$cols))
|
if (array_key_exists(strtolower($col),$cols))
|
||||||
{
|
{
|
||||||
$cols[strtolower($col)] = $ic;
|
$cols[strtolower($col)] = $ic;
|
||||||
$colcount++;
|
$colcount++;
|
||||||
}
|
}
|
||||||
if (array_key_exists(strtolower($col),$optcols))
|
if (array_key_exists(strtolower($col),$optcols))
|
||||||
{
|
{
|
||||||
$optcols[strtolower($col)] = $ic;
|
$optcols[strtolower($col)] = $ic;
|
||||||
}
|
}
|
||||||
$ic++;
|
$ic++;
|
||||||
}
|
}
|
||||||
if ($colcount != 3)
|
if ($colcount != 3)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$note = "";
|
$note = "";
|
||||||
if (isset($data[$optcols['note']]))
|
if (isset($data[$optcols['note']]))
|
||||||
$note = $data[$optcols['note']];
|
$note = $data[$optcols['note']];
|
||||||
|
|
||||||
$sd = getdate(strtotime($data[$cols['starttime']]));
|
$sd = getdate(strtotime($data[$cols['starttime']]));
|
||||||
$s = $sd['year'] . "-" . str_pad($sd['mon'],2,"0", STR_PAD_LEFT) . "-" . str_pad($sd['mday'],2,"0",STR_PAD_LEFT) . " " . str_pad($sd['hours'],2,"0",STR_PAD_LEFT) . ":" . str_pad($sd['minutes'],2,"0",STR_PAD_LEFT) . ":" . str_pad($sd['seconds'],2,"0",STR_PAD_LEFT);
|
$s = $sd['year'] . "-" . str_pad($sd['mon'],2,"0", STR_PAD_LEFT) . "-" . str_pad($sd['mday'],2,"0",STR_PAD_LEFT) . " " . str_pad($sd['hours'],2,"0",STR_PAD_LEFT) . ":" . str_pad($sd['minutes'],2,"0",STR_PAD_LEFT) . ":" . str_pad($sd['seconds'],2,"0",STR_PAD_LEFT);
|
||||||
|
|
||||||
$sd = getdate(strtotime($data[$cols['endtime']]));
|
$sd = getdate(strtotime($data[$cols['endtime']]));
|
||||||
$e = $sd['year'] . "-" . str_pad($sd['mon'],2,"0", STR_PAD_LEFT) . "-" . str_pad($sd['mday'],2,"0",STR_PAD_LEFT) . " " . str_pad($sd['hours'],2,"0",STR_PAD_LEFT) . ":" . str_pad($sd['minutes'],2,"0",STR_PAD_LEFT) . ":" . str_pad($sd['seconds'],2,"0",STR_PAD_LEFT);
|
$e = $sd['year'] . "-" . str_pad($sd['mon'],2,"0", STR_PAD_LEFT) . "-" . str_pad($sd['mday'],2,"0",STR_PAD_LEFT) . " " . str_pad($sd['hours'],2,"0",STR_PAD_LEFT) . ":" . str_pad($sd['minutes'],2,"0",STR_PAD_LEFT) . ":" . str_pad($sd['seconds'],2,"0",STR_PAD_LEFT);
|
||||||
|
|
||||||
$todor = array($data[$cols['caseid']],$s,$e,$note);
|
$todor = array($data[$cols['caseid']],$s,$e,$note);
|
||||||
|
|
||||||
$todo[] = $todor;
|
$todo[] = $todor;
|
||||||
}
|
}
|
||||||
|
|
||||||
$row++;
|
$row++;
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose($handle);
|
fclose($handle);
|
||||||
|
|
||||||
return $todo;
|
return $todo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (isset($_POST['tmpfname']))
|
if (isset($_POST['tmpfname']))
|
||||||
{
|
{
|
||||||
xhtml_head("queXS",true,array("../css/table.css"));
|
$subtitle = T_("Result");
|
||||||
$todo = validate_bulk_appointment($_POST['tmpfname']);
|
xhtml_head(T_("Bulk appointment generator"),true,array("../include/bootstrap-3.3.2/css/bootstrap.min.css","../css/custom.css"),false,false,false,false,$subtitle);
|
||||||
|
$todo = validate_bulk_appointment($_POST['tmpfname']);
|
||||||
if (is_array($todo))
|
|
||||||
{
|
if (is_array($todo))
|
||||||
$res = array();
|
{
|
||||||
foreach($todo as $r)
|
$res = array();
|
||||||
{
|
foreach($todo as $r)
|
||||||
$db->StartTrans();
|
{
|
||||||
|
$db->StartTrans();
|
||||||
//check the current case id exists and outcome is not final
|
|
||||||
$sql = "SELECT c.case_id
|
//check the current case id exists and outcome is not final
|
||||||
FROM `case` as c, `outcome` as o
|
$sql = "SELECT c.case_id
|
||||||
WHERE c.current_outcome_id = o.outcome_id
|
FROM `case` as c, `outcome` as o
|
||||||
AND o.outcome_type_id != 4
|
WHERE c.current_outcome_id = o.outcome_id
|
||||||
AND c.case_id = {$r[0]}
|
AND o.outcome_type_id != 4
|
||||||
AND c.current_operator_id IS NULL";
|
AND c.case_id = {$r[0]}
|
||||||
|
AND c.current_operator_id IS NULL";
|
||||||
$caseid = $db->GetOne($sql);
|
|
||||||
|
$caseid = $db->GetOne($sql);
|
||||||
if (!empty($caseid))
|
|
||||||
{
|
if (!empty($caseid))
|
||||||
//insert an appointment in respondent time
|
{
|
||||||
$sql = "SELECT respondent_id
|
//insert an appointment in respondent time
|
||||||
FROM respondent
|
$sql = "SELECT respondent_id
|
||||||
WHERE case_id = {$r[0]}";
|
FROM respondent
|
||||||
|
WHERE case_id = {$r[0]}";
|
||||||
$rid = $db->GetOne($sql);
|
|
||||||
|
$rid = $db->GetOne($sql);
|
||||||
$sql = "SELECT contact_phone_id
|
|
||||||
FROM contact_phone
|
$sql = "SELECT contact_phone_id
|
||||||
WHERE case_id = {$r[0]}
|
FROM contact_phone
|
||||||
ORDER BY priority ASC";
|
WHERE case_id = {$r[0]}
|
||||||
|
ORDER BY priority ASC";
|
||||||
$cid = $db->GetOne($sql);
|
|
||||||
|
$cid = $db->GetOne($sql);
|
||||||
$oid = get_operator_id();
|
|
||||||
|
$oid = get_operator_id();
|
||||||
$sql = "INSERT INTO call_attempt (call_attempt_id,case_id,operator_id,respondent_id,start,end)
|
|
||||||
VALUES (NULL,{$r[0]},$oid,$rid,CONVERT_TZ(NOW(),'System','UTC'),CONVERT_TZ(NOW(),'System','UTC'))";
|
$sql = "INSERT INTO call_attempt (call_attempt_id,case_id,operator_id,respondent_id,start,end)
|
||||||
|
VALUES (NULL,{$r[0]},$oid,$rid,CONVERT_TZ(NOW(),'System','UTC'),CONVERT_TZ(NOW(),'System','UTC'))";
|
||||||
$db->Execute($sql);
|
|
||||||
|
$db->Execute($sql);
|
||||||
$call_attempt_id = $db->Insert_ID();
|
|
||||||
|
$call_attempt_id = $db->Insert_ID();
|
||||||
$sql = "INSERT INTO appointment (case_id,contact_phone_id,`start`,`end`,respondent_id,call_attempt_id)
|
|
||||||
SELECT {$r[0]},$cid,CONVERT_TZ('{$r[1]}',Time_zone_name,'UTC'),CONVERT_TZ('{$r[2]}',Time_zone_name,'UTC'),$rid,$call_attempt_id
|
$sql = "INSERT INTO appointment (case_id,contact_phone_id,`start`,`end`,respondent_id,call_attempt_id)
|
||||||
FROM respondent
|
SELECT {$r[0]},$cid,CONVERT_TZ('{$r[1]}',Time_zone_name,'UTC'),CONVERT_TZ('{$r[2]}',Time_zone_name,'UTC'),$rid,$call_attempt_id
|
||||||
WHERE respondent_id = $rid";
|
FROM respondent
|
||||||
|
WHERE respondent_id = $rid";
|
||||||
$db->Execute($sql);
|
|
||||||
|
$db->Execute($sql);
|
||||||
$aid = $db->Insert_ID();
|
|
||||||
|
$aid = $db->Insert_ID();
|
||||||
//change the outcome to unspecified appointment, other
|
|
||||||
$sql = "UPDATE `case`
|
//change the outcome to unspecified appointment, other
|
||||||
SET current_outcome_id = 22
|
$sql = "UPDATE `case`
|
||||||
WHERE case_id = {$r[0]}";
|
SET current_outcome_id = 22
|
||||||
|
WHERE case_id = {$r[0]}";
|
||||||
$db->Execute($sql);
|
|
||||||
|
$db->Execute($sql);
|
||||||
//add a note if not blank
|
|
||||||
if (!empty($r[3]))
|
//add a note if not blank
|
||||||
{
|
if (!empty($r[3]))
|
||||||
$note = $db->qstr($r[3]);
|
{
|
||||||
$sql = "INSERT INTO case_note (case_id,operator_id,note,datetime)
|
$note = $db->qstr($r[3]);
|
||||||
VALUES ({$r[0]},$oid,$note,CONVERT_TZ(NOW(),'System','UTC'))";
|
$sql = "INSERT INTO case_note (case_id,operator_id,note,datetime)
|
||||||
$db->Execute($sql);
|
VALUES ({$r[0]},$oid,$note,CONVERT_TZ(NOW(),'System','UTC'))";
|
||||||
|
$db->Execute($sql);
|
||||||
}
|
|
||||||
|
}
|
||||||
$cnote = T_("Added appointment") . " <a href='displayappointments?case_id={$r[0]}&appointment_id=$aid'>$aid</a>";
|
|
||||||
}
|
$cnote = T_("Added appointment") . " <a href='displayappointments?case_id={$r[0]}&appointment_id=$aid'>$aid</a>";
|
||||||
else
|
}
|
||||||
{
|
else
|
||||||
$cnote = T_("No such case id, or case set to a final outcome, or case currently assigned to an operator");
|
{
|
||||||
}
|
$cnote = T_("No such case id, or case set to a final outcome, or case currently assigned to an operator");
|
||||||
|
}
|
||||||
$res[] = array("<a href='supervisor.php?case_id=" . $r[0] . "'>" . $r[0] . "</a>",$cnote);
|
|
||||||
$db->CompleteTrans();
|
$res[] = array("<a href='supervisor.php?case_id=" . $r[0] . "'>" . $r[0] . "</a>",$cnote);
|
||||||
}
|
$db->CompleteTrans();
|
||||||
xhtml_table($res,array(0,1),array(T_("Case id"),T_("Result")));
|
}
|
||||||
}
|
xhtml_table($res,array(0,1),array(T_("Case id"),T_("Result")));
|
||||||
xhtml_foot();
|
}
|
||||||
}
|
xhtml_foot();
|
||||||
else if (isset($_POST['import_file']))
|
}
|
||||||
{
|
else if (isset($_POST['import_file']))
|
||||||
//file has been submitted
|
{
|
||||||
|
//file has been submitted
|
||||||
xhtml_head("queXS",true,array("../css/table.css"));
|
$subtitle = T_("Check data to submit");
|
||||||
?>
|
xhtml_head(T_("Bulk appointment generator"),true,array("../include/bootstrap-3.3.2/css/bootstrap.min.css","../css/custom.css"),false,false,false,false,$subtitle);
|
||||||
<form action="" method="post">
|
?>
|
||||||
<?php
|
<form action="" method="post" >
|
||||||
|
<?php
|
||||||
$tmpfname = tempnam(TEMPORARY_DIRECTORY, "FOO");
|
|
||||||
move_uploaded_file($_FILES['file']['tmp_name'],$tmpfname);
|
$tmpfname = tempnam(TEMPORARY_DIRECTORY, "FOO");
|
||||||
|
|
||||||
$todo = validate_bulk_appointment($tmpfname);
|
move_uploaded_file($_FILES['file']['tmp_name'],$tmpfname);
|
||||||
|
|
||||||
if (is_array($todo))
|
$todo = validate_bulk_appointment($tmpfname);
|
||||||
{
|
|
||||||
print "<p>" . T_("Please check the case id's, appointment start and end times and notes are correct before accepting below") . "</p>";
|
if (is_array($todo) && !empty($todo)) {
|
||||||
$todoh = array(T_("Case id"), T_("Start time"), T_("End time"), T_("Note"));
|
|
||||||
xhtml_table($todo,array(0,1,2,3),$todoh);
|
print "<p class='well'>" . T_("Please check the case id's, appointment start and end times and notes are correct before accepting below") . "</p>";
|
||||||
?>
|
$todoh = array(T_("Case id"), T_("Start time"), T_("End time"), T_("Note"));
|
||||||
<form action="" method="post">
|
xhtml_table($todo,array(0,1,2,3),$todoh);
|
||||||
<p><input type="hidden" name="tmpfname" value="<?php echo $tmpfname; ?>" /></p>
|
?>
|
||||||
<p><input type="submit" name="import_file" value="<?php echo T_("Accept and generate bulk appointments"); ?>"/></p>
|
<form action="" method="post">
|
||||||
</form>
|
<input type="hidden" name="tmpfname" value="<?php echo $tmpfname; ?>" />
|
||||||
<?php
|
<input type="submit" name="import_file" value="<?php echo T_("Accept and generate bulk appointments"); ?>" class="btn btn-primary"/>
|
||||||
}
|
</form>
|
||||||
else
|
<?php
|
||||||
print "<p>" . T_("The file does not contain at least caseid, starttime and endtime columns. Please try again.") ."</p>";
|
}
|
||||||
|
else
|
||||||
xhtml_foot();
|
print "<p class='well text-danger'>" . T_("The file does not contain at least caseid, starttime and endtime columns. Please try again.") ."</p>";
|
||||||
|
|
||||||
}
|
print "</form>";
|
||||||
else
|
|
||||||
{
|
|
||||||
//need to supply file to upload
|
xhtml_foot();
|
||||||
xhtml_head(T_("Import: Select file to upload"),true,array("../css/table.css"));
|
|
||||||
?>
|
}
|
||||||
<h1><?php echo T_("Bulk appointment generator"); ?></h1>
|
else
|
||||||
<p><?php echo T_("Provide a headered CSV file containing at least 3 columns - caseid, starttime and endtime. Optionally you can include a note column to attach a note to the case in addition to setting an appointment. Only cases that have temporary (non final) outcomes will have appointments generated, and the outcome of the case will be updated to an appointment outcome."); ?><p>
|
{
|
||||||
<p><?php echo T_("Example CSV file:"); ?></p>
|
//need to supply file to upload
|
||||||
<div><table class="tclass">
|
$subtitle = T_("Import: Select file to upload");
|
||||||
<tr><th>caseid</th><th>starttime</th><th>endtime</th><th>note</th></tr>
|
xhtml_head(T_("Bulk appointment generator"),true,array("../include/bootstrap-3.3.2/css/bootstrap.min.css","../include/font-awesome-4.3.0/css/font-awesome.css","../css/custom.css"),array("../js/jquery-2.1.3.min.js","../js/bootstrap-filestyle.min.js"),false,false,false,$subtitle );
|
||||||
<tr><td>1</td><td>2012-08-15 11:00:00</td><td>2012-08-15 13:00:00</td><td>Appointment automatically generated</td></tr>
|
|
||||||
<tr><td>2</td><td>2012-08-15 12:00:00</td><td>2012-08-15 14:00:00</td><td>Appointment automatically generated</td></tr>
|
$ua = $_SERVER['HTTP_USER_AGENT'];
|
||||||
<tr><td>3</td><td>2012-08-15 13:00:00</td><td>2012-08-15 15:00:00</td><td>Appointment automatically generated</td></tr>
|
if (preg_match('/Firefox/i', $ua)) $csv= "text/csv"; else $csv= ".csv";
|
||||||
</table></div>
|
|
||||||
<form enctype="multipart/form-data" action="" method="post">
|
?>
|
||||||
<p><input type="hidden" name="MAX_FILE_SIZE" value="1000000000" /></p>
|
|
||||||
<p><?php echo T_("Choose the CSV file to upload:"); ?><input name="file" type="file" /></p>
|
<p class="well"><?php echo T_("Provide a headered CSV file containing at least 3 columns - caseid, starttime and endtime. </br> Optionally you can include a note column to attach a note to the case in addition to setting an appointment. </br>Only cases that have temporary (non final) outcomes will have appointments generated, and the outcome of the case will be updated to an appointment outcome."); ?><p>
|
||||||
<p><input type="submit" name="import_file" value="<?php echo T_("Load bulk appointment CSV"); ?>"/></p>
|
|
||||||
</form>
|
<div class="panel-body">
|
||||||
|
<h5><u><?php echo T_("Example CSV file:"); ?></u></h5>
|
||||||
<?php
|
<table class="table-bordered table-condensed form-group">
|
||||||
xhtml_foot();
|
<tr><th>caseid</th><th>starttime</th><th>endtime</th><th>note</th></tr>
|
||||||
|
<tr><td>1</td><td>2012-08-15 11:00:00</td><td>2012-08-15 13:00:00</td><td>Appointment automatically generated</td></tr>
|
||||||
}
|
<tr><td>2</td><td>2012-08-15 12:00:00</td><td>2012-08-15 14:00:00</td><td>Appointment automatically generated</td></tr>
|
||||||
|
<tr><td>3</td><td>2012-08-15 13:00:00</td><td>2012-08-15 15:00:00</td><td>Appointment automatically generated</td></tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
?>
|
|
||||||
|
<form enctype="multipart/form-data" action="" method="post">
|
||||||
|
<input type="hidden" name="MAX_FILE_SIZE" value="1000000000" />
|
||||||
|
|
||||||
|
<h4 class="pull-left" ><?php echo T_("Select bulk appointment CSV file to upload"); ?>: </h4>
|
||||||
|
|
||||||
|
<div class="col-sm-4">
|
||||||
|
<input name="file" class="filestyle" type="file" required data-buttonBefore="true" data-iconName="fa fa-folder-open fa-lg text-primary " data-buttonText="<?php echo T_("Select file"); ?>" type="file" accept="<?php echo $csv; ?>"/> 
|
||||||
|
</div>
|
||||||
|
<button type="submit" class="btn btn-primary" name="import_file" value=""><i class='fa fa-upload fa-lg'></i> <?php echo "" . T_("Upload file"); ?></button>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
xhtml_foot();
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
@@ -1,74 +1,72 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Set information about this centre for diplay to operators
|
* Set information about this centre for diplay to operators
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* This file is part of queXS
|
* This file is part of queXS
|
||||||
*
|
*
|
||||||
* queXS is free software; you can redistribute it and/or modify
|
* queXS is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* queXS is distributed in the hope that it will be useful,
|
* queXS is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with queXS; if not, write to the Free Software
|
* along with queXS; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @author Adam Zammit <adam.zammit@acspri.org.au>
|
* @author Adam Zammit <adam.zammit@acspri.org.au>
|
||||||
* @copyright Australian Consortium for Social and Political Research Incorporated (ACSPRI) 2011
|
* @copyright Australian Consortium for Social and Political Research Incorporated (ACSPRI) 2011
|
||||||
* @package queXS
|
* @package queXS
|
||||||
* @subpackage admin
|
* @subpackage admin
|
||||||
* @link http://www.acspri.org.au/ queXS was writen for ACSPRI
|
* @link http://www.acspri.org.au/ queXS was writen for ACSPRI
|
||||||
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configuration file
|
* Configuration file
|
||||||
*/
|
*/
|
||||||
include("../config.inc.php");
|
include("../config.inc.php");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Database file
|
* Database file
|
||||||
*/
|
*/
|
||||||
include ("../db.inc.php");
|
include ("../db.inc.php");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* XHTML functions
|
* XHTML functions
|
||||||
*/
|
*/
|
||||||
include("../functions/functions.xhtml.php");
|
include("../functions/functions.xhtml.php");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CKEditor
|
* CKEditor
|
||||||
*/
|
*/
|
||||||
include("../include/ckeditor/ckeditor.php");
|
include("../include/ckeditor/ckeditor.php");
|
||||||
|
|
||||||
global $db;
|
global $db;
|
||||||
|
|
||||||
$CKEditor = new CKEditor();
|
$CKEditor = new CKEditor();
|
||||||
$CKEditor->basePath = "../include/ckeditor/";
|
$CKEditor->basePath = "../include/ckeditor/";
|
||||||
|
|
||||||
if (isset($_POST['information']))
|
if (isset($_POST['information']))
|
||||||
{
|
{
|
||||||
set_setting("information",$_POST['information']);
|
set_setting("information",$_POST['information']);
|
||||||
}
|
}
|
||||||
|
|
||||||
xhtml_head(T_("Set centre information"),true,false,array("../js/window.js"));
|
xhtml_head(T_("Set centre information"),true,array("../include/bootstrap-3.3.2/css/bootstrap.min.css","../css/custom.css"),array("../js/window.js"));
|
||||||
|
?>
|
||||||
?>
|
<form action="" method="post" class="panel-body">
|
||||||
<form action="" method="post"><p>
|
<!-- <label for="information"><?php //echo T_("Set centre information: "); ?></label> -->
|
||||||
<label for="information"><?php echo T_("Set centre information: "); ?></label><?php echo $CKEditor->editor("information",get_setting("information")); ?>
|
<?php echo $CKEditor->editor("information",get_setting("information")); ?>
|
||||||
<input type="submit" name="update" value="<?php echo T_("Update centre information"); ?>"/></p>
|
<br/><input class="btn btn-primary" type="submit" name="update" value="<?php echo T_("Update centre information"); ?>"/>
|
||||||
</form>
|
</form>
|
||||||
<?php
|
<?php
|
||||||
xhtml_foot();
|
xhtml_foot();
|
||||||
|
?>
|
||||||
|
|
||||||
?>
|
|
||||||
|
|||||||
@@ -1,236 +1,244 @@
|
|||||||
<?php /**
|
<?php
|
||||||
* Output data as a fixed width ASCII file
|
/**
|
||||||
*
|
* Output data as a fixed width ASCII file
|
||||||
*
|
*
|
||||||
* This file is part of queXS
|
*
|
||||||
*
|
* 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
|
* queXS is free software; you can redistribute it and/or modify
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* it under the terms of the GNU General Public License as published by
|
||||||
* (at your option) any later version.
|
* 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
|
* queXS is distributed in the hope that it will be useful,
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* GNU General Public License for more details.
|
* 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
|
* You should have received a copy of the GNU General Public License
|
||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
* 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
|
* @author Adam Zammit <adam.zammit@deakin.edu.au>
|
||||||
* @package queXS
|
* @copyright Deakin University 2007,2008
|
||||||
* @subpackage admin
|
* @package queXS
|
||||||
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility
|
* @subpackage admin
|
||||||
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
* @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
|
||||||
*/
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Input functions
|
* Input functions
|
||||||
*/
|
*/
|
||||||
include("../functions/functions.input.php");
|
include("../functions/functions.input.php");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configuration file
|
* Configuration file
|
||||||
*/
|
*/
|
||||||
include_once(dirname(__FILE__).'/../config.inc.php');
|
include_once(dirname(__FILE__).'/../config.inc.php');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Database file
|
* Database file
|
||||||
*/
|
*/
|
||||||
include ("../db.inc.php");
|
include ("../db.inc.php");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* XHTML functions
|
* XHTML functions
|
||||||
*/
|
*/
|
||||||
include ("../functions/functions.xhtml.php");
|
include ("../functions/functions.xhtml.php");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display functions
|
* Display functions
|
||||||
*/
|
*/
|
||||||
include("../functions/functions.display.php");
|
include("../functions/functions.display.php");
|
||||||
|
|
||||||
if (isset($_GET['key']) || isset($_GET['sample']))
|
if (isset($_GET['key']) || isset($_GET['sample']))
|
||||||
{
|
{
|
||||||
$questionnaire_id = bigintval($_GET['questionnaire_id']);
|
$questionnaire_id = bigintval($_GET['questionnaire_id']);
|
||||||
$sample_import_id = bigintval($_GET['sample_import_id']);
|
$sample_import_id = bigintval($_GET['sample_import_id']);
|
||||||
|
|
||||||
$sql = "SELECT sv.var as value
|
$sql = "SELECT sv.var as value
|
||||||
FROM `sample_var` as sv
|
FROM `sample_var` as sv
|
||||||
WHERE sv.sample_id = (SELECT sample_id FROM sample WHERE import_id = '$sample_import_id' LIMIT 1)";
|
WHERE sv.sample_id = (SELECT sample_id FROM sample WHERE import_id = '$sample_import_id' LIMIT 1)";
|
||||||
|
|
||||||
$svars = $db->GetAll($sql);
|
$svars = $db->GetAll($sql);
|
||||||
|
|
||||||
$fn = "key_all_";
|
$fn = "key_all_";
|
||||||
if (isset($_GET['sample'])) $fn = "sample_all_";
|
if (isset($_GET['sample'])) $fn = "sample_all_";
|
||||||
|
|
||||||
$fn .= $questionnaire_id . "_" . $sample_import_id .".csv";
|
$fn .= $questionnaire_id . "_" . $sample_import_id .".csv";
|
||||||
|
|
||||||
header("Content-Type: text/csv");
|
header("Content-Type: text/csv");
|
||||||
header("Content-Disposition: attachment; filename=$fn");
|
header("Content-Disposition: attachment; filename=$fn");
|
||||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
|
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
|
||||||
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
|
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
|
||||||
Header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
|
Header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
|
||||||
header("Pragma: no-cache"); // HTTP/1.0
|
header("Pragma: no-cache"); // HTTP/1.0
|
||||||
|
|
||||||
echo("token,caseid");
|
echo("token,".T_("Case ID")."");
|
||||||
foreach($svars as $s)
|
foreach($svars as $s)
|
||||||
{
|
{
|
||||||
echo("," . $s['value']);
|
echo("," . $s['value']);
|
||||||
}
|
}
|
||||||
if (isset($_GET['sample']))
|
|
||||||
{
|
if (isset($_GET['sample']))
|
||||||
echo(",Outcome,AAPOR");
|
{
|
||||||
}
|
echo(",".T_("Current Outcome").",".T_("Number of call attempts").",".T_("Number of calls").",".T_("Case notes").",".T_("Total interview time over all calls (mins)").",".T_("Interview time for last call (mins)").",".T_("Last number dialled").",".T_("DATE/TIME Last number dialled").",".T_("Operator username for last call").",".T_("Shift report").", AAPOR");
|
||||||
|
}
|
||||||
echo("\n");
|
|
||||||
|
echo("\n");
|
||||||
$sql = "SELECT c.token,c.case_id ";
|
|
||||||
|
$sql = "SELECT c.token,c.case_id ";
|
||||||
if (isset($_GET['sample'])) $sql .= ", o.description, o.aapor_id ";
|
|
||||||
|
if (isset($_GET['sample'])) $sql .= ", o.description,
|
||||||
$i = 0;
|
(SELECT COUNT(ca.call_attempt_id) FROM `call_attempt` as ca WHERE ca.case_id = c.case_id ) as callattempts,
|
||||||
foreach ($svars as $s)
|
(SELECT COUNT(cl.call_id) FROM `call` as cl WHERE cl.case_id = c.case_id ) as calls,
|
||||||
{
|
(SELECT GROUP_CONCAT(cn1.note SEPARATOR '|') FROM `case_note` as cn1 WHERE c.case_id = cn1.case_id GROUP BY cn1.case_id)as casenotes,
|
||||||
$sql .= ", sv$i.val as v$i";
|
(SELECT ROUND(SUM( TIMESTAMPDIFF(SECOND , cl2.start,IFNULL(cl2.end,CONVERT_TZ(NOW(),'System','UTC'))))/60,2) FROM `call_attempt` as cl2 WHERE cl2.case_id = c.case_id) as interviewtimec,
|
||||||
$i++;
|
(SELECT ROUND(TIMESTAMPDIFF(SECOND , cl3.start,IFNULL(cl3.end,CONVERT_TZ(NOW(),'System','UTC')))/60,2) FROM `call_attempt` as cl3 WHERE cl3.case_id = c.case_id ORDER BY cl3.call_attempt_id DESC LIMIT 1) as interviewtimel,
|
||||||
}
|
(SELECT cp1.phone FROM `call` as cl4, `contact_phone` as cp1 WHERE cl4.call_id = c.last_call_id AND cp1.contact_phone_id = cl4.contact_phone_id ) as lastnumber,
|
||||||
|
(SELECT cl55.start FROM `call` as cl55 WHERE cl55.call_id = c.last_call_id ) as lastcallstart,
|
||||||
$sql .= " FROM sample ";
|
(SELECT op1.username FROM `call` as cl5, `operator` as op1 WHERE cl5.call_id = c.last_call_id AND op1.operator_id = cl5.operator_id) as operatoru,
|
||||||
|
(SELECT GROUP_CONCAT(DISTINCT sr1.report SEPARATOR '|') FROM `call` as cl6, `shift` as sh1, `shift_report` as sr1 WHERE cl6.case_id = c.case_id AND sr1.shift_id = sh1.shift_id AND sh1.questionnaire_id = c.questionnaire_id AND cl6.start >= sh1.start AND cl6.end < sh1.end GROUP BY sr1.shift_id) as shiftr,
|
||||||
//left join if getting whole sample file
|
o.aapor_id ";
|
||||||
if (isset($_GET['sample'])) $sql .= "LEFT ";
|
|
||||||
|
$i = 0;
|
||||||
$sql .= "JOIN `case` as c ON (c.questionnaire_id = '$questionnaire_id' AND c.sample_id = sample.sample_id) ";
|
foreach ($svars as $s)
|
||||||
|
{
|
||||||
if (isset($_GET['sample'])) $sql .= " LEFT JOIN `outcome` as o ON (o.outcome_id = c.current_outcome_id) ";
|
$sql .= ", sv$i.val as v$i";
|
||||||
|
$i++;
|
||||||
$i = 0;
|
}
|
||||||
foreach ($svars as $s)
|
|
||||||
{
|
$sql .= " FROM sample ";
|
||||||
$sql .= " LEFT JOIN sample_var AS sv$i ON (sv$i.sample_id = sample.sample_id AND sv$i.var = '{$s['value']}') ";
|
|
||||||
$i++;
|
//left join if getting whole sample file
|
||||||
}
|
if (isset($_GET['sample'])) $sql .= "LEFT ";
|
||||||
|
|
||||||
$sql .= " WHERE sample.import_id = '$sample_import_id'";
|
$sql .= "JOIN `case` as c ON (c.questionnaire_id = '$questionnaire_id' AND c.sample_id = sample.sample_id) ";
|
||||||
|
|
||||||
$list = $db->GetAll($sql);
|
if (isset($_GET['sample'])) $sql .= " LEFT JOIN `outcome` as o ON (o.outcome_id = c.current_outcome_id)";
|
||||||
|
|
||||||
|
$i = 0;
|
||||||
if (!empty($list))
|
foreach ($svars as $s)
|
||||||
{
|
{
|
||||||
foreach($list as $l)
|
$sql .= " LEFT JOIN sample_var AS sv$i ON (sv$i.sample_id = sample.sample_id AND sv$i.var = '{$s['value']}') ";
|
||||||
{
|
$i++;
|
||||||
echo $l['token'] . "," . $l['case_id'];
|
}
|
||||||
$i = 0;
|
|
||||||
foreach ($svars as $s)
|
$sql .= " WHERE sample.import_id = '$sample_import_id'";
|
||||||
{
|
|
||||||
echo "," . str_replace(","," ",$l["v$i"]);
|
$list = $db->GetAll($sql);
|
||||||
$i++;
|
|
||||||
}
|
if (!empty($list))
|
||||||
if (isset($_GET['sample']))
|
{
|
||||||
{
|
foreach($list as $l)
|
||||||
echo "," . str_replace(","," ",$l['description']) . "," . $l['aapor_id'];
|
{
|
||||||
}
|
echo $l['token'] . "," . $l['case_id'];
|
||||||
echo "\n";
|
$i = 0;
|
||||||
}
|
foreach ($svars as $s)
|
||||||
}
|
{
|
||||||
|
echo "," . str_replace(","," ",$l["v$i"]);
|
||||||
exit;
|
$i++;
|
||||||
}
|
}
|
||||||
|
if (isset($_GET['sample']))
|
||||||
if (isset($_GET['sample_var']))
|
{
|
||||||
{
|
echo "," . str_replace(","," ",$l['description']) . "," .$l['callattempts']."," .$l['calls']."," .$l['casenotes'].",".$l['interviewtimec'].",".$l['interviewtimel'].",".$l['lastnumber'].",".$l['lastcallstart'].",".$l['operatoru'].",".$l['shiftr'].",". $l['aapor_id'];
|
||||||
$questionnaire_id = bigintval($_GET['questionnaire_id']);
|
}
|
||||||
$sample_import_id = bigintval($_GET['sample_import_id']);
|
echo "\n";
|
||||||
$sample_var = $db->quote($_GET['sample_var']);
|
}
|
||||||
|
}
|
||||||
$sql = "SELECT c.token,c.case_id, sv.val
|
exit;
|
||||||
FROM sample, `case` as c, sample_var as sv
|
}
|
||||||
WHERE c.questionnaire_id = '$questionnaire_id'
|
|
||||||
AND sample.import_id = '$sample_import_id'
|
if (isset($_GET['sample_var']))
|
||||||
AND c.sample_id = sample.sample_id
|
{
|
||||||
AND sv.sample_id = sample.sample_id
|
$questionnaire_id = bigintval($_GET['questionnaire_id']);
|
||||||
AND sv.var = $sample_var";
|
$sample_import_id = bigintval($_GET['sample_import_id']);
|
||||||
|
$sample_var = $db->quote($_GET['sample_var']);
|
||||||
$list = $db->GetAll($sql);
|
|
||||||
|
$sql = "SELECT c.token,c.case_id, sv.val
|
||||||
$fn = "key_$questionnaire_id" . "_" . $sample_import_id .".csv";
|
FROM sample, `case` as c, sample_var as sv
|
||||||
|
WHERE c.questionnaire_id = '$questionnaire_id'
|
||||||
header("Content-Type: text/csv");
|
AND sample.import_id = '$sample_import_id'
|
||||||
header("Content-Disposition: attachment; filename=$fn");
|
AND c.sample_id = sample.sample_id
|
||||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
|
AND sv.sample_id = sample.sample_id
|
||||||
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
|
AND sv.var = $sample_var";
|
||||||
Header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
|
|
||||||
header("Pragma: no-cache"); // HTTP/1.0
|
$list = $db->GetAll($sql);
|
||||||
|
|
||||||
echo("token,caseid,$sample_var\n");
|
$fn = "key_$questionnaire_id" . "_" . $sample_import_id .".csv";
|
||||||
|
|
||||||
if (!empty($list))
|
header("Content-Type: text/csv");
|
||||||
{
|
header("Content-Disposition: attachment; filename=$fn");
|
||||||
foreach($list as $l)
|
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
|
||||||
{
|
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
|
||||||
echo $l['token'] . "," . $l['case_id'] . "," . $l['val'] . "\n";
|
Header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
|
||||||
}
|
header("Pragma: no-cache"); // HTTP/1.0
|
||||||
}
|
|
||||||
|
echo("token,caseid,$sample_var\n");
|
||||||
exit;
|
|
||||||
}
|
if (!empty($list))
|
||||||
|
{
|
||||||
|
foreach($list as $l)
|
||||||
|
{
|
||||||
xhtml_head(T_("Data output"),true,false,array("../js/window.js"));
|
echo $l['token'] . "," . $l['case_id'] . "," . $l['val'] . "\n";
|
||||||
|
}
|
||||||
print "<h3>" . T_("Please select a questionnaire") . "</h3>";
|
}
|
||||||
$questionnaire_id = false;
|
|
||||||
if (isset($_GET['questionnaire_id'])) $questionnaire_id = bigintval($_GET['questionnaire_id']);
|
exit;
|
||||||
display_questionnaire_chooser($questionnaire_id);
|
}
|
||||||
|
|
||||||
if ($questionnaire_id)
|
|
||||||
{
|
xhtml_head(T_("Data output"),true,array("../include/bootstrap-3.3.2/css/bootstrap.min.css","../css/custom.css"),array("../js/window.js"));
|
||||||
$sql = "SELECT lime_sid
|
|
||||||
FROM questionnaire
|
print "<div class='form-group clearfix'><h3 class='col-sm-4 text-right'>" . T_("Please select a questionnaire") . ": </h3>";
|
||||||
WHERE questionnaire_id = $questionnaire_id";
|
$questionnaire_id = false;
|
||||||
|
if (isset($_GET['questionnaire_id'])) $questionnaire_id = bigintval($_GET['questionnaire_id']);
|
||||||
$ls = $db->GetRow($sql);
|
display_questionnaire_chooser($questionnaire_id,false,"form-inline pull-left", "form-control");
|
||||||
$lsid = $ls['lime_sid'];
|
|
||||||
|
if ($questionnaire_id)
|
||||||
print "<p><a href='" . LIME_URL . "admin/admin.php?action=exportresults&sid=$lsid'>". T_("Download data for this questionnaire via Limesurvey") . "</a></p>";
|
{
|
||||||
|
$sql = "SELECT lime_sid
|
||||||
print "<h3>" . T_("Please select a sample") . "</h3>";
|
FROM questionnaire
|
||||||
$sample_import_id = false;
|
WHERE questionnaire_id = $questionnaire_id";
|
||||||
if (isset($_GET['sample_import_id'])) $sample_import_id = bigintval($_GET['sample_import_id']);
|
|
||||||
display_sample_chooser($questionnaire_id,$sample_import_id);
|
$ls = $db->GetRow($sql);
|
||||||
|
$lsid = $ls['lime_sid'];
|
||||||
if ($sample_import_id)
|
|
||||||
{
|
print "  <a href='" . LIME_URL . "admin/admin.php?action=exportresults&sid=$lsid' class='btn btn-default fa btn-lime'>". T_("Download data for this questionnaire via Limesurvey") . "</a></div>";
|
||||||
print "<p><a href='" .LIME_URL . "admin/admin.php?action=exportresults&sid=$lsid&quexsfilterinc=$questionnaire_id:$sample_import_id'>" . T_("Download data for this sample via Limesurvey") . "</a></p>";
|
|
||||||
//get sample vars
|
print "<div class='form-group clearfix'><h3 class='col-sm-4 text-right'>" . T_("Please select a sample") . ": </h3>";
|
||||||
$sql = "SELECT sv.var as value, sv.var as description
|
$sample_import_id = false;
|
||||||
FROM `sample_var` as sv
|
if (isset($_GET['sample_import_id'])) $sample_import_id = bigintval($_GET['sample_import_id']);
|
||||||
WHERE sv.sample_id = (SELECT sample_id FROM sample WHERE import_id = '$sample_import_id' LIMIT 1)";
|
display_sample_chooser($questionnaire_id,$sample_import_id,false,"form-inline pull-left", "form-control");
|
||||||
|
|
||||||
//download a key file linking the caseid to the sample
|
if ($sample_import_id)
|
||||||
print "<h3>" . T_("Download key file: select sample var") . "</h3>";
|
{
|
||||||
|
print "  <a href='" .LIME_URL . "admin/admin.php?action=exportresults&sid=$lsid&quexsfilterinc=$questionnaire_id:$sample_import_id' class='btn btn-default fa btn-lime'>" . T_("Download data for this sample via Limesurvey") . "</a></div>";
|
||||||
display_chooser($db->GetAll($sql),"sample_var","sample_var",true,"questionnaire_id=$questionnaire_id&sample_import_id=$sample_import_id");
|
|
||||||
//download complete key file
|
//get sample vars
|
||||||
print "<p><a href='?key=key&questionnaire_id=$questionnaire_id&sample_import_id=$sample_import_id'>" . T_("Download complete key file") . "</a></p>";
|
$sql = "SELECT sv.var as value, sv.var as description
|
||||||
|
FROM `sample_var` as sv
|
||||||
//download complete sample file with outcomes
|
WHERE sv.sample_id = (SELECT sample_id FROM sample WHERE import_id = '$sample_import_id' LIMIT 1)";
|
||||||
print "<p><a href='?sample=sample&questionnaire_id=$questionnaire_id&sample_import_id=$sample_import_id'>" . T_("Download complete sample file with current outcomes") . "</a></p>";
|
|
||||||
|
//download a key file linking the caseid to the sample
|
||||||
|
print "<div class='form-group clearfix'><h3 class='col-sm-4 text-right'>" . T_("Download key file: select sample var") . ": </h3>";
|
||||||
}
|
|
||||||
}
|
display_chooser($db->GetAll($sql),"sample_var","sample_var",true,"questionnaire_id=$questionnaire_id&sample_import_id=$sample_import_id",true,true,false,true,"form-inline pull-left");
|
||||||
|
|
||||||
xhtml_foot();
|
// print "</div><div class='form-group col-sm-offset-4'>";
|
||||||
|
|
||||||
|
//download complete key file
|
||||||
|
print "  <a href='?key=key&questionnaire_id=$questionnaire_id&sample_import_id=$sample_import_id' class='btn btn-default fa'>" . T_("Download complete key file") . "</a>";
|
||||||
?>
|
|
||||||
|
//download complete sample file with outcomes
|
||||||
|
print "  <a href='?sample=sample&questionnaire_id=$questionnaire_id&sample_import_id=$sample_import_id' class='btn btn-default fa'>" . T_("Download complete sample file with current outcomes") . "</a></div>";
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
xhtml_foot();
|
||||||
|
|
||||||
|
?>
|
||||||
@@ -1,113 +1,110 @@
|
|||||||
<?php /**
|
<?php /**
|
||||||
* Display operator performance
|
* Display operator performance
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* This file is part of queXS
|
* This file is part of queXS
|
||||||
*
|
*
|
||||||
* queXS is free software; you can redistribute it and/or modify
|
* queXS is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* queXS is distributed in the hope that it will be useful,
|
* queXS is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with queXS; if not, write to the Free Software
|
* along with queXS; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @author Adam Zammit <adam.zammit@deakin.edu.au>
|
* @author Adam Zammit <adam.zammit@deakin.edu.au>
|
||||||
* @copyright Deakin University 2007,2008
|
* @copyright Deakin University 2007,2008
|
||||||
* @package queXS
|
* @package queXS
|
||||||
* @subpackage admin
|
* @subpackage admin
|
||||||
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility
|
* @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
|
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configuration file
|
* Configuration file
|
||||||
*/
|
*/
|
||||||
include_once(dirname(__FILE__).'/../config.inc.php');
|
include_once(dirname(__FILE__).'/../config.inc.php');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Database file
|
* Database file
|
||||||
*/
|
*/
|
||||||
include ("../db.inc.php");
|
include ("../db.inc.php");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* XHTML functions
|
* XHTML functions
|
||||||
*/
|
*/
|
||||||
include ("../functions/functions.xhtml.php");
|
include ("../functions/functions.xhtml.php");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Performance functions
|
* Performance functions
|
||||||
*/
|
*/
|
||||||
include("../functions/functions.performance.php");
|
include("../functions/functions.performance.php");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display functions
|
* Display functions
|
||||||
*/
|
*/
|
||||||
include("../functions/functions.display.php");
|
include("../functions/functions.display.php");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Input functions
|
* Input functions
|
||||||
*/
|
*/
|
||||||
include("../functions/functions.input.php");
|
include("../functions/functions.input.php");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Operator functions
|
* Operator functions
|
||||||
*/
|
*/
|
||||||
include("../functions/functions.operator.php");
|
include("../functions/functions.operator.php");
|
||||||
|
|
||||||
xhtml_head(T_("Operator Performance"),true,array("../css/table.css"),array("../js/window.js"));
|
xhtml_head(T_("Operator Performance"),true,array("../include/bootstrap-3.3.2/css/bootstrap.min.css","../css/custom.css"),array("../js/window.js"));
|
||||||
|
|
||||||
//$rs = get_stats_total(get_stats());
|
//$rs = get_stats_total(get_stats());
|
||||||
//print "<h2>" . T_("Overall") . "</h2>";
|
//print "<h2>" . T_("Overall") . "</h2>";
|
||||||
//xhtml_table($rs,array("firstName","completions","totalcalls","time","callt","CPH","CALLSPH","effectiveness"),array(T_("Operator"),T_("Completions"),T_("Calls"),T_("Total time"),T_("Call time"),T_("Completions p/h"),T_("Calls p/h"),T_("Effectiveness")));
|
//xhtml_table($rs,array("firstName","completions","totalcalls","time","callt","CPH","CALLSPH","effectiveness"),array(T_("Operator"),T_("Completions"),T_("Calls"),T_("Total time"),T_("Call time"),T_("Completions p/h"),T_("Calls p/h"),T_("Effectiveness")));
|
||||||
|
|
||||||
$questionnaire_id = false;
|
$questionnaire_id = false;
|
||||||
print "<h3>" . T_("Please select a questionnaire") . "</h3>";
|
print "<h3 class='form-inline pull-left'>" . T_("Please select a questionnaire") . " </h3>";
|
||||||
if (isset($_GET['questionnaire_id'])) $questionnaire_id = bigintval($_GET['questionnaire_id']);
|
if (isset($_GET['questionnaire_id'])) $questionnaire_id = bigintval($_GET['questionnaire_id']);
|
||||||
display_questionnaire_chooser($questionnaire_id);
|
display_questionnaire_chooser($questionnaire_id,false,"form-inline clearfix", "form-control");
|
||||||
|
|
||||||
if ($questionnaire_id)
|
if ($questionnaire_id)
|
||||||
{
|
{
|
||||||
$rs = get_stats_total(get_stats_by_questionnaire($questionnaire_id));
|
$rs = get_stats_total(get_stats_by_questionnaire($questionnaire_id));
|
||||||
print "<h2>" . T_("This project") . "</h2>";
|
print "<h2>" . T_("This project") . "</h2>";
|
||||||
xhtml_table($rs,array("firstName","completions","totalcalls","time","callt","CPH","CALLSPH","effectiveness"),array(T_("Operator"),T_("Completions"),T_("Calls"),T_("Total time"),T_("Call time"),T_("Completions p/h"),T_("Calls p/h"),T_("Effectiveness")));
|
xhtml_table($rs,array("firstName","completions","totalcalls","time","callt","CPH","CALLSPH","effectiveness"),array(T_("Operator"),T_("Completions"),T_("Calls"),T_("Total time"),T_("Call time"),T_("Completions p/h"),T_("Calls p/h"),T_("Effectiveness")));
|
||||||
|
|
||||||
$operator_id = get_operator_id();
|
$operator_id = get_operator_id();
|
||||||
|
|
||||||
$shift_id = false;
|
$shift_id = false;
|
||||||
if (isset($_GET['shift_id'])) $shift_id = bigintval($_GET['shift_id']);
|
if (isset($_GET['shift_id'])) $shift_id = bigintval($_GET['shift_id']);
|
||||||
|
|
||||||
$sql = "SELECT s.shift_id as value,CONCAT(DATE_FORMAT(CONVERT_TZ(s.start,'UTC',o.Time_zone_name),'" . DATE_TIME_FORMAT . "'),' " . TQ_("till") . " ',DATE_FORMAT(CONVERT_TZ(s.end,'UTC',o.Time_zone_name),'" . TIME_FORMAT . "')) as description,CASE WHEN s.shift_id = '$shift_id' THEN 'selected=\'selected\'' ELSE '' END AS selected
|
$sql = "SELECT s.shift_id as value,CONCAT(DATE_FORMAT(CONVERT_TZ(s.start,'UTC',o.Time_zone_name),'" . DATE_TIME_FORMAT . "'),' " . TQ_("till") . " ',DATE_FORMAT(CONVERT_TZ(s.end,'UTC',o.Time_zone_name),'" . TIME_FORMAT . "')) as description,CASE WHEN s.shift_id = '$shift_id' THEN 'selected=\'selected\'' ELSE '' END AS selected
|
||||||
FROM shift as s
|
FROM shift as s
|
||||||
LEFT JOIN (operator as o) on (o.operator_id = '$operator_id')
|
LEFT JOIN (operator as o) on (o.operator_id = '$operator_id')
|
||||||
WHERE s.questionnaire_id = '$questionnaire_id'
|
WHERE s.questionnaire_id = '$questionnaire_id'
|
||||||
ORDER BY s.start ASC";
|
ORDER BY s.start ASC";
|
||||||
|
|
||||||
$rs = $db->GetAll($sql);
|
$rs = $db->GetAll($sql);
|
||||||
|
|
||||||
print "<h3>" . T_("Please select a shift") . "</h3>";
|
print "</br><h3 class='form-inline pull-left'>" . T_("Please select a shift") . " </h3>";
|
||||||
|
|
||||||
display_chooser($rs,"shift_id","shift_id",true,"questionnaire_id=$questionnaire_id");
|
display_chooser($rs,"shift_id","shift_id",true,"questionnaire_id=$questionnaire_id",true,true,false,true,"form-inline form-group");//,false,true,false,true,"pull-left"
|
||||||
|
|
||||||
if ($shift_id)
|
if ($shift_id)
|
||||||
{
|
{
|
||||||
$rs = get_stats_total(get_stats_by_shift($questionnaire_id,$shift_id));
|
$rs = get_stats_total(get_stats_by_shift($questionnaire_id,$shift_id));
|
||||||
print "<h2>" . T_("This shift") . "</h2>";
|
print "<h2>" . T_("This shift") . "</h2>";
|
||||||
xhtml_table($rs,array("firstName","completions","totalcalls","time","callt","CPH","CALLSPH","effectiveness"),array(T_("Operator"),T_("Completions"),T_("Calls"),T_("Total time"),T_("Call time"),T_("Completions p/h"),T_("Calls p/h"),T_("Effectiveness")));
|
xhtml_table($rs,array("firstName","completions","totalcalls","time","callt","CPH","CALLSPH","effectiveness"),array(T_("Operator"),T_("Completions"),T_("Calls"),T_("Total time"),T_("Call time"),T_("Completions p/h"),T_("Calls p/h"),T_("Effectiveness")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
xhtml_foot();
|
xhtml_foot();
|
||||||
|
?>
|
||||||
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,176 +1,176 @@
|
|||||||
<?php /**
|
<?php /**
|
||||||
* List and edit reports on shifts
|
* List and edit reports on shifts
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* This file is part of queXS
|
* This file is part of queXS
|
||||||
*
|
*
|
||||||
* queXS is free software; you can redistribute it and/or modify
|
* queXS is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* queXS is distributed in the hope that it will be useful,
|
* queXS is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with queXS; if not, write to the Free Software
|
* along with queXS; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @author Adam Zammit <adam.zammit@deakin.edu.au>
|
* @author Adam Zammit <adam.zammit@deakin.edu.au>
|
||||||
* @copyright Deakin University 2007,2008
|
* @copyright Deakin University 2007,2008
|
||||||
* @package queXS
|
* @package queXS
|
||||||
* @subpackage admin
|
* @subpackage admin
|
||||||
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility
|
* @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
|
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configuration file
|
* Configuration file
|
||||||
*/
|
*/
|
||||||
include_once(dirname(__FILE__).'/../config.inc.php');
|
include_once(dirname(__FILE__).'/../config.inc.php');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Database file
|
* Database file
|
||||||
*/
|
*/
|
||||||
include ("../db.inc.php");
|
include ("../db.inc.php");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* XHTML functions
|
* XHTML functions
|
||||||
*/
|
*/
|
||||||
include ("../functions/functions.xhtml.php");
|
include ("../functions/functions.xhtml.php");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display functions
|
* Display functions
|
||||||
*/
|
*/
|
||||||
include("../functions/functions.display.php");
|
include("../functions/functions.display.php");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Operator functions
|
* Operator functions
|
||||||
*/
|
*/
|
||||||
include("../functions/functions.operator.php");
|
include("../functions/functions.operator.php");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Input functions
|
* Input functions
|
||||||
*/
|
*/
|
||||||
include("../functions/functions.input.php");
|
include("../functions/functions.input.php");
|
||||||
|
|
||||||
xhtml_head(T_("Shift reports"),true,array("../css/table.css"),array("../js/window.js"));
|
xhtml_head(T_("Shift reports"),true,array("../include/bootstrap-3.3.2/css/bootstrap.min.css","../css/custom.css"),array("../js/window.js"));
|
||||||
|
|
||||||
$operator_id = get_operator_id();
|
$operator_id = get_operator_id();
|
||||||
|
|
||||||
print "<h3>" . T_("Please select a questionnaire") . "</h3>";
|
print "<h3>" . T_("Please select a questionnaire") . "</h3>";
|
||||||
$questionnaire_id = false;
|
$questionnaire_id = false;
|
||||||
if (isset($_GET['questionnaire_id'])) $questionnaire_id = bigintval($_GET['questionnaire_id']);
|
if (isset($_GET['questionnaire_id'])) $questionnaire_id = bigintval($_GET['questionnaire_id']);
|
||||||
display_questionnaire_chooser($questionnaire_id);
|
display_questionnaire_chooser($questionnaire_id ,false,"form-inline clearfix", "form-control");
|
||||||
|
|
||||||
if ($questionnaire_id)
|
if ($questionnaire_id)
|
||||||
{
|
{
|
||||||
print "<h3>" . T_("Please select a shift") . "</h3>";
|
print "<h3>" . T_("Please select a shift") . "</h3>";
|
||||||
|
|
||||||
$shift_id = false;
|
$shift_id = false;
|
||||||
if (isset($_GET['shift_id'])) $shift_id = bigintval($_GET['shift_id']);
|
if (isset($_GET['shift_id'])) $shift_id = bigintval($_GET['shift_id']);
|
||||||
|
|
||||||
//get shifts for this questionnaire in operator time
|
//get shifts for this questionnaire in operator time
|
||||||
$sql = "SELECT s.shift_id as value, 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),'" . TIME_FORMAT ."')) as description,
|
$sql = "SELECT s.shift_id as value, 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),'" . TIME_FORMAT ."')) as description,
|
||||||
CASE WHEN s.shift_id = '$shift_id' THEN 'selected=\'selected\'' ELSE '' END AS selected
|
CASE WHEN s.shift_id = '$shift_id' THEN 'selected=\'selected\'' ELSE '' END AS selected
|
||||||
FROM `shift` as s, operator as o
|
FROM `shift` as s, operator as o
|
||||||
WHERE s.questionnaire_id = '$questionnaire_id'
|
WHERE s.questionnaire_id = '$questionnaire_id'
|
||||||
AND o.operator_id = '$operator_id'
|
AND o.operator_id = '$operator_id'
|
||||||
ORDER BY s.start ASC";
|
ORDER BY s.start ASC";
|
||||||
|
|
||||||
$r = $db->GetAll($sql);
|
$r = $db->GetAll($sql);
|
||||||
|
|
||||||
if (!empty($r))
|
if (!empty($r))
|
||||||
display_chooser($r,"shift","shift_id",true,"questionnaire_id=$questionnaire_id");
|
display_chooser($r,"shift","shift_id",true,"questionnaire_id=$questionnaire_id",true,true,false,true,"form-inline form-group");
|
||||||
|
|
||||||
if ($shift_id)
|
if ($shift_id)
|
||||||
{
|
{
|
||||||
print "<h3>" . T_("Reports for this shift") . "</h3>";
|
print "<h3>" . T_("Reports for this shift") . "</h3>";
|
||||||
|
|
||||||
//list current reports with a link to edit
|
//list current reports with a link to edit
|
||||||
$sql = "SELECT s.report,o.firstName,DATE_FORMAT(CONVERT_TZ(s.datetime,'UTC',o.Time_zone_name),'" . DATE_TIME_FORMAT ."') as d,
|
$sql = "SELECT s.report,o.firstName,DATE_FORMAT(CONVERT_TZ(s.datetime,'UTC',o.Time_zone_name),'" . DATE_TIME_FORMAT ."') as d,
|
||||||
CONCAT('<a href=\'?questionnaire_id=$questionnaire_id&shift_id=$shift_id&shift_report_id=', s.shift_report_id, '\'>". TQ_("Edit") . "</a>') as link
|
CONCAT('<a href=\'?questionnaire_id=$questionnaire_id&shift_id=$shift_id&shift_report_id=', s.shift_report_id, '\'>". TQ_("Edit") . "</a>') as link
|
||||||
FROM shift_report as s, operator as o
|
FROM shift_report as s, operator as o
|
||||||
WHERE s.operator_id = o.operator_id
|
WHERE s.operator_id = o.operator_id
|
||||||
AND s.shift_id = '$shift_id'";
|
AND s.shift_id = '$shift_id'";
|
||||||
|
|
||||||
$r = $db->GetAll($sql);
|
$r = $db->GetAll($sql);
|
||||||
|
|
||||||
if (!empty($r))
|
if (!empty($r))
|
||||||
xhtml_table($r,array("firstName", "d", "report","link"),array(T_("Operator"),T_("Date"),T_("Report"),T_("Edit")),"tclass");
|
xhtml_table($r,array("firstName", "d", "report","link"),array(T_("Operator"),T_("Date"),T_("Report"),T_("Edit")),"tclass");
|
||||||
|
|
||||||
//link to create a new report
|
//link to create a new report
|
||||||
print "<p><a href='?questionnaire_id=$questionnaire_id&shift_id=$shift_id&createnewreport=yes'>" . T_("Create new report for this shift") . "</a></p>";
|
print "<p><a href='?questionnaire_id=$questionnaire_id&shift_id=$shift_id&createnewreport=yes'>" . T_("Create new report for this shift") . "</a></p>";
|
||||||
|
|
||||||
|
|
||||||
if (isset($_GET['createnewreport']))
|
if (isset($_GET['createnewreport']))
|
||||||
{
|
{
|
||||||
//create a new report
|
//create a new report
|
||||||
print "<h3>" . T_("Enter report for this shift") . "</h3>";
|
print "<h3>" . T_("Enter report for this shift") . "</h3>";
|
||||||
print "<form action='?' method='get'><p><textarea name='report' id='report' rows='15' cols='80'></textarea></p>";
|
print "<form action='?' method='get'><p><textarea name='report' id='report' rows='15' cols='80'></textarea></p>";
|
||||||
print "<p><input type='hidden' name='questionnaire_id' id='questionnaire_id' value='$questionnaire_id'/>";
|
print "<p><input type='hidden' name='questionnaire_id' id='questionnaire_id' value='$questionnaire_id'/>";
|
||||||
print "<input type='hidden' name='shift_id' id='shift_id' value='$shift_id'/>";
|
print "<input type='hidden' name='shift_id' id='shift_id' value='$shift_id'/>";
|
||||||
print "<input type='submit' name='submit' id='submit' value=\"" . T_("Add report") . "\"/>";
|
print "<input type='submit' name='submit' id='submit' value=\"" . T_("Add report") . "\"/>";
|
||||||
print "</p></form>";
|
print "</p></form>";
|
||||||
}
|
}
|
||||||
else if (isset($_GET['report']))
|
else if (isset($_GET['report']))
|
||||||
{
|
{
|
||||||
//add report to database
|
//add report to database
|
||||||
$report = $db->qstr($_GET['report']);
|
$report = $db->qstr($_GET['report']);
|
||||||
|
|
||||||
$sql = "INSERT INTO shift_report (shift_id,operator_id,datetime,report,shift_report_id)
|
$sql = "INSERT INTO shift_report (shift_id,operator_id,datetime,report,shift_report_id)
|
||||||
VALUES ('$shift_id','$operator_id',CONVERT_TZ(NOW(),'System','UTC'),$report,NULL)";
|
VALUES ('$shift_id','$operator_id',CONVERT_TZ(NOW(),'System','UTC'),$report,NULL)";
|
||||||
|
|
||||||
$db->Execute($sql);
|
$db->Execute($sql);
|
||||||
}
|
}
|
||||||
else if (isset($_GET['shift_report_id']))
|
else if (isset($_GET['shift_report_id']))
|
||||||
{
|
{
|
||||||
$shift_report_id = bigintval($_GET['shift_report_id']);
|
$shift_report_id = bigintval($_GET['shift_report_id']);
|
||||||
|
|
||||||
if (isset($_GET['ereport']))
|
if (isset($_GET['ereport']))
|
||||||
{
|
{
|
||||||
//edit report
|
//edit report
|
||||||
$report = $db->qstr($_GET['ereport']);
|
$report = $db->qstr($_GET['ereport']);
|
||||||
|
|
||||||
$sql = "UPDATE shift_report
|
$sql = "UPDATE shift_report
|
||||||
SET operator_id = '$operator_id', datetime = CONVERT_TZ(NOW(),'System','UTC'), report = $report
|
SET operator_id = '$operator_id', datetime = CONVERT_TZ(NOW(),'System','UTC'), report = $report
|
||||||
WHERE shift_report_id = '$shift_report_id'";
|
WHERE shift_report_id = '$shift_report_id'";
|
||||||
|
|
||||||
$db->Execute($sql);
|
$db->Execute($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "SELECT report
|
$sql = "SELECT report
|
||||||
FROM shift_report
|
FROM shift_report
|
||||||
WHERE shift_report_id = '$shift_report_id'";
|
WHERE shift_report_id = '$shift_report_id'";
|
||||||
|
|
||||||
$r = $db->GetRow($sql);
|
$r = $db->GetRow($sql);
|
||||||
if (empty($r))
|
if (empty($r))
|
||||||
{
|
{
|
||||||
print "<h3>" . T_("This report does not exist in the database") . "</h3>";
|
print "<h3>" . T_("This report does not exist in the database") . "</h3>";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//edit report
|
//edit report
|
||||||
print "<h3>" . T_("Edit report for this shift") . "</h3>";
|
print "<h3>" . T_("Edit report for this shift") . "</h3>";
|
||||||
print "<form action='?' method='get'><p><textarea name='ereport' id='ereport' rows='15' cols='80'>{$r['report']}</textarea></p>";
|
print "<form action='?' method='get'><p><textarea name='ereport' id='ereport' rows='15' cols='80'>{$r['report']}</textarea></p>";
|
||||||
print "<p><input type='hidden' name='questionnaire_id' id='questionnaire_id' value='$questionnaire_id'/>";
|
print "<p><input type='hidden' name='questionnaire_id' id='questionnaire_id' value='$questionnaire_id'/>";
|
||||||
print "<input type='hidden' name='shift_id' id='shift_id' value='$shift_id'/>";
|
print "<input type='hidden' name='shift_id' id='shift_id' value='$shift_id'/>";
|
||||||
print "<input type='hidden' name='shift_report_id' id='shift_report_id' value='$shift_report_id'/>";
|
print "<input type='hidden' name='shift_report_id' id='shift_report_id' value='$shift_report_id'/>";
|
||||||
print "<input type='submit' name='submit' id='submit' value=\"" . T_("Modify report") . "\"/>";
|
print "<input type='submit' name='submit' id='submit' value=\"" . T_("Modify report") . "\"/>";
|
||||||
print "</p></form>";
|
print "</p></form>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
xhtml_foot();
|
xhtml_foot();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|||||||
@@ -1,83 +1,91 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Set if supervisor chat should be enabled and required details
|
* Set if supervisor chat should be enabled and required details
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* This file is part of queXS
|
* This file is part of queXS
|
||||||
*
|
*
|
||||||
* queXS is free software; you can redistribute it and/or modify
|
* queXS is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* queXS is distributed in the hope that it will be useful,
|
* queXS is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with queXS; if not, write to the Free Software
|
* along with queXS; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @author Adam Zammit <adam.zammit@acspri.org.au>
|
* @author Adam Zammit <adam.zammit@acspri.org.au>
|
||||||
* @copyright Australian Consortium for Social and Political Research Incorporated (ACSPRI) 2013
|
* @copyright Australian Consortium for Social and Political Research Incorporated (ACSPRI) 2013
|
||||||
* @package queXS
|
* @package queXS
|
||||||
* @subpackage admin
|
* @subpackage admin
|
||||||
* @link http://www.acspri.org.au/ queXS was writen for ACSPRI
|
* @link http://www.acspri.org.au/ queXS was writen for ACSPRI
|
||||||
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configuration file
|
* Configuration file
|
||||||
*/
|
*/
|
||||||
include("../config.inc.php");
|
include("../config.inc.php");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Database file
|
* Database file
|
||||||
*/
|
*/
|
||||||
include ("../db.inc.php");
|
include ("../db.inc.php");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* XHTML functions
|
* XHTML functions
|
||||||
*/
|
*/
|
||||||
include("../functions/functions.xhtml.php");
|
include("../functions/functions.xhtml.php");
|
||||||
|
|
||||||
|
|
||||||
if (isset($_POST['update']))
|
if (isset($_POST['update']))
|
||||||
{
|
{
|
||||||
set_setting("bosh_service",$_POST['bosh']);
|
set_setting("bosh_service",$_POST['bosh']);
|
||||||
set_setting("supervisor_xmpp",$_POST['supervisor']);
|
set_setting("supervisor_xmpp",$_POST['supervisor']);
|
||||||
$enable = false;
|
$enable = false;
|
||||||
|
|
||||||
if (isset($_POST['enable']))
|
if (isset($_POST['enable']))
|
||||||
$enable = true;
|
$enable = true;
|
||||||
|
|
||||||
set_setting("chat_enabled",$enable);
|
set_setting("chat_enabled",$enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
xhtml_head(T_("Supervisor chat"),true,false,array("../js/window.js"));
|
xhtml_head(T_("Supervisor chat"),true,array("../include/bootstrap-3.3.2/css/bootstrap.min.css","../include/bootstrap-toggle/css/bootstrap-toggle.min.css","../css/custom.css"),array("../js/jquery-2.1.3.min.js", "../include/bootstrap-3.3.2/js/bootstrap.min.js","../include/bootstrap-toggle/js/bootstrap-toggle.min.js","../js/window.js"));
|
||||||
|
|
||||||
print "<p>" . T_("Allow interviewers to chat with the supervisor over XMPP (Jabber). Required is a BOSH enabled XMPP/Jabber server. The operators and the supervisor will need XMPP/Jabber accounts.") . "</p>";
|
print "<p class='well'>" . T_("Allow interviewers to chat with the supervisor over XMPP (Jabber). Required is a BOSH enabled XMPP/Jabber server. The operators and the supervisor will need XMPP/Jabber accounts.") . "</p>";
|
||||||
|
|
||||||
$e = get_setting("chat_enabled");
|
$e = get_setting("chat_enabled");
|
||||||
$checked = "checked='checked'";
|
$checked = "checked='checked'";
|
||||||
if (empty($e))
|
if (empty($e))
|
||||||
$checked = "";
|
$checked = "";
|
||||||
|
?>
|
||||||
?>
|
<form action="" method="post" class="form-horizontal">
|
||||||
<form action="" method="post">
|
|
||||||
<p>
|
<div class="form-group form-inline">
|
||||||
<div><label for="enable"><?php echo T_("Enable supervisor chat?"); ?>: </label><input id='enable' type='checkbox' name='enable' val='1' <?php echo $checked; ?>/></div>
|
<label class="control-label col-sm-3" for="enable"><?php echo T_("Enable supervisor chat?"); ?>: </label>
|
||||||
<div><label for="bosh"><?php echo T_("Set BOSH URL"); ?>: </label><input id='bosh' type='text' name='bosh' value='<?php echo get_setting("bosh_service"); ?>'/></div>
|
<input id='enable' type='checkbox' data-toggle="toggle" data-on="<?php echo T_("Yes"); ?>" data-off="<?php echo T_("No"); ?>" data-width="80" name='enable' val='1' <?php echo $checked; ?>/>
|
||||||
<div><label for="supervisor"><?php echo T_("Supervisor XMPP/Jabber id"); ?>: </label><input id='supervisor' name='supervisor' type='text' value='<?php echo get_setting("supervisor_xmpp"); ?>'/></div>
|
</div>
|
||||||
<div><input type="submit" id="update" name="update" value="<?php echo T_("Update"); ?>"/></div>
|
<div class="form-group form-inline">
|
||||||
</p>
|
<label class="control-label col-sm-3" for="bosh"><?php echo T_("Set BOSH URL"); ?>: </label>
|
||||||
</form>
|
<input id='bosh' type='text' name='bosh' class="form-control pull-left" required size="60" value='<?php echo get_setting("bosh_service"); ?>'/>
|
||||||
<?php
|
</div>
|
||||||
xhtml_foot();
|
<div class="form-group form-inline">
|
||||||
|
<label class="control-label col-sm-3" for="supervisor"><?php echo T_("Supervisor XMPP/Jabber id"); ?>: </label>
|
||||||
|
<input id='supervisor' name='supervisor' type='text' class="form-control pull-left" required size="60" value='<?php echo get_setting("supervisor_xmpp"); ?>'/>
|
||||||
?>
|
</div>
|
||||||
|
|
||||||
|
<input type="submit" id="update" name="update" class="btn btn-primary col-sm-offset-3 col-sm-3" value="<?php echo T_("Update"); ?>"/>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
xhtml_foot();
|
||||||
|
?>
|
||||||
@@ -1,111 +1,112 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Run the system wide case sorting process and monitor it's progress
|
* Run the system wide case sorting process and monitor it's progress
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* This file is part of queXS
|
* This file is part of queXS
|
||||||
*
|
*
|
||||||
* queXS is free software; you can redistribute it and/or modify
|
* queXS is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* queXS is distributed in the hope that it will be useful,
|
* queXS is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with queXS; if not, write to the Free Software
|
* along with queXS; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @author Adam Zammit <adam.zammit@acspri.org.au>
|
* @author Adam Zammit <adam.zammit@acspri.org.au>
|
||||||
* @copyright Australian Consortium for Social and Political Research Incorporated (ACSPRI) 2011
|
* @copyright Australian Consortium for Social and Political Research Incorporated (ACSPRI) 2011
|
||||||
* @package queXS
|
* @package queXS
|
||||||
* @subpackage admin
|
* @subpackage admin
|
||||||
* @link http://www.acspri.org.au/ queXS was writen for ACSPRI
|
* @link http://www.acspri.org.au/ queXS was writen for ACSPRI
|
||||||
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configuration file
|
* Configuration file
|
||||||
*/
|
*/
|
||||||
include ("../config.inc.php");
|
include ("../config.inc.php");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Database file
|
* Database file
|
||||||
*/
|
*/
|
||||||
include ("../db.inc.php");
|
include ("../db.inc.php");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Process
|
* Process
|
||||||
*/
|
*/
|
||||||
include ("../functions/functions.process.php");
|
include ("../functions/functions.process.php");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* XHTML functions
|
* XHTML functions
|
||||||
*/
|
*/
|
||||||
include("../functions/functions.xhtml.php");
|
include("../functions/functions.xhtml.php");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (isset($_GET['watch']))
|
if (isset($_GET['watch']))
|
||||||
{
|
{
|
||||||
//start watching process
|
//start watching process
|
||||||
start_process(realpath(dirname(__FILE__) . "/systemsortprocess.php"),2);
|
start_process(realpath(dirname(__FILE__) . "/systemsortprocess.php"),2);
|
||||||
}
|
}
|
||||||
|
|
||||||
$p = is_process_running(2);
|
$p = is_process_running(2);
|
||||||
|
|
||||||
|
|
||||||
if ($p)
|
if ($p)
|
||||||
{
|
{
|
||||||
if (isset($_GET['kill']))
|
if (isset($_GET['kill']))
|
||||||
{
|
{
|
||||||
if ($_GET['kill'] == "force")
|
if ($_GET['kill'] == "force")
|
||||||
end_process($p);
|
end_process($p);
|
||||||
else
|
else
|
||||||
kill_process($p);
|
kill_process($p);
|
||||||
|
|
||||||
set_setting('systemsort',false);
|
set_setting('systemsort',false);
|
||||||
}
|
}
|
||||||
|
|
||||||
xhtml_head(T_("Monitor system wide case sorting"),true,array("../css/table.css"),false,false,false,true);
|
xhtml_head(T_("Monitor system wide case sorting"),true,array("../include/bootstrap-3.3.2/css/bootstrap.min.css","../css/custom.css"),false,false,false,true);
|
||||||
|
|
||||||
print "<h1>" . T_("Running process:") . " $p</h1>";
|
print "<h2>" . T_("Running process:") . " $p</h2>";
|
||||||
|
|
||||||
if (is_process_killed($p))
|
if (is_process_killed($p))
|
||||||
{
|
{
|
||||||
print "<h3>" . T_("Kill signal sent: Please wait...") . "</h3>";
|
print "<h3>" . T_("Kill signal sent: Please wait...") . "</h3>";
|
||||||
print "<p><a href='?kill=force'>" . T_("Process is already closed (eg. server was rebooted) - click here to confirm") . "</a></p>";
|
print "<p><a href='?kill=force'>" . T_("Process is already closed (eg. server was rebooted) - click here to confirm") . "</a></p>";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print "<p><a href='?kill=kill'>" . T_("Kill the running process") . "</a></p>";
|
print "<p><a href='?kill=kill'>" . T_("Kill the running process") . "</a></p>";
|
||||||
}
|
}
|
||||||
|
|
||||||
$d = process_get_data($p);
|
$d = process_get_data($p);
|
||||||
if ($d !== false)
|
if ($d !== false)
|
||||||
{
|
{
|
||||||
xhtml_table($d,array('process_log_id','datetime','data'),array(T_("Log id"), T_("Date"), T_("Log entry")));
|
xhtml_table($d,array('process_log_id','datetime','data'),array(T_("Log id"), T_("Date"), T_("Log entry")));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
else
|
||||||
else
|
{
|
||||||
{
|
xhtml_head(T_("Monitor system wide case sorting"),true,array("../include/bootstrap-3.3.2/css/bootstrap.min.css","../css/custom.css"));
|
||||||
xhtml_head(T_("Monitor system wide case sorting"),true,array("../css/table.css"));
|
//print "<h2>" . T_("Monitor system wide case sorting") . "</h2>";
|
||||||
print "<h2>" . T_("Monitor system wide case sorting") . "</h2>";
|
print "<p><a href='?watch=watch'>" . T_("Click here to enable and begin system wide case sorting") . "</a></p>";
|
||||||
print "<p><a href='?watch=watch'>" . T_("Click here to enable and begin system wide case sorting") . "</a></p>";
|
print "<div class='well pull-right col-sm-4'><p>" . T_("System wide case sorting is periodically (via SYSTEM_SORT_MINUTES configuration directive) sorting cases on a system wide basis instead of finding the most appropriate case each time an operator requests a new case. This may increase performance where there are a large number of cases or complex quotas in place. If you are not experiencing any performance problems, it is not recommended to use this feature.") . "</p></div>";
|
||||||
print "<p>" . T_("System wide case sorting is periodically (via SYSTEM_SORT_MINUTES configuration directive) sorting cases on a system wide basis instead of finding the most appropriate case each time an operator requests a new case. This may increase performance where there are a large number of cases or complex quotas in place. If you are not experiencing any performance problems, it is not recommended to use this feature.") . "</p>";
|
|
||||||
print "<h2>" . T_("Outcome of last process run (if any)") . "</h2>";
|
print "<h2>" . T_("Outcome of last process run (if any)") . "</h2>";
|
||||||
$d = process_get_last_data(2);
|
|
||||||
if ($d !== false)
|
$d = process_get_last_data(2);
|
||||||
{
|
if ($d !== false)
|
||||||
xhtml_table($d,array('process_log_id','datetime','data'),array(T_("Log id"), T_("Date"), T_("Log entry")));
|
{
|
||||||
}
|
xhtml_table($d,array('process_log_id','datetime','data'),array(T_("Log id"), T_("Date"), T_("Log entry")));
|
||||||
}
|
}
|
||||||
xhtml_foot();
|
}
|
||||||
|
xhtml_foot();
|
||||||
?>
|
|
||||||
|
?>
|
||||||
@@ -1,344 +1,347 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Run the system wide case sorting process
|
* Run the system wide case sorting process
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* This file is part of queXS
|
* This file is part of queXS
|
||||||
*
|
*
|
||||||
* queXS is free software; you can redistribute it and/or modify
|
* queXS is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* queXS is distributed in the hope that it will be useful,
|
* queXS is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with queXS; if not, write to the Free Software
|
* along with queXS; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @author Adam Zammit <adam.zammit@acspri.org.au>
|
* @author Adam Zammit <adam.zammit@acspri.org.au>
|
||||||
* @copyright Australian Consortium for Social and Political Research Incorporated (ACSPRI) 2011
|
* @copyright Australian Consortium for Social and Political Research Incorporated (ACSPRI) 2011
|
||||||
* @package queXS
|
* @package queXS
|
||||||
* @subpackage admin
|
* @subpackage admin
|
||||||
* @link http://www.acspri.org.au/ queXS was written for ACSPRI
|
* @link http://www.acspri.org.au/ queXS was written for ACSPRI
|
||||||
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configuration file
|
* Configuration file
|
||||||
*/
|
*/
|
||||||
include (dirname(__FILE__) . "/../config.inc.php");
|
include (dirname(__FILE__) . "/../config.inc.php");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Database file
|
* Database file
|
||||||
*/
|
*/
|
||||||
include (dirname(__FILE__) . "/../db.inc.php");
|
include (dirname(__FILE__) . "/../db.inc.php");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Process
|
* Process
|
||||||
*/
|
*/
|
||||||
include (dirname(__FILE__) . "/../functions/functions.process.php");
|
include (dirname(__FILE__) . "/../functions/functions.process.php");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Operator functions (for quotas)
|
* Operator functions (for quotas)
|
||||||
*/
|
*/
|
||||||
include (dirname(__FILE__) . "/../functions/functions.operator.php");
|
include (dirname(__FILE__) . "/../functions/functions.operator.php");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the database with the new data from the running script
|
* Update the database with the new data from the running script
|
||||||
*
|
*
|
||||||
* @param string $buffer The data to append to the database
|
* @param string $buffer The data to append to the database
|
||||||
* @return string Return a blank string to empty the buffer
|
* @return string Return a blank string to empty the buffer
|
||||||
*/
|
*/
|
||||||
function update_callback($buffer)
|
function update_callback($buffer)
|
||||||
{
|
{
|
||||||
global $process_id;
|
global $process_id;
|
||||||
|
|
||||||
process_append_data($process_id,$buffer);
|
process_append_data($process_id,$buffer);
|
||||||
|
|
||||||
return ""; //empty buffer
|
return ""; //empty buffer
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Disable system sort on shutdown
|
* Disable system sort on shutdown
|
||||||
*
|
*
|
||||||
* @author Adam Zammit <adam.zammit@acspri.org.au>
|
* @author Adam Zammit <adam.zammit@acspri.org.au>
|
||||||
* @since 2011-01-31
|
* @since 2011-01-31
|
||||||
*/
|
*/
|
||||||
function disable_systemsort()
|
function disable_systemsort()
|
||||||
{
|
{
|
||||||
set_setting('systemsort',false);
|
set_setting('systemsort',false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//get the arguments from the command line (this process_id)
|
//get the arguments from the command line (this process_id)
|
||||||
if ($argc != 2) exit();
|
if ($argc != 2) exit();
|
||||||
|
|
||||||
$process_id = $argv[1];
|
$process_id = $argv[1];
|
||||||
|
|
||||||
//register an exit function which will tell the database we have ended
|
//register an exit function which will tell the database we have ended
|
||||||
register_shutdown_function('end_process',$process_id);
|
register_shutdown_function('end_process',$process_id);
|
||||||
register_shutdown_function('disable_systemsort');
|
register_shutdown_function('disable_systemsort');
|
||||||
|
|
||||||
//all output send to database instead of stdout
|
//all output send to database instead of stdout
|
||||||
ob_start('update_callback',2);
|
ob_start('update_callback',2);
|
||||||
|
|
||||||
$closecasescounter = 0;
|
$closecasescounter = 0;
|
||||||
|
|
||||||
print T_("Sorting cases process starting");
|
print T_("Sorting cases process starting");
|
||||||
|
|
||||||
$closecasesinterval = (24 * 60) / SYSTEM_SORT_MINUTES; //check for closed cases once every day
|
$closecasesinterval = (24 * 60) / SYSTEM_SORT_MINUTES; //check for closed cases once every day
|
||||||
$sleepinterval = 10; // in seconds so we can monitor if the process has been killed
|
$sleepinterval = 10; // in seconds so we can monitor if the process has been killed
|
||||||
|
|
||||||
while (!is_process_killed($process_id)) //check if process killed every $sleepinterval
|
while (!is_process_killed($process_id)) //check if process killed every $sleepinterval
|
||||||
{
|
{
|
||||||
//Make sure that the system knows we are system sorting
|
//Make sure that the system knows we are system sorting
|
||||||
set_setting('systemsort',true);
|
set_setting('systemsort',true);
|
||||||
|
|
||||||
if ($closecasescounter == 0 || $closecasescounter > $closecasesinterval)
|
if ($closecasescounter == 0 || $closecasescounter > $closecasesinterval)
|
||||||
{
|
{
|
||||||
$time_start = microtime(true);
|
$time_start = microtime(true);
|
||||||
print T_("Checking for cases open for more than 24 hours");
|
print T_("Checking for cases open for more than 24 hours");
|
||||||
|
|
||||||
$closecasescounter = 0;
|
$closecasescounter = 0;
|
||||||
$db->StartTrans();
|
$db->StartTrans();
|
||||||
|
|
||||||
//find all call attempts without an end that started more than 24 hours ago
|
//find all call attempts without an end that started more than 24 hours ago
|
||||||
|
|
||||||
$sql = "SELECT case_id, call_attempt_id
|
$sql = "SELECT case_id, call_attempt_id
|
||||||
FROM `call_attempt`
|
FROM `call_attempt`
|
||||||
WHERE TIMESTAMPDIFF(HOUR, start, CONVERT_TZ(NOW(),'System','UTC')) > 24
|
WHERE TIMESTAMPDIFF(HOUR, start, CONVERT_TZ(NOW(),'System','UTC')) > 24
|
||||||
AND end IS NULL";
|
AND end IS NULL";
|
||||||
|
|
||||||
$rs = $db->GetAll($sql);
|
$rs = $db->GetAll($sql);
|
||||||
|
|
||||||
foreach ($rs as $r)
|
foreach ($rs as $r)
|
||||||
{
|
{
|
||||||
//refer to supervisor if case still assigned
|
//refer to supervisor if case still assigned
|
||||||
|
|
||||||
$sql = "UPDATE `case`
|
$sql = "UPDATE `case`
|
||||||
SET current_operator_id = NULL, current_outcome_id = 5
|
SET current_operator_id = NULL, current_outcome_id = 5
|
||||||
WHERE case_id = '{$r['case_id']}'
|
WHERE case_id = '{$r['case_id']}'
|
||||||
AND current_operator_id IS NOT NULL
|
AND current_operator_id IS NOT NULL
|
||||||
AND current_call_id IS NULL";
|
AND current_call_id IS NULL";
|
||||||
|
|
||||||
$db->Execute($sql);
|
$db->Execute($sql);
|
||||||
|
|
||||||
//add note
|
//add note
|
||||||
|
|
||||||
$sql = "INSERT INTO case_note (case_id,operator_id,note,`datetime`)
|
$sql = "INSERT INTO case_note (case_id,operator_id,note,`datetime`)
|
||||||
VALUES ('{$r['case_id']}',1,'" . TQ_("System automatically closed case as not closed for more than 24 hours") ."', CONVERT_TZ(NOW(),'System','UTC'))";
|
VALUES ('{$r['case_id']}',1,'" . TQ_("System automatically closed case as not closed for more than 24 hours") ."', CONVERT_TZ(NOW(),'System','UTC'))";
|
||||||
|
|
||||||
$db->Execute($sql);
|
$db->Execute($sql);
|
||||||
|
|
||||||
//finish the call attempt
|
//finish the call attempt
|
||||||
|
|
||||||
$sql = "UPDATE `call_attempt`
|
$sql = "UPDATE `call_attempt`
|
||||||
SET end = start
|
SET end = start
|
||||||
WHERE call_attempt_id = '{$r['call_attempt_id']}'";
|
WHERE call_attempt_id = '{$r['call_attempt_id']}'";
|
||||||
|
|
||||||
$db->Execute($sql);
|
$db->Execute($sql);
|
||||||
|
|
||||||
print T_("System automatically closed case as not closed for more than 24 hours") . " - " . T_("Case id") . ": {$r['case_id']}";
|
print T_("System automatically closed case as not closed for more than 24 hours") . " - " . T_("Case id") . ": {$r['case_id']}";
|
||||||
}
|
}
|
||||||
|
|
||||||
//find all calls without an end that started more than 24 hours ago
|
//find all calls without an end that started more than 24 hours ago
|
||||||
|
|
||||||
$sql = "SELECT case_id, call_id
|
$sql = "SELECT case_id, call_id
|
||||||
FROM `call`
|
FROM `call`
|
||||||
WHERE TIMESTAMPDIFF(HOUR, start, CONVERT_TZ(NOW(),'System','UTC')) > 24
|
WHERE TIMESTAMPDIFF(HOUR, start, CONVERT_TZ(NOW(),'System','UTC')) > 24
|
||||||
AND end IS NULL";
|
AND end IS NULL";
|
||||||
|
|
||||||
$rs = $db->GetAll($sql);
|
$rs = $db->GetAll($sql);
|
||||||
|
|
||||||
foreach ($rs as $r)
|
foreach ($rs as $r)
|
||||||
{
|
{
|
||||||
//refer to supervisor if case still assigned
|
//refer to supervisor if case still assigned
|
||||||
|
|
||||||
$sql = "UPDATE `case`
|
$sql = "UPDATE `case`
|
||||||
SET current_operator_id = NULL, current_outcome_id = 5, current_call_id = NULL
|
SET current_operator_id = NULL, current_outcome_id = 5, current_call_id = NULL
|
||||||
WHERE case_id = '{$r['case_id']}'
|
WHERE case_id = '{$r['case_id']}'
|
||||||
AND current_operator_id IS NOT NULL";
|
AND current_operator_id IS NOT NULL";
|
||||||
|
|
||||||
$db->Execute($sql);
|
$db->Execute($sql);
|
||||||
|
|
||||||
//add note
|
//add note
|
||||||
|
|
||||||
$sql = "INSERT INTO case_note (case_id,operator_id,note,`datetime`)
|
$sql = "INSERT INTO case_note (case_id,operator_id,note,`datetime`)
|
||||||
VALUES ('{$r['case_id']}',1,'" . TQ_("System automatically closed case as not closed for more than 24 hours") ."', CONVERT_TZ(NOW(),'System','UTC'))";
|
VALUES ('{$r['case_id']}',1,'" . TQ_("System automatically closed case as not closed for more than 24 hours") ."', CONVERT_TZ(NOW(),'System','UTC'))";
|
||||||
|
|
||||||
$db->Execute($sql);
|
$db->Execute($sql);
|
||||||
|
|
||||||
//finish the call
|
//finish the call
|
||||||
|
|
||||||
$sql = "UPDATE `call`
|
$sql = "UPDATE `call`
|
||||||
SET end = start, outcome_id = 5, state = 5
|
SET end = start, outcome_id = 5, state = 5
|
||||||
WHERE call_id = '{$r['call_id']}'";
|
WHERE call_id = '{$r['call_id']}'";
|
||||||
|
|
||||||
$db->Execute($sql);
|
$db->Execute($sql);
|
||||||
|
|
||||||
print T_("System automatically closed case as not closed for more than 24 hours") . " - " . T_("Case id") . ": {$r['case_id']}";
|
print T_("System automatically closed case as not closed for more than 24 hours") . " - " . T_("Case id") . ": {$r['case_id']}";
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $db->CompleteTrans();
|
$result = $db->CompleteTrans();
|
||||||
|
|
||||||
$time_end = microtime(true);
|
$time_end = microtime(true);
|
||||||
$timer = $time_end - $time_start;
|
$timer = $time_end - $time_start;
|
||||||
|
|
||||||
if ($result)
|
if ($result)
|
||||||
print T_("Completed case closing") . ". " . T_("This task took") . ": $timer " . T_("seconds");
|
print T_("Completed case closing") . ". " . T_("This task took") . ": $timer " . T_("seconds");
|
||||||
else
|
else
|
||||||
print T_("Failed to complete case closing") . ". " . T_("This task took") . ": $timer " . T_("seconds");
|
print T_("Failed to complete case closing") . ". " . T_("This task took") . ": $timer " . T_("seconds");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$closecasescounter++;
|
$closecasescounter++;
|
||||||
|
|
||||||
//Sort cases on a questionnaire by questionnaire basis
|
//Sort cases on a questionnaire by questionnaire basis
|
||||||
$sql = "SELECT questionnaire_id, description
|
$sql = "SELECT questionnaire_id, description
|
||||||
FROM questionnaire
|
FROM questionnaire
|
||||||
WHERE enabled = 1";
|
WHERE enabled = 1";
|
||||||
|
|
||||||
$qs = $db->GetAll($sql);
|
$qs = $db->GetAll($sql);
|
||||||
|
|
||||||
foreach($qs as $q)
|
foreach($qs as $q)
|
||||||
{
|
{
|
||||||
print T_("Sorting cases for ") . $q['description'];
|
print T_("Sorting cases for ") . $q['description'];
|
||||||
|
|
||||||
$questionnaire_id = $q['questionnaire_id'];
|
$questionnaire_id = $q['questionnaire_id'];
|
||||||
|
|
||||||
$time_start = microtime(true);
|
$time_start = microtime(true);
|
||||||
|
|
||||||
$db->StartTrans();
|
$db->StartTrans();
|
||||||
|
|
||||||
//Set all cases as unavailable
|
//Set all cases as unavailable
|
||||||
$sql = "UPDATE `case`
|
$sql = "UPDATE `case`
|
||||||
SET sortorder = NULL
|
SET sortorder = NULL
|
||||||
WHERE sortorder IS NOT NULL
|
WHERE sortorder IS NOT NULL
|
||||||
AND questionnaire_id = '$questionnaire_id'";
|
AND questionnaire_id = '$questionnaire_id'";
|
||||||
|
|
||||||
$db->Execute($sql);
|
$db->Execute($sql);
|
||||||
|
|
||||||
|
|
||||||
//update quotas
|
//update quotas
|
||||||
update_quotas($questionnaire_id);
|
update_quotas($questionnaire_id);
|
||||||
|
|
||||||
|
|
||||||
//Sort current cases for this questionnaire
|
//Sort current cases for this questionnaire
|
||||||
|
|
||||||
$sql = "SELECT c.case_id
|
$sql = "SELECT c.case_id
|
||||||
FROM `case` as c
|
FROM `case` as c
|
||||||
LEFT JOIN `call` as a on (a.call_id = c.last_call_id)
|
LEFT JOIN `call` as a on (a.call_id = c.last_call_id)
|
||||||
JOIN (sample as s, sample_import as si) on (s.sample_id = c.sample_id and si.sample_import_id = s.import_id)
|
JOIN (sample as s, sample_import as si) on (s.sample_id = c.sample_id and si.sample_import_id = s.import_id)
|
||||||
JOIN (questionnaire_sample as qs, questionnaire as q, outcome as ou) on (c.questionnaire_id = q.questionnaire_id and qs.sample_import_id = s.import_id and ou.outcome_id = c.current_outcome_id and q.questionnaire_id = '$questionnaire_id' and qs.questionnaire_id = c.questionnaire_id)
|
JOIN (questionnaire_sample as qs, questionnaire as q, outcome as ou) on (c.questionnaire_id = q.questionnaire_id and qs.sample_import_id = s.import_id and ou.outcome_id = c.current_outcome_id and q.questionnaire_id = '$questionnaire_id' and qs.questionnaire_id = c.questionnaire_id)
|
||||||
LEFT JOIN shift as sh on (sh.questionnaire_id = q.questionnaire_id and (CONVERT_TZ(NOW(),'System','UTC') >= sh.start) AND (CONVERT_TZ(NOW(),'System','UTC') <= sh.end))
|
LEFT JOIN shift as sh on (sh.questionnaire_id = q.questionnaire_id and (CONVERT_TZ(NOW(),'System','UTC') >= sh.start) AND (CONVERT_TZ(NOW(),'System','UTC') <= sh.end))
|
||||||
LEFT JOIN appointment as ap on (ap.case_id = c.case_id AND ap.completed_call_id is NULL AND (ap.start > CONVERT_TZ(NOW(),'System','UTC')))
|
LEFT JOIN appointment as ap on (ap.case_id = c.case_id AND ap.completed_call_id is NULL AND (ap.start > CONVERT_TZ(NOW(),'System','UTC')))
|
||||||
LEFT JOIN appointment as apn on (apn.case_id = c.case_id AND apn.completed_call_id is NULL AND (CONVERT_TZ(NOW(),'System','UTC') >= apn.start) AND (CONVERT_TZ(NOW(),'System','UTC') <= apn.end))
|
LEFT JOIN appointment as apn on (apn.case_id = c.case_id AND apn.completed_call_id is NULL AND (CONVERT_TZ(NOW(),'System','UTC') >= apn.start) AND (CONVERT_TZ(NOW(),'System','UTC') <= apn.end))
|
||||||
LEFT JOIN call_restrict as cr on (cr.day_of_week = DAYOFWEEK(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) and TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) >= cr.start and TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) <= cr.end)
|
LEFT JOIN call_restrict as cr on (cr.day_of_week = DAYOFWEEK(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) and TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) >= cr.start and TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) <= cr.end)
|
||||||
LEFT JOIN questionnaire_sample_exclude_priority AS qsep ON (qsep.questionnaire_id = c.questionnaire_id AND qsep.sample_id = c.sample_id)
|
LEFT JOIN questionnaire_sample_exclude_priority AS qsep ON (qsep.questionnaire_id = c.questionnaire_id AND qsep.sample_id = c.sample_id)
|
||||||
LEFT JOIN case_availability AS casa ON (casa.case_id = c.case_id)
|
LEFT JOIN case_availability AS casa ON (casa.case_id = c.case_id)
|
||||||
LEFT JOIN availability AS ava ON (ava.availability_group_id = casa.availability_group_id)
|
LEFT JOIN availability AS ava ON (ava.availability_group_id = casa.availability_group_id)
|
||||||
LEFT JOIN questionnaire_timeslot AS qast ON (qast.questionnaire_id = c.questionnaire_id)
|
LEFT JOIN questionnaire_timeslot AS qast ON (qast.questionnaire_id = c.questionnaire_id)
|
||||||
LEFT JOIN questionnaire_sample_timeslot AS qasts ON (qasts.questionnaire_id = c.questionnaire_id AND qasts.sample_import_id = si.sample_import_id)
|
LEFT JOIN questionnaire_sample_timeslot AS qasts ON (qasts.questionnaire_id = c.questionnaire_id AND qasts.sample_import_id = si.sample_import_id)
|
||||||
WHERE c.current_operator_id IS NULL
|
WHERE c.current_operator_id IS NULL
|
||||||
AND c.questionnaire_id = '$questionnaire_id'
|
AND c.questionnaire_id = '$questionnaire_id'
|
||||||
AND ((apn.appointment_id IS NOT NULL) OR casa.case_id IS NULL OR (ava.day_of_week = DAYOFWEEK(CONVERT_TZ(NOW(),'System',s.Time_zone_name)) AND TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) >= ava.start AND TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) <= ava.end ))
|
AND ((apn.appointment_id IS NOT NULL) OR casa.case_id IS NULL OR (ava.day_of_week = DAYOFWEEK(CONVERT_TZ(NOW(),'System',s.Time_zone_name)) AND TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) >= ava.start AND TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) <= ava.end ))
|
||||||
AND ((apn.appointment_id IS NOT NULL) OR qast.questionnaire_id IS NULL OR ((SELECT COUNT(*) FROM availability WHERE availability.availability_group_id = qast.availability_group_id AND (availability.day_of_week = DAYOFWEEK(CONVERT_TZ(NOW(),'System',s.Time_zone_name)) AND TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) >= availability.start AND TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) <= availability.end)) >= 1 AND (SELECT COUNT(call_attempt_id) FROM `call_attempt`, availability WHERE call_attempt.case_id = c.case_id AND (availability.availability_group_id = qast.availability_group_id AND (availability.day_of_week = DAYOFWEEK(CONVERT_TZ(call_attempt.start,'UTC',s.Time_zone_name)) AND TIME(CONVERT_TZ(call_attempt.start, 'UTC' , s.Time_zone_name)) >= availability.start AND TIME(CONVERT_TZ(call_attempt.start, 'UTC' , s.Time_zone_name)) <= availability.end))) = ( SELECT (SELECT COUNT(*) FROM availability, call_attempt WHERE call_attempt.case_id = c.case_id AND availability.availability_group_id = availability_group.availability_group_id AND (availability.day_of_week = DAYOFWEEK(CONVERT_TZ(call_attempt.start,'UTC',s.Time_zone_name)) AND TIME(CONVERT_TZ(call_attempt.start, 'UTC' , s.Time_zone_name)) >= availability.start AND TIME(CONVERT_TZ(call_attempt.start, 'UTC' , s.Time_zone_name)) <= availability.end)) as cou FROM availability_group, questionnaire_timeslot WHERE questionnaire_timeslot.questionnaire_id = c.questionnaire_id AND availability_group.availability_group_id = questionnaire_timeslot.availability_group_id ORDER BY cou ASC LIMIT 1)))
|
|
||||||
AND ((apn.appointment_id IS NOT NULL) OR qasts.questionnaire_id IS NULL OR ((SELECT COUNT(*) FROM availability WHERE availability.availability_group_id = qasts.availability_group_id AND (availability.day_of_week = DAYOFWEEK(CONVERT_TZ(NOW(),'System',s.Time_zone_name)) AND TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) >= availability.start AND TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) <= availability.end)) >= 1 AND (SELECT COUNT(call_attempt_id) FROM `call_attempt`, availability WHERE call_attempt.case_id = c.case_id AND (availability.availability_group_id = qasts.availability_group_id AND (availability.day_of_week = DAYOFWEEK(CONVERT_TZ(call_attempt.start,'UTC',s.Time_zone_name)) AND TIME(CONVERT_TZ(call_attempt.start, 'UTC' , s.Time_zone_name)) >= availability.start AND TIME(CONVERT_TZ(call_attempt.start, 'UTC' , s.Time_zone_name)) <= availability.end))) = ( SELECT (SELECT COUNT(*) FROM availability, call_attempt WHERE call_attempt.case_id = c.case_id AND availability.availability_group_id = availability_group.availability_group_id AND (availability.day_of_week = DAYOFWEEK(CONVERT_TZ(call_attempt.start,'UTC',s.Time_zone_name)) AND TIME(CONVERT_TZ(call_attempt.start, 'UTC' , s.Time_zone_name)) >= availability.start AND TIME(CONVERT_TZ(call_attempt.start, 'UTC' , s.Time_zone_name)) <= availability.end)) as cou FROM availability_group, questionnaire_sample_timeslot WHERE questionnaire_sample_timeslot.questionnaire_id = c.questionnaire_id AND questionnaire_sample_timeslot.sample_import_id = si.sample_import_id AND availability_group.availability_group_id = questionnaire_sample_timeslot.availability_group_id ORDER BY cou ASC LIMIT 1)))
|
AND ((apn.appointment_id IS NOT NULL) OR qast.questionnaire_id IS NULL OR ((SELECT COUNT(*) FROM availability WHERE availability.availability_group_id = qast.availability_group_id AND (availability.day_of_week = DAYOFWEEK(CONVERT_TZ(NOW(),'System',s.Time_zone_name)) AND TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) >= availability.start AND TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) <= availability.end)) >= 1 AND (SELECT COUNT(call_attempt_id) FROM `call_attempt`, availability WHERE call_attempt.case_id = c.case_id AND (availability.availability_group_id = qast.availability_group_id AND (availability.day_of_week = DAYOFWEEK(CONVERT_TZ(call_attempt.start,'UTC',s.Time_zone_name)) AND TIME(CONVERT_TZ(call_attempt.start, 'UTC' , s.Time_zone_name)) >= availability.start AND TIME(CONVERT_TZ(call_attempt.start, 'UTC' , s.Time_zone_name)) <= availability.end))) = ( SELECT (SELECT COUNT(*) FROM availability, call_attempt WHERE call_attempt.case_id = c.case_id AND availability.availability_group_id = availability_group.availability_group_id AND (availability.day_of_week = DAYOFWEEK(CONVERT_TZ(call_attempt.start,'UTC',s.Time_zone_name)) AND TIME(CONVERT_TZ(call_attempt.start, 'UTC' , s.Time_zone_name)) >= availability.start AND TIME(CONVERT_TZ(call_attempt.start, 'UTC' , s.Time_zone_name)) <= availability.end)) as cou FROM availability_group, questionnaire_timeslot WHERE questionnaire_timeslot.questionnaire_id = c.questionnaire_id AND availability_group.availability_group_id = questionnaire_timeslot.availability_group_id ORDER BY cou ASC LIMIT 1)))
|
||||||
AND (a.call_id is NULL or (a.end < CONVERT_TZ(DATE_SUB(NOW(), INTERVAL ou.default_delay_minutes MINUTE),'System','UTC')))
|
|
||||||
AND ap.case_id is NULL
|
AND ((apn.appointment_id IS NOT NULL) OR qasts.questionnaire_id IS NULL OR ((SELECT COUNT(*) FROM availability WHERE availability.availability_group_id = qasts.availability_group_id AND (availability.day_of_week = DAYOFWEEK(CONVERT_TZ(NOW(),'System',s.Time_zone_name)) AND TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) >= availability.start AND TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) <= availability.end)) >= 1 AND (SELECT COUNT(call_attempt_id) FROM `call_attempt`, availability WHERE call_attempt.case_id = c.case_id AND (availability.availability_group_id = qasts.availability_group_id AND (availability.day_of_week = DAYOFWEEK(CONVERT_TZ(call_attempt.start,'UTC',s.Time_zone_name)) AND TIME(CONVERT_TZ(call_attempt.start, 'UTC' , s.Time_zone_name)) >= availability.start AND TIME(CONVERT_TZ(call_attempt.start, 'UTC' , s.Time_zone_name)) <= availability.end))) = ( SELECT (SELECT COUNT(*) FROM availability, call_attempt WHERE call_attempt.case_id = c.case_id AND availability.availability_group_id = availability_group.availability_group_id AND (availability.day_of_week = DAYOFWEEK(CONVERT_TZ(call_attempt.start,'UTC',s.Time_zone_name)) AND TIME(CONVERT_TZ(call_attempt.start, 'UTC' , s.Time_zone_name)) >= availability.start AND TIME(CONVERT_TZ(call_attempt.start, 'UTC' , s.Time_zone_name)) <= availability.end)) as cou FROM availability_group, questionnaire_sample_timeslot WHERE questionnaire_sample_timeslot.questionnaire_id = c.questionnaire_id AND questionnaire_sample_timeslot.sample_import_id = si.sample_import_id AND availability_group.availability_group_id = questionnaire_sample_timeslot.availability_group_id ORDER BY cou ASC LIMIT 1)))
|
||||||
AND ((qsep.questionnaire_id is NULL) or qsep.exclude = 0)
|
|
||||||
AND !(q.restrict_work_shifts = 1 AND sh.shift_id IS NULL)
|
AND (a.call_id is NULL or (a.end < CONVERT_TZ(DATE_SUB(NOW(), INTERVAL ou.default_delay_minutes MINUTE),'System','UTC')))
|
||||||
AND !(si.call_restrict = 1 AND cr.day_of_week IS NULL)
|
AND ap.case_id is NULL
|
||||||
AND ((apn.appointment_id IS NOT NULL) or qs.call_attempt_max = 0 or ((SELECT count(*) FROM call_attempt WHERE case_id = c.case_id) < qs.call_attempt_max))
|
AND ((qsep.questionnaire_id is NULL) or qsep.exclude = 0)
|
||||||
AND ((apn.appointment_id IS NOT NULL) or qs.call_max = 0 or ((SELECT count(*) FROM `call` WHERE case_id = c.case_id) < qs.call_max))
|
AND !(q.restrict_work_shifts = 1 AND sh.shift_id IS NULL)
|
||||||
AND (SELECT count(*) FROM `questionnaire_sample_quota` WHERE questionnaire_id = c.questionnaire_id AND sample_import_id = s.import_id AND quota_reached = 1) = 0
|
AND !(si.call_restrict = 1 AND cr.day_of_week IS NULL)
|
||||||
GROUP BY c.case_id
|
AND ((apn.appointment_id IS NOT NULL) or qs.call_attempt_max = 0 or ((SELECT count(*) FROM call_attempt WHERE case_id = c.case_id) < qs.call_attempt_max))
|
||||||
ORDER BY IF(ISNULL(apn.end),1,0),apn.end ASC, qsep.priority DESC, a.start ASC";
|
AND ((apn.appointment_id IS NOT NULL) or qs.call_max = 0 or ((SELECT count(*) FROM `call` WHERE case_id = c.case_id) < qs.call_max))
|
||||||
|
AND (SELECT count(*) FROM `questionnaire_sample_quota` WHERE questionnaire_id = c.questionnaire_id AND sample_import_id = s.import_id AND quota_reached = 1) = 0
|
||||||
$rs = $db->GetAll($sql);
|
GROUP BY c.case_id
|
||||||
|
ORDER BY IF(ISNULL(apn.end),1,0), apn.end ASC, qsep.priority DESC, a.start ASC";
|
||||||
|
|
||||||
$i = 1;
|
$rs = $db->GetAll($sql);
|
||||||
foreach ($rs as $r)
|
|
||||||
{
|
|
||||||
$sql = "UPDATE `case`
|
$i = 1;
|
||||||
SET sortorder = '$i'
|
foreach ($rs as $r)
|
||||||
WHERE case_id = '{$r['case_id']}'";
|
{
|
||||||
|
$sql = "UPDATE `case`
|
||||||
$db->Execute($sql);
|
SET sortorder = '$i'
|
||||||
$i++;
|
WHERE case_id = '{$r['case_id']}'";
|
||||||
}
|
|
||||||
|
$db->Execute($sql);
|
||||||
|
$i++;
|
||||||
//First set all sample records as unavailable
|
}
|
||||||
$sql = "UPDATE `questionnaire_sample_exclude_priority`
|
|
||||||
SET sortorder = NULL
|
|
||||||
WHERE sortorder IS NOT NULL
|
//First set all sample records as unavailable
|
||||||
AND questionnaire_id = '$questionnaire_id'";
|
$sql = "UPDATE `questionnaire_sample_exclude_priority`
|
||||||
|
SET sortorder = NULL
|
||||||
$db->Execute($sql);
|
WHERE sortorder IS NOT NULL
|
||||||
|
AND questionnaire_id = '$questionnaire_id'";
|
||||||
|
|
||||||
//Sort sample list where attached to this questionnaire
|
$db->Execute($sql);
|
||||||
|
|
||||||
$sql = "SELECT s.sample_id as sample_id,qs.questionnaire_id as questionnaire_id
|
|
||||||
FROM sample as s
|
//Sort sample list where attached to this questionnaire
|
||||||
JOIN (questionnaire_sample as qs, questionnaire as q, sample_import as si) on (qs.sample_import_id = s.import_id and si.sample_import_id = s.import_id and q.questionnaire_id = qs.questionnaire_id AND q.questionnaire_id = '$questionnaire_id')
|
|
||||||
LEFT JOIN `case` as c on (c.sample_id = s.sample_id and c.questionnaire_id = qs.questionnaire_id)
|
$sql = "SELECT s.sample_id as sample_id,qs.questionnaire_id as questionnaire_id
|
||||||
LEFT JOIN call_restrict as cr on (cr.day_of_week = DAYOFWEEK(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) and TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) >= cr.start and TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) <= cr.end)
|
FROM sample as s
|
||||||
LEFT JOIN shift as sh on (sh.questionnaire_id = q.questionnaire_id and (CONVERT_TZ(NOW(),'System','UTC') >= sh.start) AND (CONVERT_TZ(NOW(),'System','UTC') <= sh.end))
|
JOIN (questionnaire_sample as qs, questionnaire as q, sample_import as si) on (qs.sample_import_id = s.import_id and si.sample_import_id = s.import_id and q.questionnaire_id = qs.questionnaire_id AND q.questionnaire_id = '$questionnaire_id')
|
||||||
LEFT JOIN questionnaire_sample_exclude_priority AS qsep ON (qsep.questionnaire_id = qs.questionnaire_id AND qsep.sample_id = s.sample_id)
|
LEFT JOIN `case` as c on (c.sample_id = s.sample_id and c.questionnaire_id = qs.questionnaire_id)
|
||||||
WHERE c.case_id is NULL
|
LEFT JOIN call_restrict as cr on (cr.day_of_week = DAYOFWEEK(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) and TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) >= cr.start and TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) <= cr.end)
|
||||||
AND ((qsep.questionnaire_id IS NULL) or qsep.exclude = 0)
|
LEFT JOIN shift as sh on (sh.questionnaire_id = q.questionnaire_id and (CONVERT_TZ(NOW(),'System','UTC') >= sh.start) AND (CONVERT_TZ(NOW(),'System','UTC') <= sh.end))
|
||||||
AND !(q.restrict_work_shifts = 1 AND sh.shift_id IS NULL)
|
LEFT JOIN questionnaire_sample_exclude_priority AS qsep ON (qsep.questionnaire_id = qs.questionnaire_id AND qsep.sample_id = s.sample_id)
|
||||||
AND !(si.call_restrict = 1 AND cr.day_of_week IS NULL)
|
WHERE c.case_id is NULL
|
||||||
AND (SELECT count(*) FROM `questionnaire_sample_quota` WHERE questionnaire_id = qs.questionnaire_id AND sample_import_id = s.import_id AND quota_reached = 1) = 0
|
AND ((qsep.questionnaire_id IS NULL) or qsep.exclude = 0)
|
||||||
GROUP BY s.sample_id,qs.questionnaire_id
|
AND !(q.restrict_work_shifts = 1 AND sh.shift_id IS NULL)
|
||||||
ORDER BY qsep.priority DESC, rand() * qs.random_select, s.sample_id";
|
AND !(si.call_restrict = 1 AND cr.day_of_week IS NULL)
|
||||||
|
AND (SELECT count(*) FROM `questionnaire_sample_quota` WHERE questionnaire_id = qs.questionnaire_id AND sample_import_id = s.import_id AND quota_reached = 1) = 0
|
||||||
$rs = $db->GetAll($sql);
|
GROUP BY s.sample_id,qs.questionnaire_id
|
||||||
|
ORDER BY qsep.priority DESC, rand() * qs.random_select, s.sample_id";
|
||||||
$i = 1;
|
|
||||||
foreach ($rs as $r)
|
$rs = $db->GetAll($sql);
|
||||||
{
|
|
||||||
$sql = "INSERT INTO questionnaire_sample_exclude_priority (questionnaire_id,sample_id,exclude,priority,sortorder)
|
$i = 1;
|
||||||
VALUES ('{$r['questionnaire_id']}', '{$r['sample_id']}', 0, 50,'$i')
|
foreach ($rs as $r)
|
||||||
ON DUPLICATE KEY UPDATE sortorder = '$i'";
|
{
|
||||||
|
$sql = "INSERT INTO questionnaire_sample_exclude_priority (questionnaire_id,sample_id,exclude,priority,sortorder)
|
||||||
$db->Execute($sql);
|
VALUES ('{$r['questionnaire_id']}', '{$r['sample_id']}', 0, 50,'$i')
|
||||||
$i++;
|
ON DUPLICATE KEY UPDATE sortorder = '$i'";
|
||||||
}
|
|
||||||
|
$db->Execute($sql);
|
||||||
|
$i++;
|
||||||
$result = $db->CompleteTrans();
|
}
|
||||||
|
|
||||||
$time_end = microtime(true);
|
|
||||||
$timer = $time_end - $time_start;
|
$result = $db->CompleteTrans();
|
||||||
|
|
||||||
if ($result)
|
$time_end = microtime(true);
|
||||||
print T_("Completed sort") . ". " . T_("This task took") . ": $timer " . T_("seconds");
|
$timer = $time_end - $time_start;
|
||||||
else
|
|
||||||
print T_("Failed to complete sort") . ". " . T_("This task took") . ": $timer " . T_("seconds");
|
if ($result)
|
||||||
}
|
print T_("Completed sort") . ". " . T_("This task took") . ": $timer " . T_("seconds");
|
||||||
|
else
|
||||||
for ($i = 0; $i < (SYSTEM_SORT_MINUTES * 60); $i += $sleepinterval)
|
print T_("Failed to complete sort") . ". " . T_("This task took") . ": $timer " . T_("seconds");
|
||||||
{
|
}
|
||||||
if (is_process_killed($process_id)){break;}
|
|
||||||
sleep($sleepinterval);
|
for ($i = 0; $i < (SYSTEM_SORT_MINUTES * 60); $i += $sleepinterval)
|
||||||
}
|
{
|
||||||
|
if (is_process_killed($process_id)){break;}
|
||||||
process_clear_log();
|
sleep($sleepinterval);
|
||||||
}
|
}
|
||||||
|
|
||||||
disable_systemsort();
|
process_clear_log();
|
||||||
|
}
|
||||||
ob_get_contents();
|
|
||||||
ob_end_clean();
|
disable_systemsort();
|
||||||
|
|
||||||
?>
|
ob_get_contents();
|
||||||
|
ob_end_clean();
|
||||||
|
|
||||||
|
?>
|
||||||
|
|||||||
@@ -1,107 +1,107 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Run the VoIP monitoring process and monitor it via the database
|
* Run the VoIP monitoring process and monitor it via the database
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* This file is part of queXS
|
* This file is part of queXS
|
||||||
*
|
*
|
||||||
* queXS is free software; you can redistribute it and/or modify
|
* queXS is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* queXS is distributed in the hope that it will be useful,
|
* queXS is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with queXS; if not, write to the Free Software
|
* along with queXS; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @author Adam Zammit <adam.zammit@deakin.edu.au>
|
* @author Adam Zammit <adam.zammit@deakin.edu.au>
|
||||||
* @copyright Deakin University 2007,2008
|
* @copyright Deakin University 2007,2008
|
||||||
* @package queXS
|
* @package queXS
|
||||||
* @subpackage admin
|
* @subpackage admin
|
||||||
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility
|
* @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
|
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configuration file
|
* Configuration file
|
||||||
*/
|
*/
|
||||||
include ("../config.inc.php");
|
include ("../config.inc.php");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Database file
|
* Database file
|
||||||
*/
|
*/
|
||||||
include ("../db.inc.php");
|
include ("../db.inc.php");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Process
|
* Process
|
||||||
*/
|
*/
|
||||||
include ("../functions/functions.process.php");
|
include ("../functions/functions.process.php");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* XHTML functions
|
* XHTML functions
|
||||||
*/
|
*/
|
||||||
include("../functions/functions.xhtml.php");
|
include("../functions/functions.xhtml.php");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (isset($_GET['watch']))
|
if (isset($_GET['watch']))
|
||||||
{
|
{
|
||||||
//start watching process
|
//start watching process
|
||||||
start_process(realpath(dirname(__FILE__) . "/process.php"));
|
start_process(realpath(dirname(__FILE__) . "/process.php"));
|
||||||
}
|
}
|
||||||
|
|
||||||
$p = is_process_running();
|
$p = is_process_running();
|
||||||
|
|
||||||
|
|
||||||
if ($p)
|
if ($p)
|
||||||
{
|
{
|
||||||
if (isset($_GET['kill']))
|
if (isset($_GET['kill']))
|
||||||
{
|
{
|
||||||
if ($_GET['kill'] == "force")
|
if ($_GET['kill'] == "force")
|
||||||
end_process($p);
|
end_process($p);
|
||||||
else
|
else
|
||||||
kill_process($p);
|
kill_process($p);
|
||||||
}
|
}
|
||||||
|
|
||||||
xhtml_head(T_("Monitor VoIP Process"),true,array("../css/table.css"),false,false,false,true);
|
xhtml_head(T_("Monitor VoIP Process"),true,array("../include/bootstrap-3.3.2/css/bootstrap.min.css","../css/custom.css"),false,false,false,true);
|
||||||
|
|
||||||
print "<h1>" . T_("Running process:") . " $p</h1>";
|
print "<h2>" . T_("Running process:") . " $p</h2>";
|
||||||
|
|
||||||
if (is_process_killed($p))
|
if (is_process_killed($p))
|
||||||
{
|
{
|
||||||
print "<h3>" . T_("Kill signal sent: Please wait... (Note: Process will be stalled until there is activity on the VoIP Server)") . "</h3>";
|
print "<h3>" . T_("Kill signal sent: Please wait... </br>(Note: Process will be stalled until there is activity on the VoIP Server)") . "</h3>";
|
||||||
print "<p><a href='?kill=force'>" . T_("Process is already closed (eg. server was rebooted) - click here to confirm") . "</a></p>";
|
print "<p>" . T_("Process is already closed (eg. server was rebooted)") . "<a href='?kill=force'>" . T_("click here to confirm") . "</a></p>";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print "<p><a href='?kill=kill'>" . T_("Kill the running process") . "</a> ". T_("(requires activity on the VoIP Server to take effect)") . "</p>";
|
print "<p><a class='btn btn-default' href='?kill=kill'>" . T_("Kill the running process") . "</a> ". T_("(requires activity on the VoIP Server to take effect)") . "</p>";
|
||||||
}
|
}
|
||||||
|
|
||||||
$d = process_get_data($p);
|
$d = process_get_data($p);
|
||||||
if ($d !== false)
|
if ($d !== false)
|
||||||
{
|
{
|
||||||
xhtml_table($d,array('process_log_id','datetime','data'),array(T_("Log id"), T_("Date"), T_("Log entry")));
|
xhtml_table($d,array('process_log_id','datetime','data'),array(T_("Log id"), T_("Date"), T_("Log entry")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
xhtml_head(T_("Monitor VoIP Process"),true,array("../css/table.css"));
|
xhtml_head(T_("Monitor VoIP Process"),true,array("../include/bootstrap-3.3.2/css/bootstrap.min.css","../css/custom.css"));
|
||||||
print "<h2>" . T_("Monitor VoIP Process") . "</h2>";
|
//print "<h2>" . T_("Monitor VoIP Process") . "</h2>";
|
||||||
print "<p><a href='?watch=watch'>" . T_("Click here to begin monitoring the VoIP Process") . "</a></p>";
|
print "<p><a class='btn btn-warning' href='?watch=watch'>" . T_("Click here to begin monitoring the VoIP Process") . "</a></p>";
|
||||||
print "<h2>" . T_("Outcome of last process run (if any)") . "</h2>";
|
print "<h3>" . T_("Outcome of last process run (if any)") . "</h3>";
|
||||||
$d = process_get_last_data();
|
$d = process_get_last_data();
|
||||||
if ($d !== false)
|
if ($d !== false)
|
||||||
{
|
{
|
||||||
xhtml_table($d,array('process_log_id','datetime','data'),array(T_("Log id"), T_("Date"), T_("Log entry")));
|
xhtml_table($d,array('process_log_id','datetime','data'),array(T_("Log id"), T_("Date"), T_("Log entry")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
xhtml_foot();
|
xhtml_foot();
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
Reference in New Issue
Block a user