diff --git a/CHANGELOG b/CHANGELOG index 1f5d8bf0..ca5e5fa0 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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 diff --git a/functions/functions.operator.php b/functions/functions.operator.php index 6cbad231..597fe83e 100644 --- a/functions/functions.operator.php +++ b/functions/functions.operator.php @@ -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 diff --git a/include/limesurvey/group.php b/include/limesurvey/group.php index fa41d0af..ba449634 100644 --- a/include/limesurvey/group.php +++ b/include/limesurvey/group.php @@ -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']; @@ -461,8 +468,17 @@ else include_once("quexs.php"); $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}"); diff --git a/include/limesurvey/index.php b/include/limesurvey/index.php index 0524e2c1..7f9a01b2 100644 --- a/include/limesurvey/index.php +++ b/include/limesurvey/index.php @@ -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'); diff --git a/include/limesurvey/quexs.php b/include/limesurvey/quexs.php index 0efbdf64..0d2bb8ea 100644 --- a/include/limesurvey/quexs.php +++ b/include/limesurvey/quexs.php @@ -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 + * @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