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

Merging from internetcompletion branch

This commit is contained in:
Adam Zammit
2013-03-07 16:28:08 +11:00
120 changed files with 2230 additions and 1314 deletions

View File

@@ -1,3 +1,36 @@
queXS 1.7.0 - Changes since 1.6.1
New Feature: Replace queXS caseid as token with a random token to allow for safe external access
New Feature: Allow for responents to self complete the questionnaire via email invitation
Fixed Bug: Replaced php short tags with long tags
Database updates:
ALTER TABLE `case` ADD `token` VARCHAR( 36 ) NOT NULL ;
To allow for accessing existing cases in new system, need to assign a "token" for each case:
UPDATE `case` SET token = case_id;
ALTER TABLE `case` ADD UNIQUE (`token`);
New outcomes for email invitation and online self completion:
INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`) VALUES
(40, '1.1', 'Self completed online', 0, 4, 0, 1, 1, 1, 0, 'I'),
(41, '2.36', 'Self completion email invitation sent', 10080, 1, 0, 1, 1, 1, 0, 'O');
New sample variable type (Email address):
INSERT INTO `sample_var_type` (`type`, `description`, `table`) VALUES
(8, 'Email address', '');
Specify details of respondent self completion:
ALTER TABLE `questionnaire` ADD `self_complete` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `info`,
ADD `lime_mode` VARCHAR( 64 ) NULL COMMENT 'Limesurvey mode for respondent self completion' AFTER `self_complete` ,
ADD `lime_template` VARCHAR( 128 ) NULL COMMENT 'Limesurvey template for respondent self completion' AFTER `lime_mode` ,
ADD `lime_endurl` VARCHAR( 256 ) NULL COMMENT 'Forwarding end URL for respondent self completion' AFTER `lime_template` ;
queXS 1.6.1 - Changes since 1.6.0
New Feature: Include paradata/metadata in data output (number call attempts, number of answering machine messages and all sample variables)

View File

@@ -1,4 +1,4 @@
<?
<?php
/**
* Add and modify shifts by questionnaire
*
@@ -231,7 +231,7 @@ if ($questionnaire_id != false)
?>
<form method="post" action="">
<table>
<?
<?php
print "<tr><th>" . T_("Day") . "</th><th>" . T_("Start") . "</th><th>" . T_("End") . "</th><th>" . T_("Use shift?") . "</th></tr>";
$count = 1;
foreach($shifts as $shift)
@@ -257,12 +257,12 @@ if ($questionnaire_id != false)
<!--<tr><td/><td/><td/><td>Select all</td></tr>-->
</table>
<!--<p><input type="submit" name="addshift" value="Add Shift"/></p>-->
<p><input type="submit" name="submit" value="<? echo T_("Submit changes"); ?>"/></p>
<p><input type="hidden" name="year" value="<? echo $year; ?>"/></p>
<p><input type="hidden" name="woy" value="<? echo $woy; ?>"/></p>
<p><input type="hidden" name="qid" value="<? echo $questionnaire_id; ?>"/></p>
<p><input type="submit" name="submit" value="<?php echo T_("Submit changes"); ?>"/></p>
<p><input type="hidden" name="year" value="<?php echo $year; ?>"/></p>
<p><input type="hidden" name="woy" value="<?php echo $woy; ?>"/></p>
<p><input type="hidden" name="qid" value="<?php echo $questionnaire_id; ?>"/></p>
</form>
<?
<?php
}
xhtml_foot();

View File

@@ -1,4 +1,4 @@
<?
<?php
/**
* Assign sample(s) to a questionnaire
*
@@ -135,8 +135,8 @@ if ($questionnaire_id != false)
print "<h1>" . T_("Add a sample to this questionnaire:") . "</h1>";
?>
<form action="" method="get">
<p><label for="sample"><? echo T_("Select sample:"); ?></label><select name="sample" id="sample">
<?
<p><label for="sample"><?php echo T_("Select sample:"); ?></label><select name="sample" id="sample">
<?php
foreach($qs as $q)
{
@@ -145,14 +145,14 @@ if ($questionnaire_id != false)
?>
</select><br/>
<label for="call_max"><? echo T_("Max calls (0 for unlimited)"); ?></label><input type="text" name="call_max" id="call_max" value="0"/><br/>
<label for="call_attempt_max"><? echo T_("Max call attempts (0 for unlimited)"); ?></label><input type="text" name="call_attempt_max" id="call_attempt_max" value="0"/> <br/>
<label for="answering_machine_messages"><? echo T_("Number of answering machine messages to leave per case (0 for never)"); ?></label><input type="text" name="answering_machine_messages" id="answering_machine_messages" value="1"/> <br/>
<label for="selecttype"><? echo T_("Select from sample randomly? (otherwise sequentially)"); ?></label><input type="checkbox" id = "selecttype" name="selecttype" /> <br/>
<input type="hidden" name="questionnaire_id" value="<? print($questionnaire_id); ?>"/>
<label for="call_max"><?php echo T_("Max calls (0 for unlimited)"); ?></label><input type="text" name="call_max" id="call_max" value="0"/><br/>
<label for="call_attempt_max"><?php echo T_("Max call attempts (0 for unlimited)"); ?></label><input type="text" name="call_attempt_max" id="call_attempt_max" value="0"/> <br/>
<label for="answering_machine_messages"><?php echo T_("Number of answering machine messages to leave per case (0 for never)"); ?></label><input type="text" name="answering_machine_messages" id="answering_machine_messages" value="1"/> <br/>
<label for="selecttype"><?php echo T_("Select from sample randomly? (otherwise sequentially)"); ?></label><input type="checkbox" id = "selecttype" name="selecttype" /> <br/>
<input type="hidden" name="questionnaire_id" value="<?php print($questionnaire_id); ?>"/>
<input type="submit" name="add_sample" value="Add sample"/></p>
</form>
<?
<?php
}
}
xhtml_foot();

View File

@@ -1,4 +1,4 @@
<?
<?php
/**
* Modify availability within this availability group
*
@@ -132,7 +132,7 @@ translate_array($daysofweek,array("description"));
?>
<form method="post" action="">
<table>
<?
<?php
print "<tr><th>" . T_("Day") . "</th><th>" . T_("Start") . "</th><th>" . T_("End") . "</th></tr>";
$count = 0;
foreach($availabilitys as $availability)
@@ -149,11 +149,11 @@ translate_array($daysofweek,array("description"));
?>
</table>
<div><a onclick="addRow(); return false;" href="#"><? echo T_("Add row"); ?></a></div>
<p><input type="submit" name="submit" value="<? echo T_("Save changes to availabilities"); ?>"/></p>
<input type="hidden" name="availability_group" value="<? echo $availability_group;?>"/>
<div><a onclick="addRow(); return false;" href="#"><?php echo T_("Add row"); ?></a></div>
<p><input type="submit" name="submit" value="<?php echo T_("Save changes to availabilities"); ?>"/></p>
<input type="hidden" name="availability_group" value="<?php echo $availability_group;?>"/>
</form>
<?
<?php
xhtml_foot();

View File

@@ -1,4 +1,4 @@
<?
<?php
/**
* List and create availability groups
*
@@ -97,10 +97,10 @@ else
//add a note
?>
<form method="get" action="?">
<p><input type="text" class="textclass" name="availability_group" id="availability_group"/><input class="submitclass" type="submit" name="submit" value="<? echo T_("Add availability group"); ?>"/>
<p><input type="text" class="textclass" name="availability_group" id="availability_group"/><input class="submitclass" type="submit" name="submit" value="<?php echo T_("Add availability group"); ?>"/>
</p>
</form>
<?
<?php
xhtml_foot();

View File

@@ -1,4 +1,4 @@
<?
<?php
/**
* Generate bulk appointments from a Headered CSV file
*
@@ -217,7 +217,7 @@ else if (isset($_POST['import_file']))
xhtml_head("queXS",true,array("../css/table.css"));
?>
<form action="" method="post">
<?
<?php
$tmpfname = tempnam(TEMPORARY_DIRECTORY, "FOO");
move_uploaded_file($_FILES['file']['tmp_name'],$tmpfname);
@@ -231,10 +231,10 @@ else if (isset($_POST['import_file']))
xhtml_table($todo,array(0,1,2,3),$todoh);
?>
<form action="" method="post">
<p><input type="hidden" name="tmpfname" value="<? echo $tmpfname; ?>" /></p>
<p><input type="submit" name="import_file" value="<? echo T_("Accept and generate bulk appointments"); ?>"/></p>
<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>
<?
<?php
}
else
print "<p>" . T_("The file does not contain at least caseid, starttime and endtime columns. Please try again.") ."</p>";
@@ -258,11 +258,11 @@ else
</table></div>
<form enctype="multipart/form-data" action="" method="post">
<p><input type="hidden" name="MAX_FILE_SIZE" value="1000000000" /></p>
<p><? echo T_("Choose the CSV file to upload:"); ?><input name="file" type="file" /></p>
<p><input type="submit" name="import_file" value="<? echo T_("Load bulk appointment CSV"); ?>"/></p>
<p><?php echo T_("Choose the CSV file to upload:"); ?><input name="file" type="file" /></p>
<p><input type="submit" name="import_file" value="<?php echo T_("Load bulk appointment CSV"); ?>"/></p>
</form>
<?
<?php
xhtml_foot();
}

View File

@@ -1,4 +1,4 @@
<?
<?php
/**
* Display a list of calls and outcomes for all calls
*

View File

@@ -1,4 +1,4 @@
<?
<?php
/**
* Modify the call restriction times
*
@@ -114,7 +114,7 @@ translate_array($daysofweek,array("description"));
?>
<form method="post" action="">
<table>
<?
<?php
print "<tr><th>" . T_("Day") . "</th><th>" . T_("Start") . "</th><th>" . T_("End") . "</th></tr>";
$count = 0;
foreach($shifts as $shift)
@@ -131,10 +131,10 @@ translate_array($daysofweek,array("description"));
?>
</table>
<div><a onclick="addRow(); return false;" href="#"><? echo T_("Add row"); ?></a></div>
<p><input type="submit" name="submit" value="<? echo T_("Save changes to restriction times"); ?>"/></p>
<div><a onclick="addRow(); return false;" href="#"><?php echo T_("Add row"); ?></a></div>
<p><input type="submit" name="submit" value="<?php echo T_("Save changes to restriction times"); ?>"/></p>
</form>
<?
<?php
xhtml_foot();

View File

@@ -1,4 +1,4 @@
<?
<?php
/**
* Display a list of cases for a questionnaire based on the current outcome
*

View File

@@ -1,4 +1,4 @@
<?
<?php
/**
* Set information about this centre for diplay to operators
*
@@ -63,10 +63,10 @@ xhtml_head(T_("Set centre information"),true,false,array("../js/window.js"));
?>
<form action="" method="post"><p>
<label for="information"><? echo T_("Set centre information: "); ?></label><? echo $CKEditor->editor("information",get_setting("information")); ?>
<input type="submit" name="update" value="<? echo T_("Update centre information"); ?>"/></p>
<label for="information"><?php echo T_("Set centre information: "); ?></label><?php echo $CKEditor->editor("information",get_setting("information")); ?>
<input type="submit" name="update" value="<?php echo T_("Update centre information"); ?>"/></p>
</form>
<?
<?php
xhtml_foot();

View File

@@ -1,4 +1,4 @@
<?
<?php
/**
* Assign clients to questionnaires in a checkbox matrix
*
@@ -153,7 +153,7 @@ xhtml_head(T_("Assign clients to questionnaires"),false,array("../css/table.css"
<script type="text/javascript">
<?
<?php
print "questionnaire_id = new Array(";
$s = "";
@@ -236,7 +236,7 @@ function checkVid(v)
<body>
<?
<?php

View File

@@ -1,4 +1,4 @@
<?
<?php
/**
* Create a client and link to a webserver username for authentication
*
@@ -97,25 +97,25 @@ $rs = $db->GetAll($sql);
if ($a)
{
?>
<h3><? echo $a; ?></h3>
<?
<h3><?php echo $a; ?></h3>
<?php
}
?>
<h1><? echo T_("Add a client"); ?></h1>
<p><? echo T_("Adding a client here will allow them to access project information in the client subdirectory. You can assign a client to a particular project using the"); ?> <a href="clientquestionnaire.php"><? echo T_("Assign client to Questionnaire"); ?></a> <? echo T_("tool."); ?></p>
<p><? echo T_("Use this form to enter the username of a user based on your directory security system. For example, if you have secured the base directory of queXS using Apache file based security, enter the usernames of the users here."); ?></p>
<h1><?php echo T_("Add a client"); ?></h1>
<p><?php echo T_("Adding a client here will allow them to access project information in the client subdirectory. You can assign a client to a particular project using the"); ?> <a href="clientquestionnaire.php"><?php echo T_("Assign client to Questionnaire"); ?></a> <?php echo T_("tool."); ?></p>
<p><?php echo T_("Use this form to enter the username of a user based on your directory security system. For example, if you have secured the base directory of queXS using Apache file based security, enter the usernames of the users here."); ?></p>
<form enctype="multipart/form-data" action="" method="post">
<p><? echo T_("Enter the username of a client to add:"); ?> <input name="client" type="text"/></p>
<? if (HTPASSWD_PATH !== false && HTGROUP_PATH !== false) { ?>
<p><? echo T_("Enter the password of a client to add:"); ?> <input name="password" type="text"/></p>
<? } ?>
<p><? echo T_("Enter the first name of a client to add:"); ?> <input name="firstname" type="text"/></p>
<p><? echo T_("Enter the surname of a client to add:"); ?> <input name="lastname" type="text"/></p>
<p><a href='timezonetemplate.php'><? echo T_("Enter the Time Zone of a client to add:"); echo "</a>"; display_chooser($rs,"Time_zone_name","Time_zone_name",false,false,false,false,array("value",DEFAULT_TIME_ZONE)); ?> </p>
<p><input type="submit" value="<? echo T_("Add user"); ?>" /></p>
<p><?php echo T_("Enter the username of a client to add:"); ?> <input name="client" type="text"/></p>
<?php if (HTPASSWD_PATH !== false && HTGROUP_PATH !== false) { ?>
<p><?php echo T_("Enter the password of a client to add:"); ?> <input name="password" type="text"/></p>
<?php } ?>
<p><?php echo T_("Enter the first name of a client to add:"); ?> <input name="firstname" type="text"/></p>
<p><?php echo T_("Enter the surname of a client to add:"); ?> <input name="lastname" type="text"/></p>
<p><a href='timezonetemplate.php'><?php echo T_("Enter the Time Zone of a client to add:"); echo "</a>"; display_chooser($rs,"Time_zone_name","Time_zone_name",false,false,false,false,array("value",DEFAULT_TIME_ZONE)); ?> </p>
<p><input type="submit" value="<?php echo T_("Add user"); ?>" /></p>
</form>
<?
<?php
xhtml_foot();

View File

@@ -1,4 +1,4 @@
<?
<?php
/**
* A list of database strings for translation
*
@@ -85,5 +85,8 @@ T_("State");
T_("Postcode");
T_("Respondent first name");
T_("Respondent last name");
T_("Email address");
T_("Self completion email invitation sent");
T_("Self completed online");
?>

View File

@@ -1,5 +1,4 @@
<?php
/**
<?php /**
* Output data as a fixed width ASCII file
*
*
@@ -35,25 +34,6 @@
*/
include("../functions/functions.input.php");
if (isset($_GET['data']))
{
/**
* Limesurvey functions
*/
include("../functions/functions.limesurvey.php");
$questionnaire_id = false;
$sample_import_id = false;
if (isset($_GET['sample_import_id'])) $sample_import_id = bigintval($_GET['sample_import_id']);
if (isset($_GET['questionnaire_id'])) $questionnaire_id = bigintval($_GET['questionnaire_id']);
limesurvey_export_fixed_width($questionnaire_id,$sample_import_id);
exit();
}
/**
* Configuration file
*/

View File

@@ -1,5 +1,4 @@
<?php
/**
<?php /**
* Display appointments
*
*
@@ -120,10 +119,13 @@ if (isset($_GET['start']) && isset($_GET['appointment_id']))
$end = $db->qstr($_GET['end']);
$contact_phone_id = bigintval($_GET['contact_phone_id']);
$respondent_id = bigintval($_GET['respondent_id']);
$require_operator_id = "NULL";
if ($_GET['require_operator_id'] > 1) $require_operator_id = bigintval($_GET['require_operator_id']);
//Edit this appointment in the database
$sql = "UPDATE appointment as a, respondent as r
SET a.start = CONVERT_TZ($start,r.Time_zone_name,'UTC'), a.end = CONVERT_TZ($end,r.Time_zone_name,'UTC'), a.contact_phone_id = $contact_phone_id, a.respondent_id = $respondent_id
SET a.start = CONVERT_TZ($start,r.Time_zone_name,'UTC'), a.end = CONVERT_TZ($end,r.Time_zone_name,'UTC'), a.contact_phone_id = $contact_phone_id, a.respondent_id = $respondent_id,
a.require_operator_id = $require_operator_id
WHERE a.appointment_id = $appointment_id
AND r.respondent_id = $respondent_id";
@@ -157,7 +159,7 @@ if (isset($_GET['appointment_id']) && isset($_GET['case_id']))
xhtml_head(T_("Edit appointment"),false,$css,$js);
print "<script type='text/javascript'>$(document).ready(function() { $('#start').datetimepicker({timeFormat: 'hh:mm:ss', dateFormat: 'yy-mm-dd'}); $('#end').datetimepicker({timeFormat: 'hh:mm:ss', dateFormat: 'yy-mm-dd'});});</script>";
$sql = "SELECT a.contact_phone_id,a.call_attempt_id,CONVERT_TZ(a.start,'UTC',r.Time_zone_name) as start,CONVERT_TZ(a.end,'UTC',r.Time_zone_name) as end,a.respondent_id
$sql = "SELECT a.contact_phone_id,a.call_attempt_id,CONVERT_TZ(a.start,'UTC',r.Time_zone_name) as start,CONVERT_TZ(a.end,'UTC',r.Time_zone_name) as end,a.respondent_id,a.require_operator_id
FROM appointment as a, respondent as r
WHERE a.appointment_id = '$appointment_id'
AND a.case_id = '$case_id'
@@ -169,6 +171,7 @@ if (isset($_GET['appointment_id']) && isset($_GET['case_id']))
{
$respondent_id = $rs['respondent_id'];
$contact_phone_id = $rs['contact_phone_id'];
$require_operator_id = $rs['require_operator_id'];
$start = $rs['start'];
$end = $rs['end'];
@@ -189,6 +192,22 @@ if (isset($_GET['appointment_id']) && isset($_GET['case_id']))
print "</div><div><label for='start'>" . T_("Start time") . "</label><input type='text' value='$start' id='start' name='start'/></div>";
print "<div><label for='end'>" . T_("End time") . "</label><input type='text' value='$end' id='end' name='end'/></div>";
print "<div><label for='require_operator_id'>" . T_("Appointment with") . "</label>";
$ops = $db->GetAll(" SELECT o.operator_id as value,
CONCAT(o.firstName, ' ', o.lastName) as description,
CASE WHEN o.operator_id = '$require_operator_id' THEN 'selected=\'selected\'' ELSE '' END as selected
FROM operator as o");
$selected = "selected=\'selected\'";
foreach($ops as $o)
{
if (!empty($o['selected']))
{
$selected = "";
break;
}
}
array_unshift($ops,array('value'=>0,'description'=>T_("Any operator"),'selected'=>$selected));
display_chooser($ops,"require_operator_id","require_operator_id",false,false,false,false);
print "<input type='hidden' value='$appointment_id' id='appointment_id' name='appointment_id'/>";
print "<div><input type='submit' value='" . T_("Edit appointment") . "'/></div>";
@@ -207,20 +226,21 @@ else
print "<h1>" . T_("Appointments") . "</h1><h2>" . T_("All appointments (with times displayed in your time zone)") . "</h2>";
$sql = "SELECT q.description, CONVERT_TZ(a.start,'UTC',o.Time_zone_name) as start, CONVERT_TZ(a.end,'UTC',o.Time_zone_name) as end, r.firstName, r.lastName, IFNULL(ou.description,'" . T_("Not yet called") . "') as outcome, oo.firstName as makerName, ooo.firstName as callerName, CONCAT('<a href=\'supervisor.php?case_id=', c.case_id, '\'>', c.case_id, '</a>') as case_id, CONCAT('<a href=\'?case_id=', c.case_id, '&amp;appointment_id=', a.appointment_id, '&amp;delete=delete\'>". T_("Delete") . "</a>') as link, CONCAT('<a href=\'?case_id=', c.case_id, '&amp;appointment_id=', a.appointment_id, '\'>". T_("Edit") . "</a>') as edit
$sql = "SELECT q.description, CONVERT_TZ(a.start,'UTC',o.Time_zone_name) as start, CONVERT_TZ(a.end,'UTC',o.Time_zone_name) as end, r.firstName, r.lastName, IFNULL(ou.description,'" . T_("Not yet called") . "') as outcome, oo.firstName as makerName, ooo.firstName as callerName, CONCAT('<a href=\'supervisor.php?case_id=', c.case_id, '\'>', c.case_id, '</a>') as case_id, CONCAT('<a href=\'?case_id=', c.case_id, '&amp;appointment_id=', a.appointment_id, '&amp;delete=delete\'>". T_("Delete") . "</a>') as link, CONCAT('<a href=\'?case_id=', c.case_id, '&amp;appointment_id=', a.appointment_id, '\'>". T_("Edit") . "</a>') as edit,IFNULL(ao.firstName,'" . T_("Any operator") . "') as witho
FROM appointment as a
JOIN (`case` as c, respondent as r, questionnaire as q, operator as o, operator as oo, call_attempt as cc) on (a.case_id = c.case_id and a.respondent_id = r.respondent_id and q.questionnaire_id = c.questionnaire_id and o.operator_id = '$operator_id' and a.call_attempt_id = cc.call_attempt_id and cc.operator_id = oo.operator_id)
LEFT JOIN (`call` as ca, outcome as ou, operator as ooo) ON (ca.call_id = a.completed_call_id and ou.outcome_id = ca.outcome_id and ca.operator_id = ooo.operator_id)
LEFT JOIN operator AS ao ON ao.operator_id = a.require_operator_id
WHERE a.end >= CONVERT_TZ(NOW(),'System','UTC')
ORDER BY a.start ASC";
$rs = $db->GetAll($sql);
if (!empty($rs))
{
translate_array($rs,array("outcome"));
xhtml_table($rs,array("description","case_id","start","end","makerName","firstName","lastName","outcome","callerName","link","edit"),array(T_("Questionnaire"),T_("Case ID"),T_("Start"),T_("End"),T_("Operator Name"),T_("Respondent Name"),T_("Surname"),T_("Current outcome"),T_("Operator who called"),T_("Delete"),T_("Edit")));
xhtml_table($rs,array("description","case_id","start","end","makerName","witho","firstName","lastName","outcome","callerName","link","edit"),array(T_("Questionnaire"),T_("Case ID"),T_("Start"),T_("End"),T_("Operator Name"),T_("Appointment with"),T_("Respondent Name"),T_("Surname"),T_("Current outcome"),T_("Operator who called"),T_("Delete"),T_("Edit")));
}
else
print "<p>" . T_("No appointments in the future") . "</p>";

View File

@@ -1,5 +1,4 @@
<?php
/**
<?php /**
* Display extension status
*
*

View File

@@ -1,4 +1,4 @@
<?
<?php
/**
* Import a sample from a Headered CSV file
*
@@ -87,7 +87,7 @@ else if (isset($_POST['import_file']))
xhtml_head(T_("Import: Select columns to import"));
?>
<form action="" method="post">
<?
<?php
$tmpfname = tempnam(TEMPORARY_DIRECTORY, "FOO");
move_uploaded_file($_FILES['file']['tmp_name'],$tmpfname);
@@ -97,12 +97,12 @@ else if (isset($_POST['import_file']))
?>
<p><input type="hidden" name="description" value="<? if (isset($_POST['description'])) print($_POST['description']); ?>"/></p>
<p><input type="hidden" name="filename" value="<? echo $tmpfname; ?>"/></p>
<p><input type="hidden" name="description" value="<?php if (isset($_POST['description'])) print($_POST['description']); ?>"/></p>
<p><input type="hidden" name="filename" value="<?php echo $tmpfname; ?>"/></p>
<p><input type="submit" name="import_form"/></p>
</form>
<?
<?php
xhtml_foot();
}
@@ -114,12 +114,12 @@ else
<form enctype="multipart/form-data" action="" method="post">
<p><input type="hidden" name="MAX_FILE_SIZE" value="1000000000" /></p>
<p><? echo T_("Choose the CSV sample file to upload:"); ?><input name="file" type="file" /></p>
<p><? echo T_("Description for file:"); ?><input name="description" type="text" /></p>
<p><input type="submit" name="import_file" value="<? echo T_("Add sample"); ?>"/></p>
<p><?php echo T_("Choose the CSV sample file to upload:"); ?><input name="file" type="file" /></p>
<p><?php echo T_("Description for file:"); ?><input name="description" type="text" /></p>
<p><input type="submit" name="import_file" value="<?php echo T_("Add sample"); ?>"/></p>
</form>
<?
<?php
xhtml_foot();
}

View File

@@ -1,5 +1,4 @@
<?php
/**
<?php /**
* Display an index of Admin tools
*
*

View File

@@ -1,4 +1,4 @@
<?
<?php
/**
* Create a queXS questionnaire and link it to a LimeSurvey questionnaire
*
@@ -68,10 +68,12 @@ if (isset($_POST['import_file']))
$testing = 0;
$rs = 0;
$lime_sid = 0;
$respsc = 0;
$lime_rs_sid = "NULL";
if (isset($_POST['ras'])) $ras = 1;
if (isset($_POST['rws'])) $rws = 1;
if (isset($_POST['testing'])) $testing = 1;
if (isset($_POST['respsc'])) $respsc = 1;
if ($_POST['selectrs'] != "none") $rs = 1;
$name = $db->qstr($_POST['description'],get_magic_quotes_gpc());
@@ -91,14 +93,26 @@ if (isset($_POST['import_file']))
$lime_rs_sid = bigintval($_POST['selectrs']);
}
$sql = "INSERT INTO questionnaire (questionnaire_id,description,lime_sid,restrict_appointments_shifts,restrict_work_shifts,respondent_selection,rs_intro,rs_project_intro,rs_project_end,rs_callback,rs_answeringmachine,testing,lime_rs_sid,info)
VALUES (NULL,$name,'$lime_sid','$ras','$rws','$rs',$rs_intro,$rs_project_intro,$rs_project_end,$rs_callback,$rs_answeringmachine,'$testing',$lime_rs_sid,$info)";
$sql = "INSERT INTO questionnaire (questionnaire_id,description,lime_sid,restrict_appointments_shifts,restrict_work_shifts,respondent_selection,rs_intro,rs_project_intro,rs_project_end,rs_callback,rs_answeringmachine,testing,lime_rs_sid,info,self_complete)
VALUES (NULL,$name,'$lime_sid','$ras','$rws','$rs',$rs_intro,$rs_project_intro,$rs_project_end,$rs_callback,$rs_answeringmachine,'$testing',$lime_rs_sid,$info,$respsc)";
$rs = $db->Execute($sql);
if ($rs)
{
$qid = $db->Insert_ID();
if ($respsc == 1)
{
$lime_mode = $db->qstr($_POST['lime_mode'],get_magic_quotes_gpc());
$lime_template = $db->qstr($_POST['lime_template'],get_magic_quotes_gpc());
$lime_endurl = $db->qstr($_POST['lime_endurl'],get_magic_quotes_gpc());
$sql = "UPDATE questionnaire
SET lime_mode = $lime_mode, lime_template = $lime_template, lime_endurl = $lime_endurl
WHERE questionnaire_id = $qid";
$db->Execute($sql);
}
print "<p>" . T_("Successfully inserted") . " $name " . T_("as questionnaire") . " $qid, " . T_("linked to") . " $lime_sid</p>";
}else
{
@@ -113,8 +127,8 @@ if (isset($_POST['import_file']))
?>
<form enctype="multipart/form-data" action="" method="post">
<p><input type="hidden" name="MAX_FILE_SIZE" value="1000000000" /></p>
<p><? echo T_("Name for questionnaire:"); ?> <input type="text" name="description"/></p>
<p><? echo T_("Select limesurvey instrument:");
<p><?php echo T_("Name for questionnaire:"); ?> <input type="text" name="description"/></p>
<p><?php echo T_("Select limesurvey instrument:");
$sql = "SELECT s.sid as sid, sl.surveyls_title AS title
FROM " . LIME_PREFIX . "surveys AS s
LEFT JOIN " . LIME_PREFIX . "surveys_languagesettings AS sl ON ( s.sid = sl.surveyls_survey_id)
@@ -137,9 +151,9 @@ else
print "<a href='" . LIME_URL ."admin/admin.php?action=newsurvey'>" . T_("Create an instrument in Limesurvey") ."</a>";
}
?></p>
<p><? echo T_("Respondent selection type:"); ?>
<select name="selectrs" onchange="if(this.value=='old') show(this,'rstext'); else hide(this,'rstext');"><option value="none"><? echo T_("No respondent selection (go straight to questionnaire)"); ?></option><option value="old"><? echo T_("Use basic respondent selection text (below)"); ?></option>
<?
<p><?php echo T_("Respondent selection type:"); ?>
<select name="selectrs" onchange="if(this.value=='old') show(this,'rstext'); else hide(this,'rstext');"><option value="none"><?php echo T_("No respondent selection (go straight to questionnaire)"); ?></option><option value="old"><?php echo T_("Use basic respondent selection text (below)"); ?></option>
<?php
$sql = "SELECT s.sid as sid, sl.surveyls_title AS title
FROM " . LIME_PREFIX . "surveys AS s
LEFT JOIN " . LIME_PREFIX . "surveys_languagesettings AS sl ON ( s.sid = sl.surveyls_survey_id
@@ -176,20 +190,37 @@ $ckeditorConfig = array("toolbar" => array(array("tokens","-","Source"),
?></select></p>
<p><? echo T_("Restrict appointments to shifts?"); ?> <input name="ras" type="checkbox" checked="checked"/></p>
<p><? echo T_("Restrict work to shifts?"); ?> <input name="rws" type="checkbox" checked="checked"/></p>
<p><? echo T_("Questionnaire for testing only?"); ?> <input name="testing" type="checkbox"/></p>
<div id='rstext' style='display:none;'>
<p><? echo T_("Respondent selection introduction:"); echo $CKEditor->editor("rs_intro","",$ckeditorConfig);?></p>
<p><? echo T_("Respondent selection project introduction:"); echo $CKEditor->editor("rs_project_intro","",$ckeditorConfig);?></p>
<p><? echo T_("Respondent selection callback (already started questionnaire):"); echo $CKEditor->editor("rs_callback","",$ckeditorConfig);?> </p>
<p><? echo T_("Message to leave on an answering machine:"); echo $CKEditor->editor("rs_answeringmachine","",$ckeditorConfig);?> </p>
<p><?php echo T_("Restrict appointments to shifts?"); ?> <input name="ras" type="checkbox" checked="checked"/></p>
<p><?php echo T_("Restrict work to shifts?"); ?> <input name="rws" type="checkbox" checked="checked"/></p>
<p><?php echo T_("Questionnaire for testing only?"); ?> <input name="testing" type="checkbox"/></p>
<p><?php echo T_("Allow for respondent self completion via email invitation?"); ?> <input name="respsc" type="checkbox" onchange="if(this.checked==true) show(this,'limesc'); else hide(this,'limesc');" /></p>
<div id='limesc' style='display:none;'>
<p><?php echo T_("Questionnaire display mode for respondent");?>: <select name="lime_mode"><option value="survey"><?php echo T_("All in one"); ?></option><option value="question"><?php echo T_("Question by question"); ?></option><option value="group"><?php echo T_("Group at a time"); ?></option></select></p>
<p><?php echo T_("Limesurvey template for respondent");?>: <select name="lime_template">
<?php
if ($handle = opendir(dirname(__FILE__)."/../include/limesurvey/templates")) {
while (false !== ($entry = readdir($handle))) {
if ($entry != "." && $entry != ".." && is_dir(dirname(__FILE__)."/../include/limesurvey/templates/" . $entry)){
echo "<option value=\"$entry\">$entry</option>";
}
}
closedir($handle);
}
?>
</select></p>
<p><?php echo T_("URL to forward respondents on self completion");?>: <input name="lime_endurl" type="text" value="http://www.acspri.org.au/"/></p>
</div>
<p><? echo T_("Project end text (thank you screen):");echo $CKEditor->editor("rs_project_end","",$ckeditorConfig); ?></p>
<p><? echo T_("Project information for interviewers/operators:");echo $CKEditor->editor("info","",$ckeditorConfig);?></p>
<p><input type="submit" name="import_file" value="<? echo T_("Create Questionnaire"); ?>"/></p>
<div id='rstext' style='display:none;'>
<p><?php echo T_("Respondent selection introduction:"); echo $CKEditor->editor("rs_intro","",$ckeditorConfig);?></p>
<p><?php echo T_("Respondent selection project introduction:"); echo $CKEditor->editor("rs_project_intro","",$ckeditorConfig);?></p>
<p><?php echo T_("Respondent selection callback (already started questionnaire):"); echo $CKEditor->editor("rs_callback","",$ckeditorConfig);?> </p>
<p><?php echo T_("Message to leave on an answering machine:"); echo $CKEditor->editor("rs_answeringmachine","",$ckeditorConfig);?> </p>
</div>
<p><?php echo T_("Project end text (thank you screen):");echo $CKEditor->editor("rs_project_end","",$ckeditorConfig); ?></p>
<p><?php echo T_("Project information for interviewers/operators:");echo $CKEditor->editor("info","",$ckeditorConfig);?></p>
<p><input type="submit" name="import_file" value="<?php echo T_("Create Questionnaire"); ?>"/></p>
</form>
<?
<?php
xhtml_foot();

View File

@@ -1,4 +1,4 @@
<?
<?php
/**
* List operators and allow for customised VoIP downloads, changing passwords, disabling, etc
*
@@ -45,35 +45,103 @@ include_once(dirname(__FILE__).'/../db.inc.php');
include_once(dirname(__FILE__).'/../functions/functions.xhtml.php');
$display = true;
$msg = "";
if (isset($_POST))
if (isset($_POST['submit']))
{
foreach($_POST as $key => $val)
$operator_id = intval($_POST['operator_id']);
$voip = $enabled = 0;
if (isset($_POST['voip'])) $voip = 1;
if (isset($_POST['enabled'])) $enabled = 1;
if (HTPASSWD_PATH !== false && $_POST['existing_username'] != $_POST['username'] && empty($_POST['password']))
{
if (substr($key,0,8) == "password")
$msg = T_("If changing usernames, you must specify a new password");
}
else
{
$sql = "UPDATE operator
SET username = " . $db->qstr($_POST['username']) . ",
lastName = " . $db->qstr($_POST['lastName']) . ",
firstName = " . $db->qstr($_POST['firstName']) . ",
extension = " . $db->qstr($_POST['extension']) . ",
extension_password = " . $db->qstr($_POST['extension_password']) . ",
Time_zone_name = " . $db->qstr($_POST['timezone']) . ",
voip = $voip, enabled = $enabled
WHERE operator_id = $operator_id";
$rs = $db->Execute($sql);
if (!empty($rs))
{
if (HTPASSWD_PATH !== false)
if (HTPASSWD_PATH !== false && !empty($_POST['password']))
{
$operator_id = intval(substr($key,8));
//update password in htaccess
include_once(dirname(__FILE__).'/../functions/functions.htpasswd.php');
$htp = New Htpasswd(HTPASSWD_PATH);
$htp->deleteUser($_POST["username" . $operator_id]);
$htp->addUser($_POST["username" . $operator_id],$val);
$htp->deleteUser($_POST["existing_username"]);
$htp->deleteUser($_POST["username"]);
$htp->addUser($_POST["username"],$_POST["password"]);
}
$msg = T_("Successfully updated user");
}
else if (substr($key,0,8) == "timezone")
else
{
$operator_id = intval(substr($key,8));
$tzone = $db->qstr($val);
$sql = "UPDATE operator
SET Time_zone_name = $tzone
WHERE operator_id = '$operator_id'";
$db->Execute($sql);
$msg = T_("Failed to update user. Please make sure the username and extension are unique");
}
}
$_GET['edit'] = $operator_id;
}
if (isset($_GET['edit']))
{
xhtml_head(T_("Operator edit"),true,array("../css/table.css"));
$operator_id = intval($_GET['edit']);
$sql = "SELECT *,
CONCAT('<select name=\'timezone\'>', (SELECT GROUP_CONCAT(CONCAT('<option ', CASE WHEN timezone_template.Time_zone_name LIKE operator.Time_zone_name THEN ' selected=\"selected\" ' ELSE '' END ,'value=\"', Time_zone_name, '\">', Time_zone_name, '</option>') SEPARATOR '') as tzones
FROM timezone_template),'</select>') as timezone
FROM operator
WHERE operator_id = $operator_id";
$rs = $db->GetRow($sql);
print "<h2>" . T_("Edit") . ": " . $rs['username'] . "</h2>";
echo "<p><a href='?'>" . T_("Go back") . "</a></p>";
if (!empty($msg)) print "<h3>$msg</h3>";
?>
<form action="?" method="post">
<div><label for="username"><?php echo T_("Username") . ": "; ?></label><input type='text' name='username' value="<?php echo $rs['username'];?>"/></div>
<?php
if (HTPASSWD_PATH !== false)
{ ?>
<div><label for="password"><?php echo T_("Update password (leave blank to keep existing password)") . ": "; ?></label><input type='text' name='password'/></div>
<?php }
?>
<div><label for="firstName"><?php echo T_("First name") . ": "; ?></label><input type='text' name='firstName' value="<?php echo $rs['firstName'];?>"/></div>
<div><label for="lastName"><?php echo T_("Last name") . ": "; ?></label><input type='text' name='lastName' value="<?php echo $rs['lastName'];?>"/></div>
<div><label for="extension"><?php echo T_("Extension") . ": "; ?></label><input type='text' name='extension' value="<?php echo $rs['extension'];?>"/></div>
<div><label for="extension_password"><?php echo T_("Extension Password") . ": "; ?></label><input type='text' name='extension_password' value="<?php echo $rs['extension_password'];?>"/></div>
<div><label for="timezone"><?php echo T_("Timezone") . ": ";?></label><?php echo $rs['timezone'];?></div>
<div><label for="enabled"><?php echo T_("Enabled") . "? ";?></label><input type="checkbox" name="enabled" <?php if ($rs['enabled'] == 1) echo "checked=\"checked\"";?> value="1" /></div>
<div><label for="voip"><?php echo T_("Uses VoIP") . "? ";?></label><input type="checkbox" name="voip" <?php if ($rs['voip'] == 1) echo "checked=\"checked\"";?> value="1" /></div>
<div><input type='hidden' name='operator_id' value='<?php echo $operator_id;?>'/></div>
<div><input type='hidden' name='existing_username' value="<?php echo $rs['username'];?>"/></div>
<div><input type="submit" name="submit" value="<?php echo T_("Update operator");?>"/></div>
</form>
<?php
xhtml_foot();
exit();
}
if (isset($_GET['voipdisable']))
{
$operator_id = intval($_GET['voipdisable']);
@@ -175,8 +243,8 @@ if ($display)
CONCAT('<a href=\'?voipenable=',operator_id,'\'>" . T_("Enable VoIP") . "</a>')
ELSE
CONCAT('<a href=\'?voipdisable=',operator_id,'\'>" . T_("Disable VoIP") . "</a>')
END
as voipenabledisable,
END as voipenabledisable,
CONCAT('<a href=\'?edit=',operator_id,'\'>" . T_("Edit") . "</a>') as edit,
username
FROM operator";
@@ -184,8 +252,8 @@ if ($display)
xhtml_head(T_("Operator list"),true,array("../css/table.css"));
$columns = array("name","username","enabledisable","timezone");
$titles = array(T_("Operator"),T_("Username"),T_("Enable/Disable"),T_("Update timezone"));
$columns = array("name","username","enabledisable","edit");
$titles = array(T_("Operator"),T_("Username"),T_("Enable/Disable"),T_("Edit"));
if (VOIP_ENABLED)
{
@@ -202,12 +270,6 @@ if ($display)
$titles[] = T_("*nix VoIP");
}
if (HTPASSWD_PATH !== false)
{
$columns[] = "password";
$titles[] = T_("Update password");
}
xhtml_table($rs,$columns,$titles);

View File

@@ -1,5 +1,4 @@
<?php
/**
<?php /**
* Display operator performance
*
*

View File

@@ -1,4 +1,4 @@
<?
<?php
/**
* Assign operators to questionnaires in a checkbox matrix
*
@@ -158,7 +158,7 @@ xhtml_head(T_("Assign operators to questionnaires"),false,array("../css/table.cs
<script type="text/javascript">
<?
<?php
print "questionnaire_id = new Array(";
$s = "";
@@ -241,7 +241,7 @@ function checkVid(v)
<body>
<?
<?php

View File

@@ -1,4 +1,4 @@
<?
<?php
/**
* Create an operator and link to a webserver username for authentication
*
@@ -173,8 +173,8 @@ xhtml_head(T_("Add an operator"));
if ($a)
{
?>
<h3><? echo $a; ?></h3>
<?
<h3><?php echo $a; ?></h3>
<?php
}
$sql = "SELECT Time_zone_name as value, Time_zone_name as description
@@ -183,29 +183,29 @@ $sql = "SELECT Time_zone_name as value, Time_zone_name as description
$rs = $db->GetAll($sql);
?>
<h1><? echo T_("Add an operator"); ?></h1>
<p><? echo T_("Adding an operator here will give the user the ability to call cases"); ?> <a href="operatorquestionnaire.php"><? echo T_("Assign Operator to Questionnaire"); ?></a> <? echo T_("tool"); ?>.</p>
<p><? echo T_("Use this form to enter the username of a user based on your directory security system. For example, if you have secured the base directory of queXS using Apache file based security, enter the usernames of the users here."); ?></p>
<h1><?php echo T_("Add an operator"); ?></h1>
<p><?php echo T_("Adding an operator here will give the user the ability to call cases"); ?> <a href="operatorquestionnaire.php"><?php echo T_("Assign Operator to Questionnaire"); ?></a> <?php echo T_("tool"); ?>.</p>
<p><?php echo T_("Use this form to enter the username of a user based on your directory security system. For example, if you have secured the base directory of queXS using Apache file based security, enter the usernames of the users here."); ?></p>
<form enctype="multipart/form-data" action="" method="post">
<p><? echo T_("Enter the username of an operator to add:"); ?> <input name="operator" type="text"/></p>
<? if (HTPASSWD_PATH !== false && HTGROUP_PATH !== false) { ?>
<p><? echo T_("Enter the password of an operator to add:"); ?> <input name="password" type="text"/></p>
<? } ?>
<p><? echo T_("Enter the first name of an operator to add:"); ?> <input name="firstname" type="text"/></p>
<p><? echo T_("Enter the surname of an operator to add:"); ?> <input name="lastname" type="text"/></p>
<p><a href='timezonetemplate.php'><? echo T_("Enter the Time Zone of an operator to add:"); echo "</a>"; display_chooser($rs,"Time_zone_name","Time_zone_name",false,false,false,false,array("value",DEFAULT_TIME_ZONE)); ?> </p>
<? if (FREEPBX_PATH == false) { ?>
<p><? echo T_("Enter the telephone extension number:"); ?> <input name="extension" type="text"/></p>
<p><? echo T_("Enter the telephone extension password:"); ?> <input name="extensionp" type="text"/></p>
<? } ?>
<p><? echo T_("Will this operator be using VoIP?"); ?> <input name="voip" type="checkbox" checked="checked"/></p>
<p><? echo T_("Is the operator a normal interviewer?"); ?> <input name="temporary" type="checkbox" checked="checked"/></p>
<p><? echo T_("Is the operator a supervisor?"); ?> <input name="supervisor" type="checkbox"/></p>
<p><? echo T_("Is the operator a refusal converter?"); ?> <input name="refusal" type="checkbox"/></p>
<p><input type="submit" value="<? echo T_("Add user"); ?>" /></p>
<p><?php echo T_("Enter the username of an operator to add:"); ?> <input name="operator" type="text"/></p>
<?php if (HTPASSWD_PATH !== false && HTGROUP_PATH !== false) { ?>
<p><?php echo T_("Enter the password of an operator to add:"); ?> <input name="password" type="text"/></p>
<?php } ?>
<p><?php echo T_("Enter the first name of an operator to add:"); ?> <input name="firstname" type="text"/></p>
<p><?php echo T_("Enter the surname of an operator to add:"); ?> <input name="lastname" type="text"/></p>
<p><a href='timezonetemplate.php'><?php echo T_("Enter the Time Zone of an operator to add:"); echo "</a>"; display_chooser($rs,"Time_zone_name","Time_zone_name",false,false,false,false,array("value",DEFAULT_TIME_ZONE)); ?> </p>
<?php if (FREEPBX_PATH == false) { ?>
<p><?php echo T_("Enter the telephone extension number:"); ?> <input name="extension" type="text"/></p>
<p><?php echo T_("Enter the telephone extension password:"); ?> <input name="extensionp" type="text"/></p>
<?php } ?>
<p><?php echo T_("Will this operator be using VoIP?"); ?> <input name="voip" type="checkbox" checked="checked"/></p>
<p><?php echo T_("Is the operator a normal interviewer?"); ?> <input name="temporary" type="checkbox" checked="checked"/></p>
<p><?php echo T_("Is the operator a supervisor?"); ?> <input name="supervisor" type="checkbox"/></p>
<p><?php echo T_("Is the operator a refusal converter?"); ?> <input name="refusal" type="checkbox"/></p>
<p><input type="submit" value="<?php echo T_("Add user"); ?>" /></p>
</form>
<?
<?php
xhtml_foot();

View File

@@ -1,4 +1,4 @@
<?
<?php
/**
* Assign operators to skills in a checkbox matrix
*
@@ -152,7 +152,7 @@ xhtml_head(T_("Assign operators to Skills"),false,array("../css/table.css"));
<script type="text/javascript">
<?
<?php
print "outcome_type_id = new Array(";
$s = "";
@@ -235,7 +235,7 @@ function checkVid(v)
<body>
<?
<?php

View File

@@ -1,5 +1,4 @@
<?php
/**
<?php /**
* Display outcomes by questionnaire
*
*

View File

@@ -1,4 +1,4 @@
<?
<?php
/**
* Run the VoIP monitoring process and monitor it via the database
*

View File

@@ -1,4 +1,4 @@
<?
<?php
/**
* Assign availability groups to a questionnaire
*
@@ -132,8 +132,8 @@ if ($questionnaire_id != false)
print "<h2>" . T_("Add an availability group to this questionnaire:") . "</h2>";
?>
<form action="" method="get">
<p><label for="availability_group"><? echo T_("Select availability group:"); ?></label><select name="availability_group" id="availability_group">
<?
<p><label for="availability_group"><?php echo T_("Select availability group:"); ?></label><select name="availability_group" id="availability_group">
<?php
foreach($qs as $q)
{
@@ -142,10 +142,10 @@ if ($questionnaire_id != false)
?>
</select><br/>
<input type="hidden" name="questionnaire_id" value="<? print($questionnaire_id); ?>"/>
<input type="hidden" name="questionnaire_id" value="<?php print($questionnaire_id); ?>"/>
<input type="submit" name="add_availability" value="Add availability group"/></p>
</form>
<?
<?php
}
}
xhtml_foot();

View File

@@ -1,4 +1,4 @@
<?
<?php
/**
* Manage questionnaires by editing them or disabling/enabling them
*
@@ -57,6 +57,149 @@ include("../include/ckeditor/ckeditor.php");
global $db;
if (isset($_POST['questionnaire_id']) && isset($_POST['submit']))
{
//Delete the questionnaire
$questionnaire_id = intval($_POST['questionnaire_id']);
$db->StartTrans();
$sql = "DELETE FROM `appointment`
WHERE case_id IN
(SELECT case_id
FROM `case`
WHERE questionnaire_id = $questionnaire_id)";
$db->Execute($sql);
$sql = "DELETE FROM `call`
WHERE case_id IN
(SELECT case_id
FROM `case`
WHERE questionnaire_id = $questionnaire_id)";
$db->Execute($sql);
$sql = "DELETE FROM `call_attempt`
WHERE case_id IN
(SELECT case_id
FROM `case`
WHERE questionnaire_id = $questionnaire_id)";
$db->Execute($sql);
$sql = "DELETE FROM `case_availability`
WHERE case_id IN
(SELECT case_id
FROM `case`
WHERE questionnaire_id = $questionnaire_id)";
$db->Execute($sql);
$sql = "DELETE FROM `case_note`
WHERE case_id IN
(SELECT case_id
FROM `case`
WHERE questionnaire_id = $questionnaire_id)";
$db->Execute($sql);
$sql = "DELETE FROM `contact_phone`
WHERE case_id IN
(SELECT case_id
FROM `case`
WHERE questionnaire_id = $questionnaire_id)";
$db->Execute($sql);
$sql = "DELETE FROM `respondent`
WHERE case_id IN
(SELECT case_id
FROM `case`
WHERE questionnaire_id = $questionnaire_id)";
$db->Execute($sql);
$sql = "DELETE FROM `client_questionnaire`
WHERE questionnaire_id = $questionnaire_id";
$db->Execute($sql);
$sql = "DELETE FROM `operator_questionnaire`
WHERE questionnaire_id = $questionnaire_id";
$db->Execute($sql);
$sql = "DELETE FROM `questionnaire_availability`
WHERE questionnaire_id = $questionnaire_id";
$db->Execute($sql);
$sql = "DELETE FROM `questionnaire_prefill`
WHERE questionnaire_id = $questionnaire_id";
$db->Execute($sql);
$sql = "DELETE FROM `questionnaire_sample`
WHERE questionnaire_id = $questionnaire_id";
$db->Execute($sql);
$sql = "DELETE FROM `questionnaire_sample_exclude_priority`
WHERE questionnaire_id = $questionnaire_id";
$db->Execute($sql);
$sql = "DELETE FROM `questionnaire_sample_priority`
WHERE questionnaire_id = $questionnaire_id";
$db->Execute($sql);
$sql = "DELETE FROM `questionnaire_sample_quota`
WHERE questionnaire_id = $questionnaire_id";
$db->Execute($sql);
$sql = "DELETE FROM `questionnaire_sample_quota_row`
WHERE questionnaire_id = $questionnaire_id";
$db->Execute($sql);
$sql = "DELETE FROM `questionnaire_sample_quota_row_exclude`
WHERE questionnaire_id = $questionnaire_id";
$db->Execute($sql);
$sql = "DELETE FROM `shift_report`
WHERE shift_id IN
(SELECT shift_id
FROM `shift`
WHERE questionnaire_id = $questionnaire_id)";
$db->Execute($sql);
$sql = "DELETE FROM `shift`
WHERE questionnaire_id = $questionnaire_id";
$db->Execute($sql);
$sql = "DELETE FROM `case`
WHERE questionnaire_id = $questionnaire_id";
$db->Execute($sql);
$sql = "DELETE FROM `questionnaire`
WHERE questionnaire_id = $questionnaire_id";
$db->Execute($sql);
$db->CompleteTrans();
}
if (isset($_GET['disable']))
{
$questionnaire_id = intval($_GET['disable']);
@@ -86,8 +229,10 @@ if (isset($_POST['update']) && isset($_GET['modify']))
$ras =0;
$rws = 0;
$rs = 0;
$respsc = 0;
if (isset($_POST['ras'])) $ras = 1;
if (isset($_POST['rws'])) $rws = 1;
if (isset($_POST['respsc'])) $respsc = 1;
$name = $db->qstr(html_entity_decode($_POST['description']));
if (isset($_POST['rs_intro']))
@@ -102,7 +247,7 @@ if (isset($_POST['update']) && isset($_GET['modify']))
$rs_project_end = $db->qstr(html_entity_decode($_POST['rs_project_end'],true));
$sql = "UPDATE questionnaire
SET description = $name, info = $info, rs_project_end = $rs_project_end, restrict_appointments_shifts = '$ras', restrict_work_shifts = '$rws'
SET description = $name, info = $info, rs_project_end = $rs_project_end, restrict_appointments_shifts = '$ras', restrict_work_shifts = '$rws', self_complete = $respsc
WHERE questionnaire_id = '$questionnaire_id'";
$db->Execute($sql);
@@ -116,10 +261,22 @@ if (isset($_POST['update']) && isset($_GET['modify']))
$db->Execute($sql);
}
if ($respsc == 1)
{
$lime_mode = $db->qstr($_POST['lime_mode'],get_magic_quotes_gpc());
$lime_template = $db->qstr($_POST['lime_template'],get_magic_quotes_gpc());
$lime_endurl = $db->qstr($_POST['lime_endurl'],get_magic_quotes_gpc());
$sql = "UPDATE questionnaire
SET lime_mode = $lime_mode, lime_template = $lime_template, lime_endurl = $lime_endurl
WHERE questionnaire_id = $questionnaire_id";
$db->Execute($sql);
}
}
xhtml_head(T_("Questionnaire list"),true,array("../css/table.css"));
xhtml_head(T_("Questionnaire list"),true,array("../css/table.css"),array("../js/new.js"));
if (isset($_GET['modify']))
@@ -150,38 +307,93 @@ if (isset($_GET['modify']))
$rs = $db->GetRow($sql);
$testing = $rws = $ras = "checked=\"checked\"";
$testing = $rws = $ras = $rsc = "checked=\"checked\"";
$rscd = "";
$aio = $qbq = $gat = "";
if ($rs['lime_mode'] == "survey") $aio = "selected=\"selected\"";
if ($rs['lime_mode'] == "question") $qbq = "selected=\"selected\"";
if ($rs['lime_mode'] == "group") $gat = "selected=\"selected\"";
if ($rs['restrict_appointments_shifts'] != 1) $ras = "";
if ($rs['restrict_work_shifts'] != 1) $rws = "";
if ($rs['testing'] != 1) $testing = "";
if ($rs['self_complete'] == 0)
{
$rsc = "";
$rscd = "style='display:none;'";
}
echo "<h1>" . $rs['description'] . "</h1>";
echo "<p><a href='?'>" . T_("Go back") . "</a></p>";
echo "<p><a href='" . LIME_URL . "admin/admin.php?sid={$rs['lime_sid']}'>" . T_("Edit instrument in Limesurvey") . "</a></p>";
?>
<form action="?modify=<? echo $questionnaire_id; ?>" method="post">
<p><? echo T_("Name for questionnaire:"); ?> <input type="text" name="description" value="<? echo $rs['description']; ?>"/></p>
<p><? echo T_("Restrict appointments to shifts?"); ?> <input name="ras" type="checkbox" <? echo $ras; ?>/></p>
<p><? echo T_("Restrict work to shifts?"); ?> <input name="rws" type="checkbox" <? echo $rws; ?>/></p>
<p><? echo T_("Questionnaire for testing only?"); ?> <input name="testing" type="checkbox" disabled="true" <? echo $testing; ?>/></p>
<? if ($rs['respondent_selection'] == 1 && empty($rs['lime_rs_sid'])) { ?>
<p><? echo T_("Respondent selection introduction:"); echo $CKEditor->editor("rs_intro",$rs['rs_intro'],$ckeditorConfig);?></p>
<p><? echo T_("Respondent selection project introduction:"); echo $CKEditor->editor("rs_project_intro",$rs['rs_project_intro'],$ckeditorConfig);?></p>
<p><? echo T_("Respondent selection callback (already started questionnaire):"); echo $CKEditor->editor("rs_callback",$rs['rs_callback'],$ckeditorConfig);?> </p>
<p><? echo T_("Message to leave on an answering machine:"); echo $CKEditor->editor("rs_answeringmachine",$rs['rs_answeringmachine'],$ckeditorConfig);?> </p>
<? } else if (!empty($rs['lime_rs_sid'])) { echo "<p><a href='" . LIME_URL . "admin/admin.php?sid={$rs['lime_rs_sid']}'>" . T_("Edit respondent selection instrument in Limesurvey") . "</a></p>"; } ?>
<p><? echo T_("Project end text (thank you screen):");echo $CKEditor->editor("rs_project_end",$rs['rs_project_end'],$ckeditorConfig); ?></p>
<p><? echo T_("Project information for interviewers/operators:");echo $CKEditor->editor("info",$rs['info'],$ckeditorConfig); ?></p>
<p><input type="submit" name="update" value="<? echo T_("Update Questionnaire"); ?>"/></p>
<form action="?modify=<?php echo $questionnaire_id; ?>" method="post">
<p><?php echo T_("Name for questionnaire:"); ?> <input type="text" name="description" value="<?php echo $rs['description']; ?>"/></p>
<p><?php echo T_("Restrict appointments to shifts?"); ?> <input name="ras" type="checkbox" <?php echo $ras; ?>/></p>
<p><?php echo T_("Restrict work to shifts?"); ?> <input name="rws" type="checkbox" <?php echo $rws; ?>/></p>
<p><?php echo T_("Questionnaire for testing only?"); ?> <input name="testing" type="checkbox" disabled="true" <?php echo $testing; ?>/></p>
<p><?php echo T_("Allow for respondent self completion via email invitation?"); ?> <input name="respsc" type="checkbox" <?php echo $rsc ?> onchange="if(this.checked==true) show(this,'limesc'); else hide(this,'limesc');" /></p>
<div id='limesc' <?php echo $rscd; ?>>
<p><?php echo T_("Questionnaire display mode for respondent");?>: <select name="lime_mode"><option <?php echo $aio;?> value="survey"><?php echo T_("All in one"); ?></option><option <?php echo $qbq; ?> value="question"><?php echo T_("Question by question"); ?></option><option <?php echo $gat; ?> value="group"><?php echo T_("Group at a time"); ?></option></select></p>
<p><?php echo T_("Limesurvey template for respondent");?>: <select name="lime_template">
<?php
if ($handle = opendir(dirname(__FILE__)."/../include/limesurvey/templates")) {
while (false !== ($entry = readdir($handle))) {
if ($entry != "." && $entry != ".." && is_dir(dirname(__FILE__)."/../include/limesurvey/templates/" . $entry)){
echo "<option value=\"$entry\" ";
if ($rs['lime_template'] == $entry) echo " selected=\"selected\" ";
echo ">$entry</option>";
}
}
closedir($handle);
}
?>
</select></p>
<p><?php echo T_("URL to forward respondents on self completion");?>: <input name="lime_endurl" type="text" value="<?php echo $rs['lime_endurl']; ?>"/></p>
</div>
<?php if ($rs['respondent_selection'] == 1 && empty($rs['lime_rs_sid'])) { ?>
<p><?php echo T_("Respondent selection introduction:"); echo $CKEditor->editor("rs_intro",$rs['rs_intro'],$ckeditorConfig);?></p>
<p><?php echo T_("Respondent selection project introduction:"); echo $CKEditor->editor("rs_project_intro",$rs['rs_project_intro'],$ckeditorConfig);?></p>
<p><?php echo T_("Respondent selection callback (already started questionnaire):"); echo $CKEditor->editor("rs_callback",$rs['rs_callback'],$ckeditorConfig);?> </p>
<p><?php echo T_("Message to leave on an answering machine:"); echo $CKEditor->editor("rs_answeringmachine",$rs['rs_answeringmachine'],$ckeditorConfig);?> </p>
<?php } else if (!empty($rs['lime_rs_sid'])) { echo "<p><a href='" . LIME_URL . "admin/admin.php?sid={$rs['lime_rs_sid']}'>" . T_("Edit respondent selection instrument in Limesurvey") . "</a></p>"; } ?>
<p><?php echo T_("Project end text (thank you screen):");echo $CKEditor->editor("rs_project_end",$rs['rs_project_end'],$ckeditorConfig); ?></p>
<p><?php echo T_("Project information for interviewers/operators:");echo $CKEditor->editor("info",$rs['info'],$ckeditorConfig); ?></p>
<p><input type="submit" name="update" value="<?php echo T_("Update Questionnaire"); ?>"/></p>
</form>
<?
<?php
}
else if (isset($_GET['delete']))
{
$questionnaire_id = intval($_GET['delete']);
$sql = "SELECT *
FROM questionnaire
WHERE questionnaire_id = $questionnaire_id";
$rs = $db->GetRow($sql);
echo "<h1>" . $rs['description'] . "</h1>";
echo "<p><a href='?'>" . T_("Go back") . "</a></p>";
print "<p>" . T_("Any collected data and the limesurvey instrument will NOT be deleted") . "</p>";
print "<p>" . T_("The questionnaire will be deleted from queXS including call history, cases, case notes, respondent details, appointments and the links between operators, clients and the questionnaire") . "</p>";
print "<p>" . T_("Please confirm you wish to delete the questionnaire") . "</p>";
print "<form method='post' action='?'>";
print "<p><input type='submit' name='submit' value='" . T_("Delete this questionnaire") . "'/>";
print "<input type='hidden' name='questionnaire_id' value='$questionnaire_id'/></p>";
print "</form>";
}
else
{
$columns = array("description","enabledisable","modify");
$titles = array(T_("Questionnaire"),T_("Enable/Disable"),("Modify"));
$columns = array("description","enabledisable","modify","deletee");
$titles = array(T_("Questionnaire"),T_("Enable/Disable"),T_("Modify"),T_("Delete"));
$sql = "SELECT
description,
@@ -191,7 +403,8 @@ else
CONCAT('<a href=\'?disable=',questionnaire_id,'\'>" . T_("Disable") . "</a>')
END
as enabledisable,
CONCAT('<a href=\'?modify=',questionnaire_id,'\'>" . T_("Modify"). "</a>') as modify
CONCAT('<a href=\'?modify=',questionnaire_id,'\'>" . T_("Modify"). "</a>') as modify,
CONCAT('<a href=\'?delete=',questionnaire_id,'\'>" . T_("Delete"). "</a>') as deletee
FROM questionnaire";
$rs = $db->GetAll($sql);

View File

@@ -1,4 +1,4 @@
<?
<?php
/**
* Select and set questions to pre fill in the questionnaire
*
@@ -171,16 +171,16 @@ if ($questionnaire_id != false)
?>
<form action="" method="get">
<p>
<label for="value"><? echo T_("The value to pre fill"); ?> </label><input type="text" name="value" id="value"/> <br/>
<label for="svar"><? echo T_("or: Select pre fill from sample list"); ?> </label>
<? //display a list of possible sample variables for this questionnaire
<label for="value"><?php echo T_("The value to pre fill"); ?> </label><input type="text" name="value" id="value"/> <br/>
<label for="svar"><?php echo T_("or: Select pre fill from sample list"); ?> </label>
<?php //display a list of possible sample variables for this questionnaire
display_chooser($db->GetAll($sql),"svar","svar",true,false,false,false,false);
?> <br/>
<input type="hidden" name="questionnaire_id" value="<? print($questionnaire_id); ?>"/>
<input type="hidden" name="sgqa" value="<? print($sgqa); ?>"/>
<input type="submit" name="add_prefill" value="<? print(T_("Add pre fill")); ?>"/></p>
<input type="hidden" name="questionnaire_id" value="<?php print($questionnaire_id); ?>"/>
<input type="hidden" name="sgqa" value="<?php print($sgqa); ?>"/>
<input type="submit" name="add_prefill" value="<?php print(T_("Add pre fill")); ?>"/></p>
</form>
<?
<?php
}
}
xhtml_foot();

View File

@@ -1,4 +1,4 @@
<?
<?php
/**
* Set quota's for answered questions
*
@@ -210,15 +210,15 @@ if ($questionnaire_id != false)
?>
<form action="" method="get">
<p>
<label for="value"><? echo T_("The code value to compare"); ?> </label><input type="text" name="value" id="value"/> <br/>
<label for="comparison"><? echo T_("The type of comparison"); ?></label><select name="comparison" id="comparison"><option value="LIKE">LIKE</option><option value="NOT LIKE">NOT LIKE</option><option value="=">=</option><option value="!=">!=</option><option value="&lt;">&lt;</option><option value="&gt;">&gt;</option><option value="&lt;=">&lt;=</option><option value="&gt;=">&gt;=</option></select><br/>
<label for="completions"><? echo T_("The number of completions to stop calling at"); ?> </label><input type="text" name="completions" id="completions"/> <br/>
<input type="hidden" name="questionnaire_id" value="<? print($questionnaire_id); ?>"/>
<input type="hidden" name="sample_import_id" value="<? print($sample_import_id); ?>"/>
<input type="hidden" name="sgqa" value="<? print($sgqa); ?>"/>
<input type="submit" name="add_quota" value="<? print(T_("Add quota")); ?>"/></p>
<label for="value"><?php echo T_("The code value to compare"); ?> </label><input type="text" name="value" id="value"/> <br/>
<label for="comparison"><?php echo T_("The type of comparison"); ?></label><select name="comparison" id="comparison"><option value="LIKE">LIKE</option><option value="NOT LIKE">NOT LIKE</option><option value="=">=</option><option value="!=">!=</option><option value="&lt;">&lt;</option><option value="&gt;">&gt;</option><option value="&lt;=">&lt;=</option><option value="&gt;=">&gt;=</option></select><br/>
<label for="completions"><?php echo T_("The number of completions to stop calling at"); ?> </label><input type="text" name="completions" id="completions"/> <br/>
<input type="hidden" name="questionnaire_id" value="<?php print($questionnaire_id); ?>"/>
<input type="hidden" name="sample_import_id" value="<?php print($sample_import_id); ?>"/>
<input type="hidden" name="sgqa" value="<?php print($sgqa); ?>"/>
<input type="submit" name="add_quota" value="<?php print(T_("Add quota")); ?>"/></p>
</form>
<?
<?php
}
}
}

View File

@@ -1,5 +1,4 @@
<?php
/**
<?php /**
* Display a report of all quota's
* a. (Standard quota) Monitor outcomes of questions in completed questionnaires, and exclude selected sample records when completion limit is reached
* b. (Replicate quota) Exclude selected sample records
@@ -271,7 +270,7 @@ if ($questionnaire_id)
JOIN `sample` as sam ON (c.sample_id = sam.sample_id AND sam.import_id = '$sample_import_id')
WHERE ".implode(' AND ',$sqlq)." "."
AND submitdate IS NOT NULL
AND s.token = c.case_id";
AND s.token = c.token";
$rs = $db->GetRow($sql);

View File

@@ -1,4 +1,4 @@
<?
<?php
/**
* Set quota's for answered questions and be able to exclude sample records by row
* instead of an entire sample
@@ -297,24 +297,24 @@ if ($questionnaire_id != false)
?>
<form action="" method="get">
<p>
<label for="description"><? echo T_("Describe this quota"); ?> </label><input type="text" name="description" id="description"/> <br/>
<label for="priority"><? echo T_("Quota priority (50 is default, 100 highest, 0 lowest)"); ?> </label><input type="text" name="priority" id="priority" value="50"/> <br/>
<label for="autoprioritise"><? echo T_("Should the priority be automatically updated based on the number of completions in this quota?"); ?> </label><input type="checkbox" name="autoprioritise" id="autoprioritise"/> <br/>
<? if ($sgqa != -1) { if ($sgqa != -2) { ?>
<label for="value"><? echo T_("The code value to compare"); ?> </label><input type="text" name="value" id="value"/> <br/>
<label for="comparison"><? echo T_("The type of comparison"); ?></label><select name="comparison" id="comparison"><option value="LIKE">LIKE</option><option value="NOT LIKE">NOT LIKE</option><option value="=">=</option><option value="!=">!=</option><option value="&lt;">&lt;</option><option value="&gt;">&gt;</option><option value="&lt;=">&lt;=</option><option value="&gt;=">&gt;=</option></select><br/>
<? } else { ?>
<label for="description"><?php echo T_("Describe this quota"); ?> </label><input type="text" name="description" id="description"/> <br/>
<label for="priority"><?php echo T_("Quota priority (50 is default, 100 highest, 0 lowest)"); ?> </label><input type="text" name="priority" id="priority" value="50"/> <br/>
<label for="autoprioritise"><?php echo T_("Should the priority be automatically updated based on the number of completions in this quota?"); ?> </label><input type="checkbox" name="autoprioritise" id="autoprioritise"/> <br/>
<?php if ($sgqa != -1) { if ($sgqa != -2) { ?>
<label for="value"><?php echo T_("The code value to compare"); ?> </label><input type="text" name="value" id="value"/> <br/>
<label for="comparison"><?php echo T_("The type of comparison"); ?></label><select name="comparison" id="comparison"><option value="LIKE">LIKE</option><option value="NOT LIKE">NOT LIKE</option><option value="=">=</option><option value="!=">!=</option><option value="&lt;">&lt;</option><option value="&gt;">&gt;</option><option value="&lt;=">&lt;=</option><option value="&gt;=">&gt;=</option></select><br/>
<?php } else { ?>
<input type="hidden" name="value" value="-2"/>
<input type="hidden" name="comparison" value="-2"/>
<? } ?>
<label for="completions"><? echo T_("The number of completions to stop calling at"); ?> </label><input type="text" name="completions" id="completions"/> <br/>
<? } else { ?>
<?php } ?>
<label for="completions"><?php echo T_("The number of completions to stop calling at"); ?> </label><input type="text" name="completions" id="completions"/> <br/>
<?php } else { ?>
<input type="hidden" name="value" value="-1"/>
<input type="hidden" name="comparison" value="-1"/>
<input type="hidden" name="completions" value="-1"/>
<? } ?>
<label for="exclude_val"><? echo T_("Exclude from the sample where the value is like"); ?></label>
<?
<?php } ?>
<label for="exclude_val"><?php echo T_("Exclude from the sample where the value is like"); ?></label>
<?php
$sql = "SELECT sv.val as value, sv.val as description, '' AS selected
FROM sample_var AS sv, sample AS s
@@ -327,13 +327,13 @@ if ($questionnaire_id != false)
flush();
?>
<br/>
<input type="hidden" name="exclude_var" value="<? print($sample_var); ?>"/>
<input type="hidden" name="questionnaire_id" value="<? print($questionnaire_id); ?>"/>
<input type="hidden" name="sample_import_id" value="<? print($sample_import_id); ?>"/>
<input type="hidden" name="sgqa" value="<? print($sgqa); ?>"/>
<input type="submit" name="add_quota" value="<? print(T_("Add row quota")); ?>"/></p>
<input type="hidden" name="exclude_var" value="<?php print($sample_var); ?>"/>
<input type="hidden" name="questionnaire_id" value="<?php print($questionnaire_id); ?>"/>
<input type="hidden" name="sample_import_id" value="<?php print($sample_import_id); ?>"/>
<input type="hidden" name="sgqa" value="<?php print($sgqa); ?>"/>
<input type="submit" name="add_quota" value="<?php print(T_("Add row quota")); ?>"/></p>
</form>
<?
<?php
}
}
}

View File

@@ -1,5 +1,4 @@
<?php
/**
<?php /**
* Display sample call attempt report (A listing of how many attempts made for cases within a sample)
*
*

View File

@@ -1,4 +1,4 @@
<?
<?php
/**
* Select and search within a sample to see what case(s) is/are assigned to a sample record
* and if so to look at them, otherwise give the option to remove a sample record
@@ -153,12 +153,12 @@ if ($sample_import_id != false)
?>
<form action="" method="get">
<p>
<label for="search"><? echo T_("Search for:"); ?></label><input type="text" name="search" id="search"/><br/>
<input type="hidden" name="sample_import_id" value="<? print($sample_import_id); ?>"/>
<input type="submit" name="searchsub" value="<? echo T_("Start search"); ?>"/>
<label for="search"><?php echo T_("Search for:"); ?></label><input type="text" name="search" id="search"/><br/>
<input type="hidden" name="sample_import_id" value="<?php print($sample_import_id); ?>"/>
<input type="submit" name="searchsub" value="<?php echo T_("Start search"); ?>"/>
</p>
</form>
<?
<?php
}
xhtml_foot();

View File

@@ -1,5 +1,4 @@
<?php
/**
<?php /**
* List and edit reports on shifts
*
*

View File

@@ -1,4 +1,4 @@
<?
<?php
/**
* Modify the standard shift template
*
@@ -114,7 +114,7 @@ translate_array($daysofweek,array("description"));
?>
<form method="post" action="">
<table>
<?
<?php
print "<tr><th>" . T_("Day") . "</th><th>" . T_("Start") . "</th><th>" . T_("End") . "</th></tr>";
$count = 0;
foreach($shifts as $shift)
@@ -131,10 +131,10 @@ translate_array($daysofweek,array("description"));
?>
</table>
<div><a onclick="addRow(); return false;" href="#"><? echo T_("Add row"); ?></a></div>
<p><input type="submit" name="submit" value="<? echo T_("Save changes to shifts"); ?>"/></p>
<div><a onclick="addRow(); return false;" href="#"><?php echo T_("Add row"); ?></a></div>
<p><input type="submit" name="submit" value="<?php echo T_("Save changes to shifts"); ?>"/></p>
</form>
<?
<?php
xhtml_foot();

View File

@@ -1,4 +1,4 @@
<?
<?php
/**
* View cases referred to the supervisor and add notes/assign outcomes
*
@@ -105,10 +105,10 @@ if (!empty($rs))
?>
<form action="" method="get">
<p>
<label for="case_id"><? echo T_("Case id:"); ?> </label><input type="text" name="case_id" id="case_id" value="<? echo $case_id; ?>"/>
<input type="submit" name="case_form" value="<? echo T_("Select case"); ?>"/></p>
<label for="case_id"><?php echo T_("Case id:"); ?> </label><input type="text" name="case_id" id="case_id" value="<?php echo $case_id; ?>"/>
<input type="submit" name="case_form" value="<?php echo T_("Select case"); ?>"/></p>
</form>
<?
<?php
if (isset($_GET['call_id']))
{
@@ -127,7 +127,7 @@ if (isset($_GET['call_id']))
?>
<form method="get" action="?">
<?
<?php
$sql = "SELECT o.outcome_id as value,description, CASE WHEN o.outcome_id = c.outcome_id THEN 'selected=\'selected\'' ELSE '' END AS selected
FROM outcome as o, `call` as c
WHERE c.call_id = '$call_id'";
@@ -136,9 +136,9 @@ if (isset($_GET['call_id']))
translate_array($rs2,array("description"));
display_chooser($rs2, "set_outcome_id", "set_outcome_id",true,false,false);
?>
<p><input type="hidden" name="call_id" value="<? echo $call_id;?>"/><input type="hidden" name="case_id" value="<? echo $case_id;?>"/><input class="submitclass" type="submit" name="submit" value="<? echo T_("Set outcome"); ?>"/></p>
<p><input type="hidden" name="call_id" value="<?php echo $call_id;?>"/><input type="hidden" name="case_id" value="<?php echo $case_id;?>"/><input class="submitclass" type="submit" name="submit" value="<?php echo T_("Set outcome"); ?>"/></p>
</form>
<?
<?php
}
}
if ($case_id != false)
@@ -289,10 +289,10 @@ if ($case_id != false)
?>
<form method="get" action="?">
<p>
<input type="hidden" name="case_id" value="<? echo $case_id;?>"/><input type="text" class="textclass" name="note" id="note"/><input class="submitclass" type="submit" name="submit" value="<? echo T_("Add note"); ?>"/>
<input type="hidden" name="case_id" value="<?php echo $case_id;?>"/><input type="text" class="textclass" name="note" id="note"/><input class="submitclass" type="submit" name="submit" value="<?php echo T_("Add note"); ?>"/>
</p>
</form>
<?
<?php
//Modify the case in Limesurvey
@@ -309,7 +309,7 @@ if ($case_id != false)
?>
<form method="get" action="?">
<?
<?php
$sql = "SELECT outcome_id as value,description, CASE WHEN outcome_id = '$current_outcome_id' THEN 'selected=\'selected\'' ELSE '' END AS selected
FROM outcome";
@@ -318,9 +318,9 @@ if ($case_id != false)
display_chooser($rs2, "outcome_id", "outcome_id",true,false,false);
?>
<p><input type="hidden" name="case_id" value="<? echo $case_id;?>"/><input class="submitclass" type="submit" name="submit" value="<? echo T_("Set outcome"); ?>"/></p>
<p><input type="hidden" name="case_id" value="<?php echo $case_id;?>"/><input class="submitclass" type="submit" name="submit" value="<?php echo T_("Set outcome"); ?>"/></p>
</form>
<?
<?php
//view availability
if (is_using_availability($case_id))
@@ -355,9 +355,9 @@ if ($case_id != false)
}
?>
<p><input type="hidden" name="case_id" value="<? echo $case_id;?>"/><input class="submitclass" type="submit" name="submitag" value="<? echo T_("Update case availability"); ?>"/></p>
<p><input type="hidden" name="case_id" value="<?php echo $case_id;?>"/><input class="submitclass" type="submit" name="submitag" value="<?php echo T_("Update case availability"); ?>"/></p>
</form>
<?
<?php
}
else
{
@@ -370,7 +370,7 @@ if ($case_id != false)
print "<h3>" . T_("Assign this case to operator (will appear as next case for them)") . "</h3>";
?>
<form method="get" action="?">
<?
<?php
$sql = "SELECT operator_id as value,CONCAT(firstName,' ', lastName) as description, CASE WHEN next_case_id = '$case_id' THEN 'selected=\'selected\'' ELSE '' END AS selected
FROM operator
WHERE enabled = 1";
@@ -379,9 +379,9 @@ if ($case_id != false)
display_chooser($rs3, "operator_id", "operator_id",true,false,false);
?>
<p><input type="hidden" name="case_id" value="<? echo $case_id;?>"/><input class="submitclass" type="submit" name="submit" value="<? echo T_("Assign this case to operator"); ?>"/></p>
<p><input type="hidden" name="case_id" value="<?php echo $case_id;?>"/><input class="submitclass" type="submit" name="submit" value="<?php echo T_("Assign this case to operator"); ?>"/></p>
</form>
<?
<?php
}

View File

@@ -1,4 +1,4 @@
<?
<?php
/**
* Run the system wide case sorting process and monitor it's progress
*

View File

@@ -1,4 +1,4 @@
<?
<?php
/**
* Run the system wide case sorting process
*

View File

@@ -1,4 +1,4 @@
<?
<?php
/**
* Modify the default timezones
*
@@ -113,10 +113,10 @@ foreach($qs as $q)
print "<h1>" . T_("Add a Timezone:") . "</h1>";
?>
<form action="" method="get"><p>
<label for="time_zone"><? echo T_("Timezone: "); ?></label><? display_chooser($tzl, 'time_zone', 'time_zone', false, false, false, false, false); ?>
<input type="submit" name="add_timezone" value="<? echo T_("Add Timezone"); ?>"/></p>
<label for="time_zone"><?php echo T_("Timezone: "); ?></label><?php display_chooser($tzl, 'time_zone', 'time_zone', false, false, false, false, false); ?>
<input type="submit" name="add_timezone" value="<?php echo T_("Add Timezone"); ?>"/></p>
</form>
<?
<?php
xhtml_foot();

View File

@@ -1,4 +1,4 @@
<?
<?php
/**
* Run the VoIP monitoring process and monitor it via the database
*

View File

@@ -1,4 +1,4 @@
<?
<?php
/**
* Create an appointment for the currently assigned case
*
@@ -99,8 +99,10 @@ if(isset($_POST['start']) && isset($_POST['end']) && isset($_POST['day']) && iss
$start = $_POST['start'];
$end = $_POST['end'];
$call_attempt_id = get_call_attempt($operator_id,false);
$require_operator_id = false;
if (isset($_POST['require_operator_id'])) $require_operator_id = bigintval($_POST['require_operator_id']);
make_appointment($respondent_id,$case_id,$contact_phone_id,$call_attempt_id,$day,$month,$year,$start,$end);
make_appointment($respondent_id,$case_id,$contact_phone_id,$call_attempt_id,$day,$month,$year,$start,$end,$require_operator_id);
$db->CompleteTrans();
@@ -129,12 +131,12 @@ if(isset($_GET['respondent_id']) && $_GET['respondent_id'] == 0)
{
//ability to create a new one
?>
<p><? echo T_("Create new respondent:"); ?></p>
<p><?php echo T_("Create new respondent:"); ?></p>
<form id="addRespondent" method="post" action="">
<? display_respondent_form(); ?>
<p><input type="submit" value="<? echo T_("Add this respondent"); ?>"/></p>
<?php display_respondent_form(); ?>
<p><input type="submit" value="<?php echo T_("Add this respondent"); ?>"/></p>
</form>
<?
<?php
}
else if(isset($_GET['respondent_id']))
{
@@ -179,18 +181,18 @@ else if(isset($_GET['respondent_id']))
{
//ability to add a new one
?>
<p><? echo T_("Add new phone number (with area code, eg 0398761234):"); ?></p>
<p><?php echo T_("Add new phone number (with area code, eg 0398761234):"); ?></p>
<form id="addPhone" method="get" action="">
<p><input type="text" name="phonenum"/></p>
<p><input type="submit" value="<? echo T_("Add this phone number"); ?>"/>
<input type="hidden" name="start" value="<? print $_GET['start']; ?>"/>
<input type="hidden" name="end" value="<? print $_GET['end']; ?>"/>
<input type="hidden" name="d" value="<? print $day; ?>"/>
<input type="hidden" name="m" value="<? print $month; ?>"/>
<input type="hidden" name="y" value="<? print $year; ?>"/>
<input type="hidden" name="respondent_id" value="<? print $respondent_id; ?>"/></p>
<p><input type="submit" value="<?php echo T_("Add this phone number"); ?>"/>
<input type="hidden" name="start" value="<?php print $_GET['start']; ?>"/>
<input type="hidden" name="end" value="<?php print $_GET['end']; ?>"/>
<input type="hidden" name="d" value="<?php print $day; ?>"/>
<input type="hidden" name="m" value="<?php print $month; ?>"/>
<input type="hidden" name="y" value="<?php print $year; ?>"/>
<input type="hidden" name="respondent_id" value="<?php print $respondent_id; ?>"/></p>
</form>
<?
<?php
}
else
{
@@ -201,20 +203,22 @@ else if(isset($_GET['respondent_id']))
}
?>
<p><? echo T_("Appointment:"); ?></p>
<p><?php echo T_("Appointment:"); ?></p>
<form id="appointment" method="post" action="">
<? print "<p>" . T_("Accept appointment from ") .convert_time($_GET['start']).T_(" till ").convert_time($_GET['end']).T_(" on ") . "$day/$month/$year? " . T_("on") . " $phonenum </p>"; ?>
<?php print "<p>" . T_("Accept appointment from ") .convert_time($_GET['start']).T_(" till ").convert_time($_GET['end']).T_(" on ") . "$day/$month/$year? " . T_("on") . " $phonenum </p>"; ?>
<p>
<input type="hidden" name="start" value="<? print $_GET['start']; ?>"/>
<input type="hidden" name="end" value="<? print $_GET['end']; ?>"/>
<input type="hidden" name="day" value="<? print $day; ?>"/>
<input type="hidden" name="month" value="<? print $month; ?>"/>
<input type="hidden" name="year" value="<? print $year; ?>"/>
<input type="hidden" name="respondent_id" value="<? print $respondent_id; ?>"/>
<input type="hidden" name="contact_phone_id" value="<? print $contact_phone_id; ?>"/>
<?php print "<p><label for='require_operator_id'>" . T_("Appointment with myself only?"); ?></label>
<input type="checkbox" id="require_operator_id" name="require_operator_id" value="<?php echo $operator_id;?>">
<input type="hidden" name="start" value="<?php print $_GET['start']; ?>"/>
<input type="hidden" name="end" value="<?php print $_GET['end']; ?>"/>
<input type="hidden" name="day" value="<?php print $day; ?>"/>
<input type="hidden" name="month" value="<?php print $month; ?>"/>
<input type="hidden" name="year" value="<?php print $year; ?>"/>
<input type="hidden" name="respondent_id" value="<?php print $respondent_id; ?>"/>
<input type="hidden" name="contact_phone_id" value="<?php print $contact_phone_id; ?>"/>
<input type="submit" value="Make appointment"/></p>
</form>
<?
<?php
}
}

View File

@@ -1,4 +1,4 @@
<?
<?php
/**
* Display appointments for this case and their outcomes if any
*
@@ -67,10 +67,11 @@ $rs = "";
if ($case_id)
{
$sql = "SELECT DATE_FORMAT(CONVERT_TZ(c.start,'UTC',r.Time_zone_name),'".DATE_TIME_FORMAT."') as start,DATE_FORMAT(CONVERT_TZ(c.end,'UTC',r.Time_zone_name),'".TIME_FORMAT."') as end, c.completed_call_id, IFNULL(ou.firstName,'" . T_("Not yet called") . "') as firstName, CONCAT(r.firstName, ' ', r.lastName) as respname, IFNULL(o.description,'" . T_("Not yet called") . "') as des
$sql = "SELECT DATE_FORMAT(CONVERT_TZ(c.start,'UTC',r.Time_zone_name),'".DATE_TIME_FORMAT."') as start,DATE_FORMAT(CONVERT_TZ(c.end,'UTC',r.Time_zone_name),'".TIME_FORMAT."') as end, c.completed_call_id, IFNULL(ou.firstName,'" . T_("Not yet called") . "') as firstName, CONCAT(r.firstName, ' ', r.lastName) as respname, IFNULL(o.description,'" . T_("Not yet called") . "') as des, IFNULL(ao.firstName,'" . T_("Any operator") . "') as witho
FROM `appointment` as c
JOIN respondent as r on (r.respondent_id = c.respondent_id)
LEFT JOIN (`call` as ca, outcome as o, operator as ou) on (ca.call_id = c.completed_call_id and ca.outcome_id = o.outcome_id and ou.operator_id = ca.operator_id)
LEFT JOIN operator AS ao ON (ao.operator_id = c.require_operator_id)
WHERE c.case_id = '$case_id'
ORDER BY c.start DESC";
@@ -86,7 +87,7 @@ if (empty($rs))
else
{
translate_array($rs,array("des"));
xhtml_table($rs,array("start","end","respname","des","firstName"),array(T_("Start"),T_("End"),T_("Respondent"),T_("Outcome"),T_("Operator")));
xhtml_table($rs,array("start","end","respname","witho","des","firstName"),array(T_("Start"),T_("End"),T_("Respondent"),T_("Appointment with"),T_("Outcome"),T_("Operator")));
}

View File

@@ -1,4 +1,4 @@
<?
<?php
/**
* Update case availability
*

View File

@@ -1,4 +1,4 @@
<?
<?php
/**
* Popup screen to manage calling and hanging up and assigning outcomes to calls
*
@@ -126,6 +126,7 @@ function display_outcomes($contacted,$ca,$case_id)
WHERE contacted = '$contacted'
AND outcome_id != 10"; //don't show completed if not
}
}
}
$rs = $db->GetAll($sql);
@@ -133,7 +134,17 @@ function display_outcomes($contacted,$ca,$case_id)
print "<div>";
if (!empty($rs))
{
$do = false;
$lime_sid = get_limesurvey_id(get_operator_id());
//Check to see if we have sent an email on this call and set the default outcome
$sql = "SELECT 41
FROM `case` as c, " . LIME_PREFIX . "tokens_$lime_sid as t
WHERE t.sent = '$ca'
AND c.case_id = $case_id
AND t.token = c.token";
$do = $db->GetOne($sql);
if (isset($_GET['defaultoutcome'])) $do = bigintval($_GET['defaultoutcome']);
foreach($rs as $r)
{

View File

@@ -1,4 +1,4 @@
<?
<?php
/**
* Popup screen to manage calling and hanging up and assigning outcomes to calls
*

View File

@@ -1,4 +1,4 @@
<?
<?php
/**
* Display a list of calls and outcomes for this operator over time
*

View File

@@ -1,4 +1,4 @@
<?
<?php
/**
* Display a list of calls and outcomes for this case
*

View File

@@ -1,4 +1,4 @@
<?
<?php
/**
* Display notes for this case and the ability to add notes
*
@@ -63,12 +63,12 @@ if (isset($_GET['add']))
?>
<form method="post" action="?">
<p>
<input type="text" class="textclass" name="note" id="note"/><input class="submitclass" type="submit" name="submit" value="<? echo T_("Add note"); ?>"/>
<input type="text" class="textclass" name="note" id="note"/><input class="submitclass" type="submit" name="submit" value="<?php echo T_("Add note"); ?>"/>
</p>
</form>
<p><a href="?"><? echo T_("Go back"); ?></a></p>
<p><a href="?"><?php echo T_("Go back"); ?></a></p>
<?
<?php
}
else
{

View File

@@ -1,5 +1,4 @@
<?php
/**
<?php /**
* Display outcomes for each questionnaire assigned to this client
*
*

View File

@@ -1,4 +1,4 @@
<?
<?php
/**
* Default Configuration file
*

View File

@@ -1,4 +1,4 @@
<?
<?php
/**
* Configuration file
*

View File

@@ -1,4 +1,4 @@
<?
<?php
/**
* Configuration file
*

View File

@@ -1,4 +1,4 @@
<?
<?php
/**
* Display sample details of respondent
*
@@ -86,12 +86,12 @@ if (isset($_GET['respondent_id']) && $_GET['respondent_id'] == 0)
{
?>
<form method="post" action="?">
<? display_respondent_form(false,$case_id); ?>
<div class="text"><input type='submit' name='submit' id='submit' value='<? echo T_("Add respondent"); ?>'/></div>
<?php display_respondent_form(false,$case_id); ?>
<div class="text"><input type='submit' name='submit' id='submit' value='<?php echo T_("Add respondent"); ?>'/></div>
</form>
<div><a href="?"><? echo T_("Go back"); ?></a></div>
<div><a href="?"><?php echo T_("Go back"); ?></a></div>
<?
<?php
}
else
{

View File

@@ -27,3 +27,6 @@
.addresp{
font-style:italic;
}
#submit {
margin-top: 40px;
}

View File

@@ -3,7 +3,7 @@
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Nov 16, 2012 at 12:35 PM
-- Generation Time: Feb 28, 2013 at 09:35 AM
-- Server version: 5.0.51
-- PHP Version: 5.2.6-1+lenny16
@@ -16,8 +16,9 @@ SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
/*!40101 SET NAMES utf8 */;
--
-- Database: `quexs`
-- Database: `quexs_ictest`
--
-- --------------------------------------------------------
--
@@ -241,8 +242,10 @@ CREATE TABLE `case` (
`current_call_id` bigint(20) default NULL,
`current_outcome_id` int(11) NOT NULL default '1',
`sortorder` int(11) default NULL,
`token` varchar(36) collate utf8_unicode_ci NOT NULL,
PRIMARY KEY (`case_id`),
UNIQUE KEY `onecasepersample` (`sample_id`,`questionnaire_id`),
UNIQUE KEY `token` (`token`),
UNIQUE KEY `current_operator_id` (`current_operator_id`),
UNIQUE KEY `current_call_id` (`current_call_id`),
KEY `sample_id` (`sample_id`),
@@ -883,9 +886,8 @@ CREATE TABLE `lime_settings_global` (
-- Dumping data for table `lime_settings_global`
--
INSERT INTO `lime_settings_global` (`stg_name`, `stg_value`) VALUES
('DBVersion', '155.6'),
('SessionName', 'ls28629164789259281352');
INSERT INTO `lime_settings_global` (`stg_name`, `stg_value`) VALUES('DBVersion', '155.6');
INSERT INTO `lime_settings_global` (`stg_name`, `stg_value`) VALUES('SessionName', 'ls28629164789259281352');
-- --------------------------------------------------------
@@ -1109,8 +1111,7 @@ CREATE TABLE `lime_users` (
-- Dumping data for table `lime_users`
--
INSERT INTO `lime_users` (`uid`, `users_name`, `password`, `full_name`, `parent_id`, `lang`, `email`, `create_survey`, `create_user`, `participant_panel`, `delete_user`, `superadmin`, `configurator`, `manage_template`, `manage_label`, `htmleditormode`, `templateeditormode`, `questionselectormode`, `one_time_pw`, `dateformat`) VALUES
(1, 'admin', 0x35653838343839386461323830343731353164306535366638646336323932373733363033643064366161626264643632613131656637323164313534326438, 'Your Name', 0, 'en', 'your-email@example.net', 1, 1, 0, 1, 1, 1, 1, 1, 'default', 'default', 'default', NULL, 1);
INSERT INTO `lime_users` (`uid`, `users_name`, `password`, `full_name`, `parent_id`, `lang`, `email`, `create_survey`, `create_user`, `participant_panel`, `delete_user`, `superadmin`, `configurator`, `manage_template`, `manage_label`, `htmleditormode`, `templateeditormode`, `questionselectormode`, `one_time_pw`, `dateformat`) VALUES(1, 'admin', 0x35653838343839386461323830343731353164306535366638646336323932373733363033643064366161626264643632613131656637323164313534326438, 'Your Name', 0, 'en', 'your-email@example.net', 1, 1, 0, 1, 1, 1, 1, 1, 'default', 'default', 'default', NULL, 1);
-- --------------------------------------------------------
@@ -1270,6 +1271,8 @@ INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_m
INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`) VALUES(31, '2.20', 'Non contact', 180, 1, 1, 1, 1, 1, 0, 'NC');
INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`) VALUES(32, '4.80', 'Quota filled', 0, 4, 0, 1, 0, 0, 0, '');
INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`) VALUES(33, '2.36', 'Miscellaneous - Unavailable for a week', 10080, 1, 0, 1, 1, 1, 0, 'O');
INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`) VALUES(40, '1.1', 'Self completed online', 0, 4, 0, 1, 1, 1, 0, 'I');
INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`) VALUES(41, '2.36', 'Self completion email invitation sent', 10080, 1, 0, 1, 1, 1, 0, 'O');
-- --------------------------------------------------------
@@ -1355,6 +1358,10 @@ CREATE TABLE `questionnaire` (
`rs_answeringmachine` text collate utf8_unicode_ci NOT NULL,
`lime_rs_sid` int(11) default NULL,
`info` text collate utf8_unicode_ci,
`self_complete` tinyint(1) NOT NULL default '0',
`lime_mode` varchar(64) collate utf8_unicode_ci default NULL COMMENT 'Limesurvey mode for respondent self completion',
`lime_template` varchar(128) collate utf8_unicode_ci default NULL COMMENT 'Limesurvey template for respondent self completion',
`lime_endurl` varchar(256) collate utf8_unicode_ci default NULL COMMENT 'Forwarding end URL for respondent self completion',
`enabled` tinyint(1) NOT NULL default '1',
PRIMARY KEY (`questionnaire_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
@@ -1625,7 +1632,7 @@ CREATE TABLE `sample_postcode_timezone` (
--
CREATE TABLE `sample_prefix_timezone` (
`val` char(10) NOT NULL,
`val` char(10) collate utf8_unicode_ci NOT NULL,
`Time_zone_name` char(64) collate utf8_unicode_ci NOT NULL,
PRIMARY KEY (`val`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
@@ -1696,6 +1703,7 @@ INSERT INTO `sample_var_type` (`type`, `description`, `table`) VALUES(4, 'State'
INSERT INTO `sample_var_type` (`type`, `description`, `table`) VALUES(5, 'Postcode', 'sample_postcode_timezone');
INSERT INTO `sample_var_type` (`type`, `description`, `table`) VALUES(6, 'Respondent first name', '');
INSERT INTO `sample_var_type` (`type`, `description`, `table`) VALUES(7, 'Respondent last name', '');
INSERT INTO `sample_var_type` (`type`, `description`, `table`) VALUES(8, 'Email address', '');
-- --------------------------------------------------------

View File

@@ -1,4 +1,4 @@
<?
<?php
/**
* Database configuration file
*

View File

@@ -1,4 +1,4 @@
<?
<?php
/**
* Display a "full screen" view of outcomes for display on a large
* communal screen - will change views periodically

278
email.php Normal file
View File

@@ -0,0 +1,278 @@
<?php
/**
* 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@acspri.org.au>
* @copyright Australian Consortium for Social and Political Research Incorporated (ACSPRI) 2013
* @package queXS
* @subpackage user
* @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
*
*/
/**
* 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");
/**
* Input functions
*/
include("functions/functions.input.php");
/**
* LimeSurvey functions
*/
include("functions/functions.limesurvey.php");
global $db;
$operator_id = get_operator_id();
$msg = "";
if (isset($_POST['firstname']))
{
//validate email address
if (validate_email($_POST['email']))
{
$case_id = get_case_id($operator_id);
$lime_sid = get_lime_sid($case_id);
$ca = get_call_attempt($operator_id);
$token = get_token($case_id);
$email = $db->qstr($_POST['email']);
$firstname = $db->qstr($_POST['firstname']);
$lastname = $db->qstr($_POST['lastname']);
//update the limesurvey database email details
$sql = "UPDATE " . LIME_PREFIX ."tokens_{$lime_sid}
SET email = $email, firstname = $firstname, lastname = $lastname, emailstatus = 'OK'
WHERE token = '$token'";
$db->Execute($sql);
//Send email
include_once("include/limesurvey/classes/phpmailer/class.phpmailer.php");
$fieldsarray = array();
$fieldsarray["{EMAIL}"]=$_POST['email'];
$fieldsarray["{FIRSTNAME}"]=$_POST['firstname'];
$fieldsarray["{LASTNAME}"]=$_POST['lastname'];
$fieldsarray["{TOKEN}"]=$token;
$fieldsarray["{LANGUAGE}"]=DEFAULT_LOCALE;
$fieldsarray["{SID}"]=$fieldsarray["{SURVEYID}"]=$lime_sid;
//$fieldsarray["{SURVEYNAME}"]=$thissurvey["surveyls_title"];
$sql = "SELECT s.var,s.val
FROM `sample_var` as s, `case` as c
WHERE c.case_id = $case_id
AND s.sample_id = c.sample_id";
$attributes = $db->GetAssoc($sql);
//Assign sample variables
foreach ($attributes as $attributefield=>$val)
{
$fieldsarray['{SAMPLE:'.strtoupper($attributefield).'}']=$val;
}
$fieldsarray["{OPTOUTURL}"]=LIME_URL . "optout.php?lang=".trim(DEFAULT_LOCALE)."&sid=$lime_sid&token={$token}";
$fieldsarray["{SURVEYURL}"]=LIME_URL . "index.php?lang=".trim(DEFAULT_LOCALE)."&sid=$lime_sid&token={$token}";
$barebone_link=$fieldsarray["{SURVEYURL}"];
$customheaders = array( '1' => "X-surveyid: ".$lime_sid, '2' => "X-tokenid: ".$fieldsarray["{TOKEN}"]);
$sql = "SELECT surveyls_email_invite_subj, surveyls_email_invite
FROM `lime_surveys_languagesettings`
WHERE `surveyls_survey_id` = $lime_sid
order by surveyls_language LIKE '" . DEFAULT_LOCALE . "' DESC";
$econtent = $db->GetRow($sql);
$modsubject = $econtent['surveyls_email_invite_subj'];
$modmessage = $econtent['surveyls_email_invite'];
foreach ( $fieldsarray as $key => $value )
{
$modsubject=str_replace($key, $value, $modsubject);
}
foreach ( $fieldsarray as $key => $value )
{
$modmessage=str_replace($key, $value, $modmessage);
}
$modsubject = str_replace("@@SURVEYURL@@", $barebone_link, $modsubject);
$modmessage = str_replace("@@SURVEYURL@@", $barebone_link, $modmessage);
$mail = new PHPMailer;
$sql = "SELECT stg_value
FROM " . LIME_PREFIX . "settings_global
WHERE stg_name LIKE 'siteadminemail'";
$fromemail = $db->GetOne($sql);
$sql = "SELECT stg_value
FROM " . LIME_PREFIX . "settings_global
WHERE stg_name LIKE 'siteadminname'";
$fromname = $db->GetOne($sql);
$mail->SetFrom($fromemail,$fromname);
$mail->AddAddress($_POST['email']);
foreach ($customheaders as $key=>$val)
{
$mail->AddCustomHeader($val);
}
$mail->AddCustomHeader("X-Surveymailer: queXS Emailer (quexs.sourceforge.net)");
$mail->IsHTML(true);
$mail->Body = $modmessage;
$mail->AltBody = trim(strip_tags(html_entity_decode($modmessage,ENT_QUOTES,'UTF-8')));
$mail->Subject = $modsubject;
if ($mail->Send())
{
// Put call attempt id in to sent
$sql = "UPDATE ". LIME_PREFIX . "tokens_{$lime_sid}
SET sent='$ca'
WHERE token='$token'";
$db->Execute($sql);
//Add a note that sent
$sql = "INSERT INTO `case_note` (case_id,operator_id,note,datetime)
VALUES ($case_id,$operator_id,'" . T_("Self completion invitation sent via email to") . ": " . $_POST['email'] . "',CONVERT_TZ(NOW(),'System','UTC'))";
$db->Execute($sql);
if (isset($_POST['submith']))
{
end_call($operator_id,41); //end with outcome sent
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.js";
if (browser_ie()) $js = "js/window_ie6.js";
if (isset($_GET['interface2']))
{
xhtml_head(T_("Email"),true,array("css/call.css"),array($js),"onload='openParent(\"endcase=endcase\");'");
}
else
{
xhtml_head(T_("Email"),true,array("css/call.css"),array($js),"onload='toggleRec(\"$newtext\",\"record.php?start=start\",\"offline\"); openParentObject(\"main-content\",\"" . get_respondentselection_url($operator_id) . "\"); parent.closePopup();'");
}
}
else if (isset($_POST['submit']))
{
xhtml_head(T_("Email"),true,array("css/call.css"),array($js),"onload='parent.closePopup();'");
}
xhtml_foot();
die();
}
else
{
$msg = T_("The email did not send");
}
}
else
{
$msg = T_("The email address is not valid");
}
}
$case_id = get_case_id($operator_id);
$js = "js/window.js";
if (browser_ie()) $js = "js/window_ie6.js";
xhtml_head(T_("Email"),true,array("css/call.css"),array($js));
$sql = "SELECT q.self_complete
FROM questionnaire as q, `case` as c
WHERE c.case_id = $case_id
AND c.questionnaire_id = q.questionnaire_id";
$sc = $db->GetOne($sql);
if ($sc == 1)
{
$sql = "SELECT sv1.val as firstname, sv2.val as lastname, sv3.val as email
FROM `case` as c
LEFT JOIN sample_var as sv1 on (sv1.sample_id = c.sample_id AND sv1.type = 6)
LEFT JOIN sample_var as sv2 on (sv2.sample_id = c.sample_id AND sv2.type = 7)
LEFT JOIN sample_var as sv3 on (sv3.sample_id = c.sample_id AND sv3.type = 8)
WHERE c.case_id = $case_id";
$rs = $db->GetRow($sql);
print "<div class='status'>" . T_("Email respondent for self completion") . "</div>";
if (!empty($msg)) print "<p>$msg</p>";
print "<form action='?";
if (isset($_GET['interface2']))
{
print "interface2=true";
}
print "' method='post'>";
print "<div><label for='firstname'>" . T_("First name") . "</label><input type='text' value='{$rs['firstname']}' name='firstname' id='firstname'/></div>";
print "<div><label for='lastname'>" . T_("Last name") . "</label><input type='text' value='{$rs['lastname']}' name='lastname' id='lastname'/></div>";
print "<div><label for='email'>" . T_("Email") . "</label><input type='text' value='{$rs['email']}' name='email' id='email'/></div>";
if (!isset($_GET['interface2']))
{
print "<div><input type='submit' value='" . T_("Send invitation") . "' name='submit' id='submit'/></div>";
}
print "<div><input type='submit' value='" . T_("Send invitation and Hang up") . "' name='submith' id='submith'/></div></form>";
}
else
{
print "<p>" . T_("Self completion email not available for this questionnaire") . "</p>";
}
xhtml_foot();
?>

View File

@@ -1,4 +1,4 @@
<?
<?php
/**
* Display the end work screen to the operator
*

View File

@@ -1,4 +1,4 @@
<?
<?php
/**
* Functions to calculate AAPOR outcomes based on Standard Definitions here:
*

View File

@@ -1,4 +1,4 @@
<?
<?php
/**
* Functions relating to appointment times and calendars
*
@@ -77,18 +77,22 @@ function add_contact_phone($case_id,$phone)
* @param int $y the year (4 digit)
* @param string $start The time in the format HH:MM:SS
* @param string $end The time in the format HH:MM:SS
* @param string|int $require_operator_id False if for any operator otherwise restrict this appointment to a particular operator
* @return bool Result false if failed to add else true
*/
function make_appointment($respondent_id,$case_id,$contact_phone_id,$call_attempt_id,$d,$m,$y,$start,$end)
function make_appointment($respondent_id,$case_id,$contact_phone_id,$call_attempt_id,$d,$m,$y,$start,$end,$require_operator_id = false)
{
global $db;
$start = "$y-$m-$d $start";
$end= "$y-$m-$d $end";
if ($require_operator_id == false)
$require_operator_id = "NULL";
$sql = "INSERT INTO `appointment`
(appointment_id,case_id,contact_phone_id,call_attempt_id,start,end,require_operator_id,respondent_id,completed_call_id)
SELECT NULL,'$case_id','$contact_phone_id','$call_attempt_id',CONVERT_TZ('$start',r.Time_zone_name,'UTC'),CONVERT_TZ('$end',r.Time_zone_name,'UTC'),NULL,$respondent_id,NULL
SELECT NULL,'$case_id','$contact_phone_id','$call_attempt_id',CONVERT_TZ('$start',r.Time_zone_name,'UTC'),CONVERT_TZ('$end',r.Time_zone_name,'UTC'),$require_operator_id,$respondent_id,NULL
FROM respondent as r
WHERE r.respondent_id = '$respondent_id'";
@@ -495,8 +499,7 @@ function display_calendar($respondent_id, $questionnaire_id, $year = false, $mon
<th>S</th>
<th>S</th>
</tr>
<?php
<?php
while ( $Day = $Month->fetch() ) {
@@ -564,7 +567,7 @@ function display_calendar($respondent_id, $questionnaire_id, $year = false, $mon
</td>
</tr>
</table>
<?
<?php
print "<div>" . date('l j F Y',mktime(0,0,0,$month,$day,$year)) . "</div>";
}

View File

@@ -1,4 +1,4 @@
<?
<?php
/**
* Client functions
*

View File

@@ -1,4 +1,4 @@
<?
<?php
/**
* Functions relating to displaying for XHTML
*

View File

@@ -1,4 +1,4 @@
<?
<?php
/**
* FreePBX Functions
*

View File

@@ -1,4 +1,4 @@
<?
<?php
/**
* htpasswd/htgroup functions for authentication integration
*

View File

@@ -1,4 +1,4 @@
<?
<?php
/**
* Functions relating to importing a sample file (from CSV)
*

View File

@@ -1,4 +1,4 @@
<?
<?php
/**
* Input conversion functions
*

View File

@@ -1,4 +1,4 @@
<?
<?php
/**
* Functions relating to integration with {@link http://www.limesurvey.org/ LimeSurvey}
@@ -42,6 +42,238 @@ include_once(dirname(__FILE__).'/../config.inc.php');
*/
include_once(dirname(__FILE__).'/../db.inc.php');
/**
* Strip comments from email taken from limesurvey common functions
*
* @param mixed $comment
* @param mixed $email
* @param resource $replace Optional, defaults to ''.
*
* @return TODO
* @author Adam Zammit <adam.zammit@acspri.org.au>
* @since 2013-02-26
*/
function strip_comments($comment, $email, $replace=''){
while (1){
$new = preg_replace("!$comment!", $replace, $email);
if (strlen($new) == strlen($email)){
return $email;
}
$email = $new;
}
}
/*function validate_email($email)
{
// Create the syntactical validation regular expression
// Validate the syntax
// see http://data.iana.org/TLD/tlds-alpha-by-domain.txt
$maxrootdomainlength = 6;
return ( ! preg_match("/^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.(([0-9]{1,3})|([a-zA-Z]{2,".$maxrootdomainlength."}))$/ix", $email)) ? FALSE : TRUE;
}*/
function validate_email($email){
$no_ws_ctl = "[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f]";
$alpha = "[\\x41-\\x5a\\x61-\\x7a]";
$digit = "[\\x30-\\x39]";
$cr = "\\x0d";
$lf = "\\x0a";
$crlf = "(?:$cr$lf)";
$obs_char = "[\\x00-\\x09\\x0b\\x0c\\x0e-\\x7f]";
$obs_text = "(?:$lf*$cr*(?:$obs_char$lf*$cr*)*)";
$text = "(?:[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f]|$obs_text)";
$text = "(?:$lf*$cr*$obs_char$lf*$cr*)";
$obs_qp = "(?:\\x5c[\\x00-\\x7f])";
$quoted_pair = "(?:\\x5c$text|$obs_qp)";
$wsp = "[\\x20\\x09]";
$obs_fws = "(?:$wsp+(?:$crlf$wsp+)*)";
$fws = "(?:(?:(?:$wsp*$crlf)?$wsp+)|$obs_fws)";
$ctext = "(?:$no_ws_ctl|[\\x21-\\x27\\x2A-\\x5b\\x5d-\\x7e])";
$ccontent = "(?:$ctext|$quoted_pair)";
$comment = "(?:\\x28(?:$fws?$ccontent)*$fws?\\x29)";
$cfws = "(?:(?:$fws?$comment)*(?:$fws?$comment|$fws))";
$outer_ccontent_dull = "(?:$fws?$ctext|$quoted_pair)";
$outer_ccontent_nest = "(?:$fws?$comment)";
$outer_comment = "(?:\\x28$outer_ccontent_dull*(?:$outer_ccontent_nest$outer_ccontent_dull*)+$fws?\\x29)";
$atext = "(?:$alpha|$digit|[\\x21\\x23-\\x27\\x2a\\x2b\\x2d\\x2f\\x3d\\x3f\\x5e\\x5f\\x60\\x7b-\\x7e])";
$atext_domain = "(?:$alpha|$digit|[\\x2b\\x2d\\x5f])";
$atom = "(?:$cfws?(?:$atext)+$cfws?)";
$atom_domain = "(?:$cfws?(?:$atext_domain)+$cfws?)";
$qtext = "(?:$no_ws_ctl|[\\x21\\x23-\\x5b\\x5d-\\x7e])";
$qcontent = "(?:$qtext|$quoted_pair)";
$quoted_string = "(?:$cfws?\\x22(?:$fws?$qcontent)*$fws?\\x22$cfws?)";
$quoted_string = "(?:$cfws?\\x22(?:$fws?$qcontent)+$fws?\\x22$cfws?)";
$word = "(?:$atom|$quoted_string)";
$obs_local_part = "(?:$word(?:\\x2e$word)*)";
$obs_domain = "(?:$atom_domain(?:\\x2e$atom_domain)*)";
$dot_atom_text = "(?:$atext+(?:\\x2e$atext+)*)";
$dot_atom_text_domain = "(?:$atext_domain+(?:\\x2e$atext_domain+)*)";
$dot_atom = "(?:$cfws?$dot_atom_text$cfws?)";
$dot_atom_domain = "(?:$cfws?$dot_atom_text_domain$cfws?)";
$dtext = "(?:$no_ws_ctl|[\\x21-\\x5a\\x5e-\\x7e])";
$dcontent = "(?:$dtext|$quoted_pair)";
$domain_literal = "(?:$cfws?\\x5b(?:$fws?$dcontent)*$fws?\\x5d$cfws?)";
$local_part = "(($dot_atom)|($quoted_string)|($obs_local_part))";
$domain = "(($dot_atom_domain)|($domain_literal)|($obs_domain))";
$addr_spec = "$local_part\\x40$domain";
if (strlen($email) > 256) return FALSE;
$email = strip_comments($outer_comment, $email, "(x)");
if (!preg_match("!^$addr_spec$!", $email, $m)){
return FALSE;
}
$bits = array(
'local' => isset($m[1]) ? $m[1] : '',
'local-atom' => isset($m[2]) ? $m[2] : '',
'local-quoted' => isset($m[3]) ? $m[3] : '',
'local-obs' => isset($m[4]) ? $m[4] : '',
'domain' => isset($m[5]) ? $m[5] : '',
'domain-atom' => isset($m[6]) ? $m[6] : '',
'domain-literal' => isset($m[7]) ? $m[7] : '',
'domain-obs' => isset($m[8]) ? $m[8] : '',
);
$bits['local'] = strip_comments($comment, $bits['local']);
$bits['domain'] = strip_comments($comment, $bits['domain']);
if (strlen($bits['local']) > 64) return FALSE;
if (strlen($bits['domain']) > 255) return FALSE;
if (strlen($bits['domain-literal'])){
$Snum = "(\d{1,3})";
$IPv4_address_literal = "$Snum\.$Snum\.$Snum\.$Snum";
$IPv6_hex = "(?:[0-9a-fA-F]{1,4})";
$IPv6_full = "IPv6\:$IPv6_hex(:?\:$IPv6_hex){7}";
$IPv6_comp_part = "(?:$IPv6_hex(?:\:$IPv6_hex){0,5})?";
$IPv6_comp = "IPv6\:($IPv6_comp_part\:\:$IPv6_comp_part)";
$IPv6v4_full = "IPv6\:$IPv6_hex(?:\:$IPv6_hex){5}\:$IPv4_address_literal";
$IPv6v4_comp_part = "$IPv6_hex(?:\:$IPv6_hex){0,3}";
$IPv6v4_comp = "IPv6\:((?:$IPv6v4_comp_part)?\:\:(?:$IPv6v4_comp_part\:)?)$IPv4_address_literal";
if (preg_match("!^\[$IPv4_address_literal\]$!", $bits['domain'], $m)){
if (intval($m[1]) > 255) return FALSE;
if (intval($m[2]) > 255) return FALSE;
if (intval($m[3]) > 255) return FALSE;
if (intval($m[4]) > 255) return FALSE;
}else{
while (1){
if (preg_match("!^\[$IPv6_full\]$!", $bits['domain'])){
break;
}
if (preg_match("!^\[$IPv6_comp\]$!", $bits['domain'], $m)){
list($a, $b) = explode('::', $m[1]);
$folded = (strlen($a) && strlen($b)) ? "$a:$b" : "$a$b";
$groups = explode(':', $folded);
if (count($groups) > 6) return FALSE;
break;
}
if (preg_match("!^\[$IPv6v4_full\]$!", $bits['domain'], $m)){
if (intval($m[1]) > 255) return FALSE;
if (intval($m[2]) > 255) return FALSE;
if (intval($m[3]) > 255) return FALSE;
if (intval($m[4]) > 255) return FALSE;
break;
}
if (preg_match("!^\[$IPv6v4_comp\]$!", $bits['domain'], $m)){
list($a, $b) = explode('::', $m[1]);
$b = substr($b, 0, -1); # remove the trailing colon before the IPv4 address
$folded = (strlen($a) && strlen($b)) ? "$a:$b" : "$a$b";
$groups = explode(':', $folded);
if (count($groups) > 4) return FALSE;
break;
}
return FALSE;
}
}
}else{
$labels = explode('.', $bits['domain']);
if (count($labels) == 1) return FALSE;
foreach ($labels as $label){
if (strlen($label) > 63) return FALSE;
if (substr($label, 0, 1) == '-') return FALSE;
if (substr($label, -1) == '-') return FALSE;
}
if (preg_match('!^[0-9]+$!', array_pop($labels))) return FALSE;
}
return TRUE;
}
/**
* Return the number of completions for a given
* questionnaire, where the given sample var has
@@ -65,7 +297,7 @@ function limesurvey_quota_replicate_completions($lime_sid,$questionnaire_id,$sam
JOIN `sample` as sam ON (c.sample_id = sam.sample_id AND sam.import_id = '$sample_import_id')
JOIN `sample_var` as sv ON (sv.sample_id = sam.sample_id AND sv.var LIKE '$var' AND sv.val LIKE '$val')
WHERE s.submitdate IS NOT NULL
AND s.token = c.case_id";
AND s.token = c.token";
$rs = $db->GetRow($sql);
@@ -95,7 +327,7 @@ function limesurvey_quota_match($lime_sgqa,$lime_sid,$case_id,$value,$comparison
FROM " . LIME_PREFIX . "survey_$lime_sid as s
JOIN `case` as c ON (c.case_id = '$case_id')
JOIN `sample` as sam ON (c.sample_id = sam.sample_id)
WHERE s.token = c.case_id
WHERE s.token = c.token
AND s.`$lime_sgqa` $comparison '$value'";
$rs = $db->GetRow($sql);
@@ -127,7 +359,7 @@ function limesurvey_quota_replicate_match($lime_sid,$case_id,$val,$var)
JOIN `case` as c ON (c.case_id = '$case_id')
JOIN `sample` as sam ON (c.sample_id = sam.sample_id)
JOIN `sample_var` as sv ON (sv.sample_id = sam.sample_id AND sv.var LIKE '$var' AND sv.val LIKE '$val')
WHERE s.token = c.case_id";
WHERE s.token = c.token";
$rs = $db->GetRow($sql);
@@ -161,7 +393,7 @@ function limesurvey_quota_completions($lime_sgqa,$lime_sid,$questionnaire_id,$sa
JOIN `case` as c ON (c.questionnaire_id = '$questionnaire_id')
JOIN `sample` as sam ON (c.sample_id = sam.sample_id AND sam.import_id = '$sample_import_id')
WHERE s.submitdate IS NOT NULL
AND s.token = c.case_id
AND s.token = c.token
AND s.`$lime_sgqa` $comparison '$value'";
$rs = $db->GetRow($sql);
@@ -272,7 +504,6 @@ function getRandomID()
/**
* Taken from admin/database.php in the LimeSurvey package
* With modifications
@@ -351,9 +582,10 @@ function get_lime_id($case_id)
$lime_sid = get_lime_sid($case_id);
if ($lime_sid == false) return false;
$sql = "SELECT id
FROM " . LIME_PREFIX . "survey_$lime_sid
WHERE token = '$case_id'";
$sql = "SELECT s.id
FROM " . LIME_PREFIX . "survey_$lime_sid as s, `case` as c
WHERE c.case_id = '$case_id'
AND c.token = s.token";
$r = $db->GetRow($sql);
@@ -380,9 +612,10 @@ function get_lime_tid($case_id)
$lime_sid = get_lime_sid($case_id);
if ($lime_sid == false) return false;
$sql = "SELECT tid
FROM " . LIME_PREFIX . "tokens_$lime_sid
WHERE token = '$case_id'";
$sql = "SELECT t.tid
FROM " . LIME_PREFIX . "tokens_$lime_sid as t, `case` as c
WHERE c.case_id = '$case_id'
AND c.token = t.token";
$r = $db->GetRow($sql);
@@ -431,9 +664,10 @@ function limesurvey_is_quota_full($case_id)
$lime_sid = get_lime_sid($case_id);
if ($lime_sid == false) return false;
$sql = "SELECT completed
FROM " . LIME_PREFIX . "tokens_$lime_sid
WHERE token = '$case_id'";
$sql = "SELECT t.completed
FROM " . LIME_PREFIX . "tokens_$lime_sid as t, `case` as c
WHERE c.case_id = '$case_id'
AND c.token = t.token";
$r = $db->GetRow($sql);
@@ -458,9 +692,10 @@ function limesurvey_is_completed($case_id)
$lime_sid = get_lime_sid($case_id);
if ($lime_sid == false) return false;
$sql = "SELECT completed
FROM " . LIME_PREFIX . "tokens_$lime_sid
WHERE token = '$case_id'";
$sql = "SELECT t.completed
FROM " . LIME_PREFIX . "tokens_$lime_sid as t, `case` as c
WHERE c.case_id = '$case_id'
AND t.token = c.token";
$r = $db->GetRow($sql);
@@ -540,351 +775,4 @@ function limesurvey_get_width($qid,$default)
return $default;
}
/**
* Return the greatest width of answers
*
* @param mixed $qid Limesurvey question id
*
* @return int width of longest answer
* @author Adam Zammit <adam.zammit@acspri.org.au>
* @since 2010-11-03
*/
function limesurvey_answer_width($qid)
{
global $db;
$sql = "SELECT MAX(LENGTH(code)) as c FROM ".LIME_PREFIX."answers WHERE qid = $qid";
$r = $db->GetRow($sql);
$val = 1;
if (!empty($r))
$val = $r['c'];
return $val;
}
function limesurvey_fixed_width($lid)
{
global $db;
$sql = "SELECT MAX(LENGTH(code)) as c FROM ".LIME_PREFIX."labels WHERE lid = $lid";
$r = $db->GetRow($sql);
$val = 1;
if (!empty($r))
$val = $r['c'];
return $val;
}
function limesurvey_create_multi(&$varwidth,&$vartype,$qid,$varname,$length,$type)
{
global $db;
$sql = "SELECT *
FROM ".LIME_PREFIX."answers
WHERE qid = $qid
ORDER BY sortorder ASC";
$r = $db->GetAll($sql);
foreach($r as $Row)
{
$v = $varname . $Row['code'];
$varwidth[$v] = $length;
$vartype[$v] = $type;
}
return;
}
/**
* Return a string with only ASCII characters in it
*
* This function was sourced from the php website, help on str_replace
* No author was listed at the time of access
*
* @param string $stringIn The string
* @return string A string containing only ASCII characters
*/
function all_ascii( $stringIn ){
$final = '';
$search = array(chr(145),chr(146),chr(147),chr(148),chr(150),chr(151),chr(13),chr(10));
$replace = array("'","'",'"','"','-','-',' ',' ');
$hold = str_replace($search[0],$replace[0],$stringIn);
$hold = str_replace($search[1],$replace[1],$hold);
$hold = str_replace($search[2],$replace[2],$hold);
$hold = str_replace($search[3],$replace[3],$hold);
$hold = str_replace($search[4],$replace[4],$hold);
$hold = str_replace($search[5],$replace[5],$hold);
$hold = str_replace($search[6],$replace[6],$hold);
$hold = str_replace($search[7],$replace[7],$hold);
if(!function_exists('str_split')){
function str_split($string,$split_length=1){
$count = strlen($string);
if($split_length < 1){
return false;
} elseif($split_length > $count){
return array($string);
} else {
$num = (int)ceil($count/$split_length);
$ret = array();
for($i=0;$i<$num;$i++){
$ret[] = substr($string,$i*$split_length,$split_length);
}
return $ret;
}
}
}
$holdarr = str_split($hold);
foreach ($holdarr as $val) {
if (ord($val) < 128) $final .= $val;
}
return $final;
}
/**
* Produce a fixed width string containing the data from a questionnaire
*
* @param int $questionnaire_id The quesitonnaire id
* @param int|false $sample_import_id The sample importid or false for all data
* @return string Fixed width data from the limesurvey database
*
*/
function limesurvey_export_fixed_width($questionnaire_id,$sample_import_id = false)
{
global $db;
//array of varname and width
$varwidth = array();
$vartype = array();
$sql = "SELECT lime_sid
FROM questionnaire
WHERE questionnaire_id = '$questionnaire_id'";
$r = $db->GetRow($sql);
if (!empty($r))
$surveyid = $r['lime_sid'];
else
return;
//foreach question
$sql = "SELECT q.*
FROM ".LIME_PREFIX."questions as q, ".LIME_PREFIX."groups as g
WHERE q.sid=$surveyid
AND q.type NOT LIKE 'X'
AND g.gid = q.gid
ORDER BY g.group_order ASC,q.question_order ASC";
$r = $db->GetAll($sql);
foreach ($r as $RowQ)
{
$type = $RowQ['type'];
$qid = $RowQ['qid'];
$lid = $RowQ['lid'];
$gid = $RowQ['gid'];
$varName = $surveyid . "X" . $gid . "X" . $qid;
switch ($type)
{
case "X": //BOILERPLATE QUESTION - none should appear
break;
case "5": //5 POINT CHOICE radio-buttons
$varwidth[$varName]=1;
$vartype[$varName] = 1;
break;
case "D": //DATE
$varwidth[$varName]=8;
$vartype[$varName] = 1;
break;
case "Z": //LIST Flexible drop-down/radio-button list
$varwidth[$varName]=limesurvey_fixed_width($lid);
$vartype[$varName] = 1;
break;
case "L": //LIST drop-down/radio-button list
$varwidth[$varName]=limesurvey_answer_width($qid);
$vartype[$varName] = 1;
break;
case "W": //List - dropdown
$varwidth[$varName]=limesurvey_answer_width($qid);
$vartype[$varName] = 1;
break;
case "!": //List - dropdown
$varwidth[$varName]=limesurvey_answer_width($qid);
$vartype[$varName] = 1;
break;
case "O": //LIST WITH COMMENT drop-down/radio-button list + textarea
//Not yet implemented
break;
case "R": //RANKING STYLE
//Not yet implemented
break;
case "M": //MULTIPLE OPTIONS checkbox
limesurvey_create_multi($varwidth,$vartype,$qid,$varName,1,3);
break;
case "P": //MULTIPLE OPTIONS WITH COMMENTS checkbox + text
//Not yet implemented
break;
case "Q": //MULTIPLE SHORT TEXT
limesurvey_create_multi($varwidth,$vartype,$qid,$varName,limesurvey_get_width($qid,24),2);
break;
case "K": //MULTIPLE NUMERICAL
limesurvey_create_multi($varwidth,$vartype,$qid,$varName,limesurvey_get_width($qid,10),1);
break;
case "N": //NUMERICAL QUESTION TYPE
$varwidth[$varName]= limesurvey_get_width($qid,10);
$vartype[$varName] = 1;
break;
case "S": //SHORT FREE TEXT
$varwidth[$varName]= limesurvey_get_width($qid,240);
$vartype[$varName] = 2;
break;
case "T": //LONG FREE TEXT
$varwidth[$varName]= limesurvey_get_width($qid,1024);
$vartype[$varName] = 2;
break;
case "U": //HUGE FREE TEXT
$varwidth[$varName]= limesurvey_get_width($qid,2048);
$vartype[$varName] = 2;
break;
case "Y": //YES/NO radio-buttons
$varwidth[$varName]=1;
$vartype[$varName] = 1;
break;
case "G": //GENDER drop-down list
$varwidth[$varName]=1;
$vartype[$varName] = 1;
break;
case "A": //ARRAY (5 POINT CHOICE) radio-buttons
$varwidth[$varName]=1;
$vartype[$varName] = 1;
break;
case "B": //ARRAY (10 POINT CHOICE) radio-buttons
$varwidth[$varName]=2;
$vartype[$varName] = 1;
break;
case "C": //ARRAY (YES/UNCERTAIN/NO) radio-buttons
$varwidth[$varName]=1;
$vartype[$varName] = 1;
break;
case "E": //ARRAY (Increase/Same/Decrease) radio-buttons
$varwidth[$varName]=1;
$vartype[$varName] = 1;
break;
case "F": //ARRAY (Flexible) - Row Format
limesurvey_create_multi($varwidth,$vartype,$qid,$varName,limesurvey_fixed_width($lid),1);
break;
case "H": //ARRAY (Flexible) - Column Format
limesurvey_create_multi($varwidth,$vartype,$qid,$varName,limesurvey_fixed_width($lid),1);
break;
case "^": //SLIDER CONTROL
//Not yet implemented
break;
} //End Switch
}
$fn = "survey_$surveyid.dat";
header("Content-Type: application/download");
header("Content-Disposition: attachment; filename=$fn");
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("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Pragma: no-cache"); // HTTP/1.0
$sql3 = "SELECT c.case_id as case_id
FROM `case` as c
WHERE c.questionnaire_id = '$questionnaire_id'
AND c.current_outcome_id = 10";
$r = $db->GetAll($sql3);
if (!empty($r))
{
$sql = "SELECT *
FROM ".LIME_PREFIX."survey_$surveyid
WHERE ";
if ($sample_import_id == false)
{
$sql .= " (";
$ccount = count($r);
$ccounter = 0;
foreach($r as $row)
{
$token = $row['case_id'];
$ccounter++;
$sql .= " token = '$token'";
if ($ccounter < $ccount)
$sql .= " or ";
}
$sql .= ")";
}
else
{
$sql2 = "SELECT c.case_id as case_id
FROM `case` as c, `sample` as s
WHERE c.questionnaire_id = '$questionnaire_id'
AND c.sample_id = s.sample_id
AND s.import_id = '$sample_import_id'";
$r = $db->GetAll($sql2);
if (!empty($r))
{
$sql .= " (";
$ccount = count($r);
$ccounter = 0;
foreach($r as $row)
{
$token = $row['case_id'];
$ccounter++;
$sql .= " token = '$token'";
if ($ccounter < $ccount)
$sql .= " or ";
}
$sql .= ")";
}
}
$r = $db->GetAll($sql);
foreach($r as $Row)
{
foreach ($varwidth as $var => $width)
{
if ($vartype[$var] == 1)
echo str_pad(substr(all_ascii($Row[$var]),0,$width), $width, " ", STR_PAD_LEFT);
else if ($vartype[$var] == 2)
echo str_pad(substr(all_ascii($Row[$var]),0,$width), $width, " ", STR_PAD_RIGHT);
else if ($vartype[$var] == 3)
if (empty($Row[$var])) echo " "; else echo "1";
}
echo str_pad(substr($Row['token'],0,9), 9, " ", STR_PAD_LEFT);
echo str_pad(substr($Row['datestamp'],0,16), 16, " ", STR_PAD_LEFT);
echo "\n";
}
}
}
?>

View File

@@ -1,4 +1,4 @@
<?
<?php
/**
* Operator functions for interacting with the database and getting/storing state
*
@@ -43,6 +43,26 @@ include_once(dirname(__FILE__).'/../config.inc.php');
*/
include_once(dirname(__FILE__).'/../db.inc.php');
/**
* Creates a random sequence of characters
*
* @param mixed $length Length of resulting string
* @param string $pattern To define which characters should be in the resulting string
*
* From Limesurvey
*/
function sRandomChars($length = 15,$pattern="23456789abcdefghijkmnpqrstuvwxyz")
{
$patternlength = strlen($pattern)-1;
for($i=0;$i<$length;$i++)
{
if(isset($key))
$key .= $pattern{rand(0,$patternlength)};
else
$key = $pattern{rand(0,$patternlength)};
}
return $key;
}
/**
* Check if the project associated with this case is using
@@ -362,13 +382,16 @@ function get_case_id($operator_id, $create = false)
if ($systemsort)
{
//Just make sure that this case should go to this operator (assigned to this project and skill)
//Also check if this is an exclusive appointment
$sql = "SELECT c.case_id as caseid
FROM `case` as c
JOIN operator_questionnaire AS oq ON (oq.operator_id = '$operator_id' AND oq.questionnaire_id = c.questionnaire_id)
JOIN outcome as ou ON (ou.outcome_id = c.current_outcome_id)
JOIN operator_skill as os ON (os.operator_id = '$operator_id' AND os.outcome_type_id = ou.outcome_type_id)
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))
WHERE c.sortorder IS NOT NULL
AND c.current_operator_id IS NULL
AND (apn.require_operator_id IS NULL OR apn.require_operator_id = '$operator_id')
ORDER BY c.sortorder ASC
LIMIT 1";
@@ -418,6 +441,7 @@ function get_case_id($operator_id, $create = false)
AND !(si.call_restrict = 1 AND cr.day_of_week IS NULL AND os.outcome_type_id != 2)
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 ((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 (apn.require_operator_id IS NULL OR apn.require_operator_id = '$operator_id')
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
ORDER BY apn.start DESC, a.start ASC, qsep.priority DESC
LIMIT 1";
@@ -496,8 +520,10 @@ function get_case_id($operator_id, $create = false)
if (!empty($r3))
{
$sql = "INSERT INTO `case` (case_id, sample_id, questionnaire_id, last_call_id, current_operator_id, current_call_id, current_outcome_id)
VALUES (NULL, {$r3['sample_id']}, {$r3['questionnaire_id']} , NULL, $operator_id, NULL, 1)";
$token = sRandomChars();
$sql = "INSERT INTO `case` (case_id, sample_id, questionnaire_id, last_call_id, current_operator_id, current_call_id, current_outcome_id,token)
VALUES (NULL, {$r3['sample_id']}, {$r3['questionnaire_id']} , NULL, $operator_id, NULL, 1, '$token')";
$db->Execute($sql);
@@ -576,7 +602,7 @@ function get_case_id($operator_id, $create = false)
if ($lime_sid)
{
$sql = "INSERT INTO ".LIME_PREFIX."tokens_$lime_sid (tid,firstname,lastname,email,token,language,sent,completed,mpid)
VALUES (NULL,'','','',$case_id,'".DEFAULT_LOCALE."','N','N',NULL)";
VALUES (NULL,'','','','$token','".DEFAULT_LOCALE."','N','N',NULL)";
$db->Execute($sql);
}
@@ -624,6 +650,31 @@ function get_case_id($operator_id, $create = false)
}
/**
* Get the token based on the case id
*
* @param int $case_id The case id
*
* @return string|bool The token otherwise false if case doesn't exist
* @author Adam Zammit <adam.zammit@acspri.org.au>
* @since 2013-02-25
*/
function get_token($case_id)
{
global $db;
$sql = "SELECT token
FROM `case`
WHERE case_id = $case_id";
$token = $db->GetOne($sql);
if (empty($token)) return FALSE;
return $token;
}
/**
* Return the phone number of a call
*
@@ -1077,7 +1128,7 @@ function get_respondentselection_url($operator_id,$escape = true,$interface2 = f
{
$sid = get_limesurvey_id($operator_id,true); //true for RS
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?interviewer=interviewer&amp;loadall=reload" . $amp . "sid=$sid" . $amp . "token=$call_id" . $amp . "lang=" . DEFAULT_LOCALE;
else
{
if ($interface2)
@@ -1113,14 +1164,21 @@ function get_limesurvey_url($operator_id)
if ($case_id)
{
$sql = "SELECT token
FROM `case`
WHERE case_id = $case_id";
$token = $db->GetOne($sql);
$sid = get_limesurvey_id($operator_id);
$url = LIME_URL . "index.php?loadall=reload&amp;sid=$sid&amp;token=$case_id&amp;lang=" . DEFAULT_LOCALE;
$url = LIME_URL . "index.php?interviewer=interviewer&amp;loadall=reload&amp;sid=$sid&amp;token=$token&amp;lang=" . DEFAULT_LOCALE;
$questionnaire_id = get_questionnaire_id($operator_id);
//get prefills
$sql = "SELECT lime_sgqa,value
FROM questionnaire_prefill
WHERE questionnaire_id = '$questionnaire_id'";
$pf = $db->GetAll($sql);
if (!empty($pf))

View File

@@ -1,4 +1,4 @@
<?
<?php
/**
* Functions that display data about the project
*

View File

@@ -1,4 +1,4 @@
<?
<?php
/**
* Functions related to the backgrounding of processes and the process table in the database
*

View File

@@ -1,4 +1,4 @@
<?
<?php
/**
* Template of functions
*

View File

@@ -1,4 +1,4 @@
<?
<?php
/**
* Functions to interact with Asterisk
* Some examples taken from {@link http://www.voip-info.org/wiki/index.php?page=Asterisk+manager+Example%3A+PHP voip-info.org}

View File

@@ -1,4 +1,4 @@
<?
<?php
/**
* Functions related to XHTML code generation
*
@@ -50,8 +50,8 @@ print "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head><title><? if (empty($title)) print "queXS"; else print "queXS: $title"; ?></title>
<?
<head><title><?php if (empty($title)) print "queXS"; else print "queXS: $title"; ?></title>
<?php
if ($css)
foreach ($css as $c) print "<link rel='stylesheet' href='$c' type='text/css'></link>";
if ($javascript)
@@ -67,7 +67,7 @@ print "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
if (!$body) return;
?>
</head>
<?
<?php
if ($bodytext) print "<body $bodytext>"; else print "<body>";
}
@@ -83,7 +83,7 @@ function xhtml_foot()
</body>
</html>
<?
<?php
}
/**

View File

@@ -0,0 +1,4 @@
AuthType None
Satisfy Any
Order Deny,Allow
Allow from All

View File

@@ -0,0 +1,5 @@
AuthType Basic
AuthName "queXS CATI: Authentication Required"
AuthUserFile /var/opt/quexs/htpasswd
AuthGroupFile /var/opt/quexs/htgroup
require group admin

View File

@@ -407,6 +407,11 @@ function activateSurvey($postsid,$surveyid, $scriptname='admin.php')
}
$execresult=$dict->ExecuteSQLArray($sqlarray,1);
//queXS Addition - add an index on the token
$createtokenindex = $dict->CreateIndexSQL("{$tabname}_idx", $tabname, array('token'));
$dict->ExecuteSQLArray($createtokenindex, false) or safe_die ("Failed to create token index<br />$createtokenindex<br /><br />".$connect->ErrorMsg());
if ($execresult==0 || $execresult==1)
{
$activateoutput .= "<br />\n<div class='messagebox ui-corner-all'>\n" .

View File

@@ -197,7 +197,7 @@ if ($subaction == "id")
if ($qfs != false)
{
//Limit responses by questionnaire and/or sample
$query .= " JOIN `case` AS c ON (s.token = c.case_id AND c.questionnaire_id = '{$qfs[0]}') ";
$query .= " JOIN `case` AS c ON (s.token = c.token AND c.questionnaire_id = '{$qfs[0]}') ";
if ($qfs[1] != 0) //if a sample is selected
$query .= " JOIN `sample` AS ss ON (ss.sample_id = c.sample_id AND ss.import_id = '{$qfs[1]}') ";
}
@@ -592,7 +592,7 @@ elseif ($subaction == "all")
if ($qfs != false)
{
//Limit responses by questionnaire and/or sample
$sql_from .= " JOIN `case` AS c ON ({$surveytable}.token = c.case_id AND c.questionnaire_id = '{$qfs[0]}') ";
$sql_from .= " JOIN `case` AS c ON ({$surveytable}.token = c.token AND c.questionnaire_id = '{$qfs[0]}') ";
if ($qfs[1] != 0) //if a sample is selected
$sql_from .= " JOIN `sample` AS s ON (s.sample_id = c.sample_id AND s.import_id = '{$qfs[1]}') ";
}
@@ -639,7 +639,7 @@ elseif ($subaction == "all")
if ($qfs != false)
{
//Limit responses by questionnaire and/or sample
$dtquery .= " JOIN `case` AS c ON ({$surveytable}.token = c.case_id AND c.questionnaire_id = '{$qfs[0]}') ";
$dtquery .= " JOIN `case` AS c ON ({$surveytable}.token = c.token AND c.questionnaire_id = '{$qfs[0]}') ";
if ($qfs[1] != 0) //if a sample is selected
$dtquery .= " JOIN `sample` AS s ON (s.sample_id = c.sample_id AND s.import_id = '{$qfs[1]}') ";
}
@@ -669,7 +669,7 @@ elseif ($subaction == "all")
if ($qfs != false)
{
//Limit responses by questionnaire and/or sample
$dtquery .= " JOIN `case` AS c ON ({$surveytable}.token = c.case_id AND c.questionnaire_id = '{$qfs[0]}') ";
$dtquery .= " JOIN `case` AS c ON ({$surveytable}.token = c.token AND c.questionnaire_id = '{$qfs[0]}') ";
if ($qfs[1] != 0) //if a sample is selected
$dtquery .= " JOIN `sample` AS s ON (s.sample_id = c.sample_id AND s.import_id = '{$qfs[1]}') ";
}
@@ -702,7 +702,7 @@ elseif ($subaction == "all")
if ($qfs != false)
{
//Limit responses by questionnaire and/or sample
$dtquery .= " JOIN `case` AS c ON ({$surveytable}.token = c.case_id AND c.questionnaire_id = '{$qfs[0]}') ";
$dtquery .= " JOIN `case` AS c ON ({$surveytable}.token = c.token AND c.questionnaire_id = '{$qfs[0]}') ";
if ($qfs[1] != 0) //if a sample is selected
$dtquery .= " JOIN `sample` AS s ON (s.sample_id = c.sample_id AND s.import_id = '{$qfs[1]}') ";
}

View File

@@ -460,7 +460,7 @@ function spss_getquery() {
if ($qfs != false)
{
//Limit responses by questionnaire and/or sample
$query .= " JOIN `case` AS c ON ({$dbprefix}survey_$surveyid.token = c.case_id AND c.questionnaire_id = '{$qfs[0]}') ";
$query .= " JOIN `case` AS c ON ({$dbprefix}survey_$surveyid.token = c.token AND c.questionnaire_id = '{$qfs[0]}') ";
if ($qfs[1] != 0) //if a sample is selected
$query .= " JOIN `sample` AS s ON (s.sample_id = c.sample_id AND s.import_id = '{$qfs[1]}') ";
}

View File

@@ -254,7 +254,8 @@ $quexsfilterstate = questionnaireSampleFilterstate();
$exportoutput .= "<option value='$attr_name' id='$attr_name' />".$attr_desc."</option>\n";
}
$exportoutput .= "<option value='token' id='token' />".$clang->gT("Case ID")."</option>\n"
$exportoutput .= "<option value='token' id='token' />".$clang->gT("Token")."</option>\n"
."<option value='caseid' id='caseid' />".$clang->gT("Case ID")."</option>\n"
."<option value='callattempts' id='callattempts' />".$clang->gT("Number of call attempts")."</option>\n"
."<option value='messagesleft' id='messagesleft' />".$clang->gT("Number of answering machine messages left")."</option>\n";
@@ -422,17 +423,24 @@ else
$dquery = "SELECT $selectfields";
if ($tokenTableExists && $thissurvey['anonymized']=='N' && isset($_POST['attribute_select']) && is_array($_POST['attribute_select']))
{
if (in_array('caseid',$_POST['attribute_select']))
{
$dquery .= ", (SELECT c4.case_id
FROM `case` as c4
WHERE c4.token = {$dbprefix}survey_$surveyid.token) as caseid ";
}
if (in_array('callattempts',$_POST['attribute_select']))
{
$dquery .= ", (SELECT COUNT(c.call_attempt_id)
FROM call_attempt as c
WHERE c.case_id = {$dbprefix}survey_$surveyid.token) as callattempts ";
FROM call_attempt as c, `case` as ca
WHERE c.case_id = ca.case_id AND ca.token = {$dbprefix}survey_$surveyid.token) as callattempts ";
}
if (in_array('messagesleft',$_POST['attribute_select']))
{
$dquery .= ", (SELECT COUNT(c2.call_id)
FROM `call` as c2
WHERE c2.case_id = {$dbprefix}survey_$surveyid.token
FROM `call` as c2, `case` as ca2
WHERE ca2.case_id = c2.case_id
AND ca2.token = {$dbprefix}survey_$surveyid.token
AND c2.outcome_id = 23) as messagesleft ";
}
if (in_array('token',$_POST['attribute_select']))
@@ -477,7 +485,7 @@ if ($tokenTableExists && $thissurvey['anonymized']=='N' && isset($_POST['attribu
{
$dquery .= ", ( SELECT sv.val
FROM sample_var as sv, `case` as c3
WHERE c3.case_id = {$dbprefix}survey_$surveyid.token
WHERE c3.token = {$dbprefix}survey_$surveyid.token
AND c3.sample_id = sv.sample_id
AND sv.var LIKE '$attr_name') as attribute_$i ";
@@ -505,7 +513,7 @@ $qfs = questionnaireSampleFilterstate();
if ($qfs != false)
{
//Limit responses by questionnaire and/or sample
$dquery .= " JOIN `case` AS c ON ({$dbprefix}survey_$surveyid.token = c.case_id AND c.questionnaire_id = '{$qfs[0]}') ";
$dquery .= " JOIN `case` AS c ON ({$dbprefix}survey_$surveyid.token = c.token AND c.questionnaire_id = '{$qfs[0]}') ";
if ($qfs[1] != 0) //if a sample is selected
$dquery .= " JOIN `sample` AS s ON (s.sample_id = c.sample_id AND s.import_id = '{$qfs[1]}') ";
}
@@ -530,6 +538,11 @@ for ($i=0; $i<$fieldcount; $i++)
if ($type == "csv") {$firstline .= "\"".$elang->gT("Number of answering machine messages left")."\"$separator";}
else {$firstline .= $elang->gT("Number of answering machine messages left")."$separator";}
}
elseif ($fieldinfo == "caseid")
{
if ($type == "csv") {$firstline .= "\"".$elang->gT("Case ID")."\"$separator";}
else {$firstline .= $elang->gT("Case ID")."$separator";}
}
elseif ($fieldinfo == "email")
{
if ($type == "csv") {$firstline .= "\"".$elang->gT("Email address")."\"$separator";}
@@ -547,8 +560,8 @@ for ($i=0; $i<$fieldcount; $i++)
}
elseif ($fieldinfo == "token")
{
if ($type == "csv") {$firstline .= "\"".$elang->gT("Case ID")."\"$separator";}
else {$firstline .= $elang->gT("Case ID")."$separator";}
if ($type == "csv") {$firstline .= "\"".$elang->gT("Token")."\"$separator";}
else {$firstline .= $elang->gT("Token")."$separator";}
}
elseif (substr($fieldinfo,0,10)=="attribute_")
{
@@ -823,7 +836,7 @@ elseif ($answers == "long") //chose complete answers
$fqid=0; // By default fqid is set to zero
$field=$dresult->FetchField($i);
$fieldinfo=$field->name;
if ($fieldinfo != "startlanguage" && $fieldinfo != "id" && $fieldinfo != "datestamp" && $fieldinfo != "startdate" && $fieldinfo != "ipaddr" && $fieldinfo != "refurl" && $fieldinfo != "token" && $fieldinfo != "firstname" && $fieldinfo != "lastname" && $fieldinfo != "email" && (substr($fieldinfo,0,10)!="attribute_") && $fieldinfo != "completed")
if ($fieldinfo != "startlanguage" && $fieldinfo != "id" && $fieldinfo != "datestamp" && $fieldinfo != "startdate" && $fieldinfo != "ipaddr" && $fieldinfo != "refurl" && $fieldinfo != "token" && $fieldinfo != "firstname" && $fieldinfo != "lastname" && $fieldinfo != "email" && (substr($fieldinfo,0,10)!="attribute_") && $fieldinfo != "completed" && $fieldinfo != "caseid" && $fieldinfo != "callattempts" && $fieldinfo != "messagesleft")
{
$fielddata=$fieldmap[$fieldinfo];
$fqid=$fielddata['qid'];
@@ -844,6 +857,15 @@ elseif ($answers == "long") //chose complete answers
{
switch($fieldinfo)
{
case "caseid":
$ftitle=$elang->gT("Case ID").":";
break;
case "callattempts":
$ftitle=$elang->gT("Number of call attempts").":";
break;
case "messagesleft":
$ftitle=$elang->gT("Number of answering machine messages left").":";
break;
case "datestamp":
$ftitle=$elang->gT("Date Last Action").":";
break;

View File

@@ -510,7 +510,7 @@
if ($qfs != false)
{
//Limit responses by questionnaire and/or sample
$query .= " JOIN `case` AS c ON ({$dbprefix}survey_$surveyid.token = c.case_id AND c.questionnaire_id = '{$qfs[0]}') ";
$query .= " JOIN `case` AS c ON ({$dbprefix}survey_$surveyid.token = c.token AND c.questionnaire_id = '{$qfs[0]}') ";
if ($qfs[1] != 0) //if a sample is selected
$query .= " JOIN `sample` AS s ON (s.sample_id = c.sample_id AND s.import_id = '{$qfs[1]}') ";
}
@@ -1143,7 +1143,7 @@
if ($qfs != false)
{
//Limit responses by questionnaire and/or sample
$query .= " JOIN `case` AS c ON ({$dbprefix}survey_$surveyid.token = c.case_id AND c.questionnaire_id = '{$qfs[0]}') ";
$query .= " JOIN `case` AS c ON ({$dbprefix}survey_$surveyid.token = c.token AND c.questionnaire_id = '{$qfs[0]}') ";
if ($qfs[1] != 0) //if a sample is selected
$query .= " JOIN `sample` AS s ON (s.sample_id = c.sample_id AND s.import_id = '{$qfs[1]}') ";
}
@@ -1207,7 +1207,7 @@
if ($qfs != false)
{
//Limit responses by questionnaire and/or sample
$query .= " JOIN `case` AS c ON ({$dbprefix}survey_$surveyid.token = c.case_id AND c.questionnaire_id = '{$qfs[0]}') ";
$query .= " JOIN `case` AS c ON ({$dbprefix}survey_$surveyid.token = c.token AND c.questionnaire_id = '{$qfs[0]}') ";
if ($qfs[1] != 0) //if a sample is selected
$query .= " JOIN `sample` AS s ON (s.sample_id = c.sample_id AND s.import_id = '{$qfs[1]}') ";
}
@@ -1237,7 +1237,7 @@
if ($qfs != false)
{
//Limit responses by questionnaire and/or sample
$querystarter .= " JOIN `case` AS c ON ({$dbprefix}survey_$surveyid.token = c.case_id AND c.questionnaire_id = '{$qfs[0]}') ";
$querystarter .= " JOIN `case` AS c ON ({$dbprefix}survey_$surveyid.token = c.token AND c.questionnaire_id = '{$qfs[0]}') ";
if ($qfs[1] != 0) //if a sample is selected
$querystarter .= " JOIN `sample` AS s ON (s.sample_id = c.sample_id AND s.import_id = '{$qfs[1]}') ";
}
@@ -1957,7 +1957,7 @@
if ($qfs != false)
{
//Limit responses by questionnaire and/or sample
$querylimit .= " JOIN `case` AS c ON ({$dbprefix}survey_$surveyid.token = c.case_id AND c.questionnaire_id = '{$qfs[0]}') ";
$querylimit .= " JOIN `case` AS c ON ({$dbprefix}survey_$surveyid.token = c.token AND c.questionnaire_id = '{$qfs[0]}') ";
if ($qfs[1] != 0) //if a sample is selected
$querylimit .= " JOIN `sample` AS s ON (s.sample_id = c.sample_id AND s.import_id = '{$qfs[1]}') ";
}

View File

@@ -123,7 +123,7 @@ elseif (isset($surveyid) && $surveyid)
if ($qfs != false)
{
//Limit responses by questionnaire and/or sample
$query .= " JOIN `case` AS c ON ({$dbprefix}survey_$surveyid.token = c.case_id AND c.questionnaire_id = '{$qfs[0]}') ";
$query .= " JOIN `case` AS c ON ({$dbprefix}survey_$surveyid.token = c.token AND c.questionnaire_id = '{$qfs[0]}') ";
if ($qfs[1] != 0) //if a sample is selected
$query .= " JOIN `sample` AS s ON (s.sample_id = c.sample_id AND s.import_id = '{$qfs[1]}') ";
}

View File

@@ -3419,7 +3419,7 @@
$sql = "SELECT sv.var,sv.val
FROM sample_var as sv, `case` as c
WHERE c.sample_id = sv.sample_id
AND c.case_id = {$_SESSION['token']}";
AND c.token = '{$_SESSION['token']}'";
$queXSrs = $connect->GetAssoc($sql);

View File

@@ -15,23 +15,31 @@
if (!isset($homedir) || isset($_REQUEST['$homedir'])) {die("Cannot run this script directly");}
require_once("save.php"); // for supporting functions only
include_once("quexs.php"); //queXS funcitons
// $LEMdebugLevel - customizable debugging for Lime Expression Manager
$LEMdebugLevel=0; // LEM_DEBUG_TIMING; // (LEM_DEBUG_TIMING + LEM_DEBUG_VALIDATION_SUMMARY + LEM_DEBUG_VALIDATION_DETAIL);
$LEMskipReprocessing=false; // true if used GetLastMoveResult to avoid generation of unneeded extra JavaScript
switch ($thissurvey['format'])
if ($interviewer)
{
case "A": //All in one
$surveyMode='survey';
break;
default:
case "S": //One at a time
$surveyMode='question';
break;
case "G": //Group at a time
$surveyMode='group';
break;
switch ($thissurvey['format'])
{
case "A": //All in one
$surveyMode='survey';
break;
default:
case "S": //One at a time
$surveyMode='question';
break;
case "G": //Group at a time
$surveyMode='group';
break;
}
}
else
$surveyMode=quexs_get_survey_mode($clienttoken);
$radix=getRadixPointData($thissurvey['surveyls_numberformat']);
$radix = $radix['seperator'];
@@ -459,11 +467,21 @@ else
//queXS Addition
include_once("quexs.php");
$quexs_url = get_start_interview_url();
$url = str_replace("{STARTINTERVIEWURL}", $quexs_url, $url);
$end_url = get_end_interview_url();
$url = str_replace("{ENDINTERVIEWURL}", $end_url, $url);
if ($interviewer)
{
$quexs_url = get_start_interview_url();
$url = str_replace("{STARTINTERVIEWURL}", $quexs_url, $url);
$end_url = get_end_interview_url();
$url = str_replace("{ENDINTERVIEWURL}", $end_url, $url);
}
else
{
$url = get_end_interview_url($clienttoken);
quexs_completed_by_respondent($surveyid,$clienttoken);
}
header("Location: {$url}");
}

View File

@@ -21,6 +21,8 @@ require_once(dirname(__FILE__).'/classes/core/startup.php');
require_once(dirname(__FILE__).'/config-defaults.php');
require_once(dirname(__FILE__).'/common.php');
require_once(dirname(__FILE__).'/classes/core/language.php');
include_once("quexs.php");
@ini_set('session.gc_maxlifetime', $sessionlifetime);
$loadname=returnglobal('loadname');
@@ -56,6 +58,7 @@ if (isset($_GET['loadall']) && $_GET['loadall'] == "reload" && isset($_GET['toke
//Must destroy the session
session_unset();
}
//end queXS Addition
//LimeExpressionManager::SetSurveyId($surveyid); // must be called early - it clears internal cache if a new survey is being used
@@ -120,6 +123,21 @@ if ( $embedded && $embedded_inc != '' )
require_once( $embedded_inc );
}
//queXS Addition
//see who is doing this survey - an interviewer or the respondent directly
$interviewer=returnglobal('interviewer');
if (!empty($interviewer) || (isset($_SESSION['interviewer']) && $_SESSION['interviewer'] == true))
{
$interviewer = true;
$_SESSION['interviewer'] = true;
}
else
{
$interviewer = false;
}
//CHECK FOR REQUIRED INFORMATION (sid)
if (!$surveyid || !$surveyexists)
{
@@ -512,15 +530,22 @@ else
//SET THE TEMPLATE DIRECTORY
if (!$thissurvey['templatedir'])
if ($interviewer)
{
$thistpl=sGetTemplatePath($defaulttemplate);
//SET THE TEMPLATE DIRECTORY
if (!$thissurvey['templatedir'])
{
$thistpl=sGetTemplatePath($defaulttemplate);
}
else
{
$thistpl=sGetTemplatePath($thissurvey['templatedir']);
}
}
else
{
$thistpl=sGetTemplatePath($thissurvey['templatedir']);
$thissurvey['templatedir'] = quexs_get_template($clienttoken);
$thistpl=sGetTemplatePath(quexs_get_template($clienttoken));
}
@@ -2649,7 +2674,7 @@ function check_quota($checkaction,$surveyid)
$querysel = "SELECT id FROM ".db_table_name('survey_'.$surveyid)." AS s
JOIN `case` AS cq ON (cq.case_id = '$case_id')
JOIN sample AS sampt ON (sampt.sample_id = cq.sample_id)
JOIN `case` AS c ON (c.case_id = s.token AND c.questionnaire_id = cq.questionnaire_id)
JOIN `case` AS c ON (c.token = s.token AND c.questionnaire_id = cq.questionnaire_id)
JOIN `sample` as sam ON (c.sample_id = sam.sample_id AND sam.import_id = sampt.import_id)
WHERE ".implode(' AND ',$querycond)." "."
AND s.submitdate IS NOT NULL";

View File

@@ -60,6 +60,29 @@ else
{
$usquery = "Update ".db_table_name("tokens_{$surveyid}")." set emailstatus='OptOut', usesleft=0 where token=".db_quoteall($token,true);
$usresult = $connect->Execute($usquery);
//queXS addition
//Set to Hard Refusal, respondent
$sql = "UPDATE `case`
SET current_outcome_id = 9
WHERE token = '$token'";
$connect->Execute($sql);
$sql = "SELECT case_id
FROM `case`
WHERE token = '$token'";
$case_id = $connect->GetOne($sql);
//Add a case note to clarify (need to translate this string)
$sql = "INSERT INTO `case_note` (case_id,operator_id,note,datetime)
VALUES ($case_id,1,'Self completion refused via opt out function',CONVERT_TZ(NOW(),'System','UTC'))";
$connect->Execute($sql);
$html .= $clang->gT('You have been successfully removed from this survey.');
}
else

View File

@@ -1,4 +1,4 @@
<?
<?php
/**
* Functions for interacting with queXS
*
@@ -36,6 +36,91 @@
require_once(dirname(__FILE__).'/../../config.inc.php');
/**
* Template for the self completion user
*
* @param string $clienttoken The token
*
* @return string The limesurvey template name
* @author Adam Zammit <adam.zammit@acspri.org.au>
* @since 2013-02-20
*/
function quexs_get_template($clienttoken)
{
if (empty($clienttoken)) return 'default';
$db = newADOConnection(DB_TYPE);
$db->Connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
$db->SetFetchMode(ADODB_FETCH_ASSOC);
$sql = "SELECT q.lime_template
FROM questionnaire as q, `case` as c
WHERE q.questionnaire_id = c.questionnaire_id
AND c.token = '$clienttoken'";
return $db->GetOne($sql);
}
/**
* Mode of survey completion
*
* @param string $clienttoken The token
*
* @return The limesurvey mode
* @author Adam Zammit <adam.zammit@acspri.org.au>
* @since 2013-02-20
*/
function quexs_get_survey_mode($clienttoken)
{
$db = newADOConnection(DB_TYPE);
$db->Connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
$db->SetFetchMode(ADODB_FETCH_ASSOC);
$sql = "SELECT q.lime_mode
FROM questionnaire as q, `case` as c
WHERE q.questionnaire_id = c.questionnaire_id
AND c.token = '$clienttoken'";
return $db->GetOne($sql);
}
/**
* Set the case as completed by respondent
*
* @param int $surveyid The limesurvey survey id
* @param string $clienttoken The token
*
* @return none
* @author Adam Zammit <adam.zammit@acspri.org.au>
* @since 2013-01-30
*/
function quexs_completed_by_respondent($surveyid,$clienttoken)
{
$db = newADOConnection(DB_TYPE);
$db->Connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
$db->SetFetchMode(ADODB_FETCH_ASSOC);
$sql = "UPDATE `case`
SET current_outcome_id = 40
WHERE token = '$clienttoken'";
$db->Execute($sql);
$sql = "SELECT case_id
FROM `case`
WHERE token = '$clienttoken'";
$case_id = $db->GetOne($sql);
//Add a case note to clarify (need to translate this string)
$sql = "INSERT INTO `case_note` (case_id,operator_id,note,datetime)
VALUES ($case_id,1,'Self completed online',CONVERT_TZ(NOW(),'System','UTC'))";
$db->Execute($sql);
}
/**
* Get the number of answering messages left for this case
*
@@ -441,6 +526,8 @@ function get_respondent_variable($variable,$respondent_id)
*/
function get_operator_id()
{
if (!isset($_SERVER['PHP_AUTH_USER'])) return false;
$db = newADOConnection(DB_TYPE);
$db->Connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
$db->SetFetchMode(ADODB_FETCH_ASSOC);
@@ -715,7 +802,7 @@ function get_respondent_selection_url()
{
$sid = get_limesurvey_id($operator_id,true); //true for RS
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?interviewer=interviewer&amp;loadall=reload&amp;sid=$sid&amp;token=$call_id&amp;lang=" . DEFAULT_LOCALE;
else
$url = 'rs_intro.php';
}
@@ -727,11 +814,26 @@ function get_respondent_selection_url()
/**
* Get the URL to end the interview
*
* @param string $token The token if ended by the respondent, blank if ended by the interviewer
* @return string The URL to end the interview
*/
function get_end_interview_url()
function get_end_interview_url($token = "")
{
return QUEXS_URL . "rs_project_end.php";
if ($token == "")
return QUEXS_URL . "rs_project_end.php";
else
{
$db = newADOConnection(DB_TYPE);
$db->Connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
$db->SetFetchMode(ADODB_FETCH_ASSOC);
$sql = "SELECT q.lime_endurl
FROM questionnaire as q, `case` as c
WHERE c.token = '$token'
AND c.questionnaire_id = q.questionnaire_id";
return $db->GetOne($sql);
}
}
/**
@@ -753,8 +855,14 @@ function get_start_interview_url()
if ($case_id)
{
$sql = "SELECT token
FROM `case`
WHERE case_id = $case_id";
$token = $db->GetOne($sql);
$sid = get_limesurvey_id($operator_id);
$url = LIME_URL . "index.php?loadall=reload&sid=$sid&token=$case_id&lang=" . DEFAULT_LOCALE;
$url = LIME_URL . "index.php?interviewer=interviewer&amp;loadall=reload&sid=$sid&token=$token&lang=" . DEFAULT_LOCALE;
$questionnaire_id = get_questionnaire_id($operator_id);
//get prefills

135
index.php
View File

@@ -1,4 +1,4 @@
<?
<?php
/**
* Display the main page including all panels and tabs
*
@@ -130,22 +130,31 @@ else if (HEADER_EXPANDER_MANUAL)
xhtml_head(T_("queXS"), $body, array("css/index.css","css/tabber.css","include/jquery-ui/css/smoothness/jquery-ui-1.8.2.custom.css") , $js);
print $script;
$case_id = get_case_id($operator_id,true);
$sql = "SELECT q.self_complete
FROM questionnaire as q, `case` as c
WHERE c.case_id = $case_id
AND c.questionnaire_id = q.questionnaire_id";
$sc = $db->GetOne($sql);
?>
<div id="casefunctions" class="header">
<div class='box'><a href="javascript:poptastic('call.php?end=end');"><? echo T_("End"); ?></a></div>
<div class='box'><a href="javascript:poptastic('appointment.php');"><? echo T_("Appointment"); ?></a></div>
<div class='box important'><a href="javascript:poptastic('call.php');"><? echo T_("Call/Hangup"); ?></a></div>
<div class='box'><a href="javascript:poptastic('supervisor.php');"><? echo T_("Supervisor"); ?></a></div>
<div class='box' id='recbox'><a id='reclink' class='offline' href="javascript:poptastic('record.php?start=start');"><? echo T_("Start REC"); ?></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 class='box'><a href='index.php?'><? echo T_("Restart"); ?></a></div>
<div class='box'><a href="javascript:poptastic('call.php?end=end');"><?php echo T_("End"); ?></a></div>
<div class='box'><a href="javascript:poptastic('appointment.php');"><?php echo T_("Appointment"); ?></a></div>
<div class='box important'><a href="javascript:poptastic('call.php');"><?php echo T_("Call/Hangup"); ?></a></div>
<div class='box'><a href="javascript:poptastic('supervisor.php');"><?php echo T_("Supervisor"); ?></a></div>
<?php if ($sc == 1) { ?><div class='box'><a href="javascript:poptastic('email.php');"><?php echo T_("Email"); ?></a></div><?php } ?>
<div class='box' id='recbox'><a id='reclink' class='offline' href="javascript:poptastic('record.php?start=start');"><?php echo T_("Start REC"); ?></a></div>
<?php if (HEADER_EXPANDER_MANUAL){ ?> <div class='headerexpand'><img id='headerexpandimage' src='./images/arrow-up-2.png' alt='<?php echo T_('Arrow for expanding or contracting'); ?>'/></div> <?php } ?>
<div class='box'><a href='index.php?'><?php echo T_("Restart"); ?></a></div>
</div>
<div id="content" class="content">
<?
<?php
$case_id = get_case_id($operator_id,true);
$ca = get_call_attempt($operator_id,true);
$appointment = false;
$availability = is_using_availability($case_id);
@@ -168,11 +177,11 @@ xhtml_object($data,"main-content");
</div>
<div id="respondent" class="header">
<?xhtml_object("respondent.php","main-respondent");?>
<?php xhtml_object("respondent.php","main-respondent");?>
</div>
<div id="qstatus" class="header">
<?xhtml_object("status.php","main-qstatus");?>
<?php xhtml_object("status.php","main-qstatus");?>
</div>
@@ -181,92 +190,92 @@ xhtml_object($data,"main-content");
<div class="tabber" id="tab-main">
<? if (TAB_CASENOTES) { ?>
<div class="tabbertab <? if ((DEFAULT_TAB == 'casenotes' && !$appointment) || (DEFAULT_TAB_APPOINTMENT == 'casenotes' && $appointment))
<?php if (TAB_CASENOTES) { ?>
<div class="tabbertab <?php 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>
<h2><?php echo T_("Notes"); ?></h2>
<div id="div-casenotes" class="tabberdiv"><?php xhtml_object("casenote.php","main-casenotes");?></div>
</div>
<? }?>
<?php }?>
<? if ($availability) { ?>
<div class="tabbertab <? if ((DEFAULT_TAB == 'availability' && !$appointment) || (DEFAULT_TAB_APPOINTMENT == 'availability' && $appointment))
<?php if ($availability) { ?>
<div class="tabbertab <?php if ((DEFAULT_TAB == 'availability' && !$appointment) || (DEFAULT_TAB_APPOINTMENT == 'availability' && $appointment))
print "tabbertabdefault"; ?>">
<h2><? echo T_("Availability"); ?></h2>
<div id="div-casenotes" class="tabberdiv"><?xhtml_object("availability.php","main-casenotes");?></div>
<h2><?php echo T_("Availability"); ?></h2>
<div id="div-casenotes" class="tabberdiv"><?php xhtml_object("availability.php","main-casenotes");?></div>
</div>
<? }?>
<?php }?>
<? if (TAB_CONTACTDETAILS) { ?>
<div class="tabbertab <? if ((DEFAULT_TAB == 'contactdetails' && !$appointment) || (DEFAULT_TAB_APPOINTMENT == 'contactdetails' && $appointment))
<?php if (TAB_CONTACTDETAILS) { ?>
<div class="tabbertab <?php 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>
<h2><?php echo T_("Contact details"); ?></h2>
<div id="div-contactdetails" class="tabberdiv"><?php xhtml_object("contactdetails.php","main-contactdetails");?></div>
</div>
<? }?>
<?php }?>
<? if (TAB_CALLLIST) { ?>
<div class="tabbertab <? if ((DEFAULT_TAB == 'calllist' && !$appointment) || (DEFAULT_TAB_APPOINTMENT == 'calllist' && $appointment))
<?php if (TAB_CALLLIST) { ?>
<div class="tabbertab <?php 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>
<h2><?php echo T_("Call history"); ?></h2>
<div id="div-calllist" class="tabberdiv"><?php xhtml_object("calllist.php","main-calllist");?></div>
</div>
<? }?>
<?php }?>
<? if (TAB_SHIFTS) { ?>
<div class="tabbertab <? if ((DEFAULT_TAB == 'shifts' && !$appointment) || (DEFAULT_TAB_APPOINTMENT == 'shifts' && $appointment))
<?php if (TAB_SHIFTS) { ?>
<div class="tabbertab <?php 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>
<h2><?php echo T_("Shifts"); ?></h2>
<div id="div-shifts" class="tabberdiv"><?php xhtml_object("shifts.php","main-shifts");?></div>
</div>
<? }?>
<?php }?>
<? if (TAB_APPOINTMENTLIST) { ?>
<div class="tabbertab <? if ((DEFAULT_TAB == 'appointmentlist' && !$appointment) || (DEFAULT_TAB_APPOINTMENT == 'appointmentlist' && $appointment))
<?php if (TAB_APPOINTMENTLIST) { ?>
<div class="tabbertab <?php 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>
<h2><?php echo T_("Appointments"); ?></h2>
<div id="div-appointmentlist" class="tabberdiv"><?php xhtml_object("appointmentlist.php","main-appointmentlist");?></div>
</div>
<? }?>
<?php }?>
<? if (TAB_PERFORMANCE) { ?>
<div class="tabbertab <? if ((DEFAULT_TAB == 'performance' && !$appointment) || (DEFAULT_TAB_APPOINTMENT == 'performance' && $appointment))
<?php if (TAB_PERFORMANCE) { ?>
<div class="tabbertab <?php 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>
<h2><?php echo T_("Performance"); ?></h2>
<div id="div-performance" class="tabberdiv"><?php xhtml_object("performance.php","main-performance");?></div>
</div>
<? }?>
<?php }?>
<? if (TAB_CALLHISTORY) { ?>
<div class="tabbertab <? if ((DEFAULT_TAB == 'callhistory' && !$appointment) || (DEFAULT_TAB_APPOINTMENT == 'callhistory' && $appointment))
<?php if (TAB_CALLHISTORY) { ?>
<div class="tabbertab <?php 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>
<h2><?php echo T_("Work history"); ?></h2>
<div id="div-callhistory" class="tabberdiv"><?php xhtml_object("callhistory.php","main-callhistory");?></div>
</div>
<? }?>
<?php }?>
<? if (TAB_PROJECTINFO) { ?>
<div class="tabbertab <? if ((DEFAULT_TAB == 'projectinfo' && !$appointment) || (DEFAULT_TAB_APPOINTMENT == 'projectinfo' && $appointment))
<?php if (TAB_PROJECTINFO) { ?>
<div class="tabbertab <?php 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>
<h2><?php echo T_("Project information"); ?></h2>
<div id="div-projectinfo" class="tabberdiv"><?php xhtml_object("project_info.php","main-projectinfo");?></div>
</div>
<? }?>
<?php }?>
<? if (TAB_INFO) { ?>
<div class="tabbertab <? if ((DEFAULT_TAB == 'info' && !$appointment) || (DEFAULT_TAB_APPOINTMENT == 'info' && $appointment))
<?php if (TAB_INFO) { ?>
<div class="tabbertab <?php 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>
<h2><?php echo T_("Info"); ?></h2>
<div id="div-info" class="tabberdiv"><?php xhtml_object("info.php","main-info");?></div>
</div>
<? }?>
<?php }?>
</div>
@@ -274,7 +283,7 @@ xhtml_object($data,"main-content");
</div>
<?
<?php
xhtml_foot();

View File

@@ -1,4 +1,4 @@
<?
<?php
/**
* Display the main page including all panels and tabs
*
@@ -195,20 +195,29 @@ else if (HEADER_EXPANDER_MANUAL)
xhtml_head(T_("queXS"), $body, array("css/index_interface2.css","css/tabber_interface2.css","include/jquery-ui/css/smoothness/jquery-ui-1.8.2.custom.css") , $js);
print $script;
$case_id = get_case_id($operator_id,true);
$sql = "SELECT q.self_complete
FROM questionnaire as q, `case` as c
WHERE c.case_id = $case_id
AND c.questionnaire_id = q.questionnaire_id";
$sc = $db->GetOne($sql);
?>
<ul id="casefunctions" class="header">
<li id="item_1"><a href="javascript:poptastic('call_interface2.php');"><? echo T_("Outcome"); ?> <img src="css/images/play.jpg" /></a></li>
<li id="item_2_e" class="item_2_full_height"><a href="javascript:poptastic('appointment.php');"><? echo T_("Appointment"); ?> <img src="css/images/plius.jpg" /></a></li>
<li id="item_3_e" class="item_3_full_height"><a href="?endwork=endwork"><? echo T_("End work"); ?> <img src="css/images/end.jpg" /></a></li>
<li id="item_1"><a href="javascript:poptastic('call_interface2.php');"><?php echo T_("Outcome"); ?> <img src="css/images/play.jpg" /></a></li>
<li id="item_2_e" class="item_2_full_height"><a href="javascript:poptastic('appointment.php');"><?php echo T_("Appointment"); ?> <img src="css/images/plius.jpg" /></a></li>
<?php if ($sc == 1) { ?><li id='item_4_e' class="item_2_full_height"><a href="javascript:poptastic('email.php?interface2=true');"><?php echo T_("Email"); ?> <img src="css/images/plius.jpg" /></a></li><?php } ?>
<li id="item_3_e" class="item_3_full_height"><a href="?endwork=endwork"><?php echo T_("End work"); ?> <img src="css/images/end.jpg" /></a></li>
</ul>
<div id="content" class="content">
<?
<?php
$case_id = get_case_id($operator_id,true);
$ca = get_call_attempt($operator_id,true);
$call_id = get_call($operator_id);
$appointment = false;
@@ -278,8 +287,8 @@ xhtml_object($data,"main-content");
</div>
<div id="qstatus" class="header">
<?xhtml_object("status_interface2.php","main-qstatus");?>
<? if (HEADER_EXPANDER_MANUAL){ ?> <div class='headerexpand'><img id='headerexpandimage' src='./images/arrow-up-2.jpg' alt='<? echo T_('Arrow for expanding or contracting'); ?>'/></div> <? } ?>
<?php xhtml_object("status_interface2.php","main-qstatus");?>
<?php if (HEADER_EXPANDER_MANUAL){ ?> <div class='headerexpand'><img id='headerexpandimage' src='./images/arrow-up-2.jpg' alt='<?php echo T_('Arrow for expanding or contracting'); ?>'/></div> <?php } ?>
</div>
@@ -288,82 +297,82 @@ xhtml_object($data,"main-content");
<div class="tabber" id="tab-main">
<? if (TAB_CASENOTES) { ?>
<div class="tabbertab <? if ((DEFAULT_TAB == 'casenotes' && !$appointment) || (DEFAULT_TAB_APPOINTMENT == 'casenotes' && $appointment))
<?php if (TAB_CASENOTES) { ?>
<div class="tabbertab <?php 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>
<h2><?php echo T_("Notes"); ?></h2>
<div id="div-casenotes" class="tabberdiv"><?php xhtml_object("casenote.php","main-casenotes");?></div>
</div>
<? }?>
<?php }?>
<? if (TAB_CONTACTDETAILS) { ?>
<div class="tabbertab <? if ((DEFAULT_TAB == 'contactdetails' && !$appointment) || (DEFAULT_TAB_APPOINTMENT == 'contactdetails' && $appointment))
<?php if (TAB_CONTACTDETAILS) { ?>
<div class="tabbertab <?php 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>
<h2><?php echo T_("Contact details"); ?></h2>
<div id="div-contactdetails" class="tabberdiv"><?php xhtml_object("contactdetails.php","main-contactdetails");?></div>
</div>
<? }?>
<?php }?>
<? if (TAB_CALLLIST) { ?>
<div class="tabbertab <? if ((DEFAULT_TAB == 'calllist' && !$appointment) || (DEFAULT_TAB_APPOINTMENT == 'calllist' && $appointment))
<?php if (TAB_CALLLIST) { ?>
<div class="tabbertab <?php 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>
<h2><?php echo T_("Call history"); ?></h2>
<div id="div-calllist" class="tabberdiv"><?php xhtml_object("calllist.php","main-calllist");?></div>
</div>
<? }?>
<?php }?>
<? if (TAB_SHIFTS) { ?>
<div class="tabbertab <? if ((DEFAULT_TAB == 'shifts' && !$appointment) || (DEFAULT_TAB_APPOINTMENT == 'shifts' && $appointment))
<?php if (TAB_SHIFTS) { ?>
<div class="tabbertab <?php 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>
<h2><?php echo T_("Shifts"); ?></h2>
<div id="div-shifts" class="tabberdiv"><?php xhtml_object("shifts.php","main-shifts");?></div>
</div>
<? }?>
<?php }?>
<? if (TAB_APPOINTMENTLIST) { ?>
<div class="tabbertab <? if ((DEFAULT_TAB == 'appointmentlist' && !$appointment) || (DEFAULT_TAB_APPOINTMENT == 'appointmentlist' && $appointment))
<?php if (TAB_APPOINTMENTLIST) { ?>
<div class="tabbertab <?php 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>
<h2><?php echo T_("Appointments"); ?></h2>
<div id="div-appointmentlist" class="tabberdiv"><?php xhtml_object("appointmentlist.php","main-appointmentlist");?></div>
</div>
<? }?>
<?php }?>
<? if (TAB_PERFORMANCE) { ?>
<div class="tabbertab <? if ((DEFAULT_TAB == 'performance' && !$appointment) || (DEFAULT_TAB_APPOINTMENT == 'performance' && $appointment))
<?php if (TAB_PERFORMANCE) { ?>
<div class="tabbertab <?php 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>
<h2><?php echo T_("Performance"); ?></h2>
<div id="div-performance" class="tabberdiv"><?php xhtml_object("performance.php","main-performance");?></div>
</div>
<? }?>
<?php }?>
<? if (TAB_CALLHISTORY) { ?>
<div class="tabbertab <? if ((DEFAULT_TAB == 'callhistory' && !$appointment) || (DEFAULT_TAB_APPOINTMENT == 'callhistory' && $appointment))
<?php if (TAB_CALLHISTORY) { ?>
<div class="tabbertab <?php 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>
<h2><?php echo T_("Work history"); ?></h2>
<div id="div-callhistory" class="tabberdiv"><?php xhtml_object("callhistory.php","main-callhistory");?></div>
</div>
<? }?>
<?php }?>
<? if (TAB_PROJECTINFO) { ?>
<div class="tabbertab <? if ((DEFAULT_TAB == 'projectinfo' && !$appointment) || (DEFAULT_TAB_APPOINTMENT == 'projectinfo' && $appointment))
<?php if (TAB_PROJECTINFO) { ?>
<div class="tabbertab <?php 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>
<h2><?php echo T_("Project information"); ?></h2>
<div id="div-projectinfo" class="tabberdiv"><?php xhtml_object("project_info.php","main-projectinfo");?></div>
</div>
<? }?>
<?php }?>
<? if (TAB_INFO) { ?>
<div class="tabbertab <? if ((DEFAULT_TAB == 'info' && !$appointment) || (DEFAULT_TAB_APPOINTMENT == 'info' && $appointment))
<?php if (TAB_INFO) { ?>
<div class="tabbertab <?php 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>
<h2><?php echo T_("Info"); ?></h2>
<div id="div-info" class="tabberdiv"><?php xhtml_object("info.php","main-info");?></div>
</div>
<? }?>
<?php }?>
</div>
@@ -371,7 +380,7 @@ xhtml_object($data,"main-content");
</div>
<?
<?php
xhtml_foot();

View File

@@ -1,4 +1,4 @@
<?
<?php
/**
* Display information about this centre
*

View File

@@ -1,4 +1,4 @@
<?
<?php
/**
* Language configuration file
*

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,4 @@
<?
<?php
/**
* Display error message when no current call available
*
@@ -51,8 +51,8 @@ if (AUTO_LOGOUT_MINUTES !== false)
xhtml_head(T_("No call available"),true,array("css/table.css"),$js);
?>
<h1><? echo T_("Please click on:") . " " . T_("Call/Hangup") . " " .T_("to display call script"); ?></h1>
<?
<h1><?php echo T_("Please click on:") . " " . T_("Call/Hangup") . " " .T_("to display call script"); ?></h1>
<?php
xhtml_foot();

View File

@@ -1,4 +1,4 @@
<?
<?php
/**
* Display error message when no cases available
*
@@ -65,10 +65,10 @@ xhtml_head(T_("No case available"),true,array("css/table.css"),$js);
$operator_id = get_operator_id();
?>
<h1><? echo T_("There is no case currently available"); ?></h1>
<h2><? echo T_("Reasons:"); ?></h2>
<h1><?php echo T_("There is no case currently available"); ?></h1>
<h2><?php echo T_("Reasons:"); ?></h2>
<?
<?php
/**
* check for reasons why no case is displayed
@@ -85,13 +85,13 @@ $sql = "SELECT oq.questionnaire_id, q.description
$rs = $db->GetAll($sql);
?>
<p><? echo T_("Assigned questionnaires:"); ?></p>
<?
<p><?php echo T_("Assigned questionnaires:"); ?></p>
<?php
if (!empty($rs))
xhtml_table($rs,array("questionnaire_id","description"),array(T_("ID"),T_("Description")));
else
{
?> <p class='error'><? echo T_("ERROR: No questionnaires assigned to you"); ?></p> <?
?> <p class='error'><?php echo T_("ERROR: No questionnaires assigned to you"); ?></p> <?php
}
@@ -109,13 +109,13 @@ $sql = "SELECT q.description, CONVERT_TZ(sh.start, 'UTC', o.Time_zone_name) as s
$rs = $db->GetAll($sql);
?>
<p><? echo T_("Current shifts available:"); ?></p>
<?
<p><?php echo T_("Current shifts available:"); ?></p>
<?php
if (!empty($rs))
xhtml_table($rs,array("description","st","en"),array(T_("Questionnaire"),T_("Shift start"),T_("Shift end")));
else
{
?> <p class='error'><? echo T_("ERROR: No shifts at this time"); ?></p> <?
?> <p class='error'><?php echo T_("ERROR: No shifts at this time"); ?></p> <?php
}
//call restrictions and outside times
@@ -135,11 +135,11 @@ $sql = "SELECT count(*) as c
$rs = $db->GetRow($sql);
?>
<p><? echo T_("Call restrictions:"); ?></p>
<?
<p><?php echo T_("Call restrictions:"); ?></p>
<?php
if ($rs['c'] == 0)
{
?> <p class='error'><? echo T_("ERROR: There are no cases available that fall within call restrictions"); ?></p> <?
?> <p class='error'><?php echo T_("ERROR: There are no cases available that fall within call restrictions"); ?></p> <?php
}
else
{
@@ -149,8 +149,8 @@ else
?>
<p><? echo T_("Limesurvey links:"); ?></p>
<?
<p><?php echo T_("Limesurvey links:"); ?></p>
<?php
//no link to limesurvey
$sql = "SELECT q.lime_sid, q.description

View File

@@ -1,4 +1,4 @@
<?
<?php
/**
* Display the performance of this operator
*

View File

@@ -1,4 +1,4 @@
<?
<?php
/**
* Display information about this project
*

View File

@@ -1,4 +1,4 @@
<?
<?php
/**
* Record calls using Asterisk (if enabled)
*

View File

@@ -1,4 +1,4 @@
<?
<?php
/**
* Display a list of respondents for this case, and the ability to add them if necessary
*
@@ -90,12 +90,12 @@ if (isset($_GET['respondent_id']) && $_GET['respondent_id'] == 0)
{
?>
<form method="post" action="?">
<? display_respondent_form(false,$case_id); ?>
<div><input type='submit' name='submit' id='submit' value='<? echo T_("Add respondent"); ?>'/></div>
<?php display_respondent_form(false,$case_id); ?>
<div><input type='submit' name='submit' id='submit' value='<?php echo T_("Add respondent"); ?>'/></div>
</form>
<div><a href="?"><? echo T_("Go back"); ?></a></div>
<div><a href="?"><?php echo T_("Go back"); ?></a></div>
<?
<?php
}
else
{

View File

@@ -1,4 +1,4 @@
<?
<?php
/**
* Respondent selection - Answering machine
*
@@ -78,18 +78,18 @@ else
print "<p class='rstext'>" . T_("Do not leave a message, please hang up") . "</p>";
?>
<p class='rsoption'><a href="javascript:parent.poptastic('call.php?defaultoutcome=29');"><? echo T_("End call with outcome: Business answering machine"); ?></a></p>
<?
<p class='rsoption'><a href="javascript:parent.poptastic('call.php?defaultoutcome=29');"><?php echo T_("End call with outcome: Business answering machine"); ?></a></p>
<?php
if ($leavemessage)
{
?>
<p class='rsoption'><a href="javascript:parent.poptastic('call.php?defaultoutcome=23');"><? echo T_("End call with outcome: Answering machine Message left"); ?></a></p>
<?
<p class='rsoption'><a href="javascript:parent.poptastic('call.php?defaultoutcome=23');"><?php echo T_("End call with outcome: Answering machine Message left"); ?></a></p>
<?php
}
?>
<p class='rsoption'><a href="javascript:parent.poptastic('call.php?defaultoutcome=24');"><? echo T_("End call with outcome: Answering machine No message left"); ?></a></p>
<p class='rsoption'><a href="rs_intro.php"><? echo T_("Go Back"); ?></a></p>
<?
<p class='rsoption'><a href="javascript:parent.poptastic('call.php?defaultoutcome=24');"><?php echo T_("End call with outcome: Answering machine No message left"); ?></a></p>
<p class='rsoption'><a href="rs_intro.php"><?php echo T_("Go Back"); ?></a></p>
<?php
xhtml_foot();

Some files were not shown because too many files have changed in this diff Show More