mirror of
https://github.com/ACSPRI/queXS
synced 2024-04-02 12:12:16 +00:00
Add specification for storing self completion details
Allow for self completion without using interviewer argument to Limesurvey (need to update to take details from database)
This commit is contained in:
@@ -23,6 +23,11 @@ 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 `lime_mode` VARCHAR( 64 ) NULL COMMENT 'Limesurvey mode for respondent self completion' AFTER `info` ,
|
||||
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
|
||||
|
||||
|
||||
@@ -1099,7 +1099,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&loadall=reload" . $amp . "sid=$sid" . $amp . "token=$call_id" . $amp . "lang=" . DEFAULT_LOCALE;
|
||||
else
|
||||
{
|
||||
if ($interface2)
|
||||
@@ -1142,7 +1142,7 @@ function get_limesurvey_url($operator_id)
|
||||
$token = $db->GetOne($sql);
|
||||
|
||||
$sid = get_limesurvey_id($operator_id);
|
||||
$url = LIME_URL . "index.php?loadall=reload&sid=$sid&token=$token&lang=" . DEFAULT_LOCALE;
|
||||
$url = LIME_URL . "index.php?interviewer=interviewer&loadall=reload&sid=$sid&token=$token&lang=" . DEFAULT_LOCALE;
|
||||
$questionnaire_id = get_questionnaire_id($operator_id);
|
||||
|
||||
//get prefills
|
||||
|
||||
@@ -19,19 +19,26 @@ require_once("save.php"); // for supporting functions only
|
||||
// $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='survey';
|
||||
|
||||
$radix=getRadixPointData($thissurvey['surveyls_numberformat']);
|
||||
$radix = $radix['seperator'];
|
||||
|
||||
@@ -462,7 +469,16 @@ else
|
||||
$quexs_url = get_start_interview_url();
|
||||
$url = str_replace("{STARTINTERVIEWURL}", $quexs_url, $url);
|
||||
|
||||
$end_url = get_end_interview_url();
|
||||
if ($interviewer)
|
||||
{
|
||||
$end_url = get_end_interview_url();
|
||||
}
|
||||
else
|
||||
{
|
||||
$url = get_end_interview_url($clienttoken);
|
||||
quexs_completed_by_respondent($surveyid,$clienttoken);
|
||||
}
|
||||
|
||||
$url = str_replace("{ENDINTERVIEWURL}", $end_url, $url);
|
||||
|
||||
header("Location: {$url}");
|
||||
|
||||
@@ -56,6 +56,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 +121,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,16 +528,20 @@ 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']);
|
||||
}
|
||||
$thistpl=sGetTemplatePath('sherpa');
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -36,6 +36,30 @@
|
||||
require_once(dirname(__FILE__).'/../../config.inc.php');
|
||||
|
||||
|
||||
/**
|
||||
* 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 = 34
|
||||
WHERE token = '$clienttoken'";
|
||||
|
||||
$db->Execute($sql);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the number of answering messages left for this case
|
||||
*
|
||||
@@ -715,7 +739,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&sid=$sid&token=$call_id&lang=" . DEFAULT_LOCALE;
|
||||
$url = LIME_URL . "index.php?interviewer=interviewer&loadall=reload&sid=$sid&token=$call_id&lang=" . DEFAULT_LOCALE;
|
||||
else
|
||||
$url = 'rs_intro.php';
|
||||
}
|
||||
@@ -727,11 +751,15 @@ 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
|
||||
return "http://www.google.com.au";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -760,7 +788,7 @@ function get_start_interview_url()
|
||||
$token = $db->GetOne($sql);
|
||||
|
||||
$sid = get_limesurvey_id($operator_id);
|
||||
$url = LIME_URL . "index.php?loadall=reload&sid=$sid&token=$token&lang=" . DEFAULT_LOCALE;
|
||||
$url = LIME_URL . "index.php?interviewer=interviewer&loadall=reload&sid=$sid&token=$token&lang=" . DEFAULT_LOCALE;
|
||||
$questionnaire_id = get_questionnaire_id($operator_id);
|
||||
|
||||
//get prefills
|
||||
|
||||
Reference in New Issue
Block a user