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>
|
||||
@@ -1,173 +1,188 @@
|
||||
<?php
|
||||
/**
|
||||
* Modify availability within this availability group
|
||||
*
|
||||
*
|
||||
* This file is part of queXS
|
||||
*
|
||||
* queXS is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* queXS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with queXS; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*
|
||||
* @author Adam Zammit <adam.zammit@acspri.org.au>
|
||||
* @copyright Australian Consortium for Social and Political Research Inc (ACSPRI) 2011
|
||||
* @package queXS
|
||||
* @subpackage admin
|
||||
* @link http://www.acspri.org.au/ queXS was writen for ACSPRI
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Configuration file
|
||||
*/
|
||||
include ("../config.inc.php");
|
||||
|
||||
/**
|
||||
* Database file
|
||||
*/
|
||||
include ("../db.inc.php");
|
||||
|
||||
/**
|
||||
* XHTML functions
|
||||
*/
|
||||
include ("../functions/functions.xhtml.php");
|
||||
|
||||
global $db;
|
||||
|
||||
$year="2008";
|
||||
$woy="1";
|
||||
|
||||
if (isset($_GET['availability_group']))
|
||||
$availability_group = intval($_GET['availability_group']);
|
||||
else if (isset($_POST['availability_group']))
|
||||
$availability_group = intval($_POST['availability_group']);
|
||||
else
|
||||
die(T_("No time slot group set"));
|
||||
|
||||
|
||||
if (isset($_POST['day']))
|
||||
{
|
||||
$db->StartTrans();
|
||||
|
||||
$sql = "DELETE FROM availability
|
||||
WHERE availability_group_id = $availability_group";
|
||||
|
||||
$db->Execute($sql);
|
||||
|
||||
foreach($_POST['day'] as $key => $val)
|
||||
{
|
||||
if (!empty($val))
|
||||
{
|
||||
$val = intval($val);
|
||||
$key = intval($key);
|
||||
|
||||
$start = $db->qstr($_POST['start'][$key],get_magic_quotes_gpc());
|
||||
$end = $db->qstr($_POST['end'][$key],get_magic_quotes_gpc());
|
||||
|
||||
$sql = "INSERT INTO availability (day_of_week,start,end,availability_group_id)
|
||||
VALUES ('$val',$start,$end,$availability_group)";
|
||||
|
||||
$db->Execute($sql);
|
||||
}
|
||||
}
|
||||
|
||||
$sql = "UPDATE availability_group
|
||||
SET description = " . $db->qstr($_POST['description']) . "
|
||||
WHERE availability_group_id= $availability_group";
|
||||
|
||||
$db->Execute($sql);
|
||||
|
||||
$db->CompleteTrans();
|
||||
}
|
||||
|
||||
xhtml_head(T_("Modify time slots"),true,array("../css/shifts.css"),array("../js/addrow-v2.js"));
|
||||
|
||||
/**
|
||||
* Display warning if timezone data not installed
|
||||
*
|
||||
*/
|
||||
|
||||
$sql = "SELECT CONVERT_TZ(NOW(),'Australia/Victoria','UTC') as t";
|
||||
$rs = $db->GetRow($sql);
|
||||
|
||||
if (empty($rs) || !$rs || empty($rs['t']))
|
||||
print "<div class='warning'><a href='http://dev.mysql.com/doc/mysql/en/time-zone-support.html'>" . T_("Your database does not have timezones installed, please see here for details") . "</a></div>";
|
||||
|
||||
|
||||
print "<div><a href='availabilitygroup.php'>" . T_("Go back") . "</a></div>";
|
||||
|
||||
|
||||
$sql = "SELECT description
|
||||
FROM availability_group
|
||||
WHERE availability_group_id = $availability_group";
|
||||
|
||||
$rs = $db->GetRow($sql);
|
||||
|
||||
$description = $rs['description'];
|
||||
|
||||
print "<h2>" . $rs['description'] . "</h2>";
|
||||
|
||||
print "<h3>" . T_("Enter the start and end times for each day of the week to restrict calls within") . "</h3>";
|
||||
/**
|
||||
* Begin displaying currently loaded restriction times
|
||||
*/
|
||||
|
||||
$sql = "SELECT DATE_FORMAT( STR_TO_DATE( CONCAT( '$year', ' ', '$woy', ' ', day_of_week -1 ) , '%x %v %w' ) , '%W' ) AS dt,day_of_week,start,end
|
||||
FROM availability
|
||||
WHERE availability_group_id = $availability_group";
|
||||
|
||||
$availabilitys = $db->GetAll($sql);
|
||||
translate_array($availabilitys,array("dt"));
|
||||
|
||||
$sql = "SELECT DATE_FORMAT(STR_TO_DATE(CONCAT($year, ' ',$woy,' ',day_of_week - 1),'%x %v %w'), '%W') as description, day_of_week as value, '' as selected
|
||||
FROM day_of_week";
|
||||
|
||||
$daysofweek = $db->GetAll($sql);
|
||||
translate_array($daysofweek,array("description"));
|
||||
|
||||
?>
|
||||
<form method="post" action="">
|
||||
<table>
|
||||
<?php
|
||||
print "<tr><th>" . T_("Day") . "</th><th>" . T_("Start") . "</th><th>" . T_("End") . "</th></tr>";
|
||||
$count = 0;
|
||||
foreach($availabilitys as $availability)
|
||||
{
|
||||
print "<tr id='row-$count' class='row_to_clone'><td>";
|
||||
display_chooser($daysofweek, "day[$count]", false, true, false, false, false, array("description",$availability['dt']));
|
||||
print "</td><td><input size=\"8\" name=\"start[$count]\" maxlength=\"8\" type=\"text\" value=\"{$availability['start']}\"/></td><td><input name=\"end[$count]\" type=\"text\" size=\"8\" maxlength=\"8\" value=\"{$availability['end']}\"/></td></tr>";
|
||||
$count++;
|
||||
}
|
||||
print "<tr class='row_to_clone' id='row-$count'><td>";
|
||||
display_chooser($daysofweek, "day[$count]", false, true, false, false, false, false);
|
||||
print "</td><td><input size=\"8\" name=\"start[$count]\" maxlength=\"8\" type=\"text\" value=\"00:00:00\"/></td><td><input name=\"end[$count]\" type=\"text\" size=\"8\" maxlength=\"8\" value=\"00:00:00\"/></td></tr>";
|
||||
|
||||
|
||||
?>
|
||||
</table>
|
||||
<p><a onclick="addRow(); return false;" href="#"><?php echo T_("Add row"); ?></a></p>
|
||||
<p><label for="description"><?php echo T_("Time slot group name"); ?>: </label><input type="text" name="description" id="description" value="<?php echo $description;?>"/></p>
|
||||
<p><input type="submit" name="submit" value="<?php echo T_("Save changes to time slot group"); ?>"/></p>
|
||||
<input type="hidden" name="availability_group" value="<?php echo $availability_group;?>"/>
|
||||
</form>
|
||||
<form method="post" action="availabilitygroup.php">
|
||||
<p><input type="submit" name="subdel" value="<?php echo T_("Delete this time slot group"); ?>"/></p>
|
||||
<input type="hidden" name="availability_group" value="<?php echo $availability_group;?>"/>
|
||||
</form>
|
||||
<?php
|
||||
|
||||
|
||||
xhtml_foot();
|
||||
?>
|
||||
<?php
|
||||
/**
|
||||
* Modify availability within this availability group
|
||||
*
|
||||
*
|
||||
* This file is part of queXS
|
||||
*
|
||||
* queXS is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* queXS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with queXS; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*
|
||||
* @author Adam Zammit <adam.zammit@acspri.org.au>
|
||||
* @copyright Australian Consortium for Social and Political Research Inc (ACSPRI) 2011
|
||||
* @package queXS
|
||||
* @subpackage admin
|
||||
* @link http://www.acspri.org.au/ queXS was writen for ACSPRI
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Configuration file
|
||||
*/
|
||||
include ("../config.inc.php");
|
||||
|
||||
/**
|
||||
* Database file
|
||||
*/
|
||||
include ("../db.inc.php");
|
||||
|
||||
/**
|
||||
* XHTML functions
|
||||
*/
|
||||
include ("../functions/functions.xhtml.php");
|
||||
|
||||
$css = array(
|
||||
"../include/bootstrap-3.3.2/css/bootstrap.min.css",
|
||||
//"../include/bootstrap-3.3.2/css/bootstrap-theme.min.css",
|
||||
"../include/clockpicker/dist/bootstrap-clockpicker.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/addrow-v2.js",
|
||||
);
|
||||
$js_foot = array(
|
||||
"../include/clockpicker/dist/bootstrap-clockpicker.js",
|
||||
"../js/custom.js"
|
||||
);
|
||||
|
||||
global $db;
|
||||
|
||||
$year="2008";
|
||||
$woy="1";
|
||||
|
||||
if (isset($_GET['availability_group']))
|
||||
$availability_group = intval($_GET['availability_group']);
|
||||
else if (isset($_POST['availability_group']))
|
||||
$availability_group = intval($_POST['availability_group']);
|
||||
else
|
||||
die(T_("No time slot group set"));
|
||||
|
||||
|
||||
if (isset($_POST['day']))
|
||||
{
|
||||
$db->StartTrans();
|
||||
|
||||
$sql = "DELETE FROM availability
|
||||
WHERE availability_group_id = $availability_group";
|
||||
$db->Execute($sql);
|
||||
|
||||
foreach($_POST['day'] as $key => $val)
|
||||
{
|
||||
if (!empty($val))
|
||||
{
|
||||
$val = intval($val);
|
||||
$key = intval($key);
|
||||
|
||||
$start = $db->qstr($_POST['start'][$key],get_magic_quotes_gpc());
|
||||
$end = $db->qstr($_POST['end'][$key],get_magic_quotes_gpc());
|
||||
|
||||
$sql = "INSERT INTO availability (day_of_week,start,end,availability_group_id)
|
||||
VALUES ('$val',$start,$end,$availability_group)";
|
||||
$db->Execute($sql);
|
||||
}
|
||||
}
|
||||
|
||||
$sql = "UPDATE availability_group
|
||||
SET description = " . $db->qstr($_POST['description']) . "
|
||||
WHERE availability_group_id= $availability_group";
|
||||
$db->Execute($sql);
|
||||
$db->CompleteTrans();
|
||||
}
|
||||
|
||||
xhtml_head(T_("Modify time slots"),true,$css,$js_head);//,true,array("../css/shifts.css"),array("../js/addrow-v2.js")
|
||||
|
||||
/**
|
||||
* Display warning if timezone data not installed
|
||||
*
|
||||
*/
|
||||
|
||||
$sql = "SELECT CONVERT_TZ(NOW(),'" . DEFAULT_TIME_ZONE . "','UTC') as t";//'Australia/Victoria'
|
||||
$rs = $db->GetRow($sql);
|
||||
|
||||
if (empty($rs) || !$rs || empty($rs['t']))
|
||||
print "<div class='alert alert-danger'><a href='http://dev.mysql.com/doc/mysql/en/time-zone-support.html'>" . T_("Your database does not have timezones installed, please see here for details") . "</a></div>";
|
||||
|
||||
|
||||
print "<div><a class='btn btn-default' href='availabilitygroup.php'>" . T_("Go back") . "</a></div>";
|
||||
|
||||
|
||||
$sql = "SELECT description
|
||||
FROM availability_group
|
||||
WHERE availability_group_id = $availability_group";
|
||||
|
||||
$rs = $db->GetRow($sql);
|
||||
|
||||
$description = $rs['description'];
|
||||
|
||||
print "<h3>" . T_("Time slot name") . " : <span class = 'text-primary'>" . $rs['description'] . "</span></h3>";
|
||||
|
||||
print "<div class='well'>" . T_("Enter the start and end times for each day of the week to restrict calls within") . "</div>";
|
||||
/**
|
||||
* Begin displaying currently loaded restriction times
|
||||
*/
|
||||
|
||||
$sql = "SELECT DATE_FORMAT( STR_TO_DATE( CONCAT( '$year', ' ', '$woy', ' ', day_of_week -1 ) , '%x %v %w' ) , '%W' ) AS dt,day_of_week,start,end
|
||||
FROM availability
|
||||
WHERE availability_group_id = $availability_group";
|
||||
|
||||
$availabilitys = $db->GetAll($sql);
|
||||
translate_array($availabilitys,array("dt"));
|
||||
|
||||
$sql = "SELECT DATE_FORMAT(STR_TO_DATE(CONCAT($year, ' ',$woy,' ',day_of_week - 1),'%x %v %w'), '%W') as description, day_of_week as value, '' as selected
|
||||
FROM day_of_week";
|
||||
|
||||
$daysofweek = $db->GetAll($sql);
|
||||
translate_array($daysofweek,array("description"));
|
||||
|
||||
?>
|
||||
<div class=" panel-body col-sm-4"><form method="post" action="">
|
||||
<p><label class="control-label"for="description"><?php echo T_("Time slot group name"); ?>: </label><input class="form-control" type="text" name="description" id="description" value="<?php echo $description;?>"/></p>
|
||||
<table class="table-hover table-condensed "><thead class="highlight">
|
||||
<?php
|
||||
print "<tr><th>" . T_("Day") . "</th><th>" . T_("Start") . "</th><th>" . T_("End") . "</th></tr></thead><tbody>";
|
||||
$count = 0;
|
||||
foreach($availabilitys as $availability)
|
||||
{
|
||||
print "<tr id='row-$count' ><td>";//class='row_to_clone'
|
||||
display_chooser($daysofweek, "day[$count]", false, true, false, false, false, array("description",$availability['dt']));
|
||||
print "</td><td><input class=\"form-control clockpicker\" size=\"8\" name=\"start[$count]\" maxlength=\"8\" type=\"text\" value=\"{$availability['start']}\"/></td><td><input class=\"form-control clockpicker\" name=\"end[$count]\" type=\"text\" size=\"8\" maxlength=\"8\" value=\"{$availability['end']}\"/></td></tr>";
|
||||
$count++;
|
||||
}
|
||||
print "<tr class='row_to_clone' id='row-$count'><td>";
|
||||
display_chooser($daysofweek, "day[$count]", false, true, false, false, false, false);
|
||||
print "</td><td><input class=\"form-control clockpicker\" size=\"8\" name=\"start[$count]\" maxlength=\"8\" type=\"text\" value=\"08:00:00\"/></td><td><input class=\"form-control clockpicker\" name=\"end[$count]\" type=\"text\" size=\"8\" maxlength=\"8\" value=\"20:00:00\"/></td></tr>";
|
||||
|
||||
|
||||
?>
|
||||
</tbody></table>
|
||||
<a class="btn btn-default btn-sm" onclick="addRow(); return false;" href="#"><?php echo T_("Add row"); ?></a><br/><br/>
|
||||
<input class="btn btn-primary" type="submit" name="submit" value="<?php echo T_("Save changes to time slot group"); ?>"/>
|
||||
<input type="hidden" name="availability_group" value="<?php echo $availability_group;?>"/>
|
||||
</form><br/><br/>
|
||||
<form method="post" action="availabilitygroup.php">
|
||||
<input class="btn btn-danger pull-right" type="submit" name="subdel" value="<?php echo T_("Delete this time slot group"); ?>"/>
|
||||
<input type="hidden" name="availability_group" value="<?php echo $availability_group;?>"/>
|
||||
</form></div>
|
||||
<?php
|
||||
xhtml_foot($js_foot);
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$('.clockpicker').clockpicker({
|
||||
autoclose: true
|
||||
});
|
||||
</script>
|
||||
@@ -1,135 +1,144 @@
|
||||
<?php
|
||||
/**
|
||||
* List and create availability groups
|
||||
*
|
||||
*
|
||||
* This file is part of queXS
|
||||
*
|
||||
* queXS is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* queXS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with queXS; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*
|
||||
* @author Adam Zammit <adam.zammit@acspri.org.au>
|
||||
* @copyright Australian Consortium for Social and Political Research Inc (2011)
|
||||
* @package queXS
|
||||
* @subpackage admin
|
||||
* @link http://www.acspri.org.au/ queXS was writen for ACSPRI
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Configuration file
|
||||
*/
|
||||
include("../config.inc.php");
|
||||
|
||||
/**
|
||||
* Database file
|
||||
*/
|
||||
include ("../db.inc.php");
|
||||
|
||||
/**
|
||||
* XHTML functions
|
||||
*/
|
||||
include("../functions/functions.xhtml.php");
|
||||
|
||||
/**
|
||||
* Display functions
|
||||
*/
|
||||
include("../functions/functions.display.php");
|
||||
|
||||
/**
|
||||
* Limesurvey functions
|
||||
*/
|
||||
include("../functions/functions.limesurvey.php");
|
||||
|
||||
/**
|
||||
* Operator functions
|
||||
*/
|
||||
include("../functions/functions.operator.php");
|
||||
|
||||
/**
|
||||
* Input functions
|
||||
*/
|
||||
include("../functions/functions.input.php");
|
||||
|
||||
global $db;
|
||||
|
||||
xhtml_head(T_("Time slots"),true,array("../css/table.css"),array("../js/window.js"));
|
||||
|
||||
if (isset($_POST['subdel']))
|
||||
{
|
||||
$availability_group = intval($_POST['availability_group']);
|
||||
|
||||
$db->StartTrans();
|
||||
|
||||
$sql = "DELETE FROM availability
|
||||
WHERE availability_group_id = $availability_group";
|
||||
|
||||
$db->Execute($sql);
|
||||
|
||||
$sql = "DELETE FROM questionnaire_availability
|
||||
WHERE availability_group_id = $availability_group";
|
||||
|
||||
$db->Execute($sql);
|
||||
|
||||
$sql = "DELETE FROM availability_group
|
||||
WHERE availability_group_id = $availability_group";
|
||||
|
||||
$db->Execute($sql);
|
||||
|
||||
$db->CompleteTrans();
|
||||
}
|
||||
else if (isset($_POST['availability_group']))
|
||||
{
|
||||
$availability_group = $db->qstr($_POST['availability_group']);
|
||||
|
||||
$sql = "INSERT INTO `availability_group` (availability_group_id,description)
|
||||
VALUES (NULL,$availability_group)";
|
||||
|
||||
$db->Execute($sql);
|
||||
}
|
||||
|
||||
//view groups
|
||||
$sql = "SELECT description,
|
||||
CONCAT('<a href=\'availability.php?availability_group=', availability_group_id, '\'>". TQ_("Modify") . "</a>') as link
|
||||
FROM availability_group";
|
||||
|
||||
$rs = $db->GetAll($sql);
|
||||
|
||||
print "<h3>" . T_("Time slots")."</h3>";
|
||||
|
||||
print "<p>" . T_("Time slots define periods of time during particular days of the week. These are used for the availability function and also the call attempt time slot function.") . "</p>";
|
||||
|
||||
if (empty($rs))
|
||||
print "<p>" . T_("No time slots") . "</p>";
|
||||
else
|
||||
xhtml_table($rs,array("description","link"),array(T_("Time slot"),T_("Modify")));
|
||||
|
||||
|
||||
//add an availablity group
|
||||
print "<h3>" . T_("Add time slot") . "</h3>";
|
||||
?>
|
||||
<form method="post" action="?">
|
||||
<p><label for="availability_group"><?php echo T_("Time slot name"); ?>: </label><input type="text" class="textclass" name="availability_group" id="availability_group"/></p>
|
||||
<p><input class="submitclass" type="submit" name="submit" value="<?php echo T_("Add time slot"); ?>"/>
|
||||
</p>
|
||||
</form>
|
||||
<?php
|
||||
|
||||
xhtml_foot();
|
||||
|
||||
|
||||
?>
|
||||
<?php
|
||||
/**
|
||||
* List and create availability groups
|
||||
*
|
||||
*
|
||||
* This file is part of queXS
|
||||
*
|
||||
* queXS is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* queXS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with queXS; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*
|
||||
* @author Adam Zammit <adam.zammit@acspri.org.au>
|
||||
* @copyright Australian Consortium for Social and Political Research Inc (2011)
|
||||
* @package queXS
|
||||
* @subpackage admin
|
||||
* @link http://www.acspri.org.au/ queXS was writen for ACSPRI
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Configuration file
|
||||
*/
|
||||
include("../config.inc.php");
|
||||
|
||||
/**
|
||||
* Database file
|
||||
*/
|
||||
include ("../db.inc.php");
|
||||
|
||||
/**
|
||||
* XHTML functions
|
||||
*/
|
||||
include("../functions/functions.xhtml.php");
|
||||
|
||||
/**
|
||||
* Display functions
|
||||
*/
|
||||
include("../functions/functions.display.php");
|
||||
|
||||
/**
|
||||
* Limesurvey functions
|
||||
*/
|
||||
include("../functions/functions.limesurvey.php");
|
||||
|
||||
/**
|
||||
* Operator functions
|
||||
*/
|
||||
include("../functions/functions.operator.php");
|
||||
|
||||
/**
|
||||
* Input functions
|
||||
*/
|
||||
include("../functions/functions.input.php");
|
||||
|
||||
$css = array(
|
||||
"../include/bootstrap-3.3.2/css/bootstrap.min.css",
|
||||
"../css/custom.css"
|
||||
);
|
||||
$js_head = array(
|
||||
);
|
||||
$js_foot = array(
|
||||
"../js/window.js",
|
||||
"../js/custom.js"
|
||||
);
|
||||
global $db;
|
||||
|
||||
xhtml_head(T_("Time slots"),true,$css,$js_head);//array("../css/table.css"),array("../js/window.js")
|
||||
|
||||
if (isset($_POST['subdel']))
|
||||
{
|
||||
$availability_group = intval($_POST['availability_group']);
|
||||
|
||||
$db->StartTrans();
|
||||
|
||||
$sql = "DELETE FROM availability
|
||||
WHERE availability_group_id = $availability_group";
|
||||
|
||||
$db->Execute($sql);
|
||||
|
||||
$sql = "DELETE FROM questionnaire_availability
|
||||
WHERE availability_group_id = $availability_group";
|
||||
|
||||
$db->Execute($sql);
|
||||
|
||||
$sql = "DELETE FROM availability_group
|
||||
WHERE availability_group_id = $availability_group";
|
||||
|
||||
$db->Execute($sql);
|
||||
|
||||
$db->CompleteTrans();
|
||||
}
|
||||
else if (isset($_POST['availability_group']))
|
||||
{
|
||||
$availability_group = $db->qstr($_POST['availability_group']);
|
||||
|
||||
$sql = "INSERT INTO `availability_group` (availability_group_id,description)
|
||||
VALUES (NULL,$availability_group)";
|
||||
|
||||
$db->Execute($sql);
|
||||
}
|
||||
|
||||
//view groups
|
||||
$sql = "SELECT description,
|
||||
CONCAT('<a href=\'availability.php?availability_group=', availability_group_id, '\'>". TQ_("Modify") . "</a>') as link
|
||||
FROM availability_group";
|
||||
|
||||
$rs = $db->GetAll($sql);
|
||||
|
||||
//print "<h3>" . T_("Time slots")."</h3>";
|
||||
|
||||
print "<div class='well'>" . T_("Time slots define periods of time during particular days of the week. These are used for the availability function and also the call attempt time slot function.") . "</div>";
|
||||
|
||||
if (empty($rs))
|
||||
print "<div class='alert alert-danger'>" . T_("No time slots") . "</div>";
|
||||
else{
|
||||
print "<div class='panel-body col-sm-4'>";
|
||||
// print "<h3>" . T_("Time slots")."</h3>";
|
||||
xhtml_table($rs,array("description","link"),array(T_("Time slot"),T_("Modify")));
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
//add an availablity group <label for="availability_group"><?php echo T_("Time slot name"); : </label>
|
||||
?>
|
||||
<div class=" panel-body col-sm-4"><form method="post" action="?">
|
||||
<h3><?php echo T_("Add time slot")," :";?></h3>
|
||||
<p><input type="text" class="textclass form-control" name="availability_group" id="availability_group" placeholder="<?php echo T_("Enter")," ",T_("new")," ",T_("Time slot name"); ?>"/></p>
|
||||
<p><input class="submitclass btn btn-default" type="submit" name="submit" value="<?php echo T_("Add time slot"); ?>"/></p>
|
||||
</form></div>
|
||||
<?php
|
||||
xhtml_foot($js_foot);
|
||||
?>
|
||||
|
||||
@@ -44,6 +44,22 @@ include ("../db.inc.php");
|
||||
*/
|
||||
include ("../functions/functions.xhtml.php");
|
||||
|
||||
$css = array(
|
||||
"../include/bootstrap-3.3.2/css/bootstrap.min.css",
|
||||
//"../include/bootstrap-3.3.2/css/bootstrap-theme.min.css",
|
||||
"../include/clockpicker/dist/bootstrap-clockpicker.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/addrow-v2.js",
|
||||
);
|
||||
$js_foot = array(
|
||||
"../include/clockpicker/dist/bootstrap-clockpicker.js",
|
||||
"../js/custom.js"
|
||||
);
|
||||
|
||||
global $db;
|
||||
|
||||
$year="2008";
|
||||
@@ -79,21 +95,21 @@ if (isset($_POST['day']))
|
||||
$db->CompleteTrans();
|
||||
}
|
||||
|
||||
xhtml_head(T_("Modify call restriction times"),true,array("../css/shifts.css"),array("../js/addrow-v2.js"));
|
||||
xhtml_head(T_("Set call restriction times"),true,$css,$js_head);//,array("../css/shifts.css"),array("../js/addrow-v2.js")
|
||||
|
||||
/**
|
||||
* Display warning if timezone data not installed
|
||||
*
|
||||
*/
|
||||
|
||||
$sql = "SELECT CONVERT_TZ(NOW(),'Australia/Victoria','UTC') as t";
|
||||
$sql = "SELECT CONVERT_TZ(NOW(),'" . DEFAULT_TIME_ZONE . "','UTC') as t";//'Australia/Victoria'
|
||||
$rs = $db->GetRow($sql);
|
||||
|
||||
if (empty($rs) || !$rs || empty($rs['t']))
|
||||
print "<div class='warning'><a href='http://dev.mysql.com/doc/mysql/en/time-zone-support.html'>" . T_("Your database does not have timezones installed, please see here for details") . "</a></div>";
|
||||
print "<div class='alert alert-danger'><a href='http://dev.mysql.com/doc/mysql/en/time-zone-support.html'>" . T_("Your database does not have timezones installed, please see here for details") . "</a></div>";
|
||||
|
||||
|
||||
print "<h2>" . T_("Enter the start and end times for each day of the week to restrict calls within") . "</h2>";
|
||||
print "<div class='well'>" . T_("Enter the start and end times for each day of the week to restrict calls within") . "</div>";
|
||||
|
||||
/**
|
||||
* Begin displaying currently loaded restriction times
|
||||
@@ -112,30 +128,33 @@ $daysofweek = $db->GetAll($sql);
|
||||
translate_array($daysofweek,array("description"));
|
||||
|
||||
?>
|
||||
<form method="post" action="">
|
||||
<table>
|
||||
<div class=" panel-body col-sm-4"><form method="post" action="">
|
||||
<table class="table-hover table-condensed " id="restrict"><thead class="highlight">
|
||||
<?php
|
||||
print "<tr><th>" . T_("Day") . "</th><th>" . T_("Start") . "</th><th>" . T_("End") . "</th></tr>";
|
||||
print "<tr><th>" . T_("Day") . "</th><th>" . T_("Start") . "</th><th>" . T_("End") . "</th></tr></thead><tbody>";
|
||||
$count = 0;
|
||||
foreach($shifts as $shift)
|
||||
{
|
||||
print "<tr id='row-$count' class='row_to_clone'><td>";
|
||||
print "<tr id='row-$count' ><td>";//class='row_to_clone' /* these are not the rows to clone...*/
|
||||
display_chooser($daysofweek, "day[$count]", false, true, false, false, false, array("description",$shift['dt']));
|
||||
print "</td><td><input size=\"8\" name=\"start[$count]\" maxlength=\"8\" type=\"text\" value=\"{$shift['start']}\"/></td><td><input name=\"end[$count]\" type=\"text\" size=\"8\" maxlength=\"8\" value=\"{$shift['end']}\"/></td></tr>";
|
||||
print "</td><td><input class=\"form-control clockpicker\" size=\"8\" name=\"start[$count]\" maxlength=\"8\" type=\"text\" value=\"{$shift['start']}\"/></td><td><input class=\"form-control clockpicker\" name=\"end[$count]\" type=\"text\" size=\"8\" maxlength=\"8\" value=\"{$shift['end']}\"/></td></tr>";
|
||||
$count++;
|
||||
}
|
||||
print "<tr class='row_to_clone' id='row-$count'><td>";
|
||||
display_chooser($daysofweek, "day[$count]", false, true, false, false, false, false);
|
||||
print "</td><td><input size=\"8\" name=\"start[$count]\" maxlength=\"8\" type=\"text\" value=\"00:00:00\"/></td><td><input name=\"end[$count]\" type=\"text\" size=\"8\" maxlength=\"8\" value=\"00:00:00\"/></td></tr>";
|
||||
print "</td><td><input class=\"form-control clockpicker\" size=\"8\" name=\"start[$count]\" maxlength=\"8\" type=\"text\" value=\"08:00:00\"/></td><td><input class=\"form-control clockpicker\" name=\"end[$count]\" type=\"text\" size=\"8\" maxlength=\"8\" value=\"20:00:00\"/></td></tr>";
|
||||
|
||||
|
||||
?>
|
||||
</table>
|
||||
<div><a onclick="addRow(); return false;" href="#"><?php echo T_("Add row"); ?></a></div>
|
||||
<p><input type="submit" name="submit" value="<?php echo T_("Save changes to restriction times"); ?>"/></p>
|
||||
</form>
|
||||
<?php
|
||||
|
||||
|
||||
xhtml_foot();
|
||||
</tbody></table>
|
||||
<a class="btn btn-default btn-sm" onclick="addRow(); return false;" href=""><?php echo T_("Add row"); ?></a><br/><br/>
|
||||
<input class="btn btn-default " type="submit" name="submit" value="<?php echo T_("Save changes to restriction times"); ?>"/>
|
||||
</form></div>
|
||||
<?php
|
||||
xhtml_foot($js_foot);
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$('.clockpicker').clockpicker({
|
||||
autoclose: true
|
||||
});
|
||||
</script>
|
||||
@@ -44,19 +44,33 @@ include ("../db.inc.php");
|
||||
*/
|
||||
include ("../functions/functions.xhtml.php");
|
||||
|
||||
$css = array(
|
||||
"../include/bootstrap-3.3.2/css/bootstrap.min.css",
|
||||
//"../include/bootstrap-3.3.2/css/bootstrap-theme.min.css",
|
||||
"../include/clockpicker/dist/bootstrap-clockpicker.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/addrow-v2.js",
|
||||
);
|
||||
$js_foot = array(
|
||||
"../include/clockpicker/dist/bootstrap-clockpicker.js",
|
||||
"../js/custom.js"
|
||||
);
|
||||
|
||||
global $db;
|
||||
|
||||
$year="2008";
|
||||
$woy="1";
|
||||
|
||||
|
||||
if (isset($_POST['day']))
|
||||
{
|
||||
$db->StartTrans();
|
||||
|
||||
$sql = "DELETE FROM shift_template
|
||||
WHERE 1";
|
||||
|
||||
$db->Execute($sql);
|
||||
|
||||
foreach($_POST['day'] as $key => $val)
|
||||
@@ -71,71 +85,76 @@ if (isset($_POST['day']))
|
||||
|
||||
$sql = "INSERT INTO shift_template (day_of_week,start,end)
|
||||
VALUES ('$val',$start,$end)";
|
||||
|
||||
$db->Execute($sql);
|
||||
}
|
||||
}
|
||||
|
||||
$db->CompleteTrans();
|
||||
}
|
||||
|
||||
xhtml_head(T_("Modify shift template"),true,array("../css/shifts.css"),array("../js/addrow-v2.js"));
|
||||
xhtml_head(T_("Set default shift times"),true,$css,$js_head);//T_("Modify shift template"),array("../css/shifts.css"),array("../js/addrow-v2.js")
|
||||
|
||||
/**
|
||||
* Display warning if timezone data not installed
|
||||
*
|
||||
*/
|
||||
$sql = "SELECT CONVERT_TZ(NOW(),'" . DEFAULT_TIME_ZONE . "','UTC') as t";//'Australia/Victoria'
|
||||
|
||||
$sql = "SELECT CONVERT_TZ(NOW(),'Australia/Victoria','UTC') as t";
|
||||
$rs = $db->GetRow($sql);
|
||||
|
||||
if (empty($rs) || !$rs || empty($rs['t']))
|
||||
print "<div class='warning'><a href='http://dev.mysql.com/doc/mysql/en/time-zone-support.html'>" . T_("Your database does not have timezones installed, please see here for details") . "</a></div>";
|
||||
print "<div class='alert alert-danger'><a href='http://dev.mysql.com/doc/mysql/en/time-zone-support.html'>" . T_("Your database does not have timezones installed, please see here for details") . "</a></div>";
|
||||
|
||||
/**
|
||||
* Display warning if timezone data not installed
|
||||
|
||||
print "<h2>" . T_("Enter standard shift start and end times for each day of the week in local time") . "</h2>";
|
||||
*/
|
||||
|
||||
//print "<h1>" . T_("Set default shift times") . "</h1>";
|
||||
print "<div class='well'><t>" . T_("Enter standard shift start and end times for each day of the week in local time") . "</t></div>";
|
||||
|
||||
/**
|
||||
* Begin displaying currently loaded shifts
|
||||
*/
|
||||
|
||||
$sql = "SELECT DATE_FORMAT( STR_TO_DATE( CONCAT( '$year', ' ', '$woy', ' ', day_of_week -1 ) , '%x %v %w' ) , '%W' ) AS dt,day_of_week,start,end
|
||||
$sql = "SELECT DATE_FORMAT(STR_TO_DATE(CONCAT('$year',' ','$woy',' ',day_of_week -1),'%x %v %w' ), '%W' ) AS dt,day_of_week,start,end
|
||||
FROM shift_template";
|
||||
|
||||
$shifts = $db->GetAll($sql);
|
||||
translate_array($shifts,array("dt"));
|
||||
|
||||
$sql = "SELECT DATE_FORMAT(STR_TO_DATE(CONCAT($year, ' ',$woy,' ',day_of_week - 1),'%x %v %w'), '%W') as description, day_of_week as value, '' as selected
|
||||
$sql = "SELECT DATE_FORMAT(STR_TO_DATE(CONCAT($year,' ',$woy,' ',day_of_week - 1),'%x %v %w'), '%W') as description, day_of_week as value, '' as selected
|
||||
FROM day_of_week";
|
||||
|
||||
$daysofweek = $db->GetAll($sql);
|
||||
translate_array($daysofweek,array("description"));
|
||||
|
||||
?>
|
||||
<form method="post" action="">
|
||||
<table>
|
||||
<div class="panel-body col-sm-4"><form method="post" action="" class="form-horizontal">
|
||||
<table class="table-hover table-condensed " id="shifts"><thead class="text-center highlight">
|
||||
<?php
|
||||
print "<tr><th>" . T_("Day") . "</th><th>" . T_("Start") . "</th><th>" . T_("End") . "</th></tr>";
|
||||
print "<tr ><th >" . T_("Day") . "</th><th >" . T_("Start") . "</th><th >" . T_("End") . "</th></tr></thead><tbody>";
|
||||
$count = 0;
|
||||
foreach($shifts as $shift)
|
||||
{
|
||||
print "<tr id='row-$count' class='row_to_clone'><td>";
|
||||
print "<tr id='row-$count'><td>";// class='row_to_clone' /* these are not the rows to clone...*/
|
||||
display_chooser($daysofweek, "day[$count]", false, true, false, false, false, array("description",$shift['dt']));
|
||||
print "</td><td><input size=\"8\" name=\"start[$count]\" maxlength=\"8\" type=\"text\" value=\"{$shift['start']}\"/></td><td><input name=\"end[$count]\" type=\"text\" size=\"8\" maxlength=\"8\" value=\"{$shift['end']}\"/></td></tr>";
|
||||
print "</td>
|
||||
<td> <input class=\"form-control clockpicker\" size=\"8\" maxlength=\"8\" name=\"start[$count]\" type=\"text\" value=\"{$shift['start']}\"/></td>
|
||||
<td> <input class=\"form-control clockpicker\" size=\"8\" maxlength=\"8\" name=\"end[$count]\" type=\"text\" value=\"{$shift['end']}\"/></td>
|
||||
</tr>";
|
||||
$count++;
|
||||
}
|
||||
print "<tr class='row_to_clone' id='row-$count'><td>";
|
||||
print "<tr class='row_to_clone' id='row-$count'><td>";
|
||||
display_chooser($daysofweek, "day[$count]", false, true, false, false, false, false);
|
||||
print "</td><td><input size=\"8\" name=\"start[$count]\" maxlength=\"8\" type=\"text\" value=\"00:00:00\"/></td><td><input name=\"end[$count]\" type=\"text\" size=\"8\" maxlength=\"8\" value=\"00:00:00\"/></td></tr>";
|
||||
|
||||
print " </td> <td><input class=\"form-control clockpicker\" size=\"8\" maxlength=\"8\" name=\"start[$count]\" type=\"text\" value=\"08:00:00\"/></td>
|
||||
<td><input class=\"form-control clockpicker\" size=\"8\" maxlength=\"8\" name=\"end[$count]\" type=\"text\" value=\"20:00:00\"/></td></tr>";
|
||||
|
||||
?>
|
||||
</table>
|
||||
<div><a onclick="addRow(); return false;" href="#"><?php echo T_("Add row"); ?></a></div>
|
||||
<p><input type="submit" name="submit" value="<?php echo T_("Save changes to shifts"); ?>"/></p>
|
||||
</form>
|
||||
</tbody></table>
|
||||
<a class="btn btn-default btn-sm" onclick="addRow(); return false;" href=""><?php echo T_("Add row"); ?></a><br/><br/>
|
||||
<input class="btn btn-default " type="submit" name="submit" value="<?php echo T_("Save changes to shifts"); ?>"/>
|
||||
</form></div>
|
||||
<?php
|
||||
|
||||
|
||||
xhtml_foot();
|
||||
xhtml_foot($js_foot);
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$('.clockpicker').clockpicker({
|
||||
autoclose: true
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user