2
0
mirror of https://github.com/ACSPRI/queXS synced 2024-04-02 12:12:16 +00:00

Added ALTERNATE_INTERFACE config directive (defaults to false)

Alternate interface appears for non VoIP users when ALTERNATE_INTERFACE set to true
This interface is a bit faster to operate (less popup windows) and makes more sense when not using the system to auto-dial
Sponsored by Zimi
This commit is contained in:
azammitdcarf
2011-10-05 04:29:41 +00:00
parent 4abd0c59ac
commit 16d775ec4b
25 changed files with 2022 additions and 13 deletions

View File

@@ -147,6 +147,12 @@ if ($questionnaire_id != false)
print "<h3>" . T_("Copied quotas") . "</h3>"; print "<h3>" . T_("Copied quotas") . "</h3>";
} }
if (isset($_POST['copy_sample_import_id_with_adjustment']))
{
copy_row_quota_with_adjusting($questionnaire_id,$sample_import_id,bigintval($_POST['copy_sample_import_id_with_adjustment']));
print "<h3>" . T_("Copied quotas") . "</h3>";
}
print "<h1>" . T_("Current row quotas (click to delete)") . "</h1>"; print "<h1>" . T_("Current row quotas (click to delete)") . "</h1>";
$sql = "SELECT questionnaire_sample_quota_row_id,lime_sgqa,value,completions,quota_reached,lime_sid,comparison,exclude_var,exclude_val,current_completions $sql = "SELECT questionnaire_sample_quota_row_id,lime_sgqa,value,completions,quota_reached,lime_sid,comparison,exclude_var,exclude_val,current_completions
@@ -196,6 +202,10 @@ if ($questionnaire_id != false)
print "<form action='?questionnaire_id=$questionnaire_id&amp;sample_import_id=$sample_import_id' method='post'><p>" . T_("Copy quotas for this sample to (No error/duplicate checking): "); print "<form action='?questionnaire_id=$questionnaire_id&amp;sample_import_id=$sample_import_id' method='post'><p>" . T_("Copy quotas for this sample to (No error/duplicate checking): ");
display_chooser($ss,"copy_sample_import_id","copy_sample_import_id",false,false,false,false); display_chooser($ss,"copy_sample_import_id","copy_sample_import_id",false,false,false,false);
print "<input type='submit' id='submit' value='" . T_("Copy") . "'/></p></form>"; print "<input type='submit' id='submit' value='" . T_("Copy") . "'/></p></form>";
print "<form action='?questionnaire_id=$questionnaire_id&amp;sample_import_id=$sample_import_id' method='post'><p>" . T_("Copy quotas for this sample to (No error/duplicate checking) with adjusting: ");
display_chooser($ss,"copy_sample_import_id_with_adjustment","copy_sample_import_id_with_adjustment",false,false,false,false);
print "<input type='submit' id='submit' value='" . T_("Copy adjustments") . "'/></p></form>";
} }
} }

483
call_interface2.php Normal file
View File

