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

set default list of outcomes when creating new questionnaire

This commit is contained in:
Alex
2015-09-09 03:46:58 +03:00
parent 82b7069067
commit 16de6acfb4

View File

@@ -76,8 +76,25 @@ if (isset($_POST['import_file']))
$lime_rs_sid = bigintval($_POST['selectrs']);
}
$sql = "INSERT INTO questionnaire (questionnaire_id,description,lime_sid,restrict_appointments_shifts,restrict_work_shifts,respondent_selection,rs_intro,rs_project_intro,rs_project_end,rs_callback,rs_answeringmachine,testing,lime_rs_sid,info,self_complete,referral)
VALUES (NULL,$name,'$lime_sid','$ras','$rws','$rs',$rs_intro,$rs_project_intro,$rs_project_end,$rs_callback,$rs_answeringmachine,'$testing',$lime_rs_sid,$info,$respsc,$referral)";
//** get default coma-separated outcomes list and use it for new questionnaire as initial set
$sql = "SELECT o.outcome_id
FROM `outcome` as o
WHERE o.deflt = 1;";
$def = $db->GetAll($sql);
for ($i=0; $i < count($def); $i++){
foreach($def[$i] as $key => $val){
$do[] = $val;
}
}
$do = implode($do,",");
//print $do . "</br>";
//** - end
$sql = "INSERT INTO questionnaire (questionnaire_id,description,lime_sid,restrict_appointments_shifts,restrict_work_shifts,respondent_selection,rs_intro,rs_project_intro,rs_project_end,rs_callback,rs_answeringmachine,testing,lime_rs_sid,info,self_complete,referral,outcomes)
VALUES (NULL,$name,'$lime_sid','$ras','$rws','$rs',$rs_intro,$rs_project_intro,$rs_project_end,$rs_callback,$rs_answeringmachine,'$testing',$lime_rs_sid,$info,$respsc,$referral,'$do')";
$rs = $db->Execute($sql);
@@ -96,12 +113,12 @@ if (isset($_POST['import_file']))
$db->Execute($sql);
}
$cl = info;
$cl = "info";
$message = T_("Successfully inserted") . "&ensp;" . T_("with ID") . "&ensp; $qid, </h4><h4>" . T_("linked to survey") . "&ensp; $lime_sid ";
}
else{
$cl = danger;
$cl = "danger";
$message = T_("Error: Failed to insert questionnaire");
}