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

Added PERCCOMPLETE token to enhance respondent selection scripts

Displays percentage complete of the main case instrument
Also can be used as a token for limesurvey conditions (i.e. check for it being > 0 to say "we have already started")
This commit is contained in:
azammitdcarf
2010-10-18 02:05:15 +00:00
parent 3586883a71
commit f7b418fb13
2 changed files with 105 additions and 15 deletions

View File

@@ -6152,6 +6152,7 @@ function GetTokenConditionsFieldNames($surveyid)
$basic_attrs=Array('firstname','lastname','email','token','language','sent','remindersent','remindercount');
$basic_attrs[] = 'callattempts'; //queXS addition
$basic_attrs[] = 'onappointment'; //queXS addition
$basic_attrs[] = 'perccomplete'; //queXS addition
return array_merge($basic_attrs,$extra_attrs);
}
@@ -6172,6 +6173,7 @@ function GetTokenFieldsAndNames($surveyid, $onlyAttributes=false)
$basic_attrs=Array('firstname','lastname','email','token','language','sent','remindersent','remindercount');
$basic_attrs[] = 'callattempts'; //queXS addition
$basic_attrs[] = 'onappointment'; //queXS addition
$basic_attrs[] = 'perccomplete'; //queXS addition
$basic_attrs_names=Array(
$clang->gT('First Name'),
$clang->gT('Last Name'),
@@ -6184,6 +6186,7 @@ function GetTokenFieldsAndNames($surveyid, $onlyAttributes=false)
$basic_attrs_names[] = $clang->gT('queXS: Number of call attempts'); //queXS addition
$basic_attrs_names[] = $clang->gT('queXS: On appointment?'); //queXS addition
$basic_attrs_names[] = $clang->gT('queXS: Percentage complete'); //queXS addition
$thissurvey=getSurveyInfo($surveyid);
$attdescriptiondata=!empty($thissurvey['attributedescriptions']) ? $thissurvey['attributedescriptions'] : "";
@@ -6236,7 +6239,7 @@ function GetAttributeValue($surveyid,$attrName,$token)
$sanitized_token=$connect->qstr($token,get_magic_quotes_gpc());
$surveyid=sanitize_int($surveyid);
if ($attrName == 'callattempts' || $attrName == 'onappointment') //queXS addition
if ($attrName == 'callattempts' || $attrName == 'onappointment' || $attrName == 'perccomplete') //queXS addition
{
include_once("quexs.php");
$quexs_operator_id = get_operator_id();
@@ -6247,6 +6250,8 @@ function GetAttributeValue($surveyid,$attrName,$token)
return get_call_attempts($quexs_case_id);
else if ($attrName == 'onappointment')
return is_on_appointment($quexs_case_id,$quexs_operator_id);
else if ($attrName == 'perccomplete')
return get_percent_complete($quexs_case_id);
}
else
return 0;