@@ -0,0 +1,483 @@
<?
/**
* Popup screen to manage calling and hanging up and assigning outcomes to calls
*
*
* This file is part of queXS
*
* queXS is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* queXS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with queXS; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*
* @author Adam Zammit <adam.zammit@deakin.edu.au>
* @copyright Deakin University 2007,2008
* @package queXS
* @subpackage user
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
*
*/
/**
* Configuration file
*/
include ("config.inc.php");
/**
* Database file
*/
include ("db.inc.php");
/**
* XHTML functions
*/
include ("functions/functions.xhtml.php");
/**
* Calendar functions
*/
include("functions/functions.calendar.php");
/**
* Operator functions
*/
include("functions/functions.operator.php");
/**
* Input functions
*/
include("functions/functions.input.php");
/**
* LimeSurvey functions
*/
include("functions/functions.limesurvey.php");
/**
* Display appropriate outcomes based on current call attempt status
*
* @param int $contacted 0 for not contacted, 1 for contacted (a person on the phone)
* @param int $ca Call attempt id
* @param int $case_id The Case id
*
*/
function display_outcomes($contacted,$ca,$case_id)
{
global $db;
$completed = limesurvey_is_completed($case_id);
//see if the case is completed
if ($completed)
{
$sql = "SELECT outcome_id,description
FROM outcome
WHERE outcome_id = 10";
}
else if (limesurvey_is_quota_full($case_id))
{
$sql = "SELECT outcome_id,description
FROM outcome
WHERE outcome_id = 32";
}
else
{
//see if we have made an appointment on this call attempt
$sql = "SELECT appointment_id
FROM appointment
WHERE completed_call_id IS NULL
AND call_attempt_id = '$ca'";
$rs = $db->GetAll($sql);
if (!empty($rs))
{
//we have an appointment made ... only select appointment ID's
$sql = "SELECT outcome_id,description
FROM outcome
WHERE outcome_type_id = '5'";
}
else
{
if ($contacted === false)
{
$sql = "SELECT outcome_id,description,contacted
FROM outcome
WHERE outcome_id != 10
ORDER BY contacted ASC, outcome_id ASC"; //don't show completed if not
}
else
{
$contacted = bigintval($contacted);
$sql = "SELECT outcome_id,description
FROM outcome
WHERE contacted = '$contacted'
AND outcome_id != 10"; //don't show completed if not
}
}
}
$rs = $db->GetAll($sql);
print "<div>";
if (!empty($rs))
{
$do = false;
if (isset($_GET['defaultoutcome'])) $do = bigintval($_GET['defaultoutcome']);
foreach($rs as $r)
{
if ($do == $r['outcome_id']) $selected = "checked='checked'"; else $selected = "";
if (isset($r['contacted']) && $r['contacted'] == 1) $highlight = "style='color:blue;'"; else $highlight = "";
print "<div><label $highlight class='label'><input type='radio' class='radio' name='outcome' id='outcome-{$r['outcome_id']}' value='{$r['outcome_id']}' $selected style='float:left'/>" . T_($r['description']) . "</label></div>";
}
}
print "</div>";
}
//display the respondents phone numbers as a drop down list for this call
global $db;
$db->StartTrans();
$operator_id = get_operator_id();
if (isset($_POST['submit']))
{
if (isset($_POST['contact_phone']))
{
$contact_phone_id = bigintval($_POST['contact_phone']);
$call_attempt_id = get_call_attempt($operator_id,false);
$respondent_id = get_respondent_id($call_attempt_id);
$call_id = get_call($operator_id,$respondent_id,$contact_phone_id,true);
if ($call_id)
{
if (is_voip_enabled($operator_id))
{
include("functions/functions.voip.php");
$v = new voip();
$v->connect(VOIP_SERVER);
$v->dial(get_extension($operator_id),get_call_number($call_id));
}
$btext = "onload='parent.closePopup();'";
$js = "js/window_interface2.js";
if (browser_ie()) $js = "js/window_ie6_interface2.js";
xhtml_head(T_("Call"),true,array("css/call.css"),array($js),$btext);
}
}
else if (isset($_POST['outcome']))
{
$outcome_id = bigintval($_POST['outcome']);
end_call($operator_id,$outcome_id);
if (is_voip_enabled($operator_id))
{
include("functions/functions.voip.php");
$v = new voip();
$v->connect(VOIP_SERVER);
$v->hangup(get_extension($operator_id));
}
//disable recording
$newtext = T_("Start REC");
$js = "js/window_interface2.js";
if (browser_ie()) $js = "js/window_ie6_interface2.js";
//If outcome is final, close the case
$sql = "SELECT o.tryanother
FROM `outcome` as o
WHERE o.outcome_id = '$outcome_id'";
$rs = $db->GetRow($sql);
if (!empty($rs) && $rs['tryanother'] == 0)
{
xhtml_head(T_("Call"),true,array("css/call.css"),array($js),"onload='openParent(\"endcase=endcase\");'");
}
else
{
$call_attempt_id = get_call_attempt($operator_id,false);
$case_id = get_case_id($operator_id);
//see if we have exhausted the available numbers
$sql = "SELECT c. *
FROM contact_phone AS c
LEFT JOIN (
SELECT contact_phone.contact_phone_id
FROM contact_phone
LEFT JOIN `call` ON ( call.contact_phone_id = contact_phone.contact_phone_id )
LEFT JOIN outcome ON ( call.outcome_id = outcome.outcome_id )
WHERE contact_phone.case_id = '$case_id'
AND outcome.tryagain =0
) AS l ON l.contact_phone_id = c.contact_phone_id
LEFT JOIN
(
SELECT contact_phone_id
FROM `call`
WHERE call_attempt_id = '$call_attempt_id'
AND outcome_id != 18
) as ca on ca.contact_phone_id = c.contact_phone_id
WHERE c.case_id = '$case_id'
AND l.contact_phone_id IS NULL
AND ca.contact_phone_id IS NULL"; //only select numbers that should be tried again and have not been tried in this attempt which are not the accidental hang up outcome
$rs = $db->GetAll($sql);
if (empty($rs)) //no more numbers to call, end the case
{
xhtml_head(T_("Call"),true,array("css/call.css"),array($js),"onload='openParent(\"endcase=endcase\");'");
}
else
{
xhtml_head(T_("Call"),true,array("css/call.css"),array($js),"onload='parent.closePopup();'");
}
}
}
else
{
//if no outcome selected, just hang up the call
if (is_voip_enabled($operator_id))
{
include("functions/functions.voip.php");
$v = new voip();
$v->connect(VOIP_SERVER);
$v->hangup(get_extension($operator_id));
}
//disable recording
$newtext = T_("Start REC");
$js = "js/window_interface2.js";
if (browser_ie()) $js = "js/window_ie6_interface2.js";
xhtml_head(T_("Call"),true,array("css/call.css"),array($js),"parent.closePopup();'");
}
print "<p></p>"; //for XHTML
xhtml_foot();
$db->CompleteTrans();
exit();
}
$call_attempt_id = get_call_attempt($operator_id,false);
$case_id = get_case_id($operator_id);
/**
* Set the state manually if necessary (i.e if VOIP state is playing up)
*/
if (isset($_GET['newstate']))
{
$ns = bigintval($_GET['newstate']);
$sql = "UPDATE `call`
SET state = '$ns'
WHERE case_id = '$case_id'
AND operator_id = '$operator_id'
AND call_attempt_id = '$call_attempt_id'
AND outcome_id = '0'";
$db->Execute($sql);
}
$js = "js/window_interface2.js";
if (browser_ie()) $js = "js/window_ie6_interface2.js";
xhtml_head(T_("Call"),true,array("css/call.css"),array($js,"include/jquery-ui/js/jquery-1.4.2.min.js"));
$state = is_on_call($operator_id);
switch($state)
{
case false: //no call made
case 0: //not called -- shouldn't come here as we should create requesting call immediately
print "<div class='status'>" . T_("Not on a call") . "</div>";
//if we are on an appointment, we will just call the specified number for the appointment
$appointment_id = is_on_appointment($call_attempt_id);
if ($appointment_id)
{
if (isset($_GET['end']))
{
//end the case
if (!isset($_GET['end'])) print "<div>" . T_("End work") . "</div>";
print "<p><a href='javascript:openParent(\"endcase=endcase\")'>" . T_("End case") . "</a></p>";
print "<p><a href='javascript:openParent(\"endwork=endwork\")'>" . T_("End work") . "</a></p>";
}
else
{
//determine whether to begin calling based on extension status
$es = 1;
if (is_voip_enabled($operator_id))
{
if (get_extension_status($operator_id))
$es = 1;
else
$es = 0;
}
if ($es)
{
$sql = "SELECT c.*
FROM contact_phone as c, appointment as a
WHERE a.appointment_id = '$appointment_id'
AND a.contact_phone_id = c.contact_phone_id";
$r = $db->GetRow($sql);
print "<div>" . T_("Press the call button to dial the number for this appointment:") . "</div>";
print "<form action='?' method='post'><div>";
print "<p>" . T_("Number to call:") . " {$r['phone']} - {$r['description']}</p>";
print "</div><div><input type='hidden' id='contact_phone' name='contact_phone' value='{$r['contact_phone_id']}'/><input type='submit' value='Call' name='submit' id='submit'/></div></form>";
}
else
print "<div>" . T_("Your VoIP extension is not enabled. Please close this window and enable VoIP by clicking once on the red button that says 'VoIP Off'") . "</div>";
}
}
else
{
//determine whether we should make any more calls based on the last call outcome
$sql = "SELECT o.tryanother, o.require_note
FROM `call` as c, `outcome` as o
WHERE c.call_attempt_id = '$call_attempt_id'
AND c.outcome_id = o.outcome_id
ORDER BY call_id DESC
LIMIT 1";
$rs = $db->GetRow($sql);
if (!isset($_GET['end']) && (empty($rs) || $rs['tryanother'] == 1)) //dial another number only when available and not ending
{
$rn = 0;
if (!empty($rs) && $rs['require_note'] == 1) $rn = 1;
//an exclusion left join
$sql = "SELECT c. *
FROM contact_phone AS c
LEFT JOIN (
SELECT contact_phone.contact_phone_id
FROM contact_phone
LEFT JOIN `call` ON ( call.contact_phone_id = contact_phone.contact_phone_id )
LEFT JOIN outcome ON ( call.outcome_id = outcome.outcome_id )
WHERE contact_phone.case_id = '$case_id'
AND outcome.tryagain =0
) AS l ON l.contact_phone_id = c.contact_phone_id
LEFT JOIN
(
SELECT contact_phone_id
FROM `call`
WHERE call_attempt_id = '$call_attempt_id'
AND outcome_id != 18
) as ca on ca.contact_phone_id = c.contact_phone_id
WHERE c.case_id = '$case_id'
AND l.contact_phone_id IS NULL
AND ca.contact_phone_id IS NULL"; //only select numbers that should be tried again and have not been tried in this attempt which are not the accidental hang up outcome
//could be updated to take in to account the time delay and outcome
$rs = $db->GetAll($sql);
if (!empty($rs))
{
//determine whether to begin calling based on extension status
$es = 1;
if (is_voip_enabled($operator_id))
{
if (get_extension_status($operator_id))
$es = 1;
else
$es = 0;
}
if ($es)
{
print "<div>" . T_("Select phone number to dial:") . "</div>";
print "<form action='?' method='post'><div><select id='contact_phone' name='contact_phone'>";
foreach($rs as $r)
{
print "<option value='{$r['contact_phone_id']}'>{$r['phone']} - {$r['description']}</option>";
}
print "</select></div><div><input type='submit' value='Call' name='submit' id='submit'/></div></form>";
}
else
print "<div>" . T_("Your VoIP extension is not enabled. Please close this window and enable VoIP by clicking once on the red button that says 'VoIP Off'") . "</div>";
}
else //no phone numbers left
{
//end the case
print "<div>" . T_("The last call completed this call attempt") . "</div>";
if ($rn) // a note is required to be entered
{
print "<div><label for='note'>" . T_("Enter a reason for this outcome before completing this case:") . "</label><input type='text' id='note' name='note' size='48'/><br/><br/><br/><br/></div>";
//give focus on load
print '<script type="text/javascript">$(document).ready(function(){$("#note").focus();});</script>';
//put these lower on the screen so they don't get "automatically" clicked
print "<p><a href='javascript:openParentNote(\"endcase=endcase\")'>" . T_("End case") . "</a></p>";
print "<p><a href='javascript:openParentNote(\"endwork=endwork\")'>" . T_("End work") . "</a></p>";
}
else
{
print "<p><a href='javascript:openParent(\"endcase=endcase\")'>" . T_("End case") . "</a></p>";
print "<p><a href='javascript:openParent(\"endwork=endwork\")'>" . T_("End work") . "</a></p";
}
}
}
else //don't try any more
{
$rn = 0;
if (!empty($rs) && $rs['require_note'] == 1) $rn = 1;
//end the case
if ($rn) // a note is required to be entered
{
print "<div><label for='note'>" . T_("Enter a reason for this outcome before completing this case:") . "</label><input type='text' id='note' name='note' size='48'/><br/><br/><br/><br/></div>";
print '<script type="text/javascript">$(document).ready(function(){$("#note").focus();});</script>';
print "<p><a href='javascript:openParentNote(\"endcase=endcase\")'>" . T_("End case") . "</a></p>";
print "<p><a href='javascript:openParentNote(\"endwork=endwork\")'>" . T_("End work") . "</a></p>";
}
else
{
if (!isset($_GET['end'])) print "<div>" . T_("The last call completed this call attempt") . "</div>";
print "<p><a href='javascript:openParent(\"endcase=endcase\")'>" . T_("End case") . "</a></p>";
print "<p><a href='javascript:openParent(\"endwork=endwork\")'>" . T_("End work") . "</a></p>";
}
}
}
break;
case 1: //requesting call
case 2: //ringing
case 3: //answered
case 4: //requires coding
print "<div class='status'>" . T_("Requires coding") . "</div>";
print "<form action='?' method='post'>";
display_outcomes(false,$call_attempt_id,$case_id);
print "<div><input type='submit' value='" . T_("Assign outcome") . "' name='submit' id='submit'/></div></form>";
break;
case 5: //done -- shouldn't come here as should be coded + done
default:
print "<div class='status'>" . T_("Error: Close window") . "</div>";
break;
}
xhtml_foot();
$db->CompleteTrans();
?>

