mirror of
https://github.com/ACSPRI/queXS
synced 2024-04-02 12:12:16 +00:00
Allow adding a remote questionnaire (list only active remote questionnaires)
This commit is contained in:
@@ -72,6 +72,42 @@ function limerpc_init ($url,$user,$pass)
|
||||
}
|
||||
|
||||
|
||||
function get_survey_list ()
|
||||
{
|
||||
global $db;
|
||||
global $limeRPC;
|
||||
global $limeKey;
|
||||
|
||||
//get a list of surveys from each possible remote
|
||||
|
||||
$sql = "SELECT id, rpc_url, username, password, description
|
||||
FROM remote";
|
||||
|
||||
$rs = $db->GetAll($sql);
|
||||
|
||||
$ret = array();
|
||||
|
||||
foreach($rs as $r) {
|
||||
if (limerpc_init($r['rpc_url'],$r['username'],$r['password']) === true) {
|
||||
$l = $limeRPC->list_surveys($limeKey);
|
||||
if (isset($l['status'])) {
|
||||
//none available
|
||||
} else if (is_array($l)) {
|
||||
foreach ($l as $s) {
|
||||
if ($s["active"] == "Y") {
|
||||
$ret[] = array("sid" => $s['sid'],
|
||||
"description" => $s['surveyls_title'],
|
||||
"host" => $r['description'],
|
||||
"remote_id" => $r['id']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user