mirror of
https://github.com/ACSPRI/queXS
synced 2024-04-02 12:12:16 +00:00
merged from master
This commit is contained in:
@@ -79,6 +79,9 @@ $js_foot = array(
|
||||
);
|
||||
global $db;
|
||||
|
||||
$error = "";
|
||||
|
||||
|
||||
if (isset($_GET['questionnaire_id']) && isset($_GET['sample']) && isset($_GET['call_max']) && isset($_GET['call_attempt_max']))
|
||||
{
|
||||
//need to add sample to questionnaire
|
||||
@@ -103,51 +106,46 @@ if (isset($_GET['questionnaire_id']) && isset($_GET['sample']) && isset($_GET['
|
||||
|
||||
if (isset($_GET['generatecases']))
|
||||
{
|
||||
include_once("../functions/functions.operator.php");
|
||||
|
||||
//TODO: check here if attributes available for assigning sample variables
|
||||
//if not - fail
|
||||
|
||||
$db->StartTrans();
|
||||
|
||||
$lime_sid = $db->GetOne("SELECT lime_sid FROM questionnaire WHERE questionnaire_id = '$questionnaire_id'");
|
||||
$testing = $db->GetOne("SELECT testing FROM questionnaire WHERE questionnaire_id = '$questionnaire_id'");
|
||||
|
||||
//add limesurvey attribute for each sample var record
|
||||
$sql = "SELECT var,type
|
||||
FROM sample_import_var_restrict
|
||||
//find the number of sample variables required
|
||||
$sql = "SELECT count(*)
|
||||
FROM sample_import_var_restrict
|
||||
WHERE sample_import_id = '$sid'
|
||||
ORDER BY var_id ASC";
|
||||
AND type = 1";
|
||||
|
||||
$rs = $db->GetAll($sql);
|
||||
$varsrequired = $db->GetOne($sql);
|
||||
|
||||
$i = 1;
|
||||
$addsample = false;
|
||||
|
||||
$fields = array();
|
||||
$fieldcontents='';
|
||||
foreach($rs as $r)
|
||||
{
|
||||
$fields[]=array('attribute_'.$i,'C','255');
|
||||
$fieldcontents.='attribute_'.$i.'='.$r['var']."\n";
|
||||
$i++;
|
||||
}
|
||||
if ($varsrequired > 0) {
|
||||
$addsample = true;
|
||||
}
|
||||
|
||||
include_once("../functions/functions.operator.php");
|
||||
|
||||
$db->StartTrans();
|
||||
|
||||
$lime_sid = $db->GetOne("SELECT lime_sid FROM questionnaire WHERE questionnaire_id = '$questionnaire_id'");
|
||||
$testing = $db->GetOne("SELECT testing FROM questionnaire WHERE questionnaire_id = '$questionnaire_id'");
|
||||
|
||||
//generate one case for each sample record and set outcome to 41
|
||||
$sql = "SELECT sample_id
|
||||
FROM sample
|
||||
WHERE import_id = '$sid'";
|
||||
$sql = "SELECT sample_id
|
||||
FROM sample
|
||||
WHERE import_id = '$sid'";
|
||||
|
||||
$rs = $db->GetAll($sql);
|
||||
$rs = $db->GetAll($sql);
|
||||
|
||||
foreach($rs as $r)
|
||||
{
|
||||
set_time_limit(30);
|
||||
//TODO : update add_case function to include attributes based on var_id ASC
|
||||
add_case($r['sample_id'],$questionnaire_id,"NULL",$testing,41, true);
|
||||
}
|
||||
foreach($rs as $r)
|
||||
{
|
||||
set_time_limit(30);
|
||||
if (add_case($r['sample_id'],$questionnaire_id,"NULL",$testing,41, $addsample) === false) {
|
||||
$error = "Could not add case - please ensure there enough additional attributes available in your Limesurvey participant table";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$db->CompleteTrans();
|
||||
}
|
||||
$db->CompleteTrans();
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_POST['edit']))
|
||||
@@ -312,8 +310,11 @@ print "</div>";
|
||||
|
||||
if ($questionnaire_id != false)
|
||||
{
|
||||
|
||||
print "<div class='panel-body'>
|
||||
if ($error != "") {
|
||||
print "<div class='alert text-danger'>$error</div>";
|
||||
}
|
||||
|
||||
print "<div class='panel-body'>
|
||||
<h3 class=''><i class='fa fa-list-ul text-primary'></i> ". T_("Samples assigned to questionnaire") ." <span class='text-primary'>" . $db->GetOne("SELECT description from questionnaire WHERE questionnaire_id = $questionnaire_id") . "</span></h3>";
|
||||
|
||||
$sql = "SELECT q.sort_order, si.description as description,si.sample_import_id,
|
||||
@@ -400,13 +401,10 @@ if ($questionnaire_id != false)
|
||||
<div class="col-sm-1"><input type="checkbox" id = "allownew" name="allownew" checked="checked" class="col-sm-1" data-toggle="toggle" data-size="small" data-on="<?php echo T_("Yes");?>" data-off="<?php echo T_("No");?>" data-width="85"/></div>
|
||||
<label class="control-label text-info"><?php ;?></label><br/><br/><br/>
|
||||
|
||||
<?php $self_complete = $db->GetOne("SELECT self_complete FROM questionnaire WHERE questionnaire_id = '$questionnaire_id'");
|
||||
if ($self_complete) {?>
|
||||
<label for="generatecases" class="control-label col-lg-4"><?php echo T_("Generate cases for all sample records and set outcome to 'Self completion email invitation sent'?");?></label>
|
||||
<div class="col-sm-1"><input type="checkbox" id = "generatecases" name="generatecases" class="col-sm-1" data-toggle="toggle" data-size="small" data-on="<?php echo T_("Yes");?>" data-off="<?php echo T_("No");?>" data-width="85"/></div>
|
||||
<em class="control-label"> * <?php echo T_("Ideal if you intend to send an email invitation to sample members before attempting to call using queXS");?></em>
|
||||
<em class="control-label"> * <?php echo T_("Ideal if you intend to send an email invitation to sample members before attempting to call using queXS") . " " . T_("Please ensure there are sufficient additional attribute fields in your Limesurvey questionnaire so that sample records can be inserted."); ?></em>
|
||||
<div class='clearfix '></div></br>
|
||||
<?php }?>
|
||||
|
||||
<input type="hidden" name="questionnaire_id" value="<?php print($questionnaire_id);?>"/>
|
||||
|
||||
|
||||
@@ -65,8 +65,8 @@ if (isset($_POST['import_file']))
|
||||
if (isset($_POST['ras'])) $ras = 1;
|
||||
if (isset($_POST['rws'])) $rws = 1;
|
||||
if (isset($_POST['testing'])) $testing = 1;
|
||||
if (isset($_POST['referral'])) $referral = 1;
|
||||
if (isset($_POST['respsc'])) $respsc = 1;
|
||||
if (isset($_POST['referral'])) $respsc = 1;
|
||||
if ($_POST['selectrs'] != "none") $rs = 1;
|
||||
|
||||
$name = $db->qstr($_POST['description']);
|
||||
@@ -221,7 +221,14 @@ if (!empty($surveys)){?>
|
||||
<input name="referral" type="checkbox" data-toggle="toggle" data-on="<?php echo T_("Yes"); ?>" data-off="<?php echo T_("No"); ?>" data-width="80"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-4 control-label" ><?php echo T_("Allow for respondent self completion via email invitation?"); ?></label>
|
||||
<div class="col-sm-4"style="height: 30px;">
|
||||
<input name="respsc" type="checkbox" data-toggle="toggle" data-on="<?php echo T_("Yes"); ?>" data-off="<?php echo T_("No"); ?>" data-width="80"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
/* CKEditor */
|
||||
|
||||
|
||||
@@ -296,7 +296,7 @@ if (isset($_POST['update']) && isset($_GET['modify']))
|
||||
$rs_project_end = $db->qstr(html_entity_decode($_POST['rs_project_end'],ENT_QUOTES,'UTF-8'));
|
||||
|
||||
$sql = "UPDATE questionnaire
|
||||
SET description = $name, info = $info, rs_project_end = $rs_project_end, restrict_appointments_shifts = '$ras', restrict_work_shifts = '$rws', self_complete = $respsc, referral = $referral
|
||||
SET description = $name, info = $info, rs_project_end = $rs_project_end, restrict_appointments_shifts = '$ras', restrict_work_shifts = '$rws', referral = $referral, self_complete = $respsc
|
||||
WHERE questionnaire_id = '$questionnaire_id'";
|
||||
|
||||
$db->Execute($sql);
|
||||
@@ -321,7 +321,6 @@ if (isset($_GET['modify']))
|
||||
$rs = $db->GetRow($sql);
|
||||
|
||||
$referral = $testing = $rws = $ras = $rsc = "checked=\"checked\"";
|
||||
$rscd = "";
|
||||
|
||||
$aio = $qbq = $gat = "";
|
||||
if ($rs['lime_mode'] == "survey") $aio = "selected=\"selected\"";
|
||||
@@ -335,7 +334,6 @@ if (isset($_GET['modify']))
|
||||
if ($rs['self_complete'] == 0)
|
||||
{
|
||||
$rsc = "";
|
||||
$rscd = "style='display:none;'";
|
||||
}
|
||||
|
||||
xhtml_head(T_("Modify Questionnaire "),true,$css,$js_head, false, false, false, "  <span class=' text-uppercase'>" . "$rs[description]" . "</span>");
|
||||
@@ -390,53 +388,7 @@ if (isset($_GET['modify']))
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-4 control-label" ><?php echo T_("Allow for respondent self completion via email invitation?"); ?> </label>
|
||||
<div class="col-sm-4" style="height: 30px;"><input name="respsc" id="respsc" type="checkbox" <?php echo $rsc ?> onchange="if(this.checked==true) {show(this,'limesc'); $('#url').attr('required','required');} else{ hide(this,'limesc'); $('#url').removeAttr('required');}" data-toggle="toggle" data-on="<?php echo T_("Yes"); ?>" data-off="<?php echo T_("No"); ?>" data-width="80"/></div>
|
||||
</div>
|
||||
<div id="limesc" <?php echo $rscd; ?> >
|
||||
<div class="form-group">
|
||||
<label class="col-sm-4 control-label" ><?php echo T_("Questionnaire display mode for respondent");?>: </label>
|
||||
<div class="col-sm-4">
|
||||
<select class="form-control" name="lime_mode">
|
||||
<option <?php echo $aio;?> value="survey"><?php echo T_("All in one"); ?></option>
|
||||
<option <?php echo $qbq;?> value="question"><?php echo T_("Question by question"); ?></option>
|
||||
<option <?php echo $gat;?> value="group"><?php echo T_("Group at a time"); ?></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-4 control-label" ><?php echo T_("Limesurvey template for respondent");?>: </label>
|
||||
<div class="col-sm-4">
|
||||
<select class="form-control" name="lime_template">
|
||||
<?php
|
||||
if ($handle = opendir(dirname(__FILE__)."/../include/limesurvey/templates")) {
|
||||
while (false !== ($entry = readdir($handle))) {
|
||||
if ($entry != "." && $entry != ".." && is_dir(dirname(__FILE__)."/../include/limesurvey/templates/" . $entry)){
|
||||
echo "<option value=\"$entry\" ";
|
||||
if ($rs['lime_template'] == $entry) echo " selected=\"selected\" ";
|
||||
echo ">$entry</option>";
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
if ($handle = opendir(dirname(__FILE__)."/../include/limesurvey/upload/templates")) {
|
||||
while (false !== ($entry = readdir($handle))) {
|
||||
if ($entry != "." && $entry != ".." && is_dir(dirname(__FILE__)."/../include/limesurvey/upload/templates/" . $entry)){
|
||||
echo "<option value=\"$entry\" ";
|
||||
if ($rs['lime_template'] == $entry) echo " selected=\"selected\" ";
|
||||
echo ">$entry</option>";
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-4 control-label text-danger" ><?php echo T_("URL to forward respondents on self completion (required)");?>: </label>
|
||||
<div class="col-sm-4">
|
||||
<input class="form-control" name="lime_endurl" id="url" type="url" value="<?php echo $rs['lime_endurl']; ?>"/>
|
||||
</div>
|
||||
<div class="col-sm-4" style="height: 30px;"><input name="respsc" id="respsc" type="checkbox" <?php echo $rsc ?> data-toggle="toggle" data-on="<?php echo T_("Yes"); ?>" data-off="<?php echo T_("No"); ?>" data-width="80"/></div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
@@ -493,7 +493,8 @@ if ($case_id != false)
|
||||
$sid = get_lime_sid($case_id);
|
||||
$id = get_lime_id($case_id);
|
||||
$url = get_lime_url($case_id);
|
||||
print "<div class='panel-body'>";
|
||||
|
||||
print "<div class='panel-body'>";
|
||||
if ($id)
|
||||
print "<h4><a href='" . $url . "/admin/dataentry/sa/editdata/subaction/edit/surveyid/$sid/id/$id' class='btn btn-default btn-lime'><i class='fa fa-lemon-o fa-lg'></i> " . T_("Modify responses for this case") . "</a></h4>";
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user