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:
@@ -76,8 +76,25 @@ if (isset($_POST['import_file']))
|
|||||||
$lime_rs_sid = bigintval($_POST['selectrs']);
|
$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)
|
//** get default coma-separated outcomes list and use it for new questionnaire as initial set
|
||||||
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)";
|
$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);
|
$rs = $db->Execute($sql);
|
||||||
|
|
||||||
@@ -96,12 +113,12 @@ if (isset($_POST['import_file']))
|
|||||||
|
|
||||||
$db->Execute($sql);
|
$db->Execute($sql);
|
||||||
}
|
}
|
||||||
$cl = info;
|
$cl = "info";
|
||||||
$message = T_("Successfully inserted") . " " . T_("with ID") . "  $qid, </h4><h4>" . T_("linked to survey") . "  $lime_sid ";
|
$message = T_("Successfully inserted") . " " . T_("with ID") . "  $qid, </h4><h4>" . T_("linked to survey") . "  $lime_sid ";
|
||||||
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$cl = danger;
|
$cl = "danger";
|
||||||
$message = T_("Error: Failed to insert questionnaire");
|
$message = T_("Error: Failed to insert questionnaire");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user