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

Add operator and respondent details to expression manager

This commit is contained in:
Adam Zammit
2013-03-27 12:13:21 +11:00
parent 7cb7de5d16
commit fc74099de7
4 changed files with 64 additions and 6 deletions

View File

@@ -70,7 +70,7 @@ class ExpressionManager {
$RDP_regex_compare = '<=|<|>=|>|==|!=|\ble\b|\blt\b|\bge\b|\bgt\b|\beq\b|\bne\b';
$RDP_regex_assign = '='; // '=|\+=|-=|\*=|/=';
$RDP_regex_sgqa = '(?:INSERTANS:)?[0-9]+X[0-9]+X[0-9]+[A-Z0-9_]*\#?[01]?(?:\.(?:' . ExpressionManager::$RDP_regex_var_attr . '))?';
$RDP_regex_word = '(?:TOKEN:|SAMPLE:)?(?:[A-Z][A-Z0-9_]*)?(?:\.(?:[A-Z][A-Z0-9_]*))*(?:\.(?:' . ExpressionManager::$RDP_regex_var_attr . '))?';
$RDP_regex_word = '(?:TOKEN:|SAMPLE:|OPERATOR:|RESPONDENT:)?(?:[A-Z][A-Z0-9_]*)?(?:\.(?:[A-Z][A-Z0-9_]*))*(?:\.(?:' . ExpressionManager::$RDP_regex_var_attr . '))?';
$RDP_regex_number = '[0-9]+\.?[0-9]*|\.[0-9]+';
$RDP_regex_andor = '\band\b|\bor\b|&&|\|\|';
$RDP_regex_lcb = '{';

View File

@@ -3433,6 +3433,55 @@
'readWrite'=>'N',
);
}
//add operator and respondent details
$this->knownVars["OPERATOR:FIRSTNAME"] =
array('code' => $connect->GetOne(" SELECT o.firstName
FROM operator as o, `case` as c
WHERE c.token = '{$_SESSION['token']}'
AND o.operator_id = c.current_operator_id"),
'jsName_on'=>'',
'jsName'=>'',
'readWrite'=>'N',
);
$this->knownVars["OPERATOR:LASTNAME"] =
array('code' => $connect->GetOne(" SELECT o.lastName
FROM operator as o, `case` as c
WHERE c.token = '{$_SESSION['token']}'
AND o.operator_id = c.current_operator_id"),
'jsName_on'=>'',
'jsName'=>'',
'readWrite'=>'N',
);
$this->knownVars["RESPONDENT:FIRSTNAME"] =
array('code' => $connect->GetOne(" SELECT r.firstName
FROM respondent as r, `case` as c, call_attempt as ca
WHERE c.token = '{$_SESSION['token']}'
AND ca.case_id = c.case_id
AND ca.end IS NULL
AND r.respondent_id = ca.respondent_id"),
'jsName_on'=>'',
'jsName'=>'',
'readWrite'=>'N',
);
$this->knownVars["RESPONDENT:LASTNAME"] =
array('code' => $connect->GetOne(" SELECT r.lastName
FROM respondent as r, `case` as c, call_attempt as ca
WHERE c.token = '{$_SESSION['token']}'
AND ca.case_id = c.case_id
AND ca.end IS NULL
AND r.respondent_id = ca.respondent_id"),
'jsName_on'=>'',
'jsName'=>'',
'readWrite'=>'N',
);
}
else
@@ -3480,6 +3529,17 @@
'readWrite'=>'N',
);
}
$oa= array("OPERATOR:FIRSTNAME","OPERATOR:LASTNAME","RESPONDENT:FIRSTNAME","RESPONDENT:LASTNAME");
foreach ($oa as $o)
{
$this->knownVars[$o] = array(
'code'=>"",
'jsName_on'=>'',
'jsName'=>'',
'readWrite'=>'N',
);
}
}

View File

@@ -632,10 +632,6 @@ function quexs_core_replace()
$core['PERCCOMPLETE'] = round(get_percent_complete($case_id),0);
$core['ENDINTERVIEWURL'] = get_end_interview_url();
$core['STARTINTERVIEWURL'] = get_start_interview_url();
$core['OPERATOR:FIRSTNAME'] = get_operator_variable('firstName',$operator_id);
$core['OPERATOR:LASTNAME'] = get_operator_variable('lastName',$operator_id);
$core['RESPONDENT:FIRSTNAME'] = get_respondent_variable('firstName',$respondent_id);
$core['RESPONDENT:LASTNAME'] = get_respondent_variable('lastName',$respondent_id);
return $core;
}