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

Added self_complete flag to remove need to clear variables

This commit is contained in:
Adam Zammit
2013-02-25 12:03:27 +11:00
parent e2f4a33fc8
commit a22f4acd66
3 changed files with 31 additions and 28 deletions

View File

@@ -25,7 +25,8 @@ INSERT INTO `sample_var_type` (`type`, `description`, `table`) VALUES
Specify details of respondent self completion:
ALTER TABLE `questionnaire` ADD `lime_mode` VARCHAR( 64 ) NULL COMMENT 'Limesurvey mode for respondent self completion' AFTER `info` ,
ALTER TABLE `questionnaire` ADD `self_complete` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `info`,
ADD `lime_mode` VARCHAR( 64 ) NULL COMMENT 'Limesurvey mode for respondent self completion' AFTER `self_complete` ,
ADD `lime_template` VARCHAR( 128 ) NULL COMMENT 'Limesurvey template for respondent self completion' AFTER `lime_mode` ,
ADD `lime_endurl` VARCHAR( 256 ) NULL COMMENT 'Forwarding end URL for respondent self completion' AFTER `lime_template` ;

View File

@@ -76,17 +76,6 @@ if (isset($_POST['import_file']))
if (isset($_POST['respsc'])) $respsc = 1;
if ($_POST['selectrs'] != "none") $rs = 1;
$lime_mode = "NULL";
$lime_template = "NULL";
$lime_endurl = "NULL";
if ($respsc == 1)
{
$lime_mode = $db->qstr($_POST['lime_mode'],get_magic_quotes_gpc());
$lime_template = $db->qstr($_POST['lime_template'],get_magic_quotes_gpc());
$lime_endurl = $db->qstr($_POST['lime_endurl'],get_magic_quotes_gpc());
}
$name = $db->qstr($_POST['description'],get_magic_quotes_gpc());
$rs_intro = $db->qstr(html_entity_decode($_POST['rs_intro'],get_magic_quotes_gpc()));
$rs_project_intro = $db->qstr(html_entity_decode($_POST['rs_project_intro'],get_magic_quotes_gpc()));
@@ -104,14 +93,26 @@ 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,lime_mode,lime_template,lime_endurl)
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,$lime_mode,$lime_template,$lime_endurl)";
$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)
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)";
$rs = $db->Execute($sql);
if ($rs)
{
$qid = $db->Insert_ID();
if ($respsc == 1)
{
$lime_mode = $db->qstr($_POST['lime_mode'],get_magic_quotes_gpc());
$lime_template = $db->qstr($_POST['lime_template'],get_magic_quotes_gpc());
$lime_endurl = $db->qstr($_POST['lime_endurl'],get_magic_quotes_gpc());
$sql = "UPDATE questionnaire
SET lime_mode = $lime_mode, lime_template = $lime_template, lime_endurl = $lime_endurl
WHERE questionnaire_id = $qid";
$db->Execute($sql);
}
print "<p>" . T_("Successfully inserted") . " $name " . T_("as questionnaire") . " $qid, " . T_("linked to") . " $lime_sid</p>";
}else
{

View File

@@ -91,17 +91,6 @@ if (isset($_POST['update']) && isset($_GET['modify']))
if (isset($_POST['rws'])) $rws = 1;
if (isset($_POST['respsc'])) $respsc = 1;
$lime_mode = "NULL";
$lime_template = "NULL";
$lime_endurl = "NULL";
if ($respsc == 1)
{
$lime_mode = $db->qstr($_POST['lime_mode'],get_magic_quotes_gpc());
$lime_template = $db->qstr($_POST['lime_template'],get_magic_quotes_gpc());
$lime_endurl = $db->qstr($_POST['lime_endurl'],get_magic_quotes_gpc());
}
$name = $db->qstr(html_entity_decode($_POST['description']));
if (isset($_POST['rs_intro']))
{
@@ -115,7 +104,7 @@ if (isset($_POST['update']) && isset($_GET['modify']))
$rs_project_end = $db->qstr(html_entity_decode($_POST['rs_project_end'],true));
$sql = "UPDATE questionnaire
SET description = $name, info = $info, rs_project_end = $rs_project_end, restrict_appointments_shifts = '$ras', restrict_work_shifts = '$rws', lime_mode = $lime_mode, lime_template = $lime_template, lime_endurl = $lime_endurl
SET description = $name, info = $info, rs_project_end = $rs_project_end, restrict_appointments_shifts = '$ras', restrict_work_shifts = '$rws', self_complete = $respsc
WHERE questionnaire_id = '$questionnaire_id'";
$db->Execute($sql);
@@ -129,6 +118,18 @@ if (isset($_POST['update']) && isset($_GET['modify']))
$db->Execute($sql);
}
if ($respsc == 1)
{
$lime_mode = $db->qstr($_POST['lime_mode'],get_magic_quotes_gpc());
$lime_template = $db->qstr($_POST['lime_template'],get_magic_quotes_gpc());
$lime_endurl = $db->qstr($_POST['lime_endurl'],get_magic_quotes_gpc());
$sql = "UPDATE questionnaire
SET lime_mode = $lime_mode, lime_template = $lime_template, lime_endurl = $lime_endurl
WHERE questionnaire_id = $questionnaire_id";
$db->Execute($sql);
}
}
@@ -175,7 +176,7 @@ if (isset($_GET['modify']))
if ($rs['restrict_appointments_shifts'] != 1) $ras = "";
if ($rs['restrict_work_shifts'] != 1) $rws = "";
if ($rs['testing'] != 1) $testing = "";
if (empty($rs['lime_mode']))
if ($rs['self_complete'] == 0)
{
$rsc = "";
$rscd = "style='display:none;'";