View File

@@ -232,6 +232,11 @@ if (!defined('HEADER_EXPANDER')) define('HEADER_EXPANDER', false);
*/ */
if (!defined('HEADER_EXPANDER_MANUAL')) define('HEADER_EXPANDER_MANUAL', false); if (!defined('HEADER_EXPANDER_MANUAL')) define('HEADER_EXPANDER_MANUAL', false);
/**
* Contract header at start of questionnaire
*/
if (!defined('HEADER_EXPANDER_QUESTIONNAIRE')) define('HEADER_EXPANDER_QUESTIONNAIRE', false);
/** /**
* Define how many minutes between each system sort (defaults to 5 as this is a common interval for appointments) * Define how many minutes between each system sort (defaults to 5 as this is a common interval for appointments)
*/ */
@@ -247,6 +252,11 @@ if (!defined('ALLOW_PAGE_REFRESH')) define ('ALLOW_PAGE_REFRESH',true);
*/ */
if (!defined('ALLOW_RESPONDENT_SELECTOR')) define ('ALLOW_RESPONDENT_SELECTOR',true); if (!defined('ALLOW_RESPONDENT_SELECTOR')) define ('ALLOW_RESPONDENT_SELECTOR',true);
/**
* Display a faster alternate interface where VoIP is disabled
*/
if (!defined('ALTERNATE_INTERFACE')) define ('ALTERNATE_INTERFACE',false);
/** /**
* Number of log records to display * Number of log records to display
*/ */

View File

@@ -87,7 +87,7 @@ if (isset($_GET['respondent_id']) && $_GET['respondent_id'] == 0)
?> ?>
<form method="post" action="?"> <form method="post" action="?">
<? display_respondent_form(false,$case_id); ?> <? display_respondent_form(false,$case_id); ?>
<div><input type='submit' name='submit' id='submit' value='<? echo T_("Add respondent"); ?>'/></div> <div class="text"><input type='submit' name='submit' id='submit' value='<? echo T_("Add respondent"); ?>'/></div>
</form> </form>
<div><a href="?"><? echo T_("Go back"); ?></a></div> <div><a href="?"><? echo T_("Go back"); ?></a></div>
@@ -95,8 +95,8 @@ if (isset($_GET['respondent_id']) && $_GET['respondent_id'] == 0)
} }
else else
{ {
print "<div>" . T_("Case id:") . " $case_id</div>"; print "<div class='text'>" . T_("Case id:") . " $case_id</div>";
print "<div>" . T_("Respondent:"); print "<div class='text'>" . T_("Respondent:");
if (isset($_GET['respondent_id']) && $_GET['respondent_id'] != 0) if (isset($_GET['respondent_id']) && $_GET['respondent_id'] != 0)
{ {
@@ -142,7 +142,7 @@ else
print " " . $rs[0]['firstName'] . " " . $rs[0]['lastName'] . "</div>"; print " " . $rs[0]['firstName'] . " " . $rs[0]['lastName'] . "</div>";
} }
print "<div>$timezone</div>"; print "<div class='text'>$timezone</div>";
@@ -155,7 +155,7 @@ else
$rs = $db->GetAll($sql); $rs = $db->GetAll($sql);
print "<div id='details'>"; print "<div id='details' class='text'>";
if (!empty($rs)) if (!empty($rs))
{ {
xhtml_table($rs,array("var","val"),array(T_("Var"),T_("Value"))); xhtml_table($rs,array("var","val"),array(T_("Var"),T_("Value")));

81
css/index_interface2.css Normal file
View File

@@ -0,0 +1,81 @@
.headerexpand {
position: absolute;
height: 20px;
bottom: 0px;
right: 0px;
}
#headerexpandimage {
height: 20px;
}.box {
margin: 18px;
}
.online {
background: #00FF00;
}
.offline {
background: #FF0000;
}
a {
padding: 3px 0.5em;
margin-left: 3px;
border: 1px solid #778;
background: #DDE;
text-decoration: none;
color: black;
}
a:active {
border: 4px inset;
}
#header {
position : absolute;
width : 20%;
height : 30%;
top : 0;
right : 0;
bottom : auto;
left : 0;
/*border-bottom: 1px solid #aaa;*/
}
#calllist {
position : absolute;
width : 50%;
height : 30%;
left : 50%;
top : 0;
right : 0;
bottom : auto;
}
#qstatus {
position : absolute;
width : 30%;
height : 30%;
top : 0;
right : 0;
left: 20%;
bottom : auto;
/*border: 1px solid #aaa;*/
}
#casefunctions {
position : absolute;
width : 20%;
height : 30%;
top : 0;
right : 0;
left: 0;
bottom : auto;
}
#content {
position : absolute;
top : 30%;
left : 0;
bottom : auto;
width : 100%;
height : 70%;
}
.embeddedobject {
width:100%;
height:100%;
position:absolute;
}

View File

@@ -0,0 +1,13 @@
.labelclass{
width:20%;
}
.textclass {
width:70%;
height:80%;
}
.submitclass{
width:20%;
}
.addresp{
font-style:italic;
}

View File

