mirror of
https://github.com/ACSPRI/queXS
synced 2024-04-02 12:12:16 +00:00
Merged to 1.10.1
Fixed bug in quotareport Almost finished reworking quotarow to handle multiple conditions on questions and samples (need to remove use of -2 and -1 values elsewhere)
This commit is contained in:
@@ -179,7 +179,7 @@ if ($questionnaire_id)
|
||||
|
||||
//a. (Standard quota) Monitor outcomes of questions in completed questionnaires, and exclude selected sample records when completion limit is reached
|
||||
//b. (Replicate quota) Exclude selected sample records (where lime_sgqa == -1)
|
||||
$sql = "SELECT questionnaire_sample_quota_row_id,qsqr_question.lime_sgqa,value,completions,quota_reached,lime_sid,qsq.description,current_completions, priority, autoprioritise
|
||||
$sql = "SELECT qsq.questionnaire_sample_quota_row_id,qsqr_question.lime_sgqa,completions,quota_reached,lime_sid,qsq.description,current_completions, priority, autoprioritise
|
||||
FROM questionnaire_sample_quota_row as qsq, questionnaire as q, qsqr_question
|
||||
WHERE qsq.questionnaire_id = '$questionnaire_id'
|
||||
AND qsq.sample_import_id = '$sample_import_id'
|
||||
@@ -257,7 +257,7 @@ if ($questionnaire_id)
|
||||
$status = T_("open");
|
||||
}
|
||||
|
||||
$report[] = array("strata" => "<a href='quotarow.php?questionnaire_id=$questionnaire_id&sample_import_id=$sample_import_id'>" . $v['description'] . "</a>", "status" => $status, "quota" => $v['completions'], "sample" => $drawn + $remain, "sampleused" => $drawn, "sampleremain" => $remain, "completions" => $completions, "perc" => $perc, "priority" => "<input type='text' size='3' value='$priority' id='p$qsqr' name='p$qsqr' />", "autoprioritise" => "<input type='checkbox' id='a$qsqr' name='a$qsqr' $checked />");
|
||||
$report[] = array("strata" => "<a href='quotarow.php?qsqri=$qsqr&edit=edit'>" . $v['description'] . "</a>", "status" => $status, "quota" => $v['completions'], "sample" => $drawn + $remain, "sampleused" => $drawn, "sampleremain" => $remain, "completions" => $completions, "perc" => $perc, "priority" => "<input type='text' size='3' value='$priority' id='p$qsqr' name='p$qsqr' />", "autoprioritise" => "<input type='checkbox' id='a$qsqr' name='a$qsqr' $checked />");
|
||||
}
|
||||
|
||||
//c. (Questionnaire quota) Monitor outcomes of questions in completed questionnaires, and abort interview when completion limit is reached
|
||||
|
||||
@@ -69,61 +69,48 @@ include("../functions/functions.operator.php");
|
||||
|
||||
global $db;
|
||||
|
||||
if (isset($_GET['questionnaire_id']) && isset($_GET['sgqa']) && isset($_GET['value']) && isset($_GET['completions']) && isset($_GET['sample_import_id']) && isset($_GET['comparison']) && isset($_GET['exclude_var']) && isset($_GET['exclude_val']))
|
||||
if (isset($_POST['add_quota']))
|
||||
{
|
||||
//need to add quota
|
||||
$value = -1;
|
||||
$comparison = -1;
|
||||
$completions = -1;
|
||||
$sgqa = -1;
|
||||
$completions = intval($_POST['completions']);
|
||||
$autoprioritise = 0;
|
||||
|
||||
if (isset($_GET['autoprioritise'])) $autoprioritise = 1;
|
||||
|
||||
$priority = intval($_GET['priority']);
|
||||
if (isset($_POST['autoprioritise'])) $autoprioritise = 1;
|
||||
$priority = intval($_POST['priority']);
|
||||
$questionnaire_id = bigintval($_GET['questionnaire_id']);
|
||||
$sample_import_id = bigintval($_GET['sample_import_id']);
|
||||
if ($_GET['sgqa'] != -1)
|
||||
{
|
||||
if ($_GET['sgqa'] != -2)
|
||||
{
|
||||
$comparison = $db->quote($_GET['comparison']);
|
||||
$value = $db->quote($_GET['value']);
|
||||
$sgqa = $db->quote($_GET['sgqa']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$sgqa = -2;
|
||||
}
|
||||
$completions = $db->quote($_GET['completions']);
|
||||
}
|
||||
$exclude_val = $db->quote($_GET['exclude_val']);
|
||||
$exclude_var = $db->quote($_GET['exclude_var']);
|
||||
$description = $db->quote($_GET['description']);
|
||||
$sample_import_id = bigintval($_GET['sample_import_id']);
|
||||
$description = $db->quote($_POST['description']);
|
||||
|
||||
$sql = "INSERT INTO questionnaire_sample_quota_row(questionnaire_id, sample_import_id, lime_sgqa,value,completions,comparison,exclude_var,exclude_val,description, priority, autoprioritise)
|
||||
VALUES ($questionnaire_id, $sample_import_id, $sgqa, $value, $completions, $comparison, $exclude_var, $exclude_val, $description, $priority, $autoprioritise)";
|
||||
$sql = "INSERT INTO questionnaire_sample_quota_row(questionnaire_id, sample_import_id, completions, description, priority, autoprioritise)
|
||||
VALUES ($questionnaire_id, $sample_import_id, $completions, $description, $priority, $autoprioritise)";
|
||||
|
||||
$db->Execute($sql);
|
||||
|
||||
//Make sure to calculate on the spot
|
||||
update_quotas($questionnaire_id);
|
||||
//update_quotas($questionnaire_id);
|
||||
}
|
||||
|
||||
if (isset($_GET['questionnaire_id']) && isset($_GET['questionnaire_sample_quota_row_id']))
|
||||
|
||||
$qsqri = false;
|
||||
$qsqrid = false;
|
||||
if (isset($_GET['qsqri']) & isset($_GET['edit']))
|
||||
{
|
||||
//need to edit quota
|
||||
$qsqri = bigintval($_GET['qsqri']);
|
||||
|
||||
$questionnaire_id = bigintval($_GET['questionnaire_id']);
|
||||
$questionnaire_sample_quota_row_id = bigintval($_GET['questionnaire_sample_quota_row_id']);
|
||||
$sql = "SELECT questionnaire_id,sample_import_id,description
|
||||
FROM questionnaire_sample_quota_row
|
||||
WHERE questionnaire_sample_quota_row_id = $qsqri";
|
||||
|
||||
//open_row_quota($questionnaire_sample_quota_row_id);
|
||||
$rs = $db->GetRow($sql);
|
||||
|
||||
$_GET['questionnaire_id'] = $rs['questionnaire_id'];
|
||||
$_GET['sample_import_id'] = $rs['sample_import_id'];
|
||||
$qsqrid = $rs['description'];
|
||||
}
|
||||
|
||||
$questionnaire_id = false;
|
||||
if (isset($_GET['questionnaire_id'])) $questionnaire_id = bigintval($_GET['questionnaire_id']);
|
||||
|
||||
xhtml_head(T_("Quota row management"),true,false,array("../js/window.js"));
|
||||
xhtml_head(T_("Quota row management"),true,array("../css/table.css"),array("../js/window.js"));
|
||||
print "<h1>" . T_("Select a questionnaire from the list below") . "</h1>";
|
||||
|
||||
$sql = "SELECT questionnaire_id as value,description, CASE WHEN questionnaire_id = '$questionnaire_id' THEN 'selected=\'selected\'' ELSE '' END AS selected
|
||||
@@ -147,157 +134,111 @@ if ($questionnaire_id != false)
|
||||
display_chooser($db->GetAll($sql),"sample","sample_import_id",true,"questionnaire_id=$questionnaire_id");
|
||||
|
||||
if ($sample_import_id != false)
|
||||
{
|
||||
if (isset($_POST['copy_sample_import_id']))
|
||||
{
|
||||
copy_row_quota($questionnaire_id,$sample_import_id,bigintval($_POST['copy_sample_import_id']));
|
||||
print "<h3>" . T_("Copied quotas") . "</h3>";
|
||||
}
|
||||
|
||||
if (isset($_POST['copy_sample_import_id_with_adjustment']))
|
||||
{
|
||||
copy_row_quota_with_adjusting($questionnaire_id,$sample_import_id,bigintval($_POST['copy_sample_import_id_with_adjustment']));
|
||||
print "<h3>" . T_("Copied quotas") . "</h3>";
|
||||
}
|
||||
|
||||
print "<h1>" . T_("Current row quotas (click to edit)") . "</h1>";
|
||||
|
||||
$sql = "SELECT questionnaire_sample_quota_row_id,qsq.description
|
||||
FROM questionnaire_sample_quota_row as qsq, questionnaire as q
|
||||
WHERE qsq.questionnaire_id = '$questionnaire_id'
|
||||
AND qsq.sample_import_id = '$sample_import_id'
|
||||
AND q.questionnaire_id = '$questionnaire_id'";
|
||||
|
||||
$r = $db->GetAll($sql);
|
||||
|
||||
if (empty($r))
|
||||
{
|
||||
print "<p>" . T_("Currently no row quotas") . "</p>";
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach($r as $v)
|
||||
{
|
||||
print "<div><a href='?questionnaire_id=$questionnaire_id&sample_import_id=$sample_import_id&questionnaire_sample_quota_row_id={$v['questionnaire_sample_quota_row_id']}'>" . $v['description'] . "</a>";
|
||||
|
||||
}
|
||||
/*
|
||||
|
||||
if ($v['lime_sgqa'] == -1)
|
||||
print "<div><a href='?questionnaire_id=$questionnaire_id&sample_import_id=$sample_import_id&questionnaire_sample_quota_row_id={$v['questionnaire_sample_quota_row_id']}'>" . T_("Replicate: Where") . " " . $v['exclude_var'] . " " . T_("like") . " " . $v['exclude_val'] . "</a> - ";
|
||||
else if ($v['lime_sgqa'] == -2)
|
||||
print "<div><a href='?questionnaire_id=$questionnaire_id&sample_import_id=$sample_import_id&questionnaire_sample_quota_row_id={$v['questionnaire_sample_quota_row_id']}'>" . T_("Sample only. Stop calling where") . " " . $v['exclude_var'] . " " . T_("like") . " " . $v['exclude_val'] . " " . T_("rows from this sample when:") . " {$v['completions']} " . T_("completions") . "</a> - ";
|
||||
|
||||
else
|
||||
print "<div><a href='?questionnaire_id=$questionnaire_id&sample_import_id=$sample_import_id&questionnaire_sample_quota_row_id={$v['questionnaire_sample_quota_row_id']}'>" . T_("Stop calling") . " " . $v['exclude_var'] . " " . T_("like") . " " . $v['exclude_val'] . " " . T_("rows from this sample when:") . " {$v['lime_sgqa']} {$v['comparison']} {$v['value']} " . T_("for") . ": {$v['completions']} " . T_("completions") ."</a> - ";
|
||||
|
||||
if ($v['quota_reached'] == 1)
|
||||
print T_("Row quota reached (Closed)");
|
||||
else
|
||||
print T_("Row quota not yet reached (Open)");
|
||||
|
||||
if ($v['lime_sgqa'] != -1)
|
||||
print " - " . T_("Current completions: ") . $v['current_completions'] . ":" . limesurvey_quota_completions($v['lime_sgqa'],$v['lime_sid'],$questionnaire_id,$sample_import_id,$v['value'],$v['comparison']);
|
||||
|
||||
print "</div>";
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
//new quota
|
||||
print "<h1>" . T_("Select a question for the row quota") . "</h1>";
|
||||
|
||||
$sql = "SELECT lime_sid
|
||||
FROM questionnaire
|
||||
WHERE questionnaire_id = '$questionnaire_id'";
|
||||
|
||||
$r = $db->GetRow($sql);
|
||||
|
||||
$lime_sid = $r['lime_sid'];
|
||||
|
||||
$sgqa = false;
|
||||
if (isset($_GET['sgqa'])) $sgqa = $_GET['sgqa'];
|
||||
|
||||
$sql = "SELECT CONCAT( lq.sid, 'X', lq.gid, 'X', CASE WHEN lq.parent_qid = 0 THEN lq.qid ELSE CONCAT(lq.parent_qid, lq.title) END) as value, CASE WHEN lq.parent_qid = 0 THEN lq.question ELSE CONCAT(lq2.question, ': ', lq.question) END as description, CASE WHEN CONCAT( lq.sid, 'X', lq.gid, 'X', CASE WHEN lq.parent_qid = 0 THEN lq.qid ELSE CONCAT(lq.parent_qid, lq.title) END) = '$sgqa' THEN 'selected=\'selected\'' ELSE '' END AS selected
|
||||
FROM `" . LIME_PREFIX . "questions` AS lq
|
||||
LEFT JOIN `" . LIME_PREFIX . "questions` AS lq2 ON ( lq2.qid = lq.parent_qid )
|
||||
JOIN `" . LIME_PREFIX . "groups` as g ON (g.gid = lq.gid)
|
||||
WHERE lq.sid = '$lime_sid'
|
||||
ORDER BY g.group_order ASC, lq.question_order ASC";
|
||||
|
||||
$rs = $db->GetAll($sql);
|
||||
|
||||
$selected = "";
|
||||
if ($sgqa == -1) $selected = "selected='selected'";
|
||||
array_unshift($rs,array("value" => -1, "description" => T_("No question (Replicate)"), "selected" => $selected));
|
||||
|
||||
$selected = "";
|
||||
if ($sgqa == -2) $selected = "selected='selected'";
|
||||
array_unshift($rs,array("value" => -2, "description" => T_("Sample only quota"), "selected" => $selected));
|
||||
|
||||
display_chooser($rs,"sgqa","sgqa",true,"questionnaire_id=$questionnaire_id&sample_import_id=$sample_import_id");
|
||||
|
||||
if ($sgqa != false)
|
||||
{
|
||||
$sample_var = false;
|
||||
if (isset($_GET['sample_var']))
|
||||
$sample_var = $_GET['sample_var'];
|
||||
|
||||
print "<h1>" . T_("Select the sample variable to exclude") . "</h1>";
|
||||
|
||||
$sql = "SELECT sv.var as value, sv.var as description, CASE WHEN sv.var LIKE '$sample_var' THEN 'selected=\'selected\'' ELSE '' END AS selected
|
||||
FROM sample_var AS sv, sample AS s
|
||||
WHERE s.import_id = $sample_import_id
|
||||
AND s.sample_id = sv.sample_id
|
||||
GROUP BY sv.var";
|
||||
|
||||
display_chooser($db->GetAll($sql),"sample_var","sample_var",true,"questionnaire_id=$questionnaire_id&sample_import_id=$sample_import_id&sgqa=$sgqa");
|
||||
|
||||
if ($sample_var != false)
|
||||
{
|
||||
print "<h1>" . T_("Enter the details for creating the row quota:") . "</h1>";
|
||||
print "<h2>" . T_("Pre defined values for this question:") . "</h2>";
|
||||
|
||||
$rs = "";
|
||||
|
||||
if ($sgqa != -2 && $sgqa != -1 && !empty($sgqa))
|
||||
{
|
||||
$qid = explode("X", $sgqa);
|
||||
$qid = $qid[2];
|
||||
|
||||
$sql = "SELECT l.code,l.answer as title
|
||||
FROM `" . LIME_PREFIX . "answers` as l
|
||||
WHERE l.qid = '$qid'";
|
||||
|
||||
$rs = $db->GetAll($sql);
|
||||
}
|
||||
|
||||
if (!isset($rs) || empty($rs))
|
||||
print "<p>" . T_("No labels defined for this question") ."</p>";
|
||||
else
|
||||
xhtml_table($rs,array('code','title'),array(T_("Code value"), T_("Description")));
|
||||
|
||||
|
||||
?>
|
||||
<form action="" method="get">
|
||||
{
|
||||
if ($qsqri != false)
|
||||
{
|
||||
print "<h2>" . T_("Quota") . ": $qsqrid</h2>";
|
||||
print "<p><a href='?questionnaire_id=$questionnaire_id&sample_import_id=$sample_import_id'>" . T_("Go back") . "</a></p>";
|
||||
|
||||
print "<h2>" . T_("Edit row quota") . "</h2>";
|
||||
?>
|
||||
<form action="?<?php echo "questionnaire_id=$questionnaire_id&sample_import_id=$sample_import_id"; ?>" method="post">
|
||||
<p>
|
||||
<label for="description"><?php echo T_("Describe this quota"); ?> </label><input type="text" name="description" id="description"/> <br/>
|
||||
<label for="priority"><?php echo T_("Quota priority (50 is default, 100 highest, 0 lowest)"); ?> </label><input type="text" name="priority" id="priority" value="50"/> <br/>
|
||||
<label for="autoprioritise"><?php echo T_("Should the priority be automatically updated based on the number of completions in this quota?"); ?> </label><input type="checkbox" name="autoprioritise" id="autoprioritise"/> <br/>
|
||||
<?php if ($sgqa != -1) { if ($sgqa != -2) { ?>
|
||||
<label for="value"><?php echo T_("The code value to compare"); ?> </label><input type="text" name="value" id="value"/> <br/>
|
||||
<label for="comparison"><?php echo T_("The type of comparison"); ?></label><select name="comparison" id="comparison"><option value="LIKE">LIKE</option><option value="NOT LIKE">NOT LIKE</option><option value="=">=</option><option value="!=">!=</option><option value="<"><</option><option value=">">></option><option value="<="><=</option><option value=">=">>=</option></select><br/>
|
||||
<?php } else { ?>
|
||||
<input type="hidden" name="value" value="-2"/>
|
||||
<input type="hidden" name="comparison" value="-2"/>
|
||||
<?php } ?>
|
||||
<label for="completions"><?php echo T_("The number of completions to stop calling at"); ?> </label><input type="text" name="completions" id="completions"/> <br/>
|
||||
<?php } else { ?>
|
||||
<input type="hidden" name="value" value="-1"/>
|
||||
<input type="hidden" name="comparison" value="-1"/>
|
||||
<input type="hidden" name="completions" value="-1"/>
|
||||
<?php } ?>
|
||||
<label for="exclude_val"><?php echo T_("Exclude from the sample where the value is like"); ?></label>
|
||||
<label for="completions"><?php echo T_("The number of completions to stop calling at"); ?> </label><input type="text" name="completions" id="completions"/> <br/>
|
||||
<input type="hidden" name="qsqri" value="<?php echo $qsqri; ?>"/>
|
||||
<input type="submit" name="edit_quota" value="<?php print(T_("Edit row quota")); ?>"/></p>
|
||||
</form>
|
||||
<?php
|
||||
|
||||
//display questionnaire references
|
||||
$sql = "SELECT qsqr_question_id,lime_sgqa,value,comparison,description,
|
||||
CONCAT('<a href=\'?delete=delete&qsqrqi=', qsqr_question_id, '\'>" . TQ_("Delete") . "</a>') as qdelete
|
||||
FROM qsqr_question
|
||||
WHERE questionnaire_sample_quota_row_id = $qsqri";
|
||||
|
||||
|
||||
$rs = $db->GetAll($sql);
|
||||
|
||||
if (empty($rs))
|
||||
{
|
||||
print "<h3>" . T_("All completed responses will be counted") . "</h3>";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<h3>" . T_("Only completed responses that have answered the following will be counted") . "</h3>";
|
||||
xhtml_table($rs,array('lime_sgqa','comparison','value','qdelete'),array(T_("Question"),T_("Comparison"),T_("Value"),T_("Delete")));
|
||||
}
|
||||
|
||||
//add questionnaire references if any (refer to sample only or count completions based on responses to questions)
|
||||
|
||||
$sql = "SELECT lime_sid
|
||||
FROM questionnaire
|
||||
WHERE questionnaire_id = $questionnaire_id";
|
||||
|
||||
$lime_sid = $db->GetOne($sql);
|
||||
|
||||
//select question
|
||||
$sql = "SELECT CONCAT( lq.sid, 'X', lq.gid, 'X', CASE WHEN lq.parent_qid = 0 THEN lq.qid ELSE CONCAT(lq.parent_qid, lq.title) END) as value, CASE WHEN lq.parent_qid = 0 THEN lq.question ELSE CONCAT(lq2.question, ': ', lq.question) END as description, '' AS selected
|
||||
FROM `" . LIME_PREFIX . "questions` AS lq
|
||||
LEFT JOIN `" . LIME_PREFIX . "questions` AS lq2 ON ( lq2.qid = lq.parent_qid )
|
||||
JOIN `" . LIME_PREFIX . "groups` as g ON (g.gid = lq.gid)
|
||||
WHERE lq.sid = '$lime_sid'
|
||||
ORDER BY g.group_order ASC, lq.question_order ASC";
|
||||
|
||||
$rs = $db->GetAll($sql);
|
||||
|
||||
if (!empty($rs))
|
||||
{
|
||||
print "<h4>" . T_("Add restriction based on answered questions") . "</h4>";
|
||||
print "<label for='sgqa'>" . T_("Question") . "</label>";
|
||||
display_chooser($rs,"sgqa","sgqa",false,"qsqri=$qsqri",false,false);
|
||||
?>
|
||||
<br/><label for="comparison"><?php echo T_("The type of comparison"); ?></label><select name="comparison" id="comparison"><option value="LIKE">LIKE</option><option value="NOT LIKE">NOT LIKE</option><option value="=">=</option><option value="!=">!=</option><option value="<"><</option><option value=">">></option><option value="<="><=</option><option value=">=">>=</option></select><br/>
|
||||
<label for="value"><?php echo T_("The code value to compare"); ?> </label><input type="text" name="value" id="value"/> <br/>
|
||||
<input type="submit" name="addq" value="<?php echo TQ_("Add restriction") ?>"/>
|
||||
<?php
|
||||
}
|
||||
|
||||
//list sample records to exclude
|
||||
|
||||
$sql = "SELECT qsqr_sample_id,exclude_var,exclude_val,comparison,description,
|
||||
CONCAT('<a href=\'?delete=delete&qsqrsi=',qsqr_sample_id,'\'>" . TQ_("Delete") . "</a>') as sdelete
|
||||
FROM qsqr_sample
|
||||
WHERE questionnaire_sample_quota_row_id = $qsqri";
|
||||
|
||||
$rs = $db->GetAll($sql);
|
||||
|
||||
if (empty($rs))
|
||||
{
|
||||
print "<h3>" . T_("All sample records will be counted") . "</h3>";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<h3>" . T_("Only completed responses that have the following sample details will be counted") . "</h3>";
|
||||
xhtml_table($rs,array('exclude_var','comparison','exclude_val','sdelete'),array(T_("Sample record"),T_("Comparison"),T_("Value"),T_("Delete")));
|
||||
}
|
||||
|
||||
|
||||
//add sample references (records from sample to exclude when quota reached)
|
||||
$sql = "SELECT sv.var as value, sv.var as description, '' AS selected
|
||||
FROM sample_var AS sv, sample AS s
|
||||
WHERE s.import_id = $sample_import_id
|
||||
AND s.sample_id = sv.sample_id
|
||||
GROUP BY sv.var";
|
||||
|
||||
$rs = $db->GetAll($sql);
|
||||
|
||||
if (!empty($rs))
|
||||
{
|
||||
print "<h4>" . T_("Add restriction based on sample records") . "</h4>";
|
||||
print "<label for='sample_var'>" . T_("Sample record") . "</label>";
|
||||
display_chooser($db->GetAll($sql),"sample_var","sample_var",false,"qsqri=$qsqri",false,false);
|
||||
?>
|
||||
<br/><label for="comparisons"><?php echo T_("The type of comparison"); ?></label><select name="comparisons" id="comparisons"><option value="LIKE">LIKE</option><option value="NOT LIKE">NOT LIKE</option><option value="=">=</option><option value="!=">!=</option><option value="<"><</option><option value=">">></option><option value="<="><=</option><option value=">=">>=</option></select><br/>
|
||||
<label for="exclude_val"><?php echo T_("Value"); ?></label>
|
||||
<?php
|
||||
|
||||
$sql = "SELECT sv.val as value, sv.val as description, '' AS selected
|
||||
@@ -309,18 +250,57 @@ if ($questionnaire_id != false)
|
||||
|
||||
display_chooser($db->GetAll($sql),"exclude_val","exclude_val",false,false,false,false);
|
||||
flush();
|
||||
?>
|
||||
<br/>
|
||||
<input type="hidden" name="exclude_var" value="<?php print($sample_var); ?>"/>
|
||||
<input type="hidden" name="questionnaire_id" value="<?php print($questionnaire_id); ?>"/>
|
||||
<input type="hidden" name="sample_import_id" value="<?php print($sample_import_id); ?>"/>
|
||||
<input type="hidden" name="sgqa" value="<?php print($sgqa); ?>"/>
|
||||
<input type="submit" name="add_quota" value="<?php print(T_("Add row quota")); ?>"/></p>
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<br/><input type="submit" name="adds" value="<?php echo TQ_("Add restriction") ?>"/>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
print "<h1>" . T_("Current row quotas (click to edit)") . "</h1>";
|
||||
|
||||
|
||||
$sql = "SELECT questionnaire_sample_quota_row_id,qsq.description,
|
||||
CONCAT('<a href=\'?edit=edit&qsqri=',questionnaire_sample_quota_row_id,'\'>', qsq.description, '</a>') as qedit,
|
||||
CONCAT('<input type=\'checkbox\' name=\'select_',questionnaire_sample_quota_row_id,'\'/>') as qselect,
|
||||
qsq.completions,qsq.quota_reached,qsq.current_completions
|
||||
FROM questionnaire_sample_quota_row as qsq, questionnaire as q
|
||||
WHERE qsq.questionnaire_id = '$questionnaire_id'
|
||||
AND qsq.sample_import_id = '$sample_import_id'
|
||||
AND q.questionnaire_id = '$questionnaire_id'";
|
||||
|
||||
$r = $db->GetAll($sql);
|
||||
|
||||
print "<form method='post' action='?questionnaire_id=$questionnaire_id&sample_import_id=$sample_import_id'>";
|
||||
if (empty($r))
|
||||
{
|
||||
print "<p>" . T_("Currently no row quotas") . "</p>";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
xhtml_table($r,array('qedit','completions','current_completions','qselect'),array(T_("Description"),T_("Quota"),T_("Completions"),T_("Select")));
|
||||
print "<input type='submit' name='submitdelete' value='" . TQ_("Delete selected") . "'/>";
|
||||
print "<input type='submit' name='submitexport' value='" . TQ_("Export selected") . "'/>";
|
||||
|
||||
//select sample
|
||||
|
||||
}
|
||||
print "</form>";
|
||||
print "<h2>" . T_("Add row quota") . "</h2>";
|
||||
?>
|
||||
<form action="?<?php echo "questionnaire_id=$questionnaire_id&sample_import_id=$sample_import_id"; ?>" method="post">
|
||||
<p>
|
||||
<label for="description"><?php echo T_("Describe this quota"); ?> </label><input type="text" name="description" id="description"/> <br/>
|
||||
<label for="priority"><?php echo T_("Quota priority (50 is default, 100 highest, 0 lowest)"); ?> </label><input type="text" name="priority" id="priority" value="50"/> <br/>
|
||||
<label for="autoprioritise"><?php echo T_("Should the priority be automatically updated based on the number of completions in this quota?"); ?> </label><input type="checkbox" name="autoprioritise" id="autoprioritise"/> <br/>
|
||||
<label for="completions"><?php echo T_("The number of completions to stop calling at"); ?> </label><input type="text" name="completions" id="completions"/> <br/>
|
||||
<input type="submit" name="add_quota" value="<?php print(T_("Add row quota")); ?>"/></p>
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
}
|
||||
xhtml_foot();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user