mirror of
https://github.com/ACSPRI/queXS
synced 2024-04-02 12:12:16 +00:00
updated admin panel files
added 'clockpicker' library (could replace jquerry-ui timepicker later on in some files) modified functions.display.php to handle external classes modified addrow-v2.js to display cloned values and init clockpicker
This commit is contained in:
@@ -55,9 +55,25 @@ include("../functions/functions.display.php");
|
||||
*/
|
||||
include("../functions/functions.input.php");
|
||||
|
||||
$css = array(
|
||||
"../include/bootstrap-3.3.2/css/bootstrap.min.css",
|
||||
"../include/bootstrap-3.3.2/css/bootstrap-theme.min.css",
|
||||
"../include/font-awesome-4.3.0/css/font-awesome.css",
|
||||
"../css/bootstrap-switch.min.css",
|
||||
"../css/custom.css"
|
||||
);
|
||||
$js_head = array(
|
||||
"../js/jquery-2.1.3.min.js",
|
||||
"../include/bootstrap-3.3.2/js/bootstrap.min.js",
|
||||
"../js/bootstrap-switch.min.js",
|
||||
"../js/window.js"
|
||||
);
|
||||
$js_foot = array(
|
||||
"../js/bootstrap-confirmation.js",
|
||||
"../js/custom.js"
|
||||
);
|
||||
global $db;
|
||||
|
||||
|
||||
if (isset($_GET['questionnaire_id']) && isset($_GET['sample']) && isset($_GET['call_max']) && isset($_GET['call_attempt_max']))
|
||||
{
|
||||
//need to add sample to questionnaire
|
||||
@@ -76,13 +92,11 @@ if (isset($_GET['questionnaire_id']) && isset($_GET['sample']) && isset($_GET['
|
||||
VALUES('$questionnaire_id','$sid','$cm','$cam','$selecttype','$am', '$an')";
|
||||
|
||||
$db->Execute($sql);
|
||||
|
||||
}
|
||||
|
||||
if (isset($_POST['edit']))
|
||||
{
|
||||
//need to add sample to questionnaire
|
||||
|
||||
$questionnaire_id = bigintval($_POST['questionnaire_id']);
|
||||
$sid = bigintval($_POST['sample_import_id']);
|
||||
$cm = bigintval($_POST['call_max']);
|
||||
@@ -93,8 +107,6 @@ if (isset($_POST['edit']))
|
||||
$an = 0;
|
||||
if (isset($_POST['allownew'])) $an = 1;
|
||||
|
||||
|
||||
|
||||
$sql = "UPDATE questionnaire_sample
|
||||
SET call_max = '$cm',
|
||||
call_attempt_max = '$cam',
|
||||
@@ -105,7 +117,6 @@ if (isset($_POST['edit']))
|
||||
AND sample_import_id = '$sid'";
|
||||
|
||||
$db->Execute($sql);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -117,7 +128,8 @@ if (isset($_GET['questionnaire_id']) && isset($_GET['rsid']))
|
||||
|
||||
if (isset($_GET['edit']))
|
||||
{
|
||||
xhtml_head(T_("Assign Sample: Select sample to assign"),true,array("../css/table.css"),array("../js/window.js"));
|
||||
$subtitle = T_("Edit assignment parameters");
|
||||
xhtml_head(T_("Assign samples to questionnaire: "),true,$css,$js_head,false,false,false,$subtitle);//array("../css/table.css"),array("../js/window.js")
|
||||
|
||||
$sql = "SELECT si.description as description,
|
||||
qr.description as qdescription,
|
||||
@@ -134,31 +146,36 @@ if (isset($_GET['questionnaire_id']) && isset($_GET['rsid']))
|
||||
|
||||
$qs = $db->GetRow($sql);
|
||||
|
||||
print "<h1>" . T_("Edit sample details") . "<h1>";
|
||||
print "<h2>" . T_("Questionnaire") . ": " . $qs['qdescription'] . "</h2>";
|
||||
print "<h2>" . T_("Sample") . ": " . $qs['description'] . "</h2>";
|
||||
|
||||
print "<p><a href='?questionnaire_id=$questionnaire_id'>" . T_("Go back") . "</a></p>";
|
||||
//print "<h1>" . T_("Edit sample details") . "<h1>";
|
||||
print " <p><a href='?questionnaire_id=$questionnaire_id' class='btn btn-default '><i class='fa fa-chevron-left fa-lg text-primary'></i> " . T_("Go back") . "</a></p>
|
||||
<h2 class='col-sm-6'>" . T_("Questionnaire") . ": <span class='text-primary'>" . $qs['qdescription'] . "</span></h2>
|
||||
<h2 class='col-sm-6'>" . T_("Sample") . ": <span class='text-primary'>" . $qs['description'] . "</span></h2>
|
||||
<div class='panel-body form-group'>";
|
||||
|
||||
$allownew = $selected ="";
|
||||
if ($qs['random_select'] == 1)
|
||||
$selected = "checked=\"checked\"";
|
||||
if ($qs['allow_new'] == 1)
|
||||
$allownew = "checked=\"checked\"";
|
||||
|
||||
?>
|
||||
<form action="?questionnaire_id=<?php echo $questionnaire_id;?>" method="post">
|
||||
<label for="call_max"><?php echo T_("Max calls (0 for unlimited)"); ?></label><input type="text" name="call_max" id="call_max" value="<?php echo $qs['call_max'];?>"/><br/>
|
||||
<label for="call_attempt_max"><?php echo T_("Max call attempts (0 for unlimited)"); ?></label><input type="text" name="call_attempt_max" id="call_attempt_max" value="<?php echo $qs['call_attempt_max'];?>"/> <br/>
|
||||
<label for="answering_machine_messages"><?php echo T_("Number of answering machine messages to leave per case (0 for never)"); ?></label><input type="text" name="answering_machine_messages" id="answering_machine_messages" value="<?php echo $qs['answering_machine_messages'];?>"/> <br/>
|
||||
<label for="selecttype"><?php echo T_("Select from sample randomly? (otherwise sequentially)"); ?></label><input type="checkbox" id = "selecttype" name="selecttype" <?php echo $selected;?> /> <br/>
|
||||
<label for="allownew"><?php echo T_("Allow new numbers to be drawn?"); ?></label><input type="checkbox" id = "allownew" name="allownew" <?php echo $allownew;?> /> <br/>
|
||||
<form action="?questionnaire_id=<?php echo $questionnaire_id;?>" method="post" class="form-horizontal">
|
||||
|
||||
<label for="call_max" class="control-label col-sm-4"><?php echo T_("Max calls");?></label><div class="col-sm-1"><input type="text" name="call_max" id="call_max" value="<?php echo $qs['call_max'];?>" class="form-control"/></div><label class="control-label text-info"><?php echo "0 = " . T_("Unlimited");?></label><br/><br/>
|
||||
<label for="call_attempt_max" class="control-label col-sm-4"><?php echo T_("Max call attempts");?></label><div class="col-sm-1"><input type="text" name="call_attempt_max" id="call_attempt_max" value="<?php echo $qs['call_attempt_max'];?>" class="form-control"/></div><label class="control-label text-info"><?php echo "0 = " . T_("Unlimited");?></label><br/><br/>
|
||||
<label for="answering_machine_messages" class="control-label col-sm-4"><?php echo T_("Number of answering machine messages to leave per case");?></label><div class="col-sm-1"> <input type="text" name="answering_machine_messages" id="answering_machine_messages" value="<?php echo $qs['answering_machine_messages'];?>" class="form-control"/></div><label class="control-label text-info"><?php echo "0 = " . T_("Never");?></label><br/><br/>
|
||||
<label for="selecttype" class="control-label col-sm-4"><?php echo T_("Select from sample randomly?");?></label><div class="col-sm-1"><input type="checkbox" id = "selecttype" name="selecttype" <?php echo $selected;?> switch="yes" data-size="small" data-on-text="<?php echo T_("Yes");?>" data-off-text="<?php echo T_("No");?>"/></div><label class="control-label text-info"><?php echo T_("No") ." = ". T_("Sequentially");?></label><br/><br/>
|
||||
<label for="allownew" class="control-label col-sm-4"><?php echo T_("Allow new numbers to be drawn?");?></label><div class="col-sm-1"><input type="checkbox" id = "allownew" name="allownew" <?php echo $allownew;?> class="col-sm-1" switch="yes" data-size="small" data-on-text="<?php echo T_("Yes");?>" data-off-text="<?php echo T_("No");?>"/></div><br/><br/>
|
||||
<input type="hidden" name="questionnaire_id" value="<?php print($questionnaire_id); ?>"/>
|
||||
<input type="hidden" name="sample_import_id" value="<?php print($sid); ?>"/>
|
||||
<input type="submit" name="edit" value="<?php echo T_("Edit"); ?>"/></p>
|
||||
</form>
|
||||
<div class="col-sm-12 text-center"><button type="submit" name="edit" class="btn btn-primary"><i class="fa fa-floppy-o fa-lg"></i> <?php echo T_("Save changes");?></button></div>
|
||||
</form></div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$('[switch="yes"]').bootstrapSwitch();
|
||||
</script>
|
||||
|
||||
<?php
|
||||
xhtml_foot();
|
||||
xhtml_foot($js_foot);
|
||||
die();
|
||||
}
|
||||
else
|
||||
@@ -172,27 +189,29 @@ if (isset($_GET['questionnaire_id']) && isset($_GET['rsid']))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$questionnaire_id = false;
|
||||
if (isset($_GET['questionnaire_id'])) $questionnaire_id = bigintval($_GET['questionnaire_id']);
|
||||
$subtitle = T_("List & Add Sample");
|
||||
xhtml_head(T_("Assign samples to questionnaire: "),true,$css,$js_head,false,false,false,$subtitle);//array("../css/table.css"),array("../js/window.js")
|
||||
|
||||
xhtml_head(T_("Assign Sample: Select sample to assign"),true,array("../css/table.css"),array("../js/window.js"));
|
||||
print "<h1>" . T_("Select a questionnaire from the list below") . "</h1>";
|
||||
display_questionnaire_chooser($questionnaire_id);
|
||||
|
||||
print "<a href='' onclick='history.back();return false;' class='btn btn-default pull-left'><i class='fa fa-chevron-left fa-lg text-primary'></i> " . T_("Go back") . "</a>";
|
||||
print "<h3 class='col-sm-4 text-right'>" . T_("Select a questionnaire") . ":</h3>";
|
||||
display_questionnaire_chooser($questionnaire_id,false, "pull-left", "form-control");
|
||||
|
||||
if ($questionnaire_id != false)
|
||||
{
|
||||
print "<h1>" . T_("Samples selected for this questionnaire") . "</h1>";
|
||||
|
||||
print "<div class='clearfix '></div><div class='panel-body'>
|
||||
<h3 class='text-primary'>". T_("Samples selected for this questionnaire") .":</h3>";
|
||||
|
||||
$sql = "SELECT si.description as description,
|
||||
CASE WHEN q.call_max = 0 THEN '" . TQ_("Unlimited") . "' ELSE q.call_max END as call_max,
|
||||
CASE WHEN q.call_attempt_max = 0 THEN '" . TQ_("Unlimited") . "' ELSE q.call_attempt_max END AS call_attempt_max,
|
||||
CASE WHEN q.random_select = 0 THEN '" . TQ_("Sequential") . "' ELSE '". TQ_("Random") . "' END as random_select,
|
||||
CASE WHEN q.answering_machine_messages = 0 THEN '" . TQ_("Never") . "' ELSE q.answering_machine_messages END as answering_machine_messages,
|
||||
CASE WHEN q.allow_new = 0 THEN '" . TQ_("No") . "' ELSE '".TQ_("Yes")."' END as allow_new,
|
||||
CONCAT('<a href=\"?edit=edit&questionnaire_id=$questionnaire_id&rsid=', si.sample_import_id ,'\">" . TQ_("Edit") ."</a>') as edit,
|
||||
CONCAT('<a href=\"?questionnaire_id=$questionnaire_id&rsid=', si.sample_import_id ,'\">" . TQ_("Click to unassign") ."</a>') as unassign
|
||||
CASE WHEN q.call_max = 0 THEN '". TQ_("Unlimited") ."' ELSE q.call_max END as call_max,
|
||||
CASE WHEN q.call_attempt_max = 0 THEN '". TQ_("Unlimited") . "' ELSE q.call_attempt_max END AS call_attempt_max,
|
||||
CASE WHEN q.random_select = 0 THEN '". TQ_("Sequential") ."' ELSE '". TQ_("Random") . "' END as random_select,
|
||||
CASE WHEN q.answering_machine_messages = 0 THEN '". TQ_("Never") . "' ELSE q.answering_machine_messages END as answering_machine_messages,
|
||||
CASE WHEN q.allow_new = 0 THEN '". TQ_("No") ."' ELSE '".TQ_("Yes")."' END as allow_new,
|
||||
CONCAT('<a href=\"?edit=edit&questionnaire_id=$questionnaire_id&rsid=', si.sample_import_id ,'\" data-toggle=\'tooltip\' title=\'". TQ_("Edit") ."\' class=\'btn center-block\'><i class=\'fa fa-pencil-square-o fa-lg\'></i></a>') as edit,
|
||||
CONCAT('<a href=\'\' data-toggle=\'confirmation\' data-placement=\'top\' data-href=\"?questionnaire_id=$questionnaire_id&rsid=', si.sample_import_id ,'\" class=\'btn center-block\'><i class=\'fa fa-chain-broken fa-lg\' data-toggle=\'tooltip\' title=\'". TQ_("Click to unassign") ."\'></i></a>') as unassign
|
||||
FROM questionnaire_sample as q, sample_import as si
|
||||
WHERE q.sample_import_id = si.sample_import_id
|
||||
AND q.questionnaire_id = '$questionnaire_id'";
|
||||
@@ -200,9 +219,9 @@ if ($questionnaire_id != false)
|
||||
$qs = $db->GetAll($sql);
|
||||
|
||||
if (!empty($qs))
|
||||
xhtml_table($qs,array("description","call_max","call_attempt_max","answering_machine_messages","random_select","allow_new","edit","unassign"),array(T_("Sample"), T_("Max calls"), T_("Max call attempts"), T_("Answering machine messages"), T_("Selection type"), T_("Allow new numbers to be drawn?"), T_("Edit"), T_("Unassign sample") ));
|
||||
xhtml_table($qs,array("description","call_max","call_attempt_max","answering_machine_messages","random_select","allow_new","edit","unassign"),array(T_("Sample"), T_("Max calls"), T_("Max call attempts"), T_("Answering machine messages"), T_("Selection type"), T_("Allow new numbers to be drawn?"), T_("Edit"), T_("Unassign sample")));
|
||||
else
|
||||
print "<p>" . T_("No samples selected for this questionnaire") . "</p>";
|
||||
print "<div class='alert text-danger'><h4>". T_("No samples selected for this questionnaire") ."</h4></div>";
|
||||
|
||||
$sql = "SELECT si.sample_import_id,si.description
|
||||
FROM sample_import as si
|
||||
@@ -211,36 +230,38 @@ if ($questionnaire_id != false)
|
||||
AND si.enabled = 1";
|
||||
|
||||
$qs = $db->GetAll($sql);
|
||||
print"</div>";
|
||||
|
||||
if (!empty($qs))
|
||||
{
|
||||
|
||||
|
||||
print "<h1>" . T_("Add a sample to this questionnaire:") . "</h1>";
|
||||
print "<div class='clearfix '></div>";
|
||||
print "<div class='panel-body form-group'><h3 class='text-primary'>" . T_("Add a sample to this questionnaire:") . "</h3>";
|
||||
?>
|
||||
<form action="" method="get">
|
||||
<p><label for="sample"><?php echo T_("Select sample:"); ?></label><select name="sample" id="sample">
|
||||
<?php
|
||||
|
||||
foreach($qs as $q)
|
||||
{
|
||||
print "<option value=\"{$q['sample_import_id']}\">{$q['description']}</option>";
|
||||
}
|
||||
|
||||
?>
|
||||
</select><br/>
|
||||
<label for="call_max"><?php echo T_("Max calls (0 for unlimited)"); ?></label><input type="text" name="call_max" id="call_max" value="0"/><br/>
|
||||
<label for="call_attempt_max"><?php echo T_("Max call attempts (0 for unlimited)"); ?></label><input type="text" name="call_attempt_max" id="call_attempt_max" value="0"/> <br/>
|
||||
<label for="answering_machine_messages"><?php echo T_("Number of answering machine messages to leave per case (0 for never)"); ?></label><input type="text" name="answering_machine_messages" id="answering_machine_messages" value="1"/> <br/>
|
||||
<label for="selecttype"><?php echo T_("Select from sample randomly? (otherwise sequentially)"); ?></label><input type="checkbox" id = "selecttype" name="selecttype" /> <br/>
|
||||
<label for="allownew"><?php echo T_("Allow new numbers to be drawn?"); ?></label><input type="checkbox" id = "allownew" name="allownew" checked="checked" /> <br/>
|
||||
<input type="hidden" name="questionnaire_id" value="<?php print($questionnaire_id); ?>"/>
|
||||
<input type="submit" name="add_sample" value="<?php echo T_("Add sample");?>"/></p>
|
||||
</form>
|
||||
<form action="" method="get" class="form-horizontal">
|
||||
<label for="sample" class="control-label col-sm-4"><?php echo T_("Select sample:");?></label><div class="col-sm-3"><select name="sample" id="sample" class="form-control " >
|
||||
<?php foreach($qs as $q) { print "<option value=\"{$q['sample_import_id']}\">{$q['description']}</option>"; } ?> </select></div><br/><br/>
|
||||
|
||||
<label for="call_max" class="control-label col-sm-4"><?php echo T_("Max calls");?></label><div class="col-sm-1"><input type="text" name="call_max" id="call_max" value="0" class="form-control"/></div><label class="control-label text-info"><?php echo "0 = " . T_("Unlimited");?></label><br/><br/>
|
||||
|
||||
<label for="call_attempt_max" class="control-label col-sm-4"><?php echo T_("Max call attempts");?></label><div class="col-sm-1"><input type="text" name="call_attempt_max" id="call_attempt_max" value="0" class="form-control"/></div><label class="control-label text-info"><?php echo "0 = " . T_("Unlimited");?></label><br/><br/>
|
||||
|
||||
<label for="answering_machine_messages" class="control-label col-sm-4"><?php echo T_("Number of answering machine messages to leave per case");?></label><div class="col-sm-1"> <input type="text" name="answering_machine_messages" id="answering_machine_messages" value="0" class="form-control"/></div><label class="control-label text-info"><?php echo "0 = " . T_("Never");?></label><br/><br/>
|
||||
|
||||
<label for="selecttype" class="control-label col-sm-4"><?php echo T_("Select from sample randomly?");?></label><div class="col-sm-1"><input type="checkbox" id = "selecttype" name="selecttype" switch="yes" data-size="small" data-on-text="<?php echo T_("Yes");?>" data-off-text="<?php echo T_("No");?>"/></div><label class="control-label text-info"><?php echo T_("No") ." = ". T_("Sequentially");?></label><br/><br/>
|
||||
|
||||
<label for="allownew" class="control-label col-sm-4"><?php echo T_("Allow new numbers to be drawn?");?></label><div class="col-sm-1"><input type="checkbox" id = "allownew" name="allownew" checked="checked" class="col-sm-1" switch="yes" data-size="small" data-on-text="<?php echo T_("Yes");?>" data-off-text="<?php echo T_("No");?>"/></div><br/><br/>
|
||||
|
||||
<input type="hidden" name="questionnaire_id" value="<?php print($questionnaire_id);?>"/>
|
||||
|
||||
<div class="col-sm-12 text-center"><button type="submit" name="add_sample" class="btn btn-primary"><i class="fa fa-plus-circle fa-lg"></i> <?php echo T_("Add sample");?></button></div>
|
||||
|
||||
</form></div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
xhtml_foot();
|
||||
|
||||
|
||||
xhtml_foot($js_foot);
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$('[switch="yes"]').bootstrapSwitch();
|
||||
$('[data-toggle="confirmation"]').confirmation()
|
||||
</script>
|
||||
Reference in New Issue
Block a user