@@ -1056,10 +1056,11 @@ function get_call($operator_id,$respondent_id = "",$contact_phone_id = "",$creat
* *
* @param int $operator_id The operator id * @param int $operator_id The operator id
* @param bool $escape Whether to escape the ampersands default true * @param bool $escape Whether to escape the ampersands default true
* @param bool $interface2 Whether we are using the alternate interface
* @return string The URL of the LimeSurvey questionnaire, or the URL of an error screen if none available * @return string The URL of the LimeSurvey questionnaire, or the URL of an error screen if none available
* *
*/ */
function get_respondentselection_url($operator_id,$escape = true) function get_respondentselection_url($operator_id,$escape = true,$interface2 = false)
{ {
global $db; global $db;
@@ -1078,7 +1079,12 @@ function get_respondentselection_url($operator_id,$escape = true)
if ($sid != false && !empty($sid) && $sid != 'NULL') if ($sid != false && !empty($sid) && $sid != 'NULL')
$url = LIME_URL . "index.php?loadall=reload" . $amp . "sid=$sid" . $amp . "token=$call_id" . $amp . "lang=" . DEFAULT_LOCALE; $url = LIME_URL . "index.php?loadall=reload" . $amp . "sid=$sid" . $amp . "token=$call_id" . $amp . "lang=" . DEFAULT_LOCALE;
else else
$url = 'rs_intro.php'; {
if ($interface2)
$url = 'rs_intro_interface2.php';
else
$url = 'rs_intro.php';
}
} }
//if ($db->HasFailedTrans()) { print "FAILED in get_limesurvey_url"; exit; } //if ($db->HasFailedTrans()) { print "FAILED in get_limesurvey_url"; exit; }
@@ -1377,6 +1383,94 @@ function copy_row_quota($questionnaire_id,$sample_import_id,$copy_sample_import_
$db->CompleteTrans(); $db->CompleteTrans();
} }
/**
* Copy row quotas from one sample to another with blocking
* Set quota_reached to 0 by default
*
* @param int $questionnaire_id
* @param int $sample_import_id
* @param int $copy_sample_import_id The sample_import_id to copy to
*/
function copy_row_quota_with_blocking($questionnaire_id,$sample_import_id,$copy_sample_import_id)
{
global $db;
$db->StartTrans();
//Set quota_reached to 0 always
$sql = "INSERT INTO questionnaire_sample_quota_row (questionnaire_id,sample_import_id,lime_sgqa,value,comparison,completions,exclude_var,exclude_val,quota_reached,description)
SELECT questionnaire_id, $copy_sample_import_id, lime_sgqa,value,comparison,completions,exclude_var,exclude_val,quota_reached,description
FROM questionnaire_sample_quota_row
WHERE questionnaire_id = '$questionnaire_id'
AND sample_import_id = '$sample_import_id'";
$db->Execute($sql);
update_quotas($questionnaire_id);
$db->CompleteTrans();
}
/**
* Copy row quotas from one sample to another and adjust completion number appropriately to completed in the sample.
*
* @param int $questionnaire_id
* @param int $sample_import_id
* @param int $copy_sample_import_id The sample_import_id to copy to
*/
function copy_row_quota_with_adjusting($questionnaire_id,$sample_import_id,$copy_sample_import_id)
{
global $db;
// Copy quotas (defalt Quexs function)
copy_row_quota_with_blocking($questionnaire_id,$sample_import_id,$copy_sample_import_id);
$db->StartTrans();
// Select quotas from the old sample rows and calculate
$sql = "SELECT questionnaire_sample_quota_row_id,q.questionnaire_id,sample_import_id,lime_sgqa,value,comparison,completions,quota_reached,q.lime_sid,qsq.exclude_var,qsq.exclude_val
FROM questionnaire_sample_quota_row as qsq, questionnaire as q
WHERE qsq.questionnaire_id = '$questionnaire_id'
AND q.questionnaire_id = '$questionnaire_id'
#AND qsq.quota_reached != '1'
AND qsq.lime_sgqa != -1
AND sample_import_id='".$sample_import_id."'
";
$rs = $db->GetAll($sql);
if (isset($rs) && !empty($rs))
{
//include limesurvey functions
include_once(dirname(__FILE__).'/functions.limesurvey.php');
//update all row quotas for this questionnaire
foreach($rs as $r)
{
$completions = limesurvey_quota_completions($r['lime_sgqa'],$r['lime_sid'],$r['questionnaire_id'],$r['sample_import_id'],$r['value'],$r['comparison']);
if ($completions > 0)
{
//Update adjusting the completion number
$sql = "UPDATE questionnaire_sample_quota_row
SET completions = IF(completions>".$completions.",(completions-".$completions."),0), quota_reached = IF(quota_reached = 0,IF(completions=0,1,0),1)
WHERE questionnaire_id = '".$questionnaire_id."'
AND sample_import_id='".$copy_sample_import_id."'
AND lime_sgqa='".$r['lime_sgqa']."'
AND value='".$r['value']."'
AND comparison='".$r['comparison']."'";
$db->Execute($sql);
}
}
}
$db->CompleteTrans();
}
/** /**
* Update the row quota table * Update the row quota table
* *

View File

@@ -2335,9 +2335,9 @@ function buildsurveysession()
</form>"; </form>";
echo templatereplace(file_get_contents("$thistpl/endpage.pstpl")); echo templatereplace(file_get_contents("$thistpl/endpage.pstpl"));
doFooter(); doFooter();
exit; exit;
} }
} }
//BEFORE BUILDING A NEW SESSION FOR THIS SURVEY, LET'S CHECK TO MAKE SURE THE SURVEY SHOULD PROCEED! //BEFORE BUILDING A NEW SESSION FOR THIS SURVEY, LET'S CHECK TO MAKE SURE THE SURVEY SHOULD PROCEED!
@@ -2452,6 +2452,15 @@ function buildsurveysession()
doFooter(); doFooter();
exit; exit;
} }
//This should only happen once, so a good place to add the "start of the limesurrvey instrument code"
//queXS Addition
include_once("quexs.php");
if(HEADER_EXPANDER_QUESTIONNAIRE && HEADER_EXPANDER_MANUAL)
{
global $js_header_includes;
$js_header_includes[] = '/../../js/headerexpandquestionnaire.js'; //queXS addition
}
} }
// TOKENS REQUIRED, A TOKEN PROVIDED // TOKENS REQUIRED, A TOKEN PROVIDED
// SURVEY CAPTCHA REQUIRED // SURVEY CAPTCHA REQUIRED

View File

@@ -45,10 +45,16 @@ include ("functions/functions.xhtml.php");
*/ */
include("functions/functions.operator.php"); include("functions/functions.operator.php");
$db->StartTrans();
$operator_id = get_operator_id(); $operator_id = get_operator_id();
if (ALTERNATE_INTERFACE && !is_voip_enabled($operator_id))
{
include_once("waitnextcase_interface2.php");
die();
}
$db->StartTrans();
if (isset($_GET['endwork'])) if (isset($_GET['endwork']))
{ {

330
index_interface2.php Normal file
View File

@@ -0,0 +1,330 @@
<?
/**
* Display the main page including all panels and tabs
*
*
* This file is part of queXS
*
* queXS is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* queXS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with queXS; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*
* @author Adam Zammit <adam.zammit@deakin.edu.au>
* @copyright Deakin University 2007,2008
* @package queXS
* @subpackage user
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
*
*
*/
/**
* Configuration file
*/
include ("config.inc.php");
/**
* XHTML functions
*/
include ("functions/functions.xhtml.php");
/**
* Operator functions
*/
include("functions/functions.operator.php");
$db->StartTrans();
$popupcall = false;
$operator_id = get_operator_id();
if (isset($_GET['endwork']))
{
$call_id = get_call($operator_id);
if ($call_id)
{
//Don't end the case if we are on a call
$popupcall = true;
}
else
{
if (isset($_GET['note']))
{
$case_id = get_case_id($operator_id,false);
$note = $db->qstr($_GET['note']);
$sql = "INSERT INTO `case_note` (case_note_id,case_id,operator_id,note,datetime)
VALUES (NULL,'$case_id','$operator_id',$note,CONVERT_TZ(NOW(),'System','UTC'))";
$db->Execute($sql);
}
end_call_attempt($operator_id);
end_case($operator_id);
//if ($db->HasFailedTrans()){ print "<p>FAILED AT ENDWORK</p>"; exit();}
$db->CompleteTrans();
include("waitnextcase_interface2.php");
exit();
}
}
if (isset($_GET['endcase']))
{
if (isset($_GET['note']))
{
$case_id = get_case_id($operator_id,false);
$note = $db->qstr($_GET['note']);
$sql = "INSERT INTO `case_note` (case_note_id,case_id,operator_id,note,datetime)
VALUES (NULL,'$case_id','$operator_id',$note,CONVERT_TZ(NOW(),'System','UTC'))";
$db->Execute($sql);
}
$endthecase = true;
if (isset($_GET['outcome']))
{
$outcome_id = intval($_GET['outcome']);
end_call($operator_id,$outcome_id);
$sql = "SELECT tryanother
FROM outcome
WHERE outcome_id = '$outcome_id'";
$rs = $db->GetRow($sql);
if (!empty($rs) && $rs['tryanother'] == 1)
$endthecase = false;
}
if ($endthecase)
{
end_call_attempt($operator_id);
end_case($operator_id);
$db->CompleteTrans(); //need to complete here otherwise getting the case later will fail
include("waitnextcase_interface2.php");
exit();
}
}
$js = array("js/popup.js","js/tabber.js","include/jquery-ui/js/jquery-1.4.2.min.js","include/jquery-ui/js/jquery-ui-1.8.2.custom.min.js");
$body = true;
$script = "";
if (AUTO_LOGOUT_MINUTES !== false)
{
$js[] = "include/nap-1.0.0/js/jquery.nap-1.0.0.js";
$script = "<script type='text/javascript'>
$(document).nap(
function() {
location.replace('" . QUEXS_URL . "?endwork=endwork&auto=auto');
},
function() {
//do nothing if woken up as shouldn't get here
},
" . (AUTO_LOGOUT_MINUTES * 60) . "
);</script></head><body>";
$body = false;
}
if ($popupcall)
$js[] = "js/popupcallonload.js";
if (HEADER_EXPANDER)
{
$js[] = "js/headerexpand.js";
$js[] = "js/headerexpandmanual.js";
}
else if (HEADER_EXPANDER_MANUAL)
{
$js[] = "js/headerexpand.js";
$js[] = "js/headerexpandmanual.js";
}
xhtml_head(T_("queXS"), $body, array("css/index_interface2.css","css/tabber.css","include/jquery-ui/css/smoothness/jquery-ui-1.8.2.custom.css") , $js);
print $script;
?>
<div id="casefunctions" class="header">
<div class='box important'><a href="javascript:poptastic('call_interface2.php');"><? echo T_("Assign outcome"); ?></a></div>
<div class='box'><a href="javascript:poptastic('appointment.php');"><? echo T_("Appointment"); ?></a></div>
<div class='box'><a href="?endwork=endwork"><? echo T_("End work"); ?></a></div>
<? if (HEADER_EXPANDER_MANUAL){ ?> <div class='headerexpand'><img id='headerexpandimage' src='./images/arrow-up-2.png' alt='<? echo T_('Arrow for expanding or contracting'); ?>'/></div> <? } ?>
</div>
<div id="content" class="content">
<?
$case_id = get_case_id($operator_id,true);
$ca = get_call_attempt($operator_id,true);
$call_id = get_call($operator_id);
$appointment = false;
if ($ca)
{
$appointment = is_on_appointment($ca);
$respondent_id = get_respondent_id($ca);
}
if (!$call_id)
{
if ($appointment)
{
//create a call on the appointment number
$sql = "SELECT cp.*
FROM contact_phone as cp, appointment as a
WHERE cp.case_id = '$case_id'
AND a.appointment_id = '$appointment'
AND a.contact_phone_id = cp.contact_phone_id";
}
else
{
//create a call on the first available number by priority
$sql = "SELECT *
FROM contact_phone
WHERE case_id = '$case_id'
ORDER BY priority ASC
LIMIT 1";
}
$rs = $db->GetRow($sql);
if (!empty($rs))
{
$contact_phone_id = $rs['contact_phone_id'];
$call_id = get_call($operator_id,$respondent_id,$contact_phone_id,true);
}
}
if (!is_respondent_selection($operator_id))
$data = get_limesurvey_url($operator_id);
else
$data = get_respondentselection_url($operator_id,true,true); //use second interface
xhtml_object($data,"main-content");
?>
</div>
<div id="qstatus" class="header">
<?xhtml_object("status_interface2.php","main-qstatus");?>
</div>
<div id="calllist" class="header">
<div class="tabber" id="tab-main">
<? if (TAB_CASENOTES) { ?>
<div class="tabbertab <? if ((DEFAULT_TAB == 'casenotes' && !$appointment) || (DEFAULT_TAB_APPOINTMENT == 'casenotes' && $appointment))
print "tabbertabdefault"; ?>">
<h2><? echo T_("Notes"); ?></h2>
<div id="div-casenotes" class="tabberdiv"><?xhtml_object("casenote.php","main-casenotes");?></div>
</div>
<? }?>
<? if (TAB_CONTACTDETAILS) { ?>
<div class="tabbertab <? if ((DEFAULT_TAB == 'contactdetails' && !$appointment) || (DEFAULT_TAB_APPOINTMENT == 'contactdetails' && $appointment))
print "tabbertabdefault"; ?>">
<h2><? echo T_("Contact details"); ?></h2>
<div id="div-contactdetails" class="tabberdiv"><?xhtml_object("contactdetails.php","main-contactdetails");?></div>
</div>
<? }?>
<? if (TAB_CALLLIST) { ?>
<div class="tabbertab <? if ((DEFAULT_TAB == 'calllist' && !$appointment) || (DEFAULT_TAB_APPOINTMENT == 'calllist' && $appointment))
print "tabbertabdefault"; ?>">
<h2><? echo T_("Call history"); ?></h2>
<div id="div-calllist" class="tabberdiv"><?xhtml_object("calllist.php","main-calllist");?></div>
</div>
<? }?>
<? if (TAB_SHIFTS) { ?>
<div class="tabbertab <? if ((DEFAULT_TAB == 'shifts' && !$appointment) || (DEFAULT_TAB_APPOINTMENT == 'shifts' && $appointment))
print "tabbertabdefault"; ?>" id="tab-shifts">
<h2><? echo T_("Shifts"); ?></h2>
<div id="div-shifts" class="tabberdiv"><?xhtml_object("shifts.php","main-shifts");?></div>
</div>
<? }?>
<? if (TAB_APPOINTMENTLIST) { ?>
<div class="tabbertab <? if ((DEFAULT_TAB == 'appointmentlist' && !$appointment) || (DEFAULT_TAB_APPOINTMENT == 'appointmentlist' && $appointment))
print "tabbertabdefault"; ?>">
<h2><? echo T_("Appointments"); ?></h2>
<div id="div-appointmentlist" class="tabberdiv"><?xhtml_object("appointmentlist.php","main-appointmentlist");?></div>
</div>
<? }?>
<? if (TAB_PERFORMANCE) { ?>
<div class="tabbertab <? if ((DEFAULT_TAB == 'performance' && !$appointment) || (DEFAULT_TAB_APPOINTMENT == 'performance' && $appointment))
print "tabbertabdefault"; ?>">
<h2><? echo T_("Performance"); ?></h2>
<div id="div-performance" class="tabberdiv"><?xhtml_object("performance.php","main-performance");?></div>
</div>
<? }?>
<? if (TAB_CALLHISTORY) { ?>
<div class="tabbertab <? if ((DEFAULT_TAB == 'callhistory' && !$appointment) || (DEFAULT_TAB_APPOINTMENT == 'callhistory' && $appointment))
print "tabbertabdefault"; ?>">
<h2><? echo T_("Work history"); ?></h2>
<div id="div-callhistory" class="tabberdiv"><?xhtml_object("callhistory.php","main-callhistory");?></div>
</div>
<? }?>
<? if (TAB_PROJECTINFO) { ?>
<div class="tabbertab <? if ((DEFAULT_TAB == 'projectinfo' && !$appointment) || (DEFAULT_TAB_APPOINTMENT == 'projectinfo' && $appointment))
print "tabbertabdefault"; ?>">
<h2><? echo T_("Project information"); ?></h2>
<div id="div-projectinfo" class="tabberdiv"><?xhtml_object("project_info.php","main-projectinfo");?></div>
</div>
<? }?>
<? if (TAB_INFO) { ?>
<div class="tabbertab <? if ((DEFAULT_TAB == 'info' && !$appointment) || (DEFAULT_TAB_APPOINTMENT == 'info' && $appointment))
print "tabbertabdefault"; ?>">
<h2><? echo T_("Info"); ?></h2>
<div id="div-info" class="tabberdiv"><?xhtml_object("info.php","main-info");?></div>
</div>
<? }?>
</div>
</div>
<?
xhtml_foot();
//if ($db->HasFailedTrans()){ print "<p>FAILED AT END of index</p>"; exit();}
$db->CompleteTrans();
?>

View File

@@ -4,6 +4,12 @@ $(document).ready(function(){
}); });
function headerforcecontract()
{
$("#headerexpandimage").attr('src',"./images/arrow-down-2.png");
headercontract();
}
function headertogglemanual() function headertogglemanual()
{ {
if ($("#headerexpandimage").attr('src') == './images/arrow-up-2.png') if ($("#headerexpandimage").attr('src') == './images/arrow-up-2.png')

View File

@@ -0,0 +1,2 @@
//Contract on load
$(document).ready(parent.headerforcecontract);

4
js/popupcallonload.js Normal file
View File

@@ -0,0 +1,4 @@
//Contract on load
$(document).ready(function(){
poptastic('call_interface2.php');
});

View File

@@ -0,0 +1,37 @@
function LinkUp(element)
{
var number = document.getElementById(element).selectedIndex;
location.href = document.getElementById(element).options[number].value;
}
function openParent(get)
{
parent.location.href = 'index_interface2.php?' + get;
}
function openParentNote(get)
{
parent.location.href = 'index_interface2.php?note=' + document.getElementById('note').value + '&' + get;
}
function openParentObject(oid,get)
{
var a = parent.document.getElementById(oid);
if (a)
{
a.src = get;
}
}
function toggleRec(text,link,classes)
{
var a = parent.document.getElementById('reclink');
if (a)
{
a.innerHTML = text;
a.href = "javascript:poptastic('" + link + "');";
a.className = classes;
}
}

41
js/window_interface2.js Normal file
View File

@@ -0,0 +1,41 @@
function LinkUp(element)
{
var number = document.getElementById(element).selectedIndex;
location.href = document.getElementById(element).options[number].value;
}
function openParent(get)
{
parent.location.href = 'index_interface2.php?' + get;
}
function openParentNote(get)
{
parent.location.href = 'index_interface2.php?note=' + document.getElementById('note').value + '&' + get;
}
function openParentObject(oid,get)
{
var a = parent.document.getElementById(oid);
if (a)
{
var clone = a.cloneNode(true);
var pnode = a.parentNode;
clone.data = get;
pnode.removeChild(a);
pnode.appendChild(clone);
}
}
function toggleRec(text,link,classes)
{
var a = parent.document.getElementById('reclink');
if (a)
{
a.innerHTML = text;
a.href = "javascript:poptastic('" + link + "');";
a.className = classes;
}
}

View File

@@ -0,0 +1,96 @@
<?
/**
* Respondent selection - Answering machine
*
*
* This file is part of queXS
*
* queXS is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* queXS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with queXS; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*
* @author Adam Zammit <adam.zammit@deakin.edu.au>
* @copyright Deakin University 2007,2008
* @package queXS
* @subpackage user
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
*
*/
/**
* Configuration file
*/
include ("config.inc.php");
/**
* Database file
*/
include ("db.inc.php");
/**
* XHTML
*/
include ("functions/functions.xhtml.php");
/**
* Operator functions
*/
include ("functions/functions.operator.php");
$operator_id = get_operator_id();
$case_id = get_case_id($operator_id);
$questionnaire_id = get_questionnaire_id($operator_id);
$leavemessage = leave_message($case_id);
$js = array("js/popup.js","include/jquery-ui/js/jquery-1.4.2.min.js","include/jquery-ui/js/jquery-ui-1.8.2.custom.min.js");
if (AUTO_LOGOUT_MINUTES !== false)
{
$js[] = "js/childnap.js";
}
xhtml_head(T_("Respondent Selection - Answering machine"),true,array("css/rs.css","include/jquery-ui/css/smoothness/jquery-ui-1.8.2.custom.css"),$js);
if ($leavemessage)
{
//display answering machine text
$sql = "SELECT rs_answeringmachine
FROM questionnaire
WHERE questionnaire_id = '$questionnaire_id'";
$r = $db->GetRow($sql);
print "<p class='rstext'>" . template_replace($r['rs_answeringmachine'],$operator_id,$case_id) . "</p>";
}
else
print "<p class='rstext'>" . T_("Do not leave a message, please hang up") . "</p>";
?>
<p class='rsoption'><a href="javascript:parent.location.href = 'index_interface2.php?outcome=29&endcase=endcase'"><? echo T_("End call with outcome: Business answering machine"); ?></a></p>
<?
if ($leavemessage)
{
?>
<p class='rsoption'><a href="javascript:parent.location.href = 'index_interface2.php?outcome=23&endcase=endcase'"><? echo T_("End call with outcome: Answering machine Message left"); ?></a></p>
<?
}
?>
<p class='rsoption'><a href="javascript:parent.location.href = 'index_interface2.php?outcome=24&endcase=endcase'"><? echo T_("End call with outcome: Answering machine No message left"); ?></a></p>
<p class='rsoption'><a href="rs_intro_interface2.php"><? echo T_("Go Back"); ?></a></p>
<?
xhtml_foot();
?>

View File

@@ -0,0 +1,67 @@
<?
/**
* Respondent selection - Business answers
*
*
* This file is part of queXS
*
* queXS is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* queXS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with queXS; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*
* @author Adam Zammit <adam.zammit@deakin.edu.au>
* @copyright Deakin University 2007,2008
* @package queXS
* @subpackage user
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
*
*/
/**
* Configuration file
*/
include ("config.inc.php");
/**
* XHTML
*/
include ("functions/functions.xhtml.php");
/**
* Language
*/
include ("lang.inc.php");
$js = array("js/popup.js","include/jquery-ui/js/jquery-1.4.2.min.js","include/jquery-ui/js/jquery-ui-1.8.2.custom.min.js");
if (AUTO_LOGOUT_MINUTES !== false)
{
$js[] = "js/childnap.js";
}
xhtml_head(T_("Respondent Selection - Business answers"),true,array("css/rs.css","include/jquery-ui/css/smoothness/jquery-ui-1.8.2.custom.css"), $js);
?>
<p class='rstext'><? echo T_("Sorry to bother you, I have called the wrong number")?></p>
<p class='rsoption'><a href="javascript:parent.location.href = 'index_interface2.php?outcome=16&endcase=endcase'"><? echo T_("End call with outcome: Business number"); ?></a></p>
<p class='rsoption'><a href="rs_intro_interface2.php"><? echo T_("Go Back"); ?></a></p>
<?
xhtml_foot();
?>

View File

@@ -0,0 +1,95 @@
<?
/**
* Respondent selection - Call back (respondent already started questionnaire)
*
*
* This file is part of queXS
*
* queXS is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* queXS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with queXS; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*
* @author Adam Zammit <adam.zammit@deakin.edu.au>
* @copyright Deakin University 2007,2008
* @package queXS
* @subpackage user
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
*
*/
/**
* Configuration file
*/
include ("config.inc.php");
/**
* Database file
*/
include ("db.inc.php");
/**
* XHTML functions
*/
include ("functions/functions.xhtml.php");
/**
* Operator functions
*/
include ("functions/functions.operator.php");
/**
* Limesurvey functions
*/
include ("functions/functions.limesurvey.php");
$js = array("js/popup.js","include/jquery-ui/js/jquery-1.4.2.min.js","include/jquery-ui/js/jquery-ui-1.8.2.custom.min.js");
if (AUTO_LOGOUT_MINUTES !== false)
{
$js[] = "js/childnap.js";
}
xhtml_head(T_("Respondent Selection - Call back"),true,array("css/rs.css","include/jquery-ui/css/smoothness/jquery-ui-1.8.2.custom.css"), $js );
$operator_id = get_operator_id();
$case_id = get_case_id($operator_id);
$questionnaire_id = get_questionnaire_id($operator_id);
//display introduction text
$sql = "SELECT rs_callback
FROM questionnaire
WHERE questionnaire_id = '$questionnaire_id'";
$r = $db->GetRow($sql);
print "<p class='rstext'>" . template_replace($r['rs_callback'],$operator_id,$case_id) . "</p>";
print "<p class='rstext'>" . T_("You are: ") . round(limesurvey_percent_complete($case_id),1) . T_("% complete") . "</p>";
//display outcomes
?>
<p class='rsoption'><a href="<? print(get_limesurvey_url($operator_id)); ?>"><? echo T_("Yes - Continue where we left off"); ?></a></p>
<p class='rsoption'><a href="javascript:parent.location.href = 'index_interface2.php?outcome=8&endcase=endcase'"><? echo T_("End call with outcome: Refusal by respondent"); ?></a></p>
<p class='rsoption'><a href="rs_intro_interface2.php"><? echo T_("Go Back"); ?></a></p>
<?
xhtml_foot();
?>

131
rs_intro_interface2.php Normal file
View File

@@ -0,0 +1,131 @@
<?
/**
* Respondent selection introduction
*
*
* This file is part of queXS
*
* queXS is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* queXS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with queXS; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*
* @author Adam Zammit <adam.zammit@deakin.edu.au>
* @copyright Deakin University 2007,2008
* @package queXS
* @subpackage user
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
*
*/
/**
* Configuration file
*/
include ("config.inc.php");
/**
* Database file
*/
include ("db.inc.php");
/**
* XHTML functions
*/
include ("functions/functions.xhtml.php");
/**
* Operator functions
*/
include ("functions/functions.operator.php");
/**
* Limesurvey functions
*/
include ("functions/functions.limesurvey.php");
$js = array("js/popup.js","include/jquery-ui/js/jquery-1.4.2.min.js","include/jquery-ui/js/jquery-ui-1.8.2.custom.min.js");
if (AUTO_LOGOUT_MINUTES !== false)
{
$js[] = "js/childnap.js";
}
xhtml_head(T_("Respondent Selection - Introduction"),true,array("css/rs.css","include/jquery-ui/css/smoothness/jquery-ui-1.8.2.custom.css"), $js);
//display introduction text
$operator_id = get_operator_id();
$case_id = get_case_id($operator_id);
$questionnaire_id = get_questionnaire_id($operator_id);
//display introduction text
$sql = "SELECT rs_intro,rs_project_intro,rs_callback
FROM questionnaire
WHERE questionnaire_id = '$questionnaire_id'";
$r = $db->GetRow($sql);
print "<p class='rstext'>". template_replace($r['rs_intro'],$operator_id,$case_id) . "</p>";
//display outcomes
if (limesurvey_percent_complete($case_id) == false)
{
if(empty($r['rs_project_intro']))
{
//If nothing is specified as a project introduction, skip straight to questionnaire
?>
<p class='rsoption'><a href="<? print(get_limesurvey_url($operator_id)); ?>"><? echo T_("Yes - Continue"); ?></a></p>
<?
}
else
{
?>
<p class='rsoption'><a href="rs_project_intro.php"><? echo T_("Yes - Continue"); ?></a></p>
<?
}
} else {
if(empty($r['rs_callback']))
{
//If nothing is specified as a callback screen, skip straight to questionnaire
?>
<p class='rsoption'><a href="<? print(get_limesurvey_url($operator_id)); ?>"><? echo T_("Yes - Continue"); ?></a></p>
<?
}
else
{
?>
<p class='rsoption'><a href="rs_callback_interface2.php"><? echo T_("Yes - Continue"); ?></a></p>
<?
}
}
?>
<p class='rsoption'><a href="rs_business_interface2.php"><? echo T_("Business number"); ?></a></p>
<p class='rsoption'><a href="rs_answeringmachine_interface2.php"><? echo T_("Answering machine"); ?></a></p>
<p class='rsoption'><a href="javascript:parent.location.href = 'index_interface2.php?outcome=2&endcase=endcase'"><? echo T_("End call with outcome: No answer (ring out or busy) "); ?></a></p>
<p class='rsoption'><a href="javascript:parent.location.href = 'index_interface2.php?outcome=18&endcase=endcase'"><? echo T_("End call with outcome: Accidental hang up"); ?></a></p>
<p class='rsoption'><a href="javascript:parent.location.href = 'index_interface2.php?outcome=6&endcase=endcase'"><? echo T_("End call with outcome: Refusal by unknown person"); ?></a></p>
<p class='rsoption'><a href="javascript:parent.location.href = 'index_interface2.php?outcome=8&endcase=endcase'"><? echo T_("End call with outcome: Refusal by respondent"); ?></a></p>
<p class='rsoption'><a href="javascript:parent.location.href = 'index_interface2.php?outcome=17&endcase=endcase'"><? echo T_("End call with outcome: No eligible respondent (person never available on this number)"); ?></a></p>
<p class='rsoption'><a href="javascript:parent.location.href = 'index_interface2.php?outcome=31&endcase=endcase'"><? echo T_("End call with outcome: Non contact (person not currently available on this number: no appointment made)"); ?></a></p>
<p class='rsoption'><a href="javascript:parent.location.href = 'index_interface2.php?outcome=30&endcase=endcase'"><? echo T_("End call with outcome: Out of sample (already completed in another mode)"); ?></a></p>
<?
xhtml_foot();
?>

View File

@@ -34,6 +34,7 @@
*/ */
include ("config.inc.php"); include ("config.inc.php");
/** /**
* Database file * Database file
*/ */
@@ -49,6 +50,14 @@ include ("functions/functions.xhtml.php");
*/ */
include ("functions/functions.operator.php"); include ("functions/functions.operator.php");
$operator_id = get_operator_id();
//check for alternate interface
if (ALTERNATE_INTERFACE && !is_voip_enabled($operator_id))
{
include_once("rs_project_end_interface2.php");
die();
}
$js = array("js/popup.js","include/jquery-ui/js/jquery-1.4.2.min.js","include/jquery-ui/js/jquery-ui-1.8.2.custom.min.js"); $js = array("js/popup.js","include/jquery-ui/js/jquery-1.4.2.min.js","include/jquery-ui/js/jquery-ui-1.8.2.custom.min.js");
@@ -61,7 +70,6 @@ if (AUTO_LOGOUT_MINUTES !== false)
xhtml_head(T_("Respondent Selection - Project end"),true,array("css/rs.css","include/jquery-ui/css/smoothness/jquery-ui-1.8.2.custom.css"), $js); xhtml_head(T_("Respondent Selection - Project end"),true,array("css/rs.css","include/jquery-ui/css/smoothness/jquery-ui-1.8.2.custom.css"), $js);
$operator_id = get_operator_id();
$case_id = get_case_id($operator_id); $case_id = get_case_id($operator_id);
$questionnaire_id = get_questionnaire_id($operator_id); $questionnaire_id = get_questionnaire_id($operator_id);

View File

@@ -0,0 +1,90 @@
<?
/**
* Respondent selection - Project End
*
*
* This file is part of queXS
*
* queXS is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* queXS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with queXS; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*
* @author Adam Zammit <adam.zammit@deakin.edu.au>
* @copyright Deakin University 2007,2008
* @package queXS
* @subpackage user
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
*
*/
/**
* Configuration file
*/
include_once ("config.inc.php");
/**
* Database file
*/
include_once ("db.inc.php");
/**
* XHTML functions
*/
include_once ("functions/functions.xhtml.php");
/**
* Operator functions
*/
include_once ("functions/functions.operator.php");
$js = array("js/popup.js","include/jquery-ui/js/jquery-1.4.2.min.js","include/jquery-ui/js/jquery-ui-1.8.2.custom.min.js");
if (AUTO_LOGOUT_MINUTES !== false)
{
$js[] = "js/childnap.js";
}
xhtml_head(T_("Respondent Selection - Project end"),true,array("css/rs.css","include/jquery-ui/css/smoothness/jquery-ui-1.8.2.custom.css"), $js);
$operator_id = get_operator_id();
$case_id = get_case_id($operator_id);
$questionnaire_id = get_questionnaire_id($operator_id);
//display introduction text
$sql = "SELECT rs_project_end
FROM questionnaire
WHERE questionnaire_id = '$questionnaire_id'";
$r = $db->GetRow($sql);
print "<p class='rstext'>" . template_replace($r['rs_project_end'],$operator_id,$case_id) . "</p>";
if (!is_voip_enabled($operator_id) && AUTO_COMPLETE_OUTCOME)
{
end_call($operator_id,10);
print "<p class='rsoption'><a href=\"javascript:parent.location.href = 'index_interface2.php?endcase=endcase'\">" . T_("Call automatically ended with outcome: Complete - End case") . "</a></p>";
}
else
{
?>
<p class='rsoption'><a href="javascript:parent.location.href = 'index_interface2.php?outcome=10&endcase=endcase'"><? echo T_("End call with outcome: Complete"); ?></a></p>
<?
}
xhtml_foot();
?>

View File

@@ -0,0 +1,92 @@
<?
/**
* Respondent selection - Project Introduction
*
*
* This file is part of queXS
*
* queXS is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* queXS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with queXS; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*
* @author Adam Zammit <adam.zammit@deakin.edu.au>
* @copyright Deakin University 2007,2008
* @package queXS
* @subpackage user
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
*
*/
/**
* Configuration file
*/
include ("config.inc.php");
/**
* Database file
*/
include ("db.inc.php");
/**
* XHTML functions
*/
include ("functions/functions.xhtml.php");
/**
* Operator functions
*/
include ("functions/functions.operator.php");
$js = array("js/popup.js","include/jquery-ui/js/jquery-1.4.2.min.js","include/jquery-ui/js/jquery-ui-1.8.2.custom.min.js");
if (AUTO_LOGOUT_MINUTES !== false)
{
$js[] = "js/childnap.js";
}
xhtml_head(T_("Respondent Selection - Project Introduction"),true,array("css/rs.css","include/jquery-ui/css/smoothness/jquery-ui-1.8.2.custom.css"), $js);
$operator_id = get_operator_id();
$case_id = get_case_id($operator_id);
$questionnaire_id = get_questionnaire_id($operator_id);
//display introduction text
$sql = "SELECT rs_project_intro
FROM questionnaire
WHERE questionnaire_id = '$questionnaire_id'";
$r = $db->GetRow($sql);
print "<p class='rstext'>" . template_replace($r['rs_project_intro'],$operator_id,$case_id) . "</p>";
//display outcomes
?>
<p class='rsoption'><a href="<? print(get_limesurvey_url($operator_id)); ?>"><? echo T_("Yes - Continue"); ?></a></p>
<p class='rsoption'><a href="javascript:parent.location.href = 'index_interface2.php?outcome=8&endcase=endcase'"><? echo T_("End call with outcome: Refusal by respondent"); ?></a></p>
<p class='rsoption'><a href="javascript:parent.location.href = 'index_interface2.php?outcome=17&endcase=endcase'"><? echo T_("End call with outcome: No eligible respondent (person not available on this number)"); ?></a></p>
<p class='rsoption'><a href="javascript:parent.location.href = 'index_interface2.php?outcome=30&endcase=endcase'"><? echo T_("End call with outcome: Out of sample (already completed in another mode)"); ?></a></p>
<p class='rsoption'><a href="rs_intro_interface2.php"><? echo T_("Go Back"); ?></a></p>
<?
xhtml_foot();
?>

View File

@@ -66,9 +66,18 @@ $questionnaire_id = get_questionnaire_id($operator_id);
print "<p class='rstext'>" . template_replace($_GET['message'],$operator_id,$case_id) . "</p>"; print "<p class='rstext'>" . template_replace($_GET['message'],$operator_id,$case_id) . "</p>";
if (ALTERNATE_INTERFACE && !is_voip_enabled($operator_id))
{
?>
<p class='rsoption'><a href="javascript:parent.location.href = 'index_interface2.php?outcome=32&endcase=endcase'"><? echo T_("End call with outcome: Quota filled"); ?></a></p>
<?
}
else
{
?> ?>
<p class='rsoption'><a href="javascript:parent.poptastic('call.php?defaultoutcome=32');"><? echo T_("End call with outcome: Quota filled"); ?></a></p> <p class='rsoption'><a href="javascript:parent.poptastic('call.php?defaultoutcome=32');"><? echo T_("End call with outcome: Quota filled"); ?></a></p>
<? <?
}
xhtml_foot(); xhtml_foot();

211
status_interface2.php Normal file
View File

@@ -0,0 +1,211 @@
<?
/**
* Display status of case
*
*
* This file is part of queXS
*
* queXS is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* queXS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with queXS; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*
* @author Adam Zammit <adam.zammit@deakin.edu.au>
* @copyright Deakin University 2007,2008
* @package queXS
* @subpackage user
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
*
*/
/**
* Configuration file
*/
include ("config.inc.php");
/**
* Database file
*/
include ("db.inc.php");
/**
* XHTML functions
*/
include ("functions/functions.xhtml.php");
/**
* Operator functions
*/
include("functions/functions.operator.php");
$operator_id = get_operator_id();
$state = is_on_call($operator_id);
$js = array("js/popup.js");
if (browser_ie())
$js[] = "js/window_ie6.js";
else
$js[] = "js/window.js";
if (AUTO_LOGOUT_MINUTES !== false)
{
$js[] = "include/jquery-ui/js/jquery-1.4.2.min.js";
$js[] = "js/childnap.js";
}
xhtml_head(T_("Status"),true,array("css/status.css"),$js);
$ca = get_call_attempt($operator_id,false);
if ($ca)
{
$respondent_id = get_respondent_id($ca);
$case_id = get_case_id($operator_id);
$fname = get_respondent_variable("firstName",$respondent_id);
$lname = get_respondent_variable("lastName",$respondent_id);
print "<p>" . T_("Name") . ": $fname $lname</p>";
$appointment = is_on_appointment($ca);
$call_id = get_call($operator_id);
$sql = "SELECT o.tryanother, o.require_note
FROM `call` as c, `outcome` as o
WHERE c.call_attempt_id = '$ca'
AND c.outcome_id = o.outcome_id
ORDER BY call_id DESC
LIMIT 1";
$rst = $db->GetRow($sql);
if ((empty($rst) || $rst['tryanother'] == 1)) //dial another number only when available and not ending
{
if (isset($_POST['contactphone']))
{
$pcontact_phone_id = intval($_POST['contactphone']);
//If an outcome already assigned, end the current call and start the enxt one to pcontact_phone_id
//Otherwise bring up the assign outcome window
if (!$call_id) //outcome assigned
{
$call_id = get_call($operator_id,$respondent_id,$pcontact_phone_id,true);
echo "<script type='text/javascript'>openParentObject(\"main-content\",\"" . get_respondentselection_url($operator_id,false) . "\");</script>";
}
else
{
//bring up assign outcome window
print "<script type='text/javascript'>parent.poptastic('call_interface2.php');</script>";
}
}
if (!$call_id)
{
if ($appointment)
{
//create a call on the appointment number
$sql = "SELECT cp.*
FROM contact_phone as cp, appointment as a
WHERE cp.case_id = '$case_id'
AND a.appointment_id = '$appointment'
AND a.contact_phone_id = cp.contact_phone_id";
}
else
{
//create a call on the first available number by priority
$sql = "SELECT *
FROM contact_phone
WHERE case_id = '$case_id'
ORDER BY priority ASC
LIMIT 1";
}
$rs = $db->GetRow($sql);
$contact_phone_id = $rs['contact_phone_id'];
$call_id = get_call($operator_id,$respondent_id,$contact_phone_id,true);
}
if ($appointment)
{
$sql = "SELECT DATE_FORMAT(CONVERT_TZ(a.start,'System', o.Time_zone_name),'%Y-%b-%d %H:%i') as time
FROM appointment as a, operator as o
WHERE o.operator_id = '$operator_id'
AND a.appointment_id = '$appointment'";
$rs = $db->GetRow($sql);
$apdate = $rs['time'];
print "<div class='tobecoded statusbox'>" . T_("Appointment") . ": " . $apdate . "</div><div style='clear: both;'/>";
//if (missed_appointment($ca)) print "<div class='tobecoded statusbutton'>" . T_("MISSED") . "</div>";
}
$sql = "SELECT c.*, CASE WHEN c.contact_phone_id = ccc.contact_phone_id THEN 'checked=\"checked\"' ELSE '' END as checked
FROM contact_phone as c
LEFT JOIN `call` as ccc ON (ccc.call_id = '$call_id')
LEFT JOIN (
SELECT contact_phone.contact_phone_id
FROM contact_phone
LEFT JOIN `call` ON ( call.contact_phone_id = contact_phone.contact_phone_id )
LEFT JOIN outcome ON ( call.outcome_id = outcome.outcome_id )
WHERE contact_phone.case_id = '$case_id'
AND outcome.tryagain =0
) AS l ON l.contact_phone_id = c.contact_phone_id
LEFT JOIN
(
SELECT contact_phone_id
FROM `call`
WHERE call_attempt_id = '$ca'
AND outcome_id != 18
AND outcome_id != 0
) as ca on ca.contact_phone_id = c.contact_phone_id
WHERE c.case_id = '$case_id'
AND l.contact_phone_id IS NULL
AND ca.contact_phone_id IS NULL";
$rs = $db->GetAll($sql);
//Display all available numbers for this case as a list of radio buttons
//By default, the selected radio button should have a "call" started for it
//When then next one clicked, it should bring up call screen if no outcome otherwise start new call
print "<div>";
foreach($rs as $r)
{
print "<form method='post' action='?'><div>";
print "<input onclick='this.form.submit();' type='radio' name='contactphone' value='{$r['contact_phone_id']}' id='contactphone{$r['contact_phone_id']}' {$r['checked']}/>";
print "<label for='contactphone{$r['contact_phone_id']}'>{$r['phone']}";
if (!empty($r['description'])) print " - " . $r['description'];
print "</label>";
print "</div></form>";
}
print "</div>";
}
else
print "<div class='text'>" . T_("No more numbers to call") . "</div>";
}
else
print "<div class='text'>" . T_("No case") . "</div>";
xhtml_foot();
?>

View File

@@ -0,0 +1,84 @@
<?
/**
* Display the main page including all panels and tabs
*
*
* This file is part of queXS
*
* queXS is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* queXS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with queXS; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*
* @author Adam Zammit <adam.zammit@deakin.edu.au>
* @copyright Deakin University 2007,2008
* @package queXS
* @subpackage user
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
*
*
*/
/**
* Configuration file
*/
include_once("config.inc.php");
/**
* XHTML functions
*/
include_once("functions/functions.xhtml.php");
/**
* Operator functions
*/
include_once("functions/functions.operator.php");
xhtml_head(T_("queXS"), false, array("css/index_interface2.css","css/tabber.css"),array("js/tabber.js"));
?>
<div id="casefunctions">
<div class='box'><a href="index_interface2.php"><? echo T_("Get a new case"); ?></a></div>
<div class='box'><a href="endwork.php"><? echo T_("End work"); ?></a></div>
</div>
<div id="content">
</div>
<div id="respondent">
</div>
<div id="qstatus">
</div>
<div id="calllist">
<div class="tabber" id="tab-main">
<div class="tabbertab">
<h2><? echo T_("Info"); ?></h2>
<div id="div-info" class="tabberdiv"><?xhtml_object("info.php","main-info");?></div>
</div>
</div>
</div>
<?
xhtml_foot();
?>