mirror of
https://github.com/ACSPRI/queXS
synced 2024-04-02 12:12:16 +00:00
New look,
Fetures: checkboxes transformed to toggle switches, clockpicker for time input readonly input fields : input time with clockpicker only (to avoid input typing and format mistakes), better visualisation for year and weeks selection (in addsgift.php)
This commit is contained in:
@@ -1,273 +1,278 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Add and modify shifts by questionnaire
|
* Add and modify shifts by questionnaire
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* This file is part of queXS
|
* This file is part of queXS
|
||||||
*
|
*
|
||||||
* queXS is free software; you can redistribute it and/or modify
|
* queXS is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* queXS is distributed in the hope that it will be useful,
|
* queXS is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with queXS; if not, write to the Free Software
|
* along with queXS; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @author Adam Zammit <adam.zammit@deakin.edu.au>
|
* @author Adam Zammit <adam.zammit@deakin.edu.au>
|
||||||
* @copyright Deakin University 2007,2008
|
* @copyright Deakin University 2007,2008
|
||||||
* @package queXS
|
* @package queXS
|
||||||
* @subpackage admin
|
* @subpackage admin
|
||||||
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility
|
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility
|
||||||
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configuration file
|
* Configuration file
|
||||||
*/
|
*/
|
||||||
include ("../config.inc.php");
|
include ("../config.inc.php");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Database file
|
* Database file
|
||||||
*/
|
*/
|
||||||
include ("../db.inc.php");
|
include ("../db.inc.php");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* XHTML functions
|
* XHTML functions
|
||||||
*/
|
*/
|
||||||
include ("../functions/functions.xhtml.php");
|
include ("../functions/functions.xhtml.php");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Operator functions
|
* Operator functions
|
||||||
*/
|
*/
|
||||||
include ("../functions/functions.operator.php");
|
include ("../functions/functions.operator.php");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display functions
|
* Display functions
|
||||||
*/
|
*/
|
||||||
include ("../functions/functions.display.php");
|
include ("../functions/functions.display.php");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Input functions
|
* Input functions
|
||||||
*/
|
*/
|
||||||
include("../functions/functions.input.php");
|
include("../functions/functions.input.php");
|
||||||
|
|
||||||
global $db;
|
global $db;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add shifts to the DB based on the shift_template table
|
* Add shifts to the DB based on the shift_template table
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
if (isset($_POST['year'])) $year = bigintval($_POST['year']); else $year = "YEAR(NOW())";
|
if (isset($_POST['year'])) $year = bigintval($_POST['year']); else $year = "YEAR(NOW())";
|
||||||
if (isset($_POST['woy'])) $woy = bigintval($_POST['woy']); else $woy = "WEEK(NOW(), 3)";
|
if (isset($_POST['woy'])) $woy = bigintval($_POST['woy']); else $woy = "WEEK(NOW(), 3)";
|
||||||
if (isset($_POST['qid'])) $questionnaire_id = bigintval($_POST['qid']); else $questionnaire_id = false;
|
if (isset($_POST['qid'])) $questionnaire_id = bigintval($_POST['qid']); else $questionnaire_id = false;
|
||||||
if (isset($_GET['year'])) $year = bigintval($_GET['year']);
|
if (isset($_GET['year'])) $year = bigintval($_GET['year']);
|
||||||
if (isset($_GET['woy'])) $woy = bigintval($_GET['woy']);
|
if (isset($_GET['woy'])) $woy = bigintval($_GET['woy']);
|
||||||
if (isset($_GET['questionnaire_id'])) $questionnaire_id = bigintval($_GET['questionnaire_id']);
|
if (isset($_GET['questionnaire_id'])) $questionnaire_id = bigintval($_GET['questionnaire_id']);
|
||||||
|
|
||||||
$y = $db->GetRow("SELECT $year as y");
|
$y = $db->GetRow("SELECT $year as y");
|
||||||
$year = $y['y'];
|
$year = $y['y'];
|
||||||
$y = $db->GetRow("SELECT $woy as y");
|
$y = $db->GetRow("SELECT $woy as y");
|
||||||
$woy = $y['y'];
|
$woy = $y['y'];
|
||||||
|
|
||||||
|
|
||||||
$operator_id = get_operator_id();
|
$operator_id = get_operator_id();
|
||||||
|
|
||||||
if (!$operator_id)
|
if (!$operator_id)
|
||||||
{
|
{
|
||||||
xhtml_head(T_("Add shifts"));
|
xhtml_head(T_("Add shifts"));
|
||||||
print "<p>" . T_("You must be an operator (as well as have administrator access) to add/edit shifts") . "</p>";
|
print "<p>" . T_("You must be an operator (as well as have administrator access) to add/edit shifts") . "</p>";
|
||||||
xhtml_foot();
|
xhtml_foot();
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (isset($_POST['submit']))
|
if (isset($_POST['submit']))
|
||||||
{
|
{
|
||||||
//process
|
//process
|
||||||
//update or delete existing shifts
|
//update or delete existing shifts
|
||||||
foreach($_POST as $key => $val)
|
foreach($_POST as $key => $val)
|
||||||
{
|
{
|
||||||
if (substr($key,0,5) == "start")
|
if (substr($key,0,5) == "start")
|
||||||
{
|
{
|
||||||
$num = bigintval(substr($key,6));
|
$num = bigintval(substr($key,6));
|
||||||
if (isset($_POST["use_$num"]))
|
if (isset($_POST["use_$num"]))
|
||||||
{
|
{
|
||||||
$sql = "UPDATE shift as s, operator as o
|
$sql = "UPDATE shift as s, operator as o
|
||||||
SET s.start = CONVERT_TZ(CONCAT(STR_TO_DATE(CONCAT($year, ' ',$woy,' ', {$_POST["dow_$num"]}),'%x %v %w'),' ','" . $_POST["start_$num"] . "'), o.Time_zone_name, 'UTC'),
|
SET s.start = CONVERT_TZ(CONCAT(STR_TO_DATE(CONCAT($year, ' ',$woy,' ', {$_POST["dow_$num"]}),'%x %v %w'),' ','" . $_POST["start_$num"] . "'), o.Time_zone_name, 'UTC'),
|
||||||
s.end = CONVERT_TZ(CONCAT(STR_TO_DATE(CONCAT($year, ' ',$woy,' ', {$_POST["dow_$num"]}),'%x %v %w'),' ','" . $_POST["end_$num"] . "'), o.Time_zone_name, 'UTC')
|
s.end = CONVERT_TZ(CONCAT(STR_TO_DATE(CONCAT($year, ' ',$woy,' ', {$_POST["dow_$num"]}),'%x %v %w'),' ','" . $_POST["end_$num"] . "'), o.Time_zone_name, 'UTC')
|
||||||
WHERE o.operator_id = '$operator_id'
|
WHERE o.operator_id = '$operator_id'
|
||||||
AND shift_id = '$num'";
|
AND shift_id = '$num'";
|
||||||
|
|
||||||
$db->Execute($sql);
|
$db->Execute($sql);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$sql = "DELETE FROM shift
|
$sql = "DELETE FROM shift
|
||||||
WHERE shift_id = '$num'";
|
WHERE shift_id = '$num'";
|
||||||
$db->Execute($sql);
|
$db->Execute($sql);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//insert new shifts
|
//insert new shifts
|
||||||
foreach($_POST as $key => $val)
|
foreach($_POST as $key => $val)
|
||||||
{
|
{
|
||||||
if (substr($key,0,7) == "NEW_use")
|
if (substr($key,0,7) == "NEW_use")
|
||||||
{
|
{
|
||||||
if ($val == "on")
|
if ($val == "on")
|
||||||
{
|
{
|
||||||
$num = bigintval(substr($key,8));
|
$num = bigintval(substr($key,8));
|
||||||
$sql = "INSERT INTO shift (shift_id,questionnaire_id,start,end)
|
$sql = "INSERT INTO shift (shift_id,questionnaire_id,start,end)
|
||||||
SELECT NULL,'$questionnaire_id', CONVERT_TZ(CONCAT(STR_TO_DATE(CONCAT($year, ' ',$woy,' ', {$_POST["NEW_dow_$num"]}),'%x %v %w'),' ','" . $_POST["NEW_start_$num"] . "'), Time_zone_name, 'UTC') , CONVERT_TZ(CONCAT(STR_TO_DATE(CONCAT($year, ' ',$woy,' ', {$_POST["NEW_dow_$num"]}),'%x %v %w'),' ','" . $_POST["NEW_end_$num"] . "'), Time_zone_name, 'UTC')
|
SELECT NULL,'$questionnaire_id', CONVERT_TZ(CONCAT(STR_TO_DATE(CONCAT($year, ' ',$woy,' ', {$_POST["NEW_dow_$num"]}),'%x %v %w'),' ','" . $_POST["NEW_start_$num"] . "'), Time_zone_name, 'UTC') , CONVERT_TZ(CONCAT(STR_TO_DATE(CONCAT($year, ' ',$woy,' ', {$_POST["NEW_dow_$num"]}),'%x %v %w'),' ','" . $_POST["NEW_end_$num"] . "'), Time_zone_name, 'UTC')
|
||||||
FROM operator
|
FROM operator
|
||||||
WHERE operator_id = '$operator_id'";
|
WHERE operator_id = '$operator_id'";
|
||||||
$db->Execute($sql);
|
$db->Execute($sql);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
xhtml_head(T_("Add shifts"),true,array("../css/shifts.css"),array("../js/window.js"));
|
xhtml_head(T_("Shift management"),true,array("../include/bootstrap-3.3.2/css/bootstrap.min.css","../include/clockpicker/dist/bootstrap-clockpicker.min.css","../include/bootstrap-toggle/css/bootstrap-toggle.min.css","../css/custom.css"),array("../js/jquery-2.1.3.min.js","../include/bootstrap-3.3.2/js/bootstrap.min.js","../include/clockpicker/dist/bootstrap-clockpicker.js","../include/bootstrap-toggle/js/bootstrap-toggle.min.js","../js/window.js"));
|
||||||
|
//"../css/shifts.css",
|
||||||
/**
|
/**
|
||||||
* Display warning if timezone data not installed
|
* Display warning if timezone data not installed
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$sql = "SELECT CONVERT_TZ(NOW(),'Australia/Victoria','UTC') as t";
|
$sql = "SELECT CONVERT_TZ(NOW(),'SYSTEM','UTC') as t";
|
||||||
$rs = $db->GetRow($sql);
|
$rs = $db->GetRow($sql);
|
||||||
|
|
||||||
if (empty($rs) || !$rs || empty($rs['t']))
|
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='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>";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* display years including current selected year
|
* display years including current selected year
|
||||||
* display weeks of year including current selected week of year
|
* display weeks of year including current selected week of year
|
||||||
* find if there are already shifts defined for this week of year / year and display them as selected, else show from template
|
* find if there are already shifts defined for this week of year / year and display them as selected, else show from template
|
||||||
* when submitted, add checked shifts, and delete unchecked shifts if they exist
|
* when submitted, add checked shifts, and delete unchecked shifts if they exist
|
||||||
*
|
*
|
||||||
* @todo Use javascript to add shifts if necessarry outside the template
|
* @todo Use javascript to add shifts if necessarry outside the template
|
||||||
*/
|
*/
|
||||||
|
|
||||||
print "<h2>" . T_("Add shifts in your Time Zone") . "</h2>";
|
print "<h3 class='col-sm-4'>" . T_("Add shifts in your Time Zone") . "</h3>";
|
||||||
|
|
||||||
|
|
||||||
print "<p>" . T_("Shifts allow you to restrict appointments being made, and interviewers to working on a particlar project at defined times.") . "</p>";
|
print "<p class='well col-sm-8'>" . T_("Shifts allow you to restrict appointments being made, and interviewers to working on a particlar project at defined times.") . "</p>";
|
||||||
|
|
||||||
print "<h3>" . T_("Select a questionnaire from the list below") . "</h3>";
|
print "<div class='clearfix form-group'><h3 class='col-sm-4 text-right'>" . T_("Select a questionnaire") . ":</h3>";
|
||||||
display_questionnaire_chooser($questionnaire_id);
|
display_questionnaire_chooser($questionnaire_id,false, "form-inline", "form-control");
|
||||||
|
print "</div><div class='panel-body'>";
|
||||||
if ($questionnaire_id != false)
|
|
||||||
{
|
if ($questionnaire_id != false)
|
||||||
print "<p>" . T_("Select year") . ": ";
|
{
|
||||||
for ($i = $year - 1; $i < $year + 4; $i++)
|
print "<h4>" . T_("Select year") . ":  ";
|
||||||
{
|
for ($i = $year - 1; $i < $year + 4; $i++)
|
||||||
if ($i == $year)
|
{
|
||||||
print "$i ";
|
if ($i == $year)
|
||||||
else
|
print "<span class='btn-lg btn btn-default'><b class='fa text-danger '>$i</b></span>";
|
||||||
print "<a href=\"?year=$i&woy=$woy&questionnaire_id=$questionnaire_id\">$i</a> ";
|
else
|
||||||
}
|
print "<a href=\"?year=$i&woy=$woy&questionnaire_id=$questionnaire_id\"> $i </a> ";
|
||||||
print "</p>";
|
}
|
||||||
|
print "</h4>";
|
||||||
|
|
||||||
print "<p>" . T_("Select week of year") . ": ";
|
|
||||||
for ($i = 1; $i <= 53; $i++)
|
print "<h4>" . T_("Select week") . ": ";
|
||||||
{
|
for ($i = 1; $i <= 53; $i++)
|
||||||
if ($i == $woy)
|
{
|
||||||
print "$i ";
|
if ($i == $woy)
|
||||||
else
|
print "<span class='btn-lg btn btn-default'><b class='fa text-danger '>$i</b></span>";
|
||||||
print "<a href=\"?woy=$i&year=$year&questionnaire_id=$questionnaire_id\">$i</a> ";
|
else
|
||||||
}
|
print "<a href=\"?woy=$i&year=$year&questionnaire_id=$questionnaire_id\"> $i </a> ";
|
||||||
print "</p>";
|
}
|
||||||
|
print "</h4>";
|
||||||
|
|
||||||
$sql = "SELECT shift_id, dt, dta,start,end
|
$sql = "SELECT shift_id, dt, dta,start,end
|
||||||
FROM (
|
FROM (
|
||||||
(
|
(
|
||||||
SELECT shift_id, DATE_FORMAT( CONVERT_TZ( s.start, 'UTC', o.Time_zone_name ) , '%W %d %m %Y' ) AS dt,
|
SELECT shift_id, DATE_FORMAT( CONVERT_TZ( s.start, 'UTC', o.Time_zone_name ) , '%W %d %m %Y' ) AS dt,
|
||||||
DATE( CONVERT_TZ( s.start, 'UTC', o.Time_zone_name ) ) AS dta,
|
DATE( CONVERT_TZ( s.start, 'UTC', o.Time_zone_name ) ) AS dta,
|
||||||
TIME( CONVERT_TZ( s.start, 'UTC', o.Time_zone_name ) ) AS start,
|
TIME( CONVERT_TZ( s.start, 'UTC', o.Time_zone_name ) ) AS start,
|
||||||
TIME( CONVERT_TZ( s.end, 'UTC', o.Time_zone_name ) ) AS end
|
TIME( CONVERT_TZ( s.end, 'UTC', o.Time_zone_name ) ) AS end
|
||||||
FROM shift AS s, operator AS o
|
FROM shift AS s, operator AS o
|
||||||
WHERE WEEK( CONVERT_TZ( s.start, 'UTC', o.Time_zone_name ) , 3 ) = '$woy'
|
WHERE WEEK( CONVERT_TZ( s.start, 'UTC', o.Time_zone_name ) , 3 ) = '$woy'
|
||||||
AND YEAR( CONVERT_TZ( s.start, 'UTC', o.Time_zone_name ) ) = '$year'
|
AND YEAR( CONVERT_TZ( s.start, 'UTC', o.Time_zone_name ) ) = '$year'
|
||||||
AND o.operator_id = '$operator_id'
|
AND o.operator_id = '$operator_id'
|
||||||
AND s.questionnaire_id = '$questionnaire_id'
|
AND s.questionnaire_id = '$questionnaire_id'
|
||||||
)
|
)
|
||||||
UNION (
|
UNION (
|
||||||
SELECT NULL AS shift_id,
|
SELECT NULL AS shift_id,
|
||||||
DATE_FORMAT( STR_TO_DATE( CONCAT( '$year', ' ', '$woy', ' ', day_of_week -1 ) , '%x %v %w' ) , '%W %d %m %Y' ) AS dt,
|
DATE_FORMAT( STR_TO_DATE( CONCAT( '$year', ' ', '$woy', ' ', day_of_week -1 ) , '%x %v %w' ) , '%W %d %m %Y' ) AS dt,
|
||||||
STR_TO_DATE( CONCAT( '$year', ' ', '$woy', ' ', day_of_week -1 ) , '%x %v %w' ) AS dta,
|
STR_TO_DATE( CONCAT( '$year', ' ', '$woy', ' ', day_of_week -1 ) , '%x %v %w' ) AS dta,
|
||||||
start,end
|
start,end
|
||||||
FROM shift_template
|
FROM shift_template
|
||||||
)
|
)
|
||||||
) AS sb
|
) AS sb
|
||||||
GROUP BY dta,start,end";
|
GROUP BY dta,start,end";
|
||||||
|
|
||||||
|
|
||||||
$shifts = $db->GetAll($sql);
|
$shifts = $db->GetAll($sql);
|
||||||
|
|
||||||
|
|
||||||
$sql = "SELECT DATE_FORMAT(STR_TO_DATE(CONCAT($year, ' ',$woy,' ',day_of_week - 1),'%x %v %w'), '%W %d %m %Y') as dt,
|
$sql = "SELECT DATE_FORMAT(STR_TO_DATE(CONCAT($year, ' ',$woy,' ',day_of_week - 1),'%x %v %w'), '%W %d %m %Y') as dt,
|
||||||
DATE_FORMAT(STR_TO_DATE(CONCAT($year, ' ',$woy,' ',day_of_week - 1),'%x %v %w'), '%W') as dtd,
|
DATE_FORMAT(STR_TO_DATE(CONCAT($year, ' ',$woy,' ',day_of_week - 1),'%x %v %w'), '%W') as dtd,
|
||||||
DATE_FORMAT(STR_TO_DATE(CONCAT($year, ' ',$woy,' ',day_of_week - 1),'%x %v %w'), '%d %m %Y') as dto,
|
DATE_FORMAT(STR_TO_DATE(CONCAT($year, ' ',$woy,' ',day_of_week - 1),'%x %v %w'), '%d %m %Y') as dto,
|
||||||
day_of_week - 1 as value
|
day_of_week - 1 as value
|
||||||
FROM day_of_week
|
FROM day_of_week
|
||||||
GROUP BY value";
|
GROUP BY value";
|
||||||
|
|
||||||
$daysofweek = $db->GetAll($sql);
|
$daysofweek = $db->GetAll($sql);
|
||||||
translate_array($daysofweek,array("dtd"));
|
translate_array($daysofweek,array("dtd"));
|
||||||
foreach($daysofweek as $key => $val)
|
foreach($daysofweek as $key => $val)
|
||||||
$daysofweek[$key]['description'] = $val['dtd'] . " " . $val['dto'];
|
$daysofweek[$key]['description'] = $val['dtd'] . " " . $val['dto'];
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<form method="post" action="">
|
<form method="post" action="" class="panel-body">
|
||||||
<table>
|
<table class="table-bordered table-condensed table-hover">
|
||||||
<?php
|
<?php
|
||||||
print "<tr><th>" . T_("Day") . "</th><th>" . T_("Start") . "</th><th>" . T_("End") . "</th><th>" . T_("Use shift?") . "</th></tr>";
|
print "<thead><tr><th>" . T_("Day") . "</th><th>" . T_("Start") . "</th> <th>" . T_("End") . "</th><th>" . T_("Use shift?") . "</th></tr></thead>";
|
||||||
$count = 1;
|
$count = 1;
|
||||||
foreach($shifts as $shift)
|
foreach($shifts as $shift)
|
||||||
{
|
{
|
||||||
$checked="";
|
$checked="";
|
||||||
$shift_id="";
|
$shift_id="";
|
||||||
$prefix="";
|
$prefix="";
|
||||||
if (!empty($shift['shift_id']))
|
if (!empty($shift['shift_id']))
|
||||||
{
|
{
|
||||||
$checked="checked=\"checked\""; $shift_id = $shift['shift_id'];
|
$checked="checked=\"checked\""; $shift_id = $shift['shift_id'];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$shift_id = $count;
|
$shift_id = $count;
|
||||||
$prefix = "NEW_";
|
$prefix = "NEW_";
|
||||||
}
|
}
|
||||||
print "<tr><td>";
|
print "<tr><td>";
|
||||||
display_chooser($daysofweek, $prefix . "dow_$shift_id", false, true, false, false, false, array("dt",$shift['dt']));
|
display_chooser($daysofweek, $prefix . "dow_$shift_id", false, true, false, false, false, array("dt",$shift['dt']));
|
||||||
print "</td><td><input size=\"8\" name=\"" . $prefix ."start_$shift_id\" maxlength=\"8\" type=\"text\" value=\"{$shift['start']}\"/></td><td><input name=\"" . $prefix ."end_$shift_id\" type=\"text\" size=\"8\" maxlength=\"8\" value=\"{$shift['end']}\"/></td><td><input name=\"" . $prefix ."use_$shift_id\" type=\"checkbox\" $checked/></td></tr>";
|
print "</td><td><div class=\"input-group clockpicker\"><input readonly size=\"8\" name=\"" . $prefix ."start_$shift_id\" maxlength=\"8\" type=\"time\" value=\"{$shift['start']}\" class=\"form-control \"/><span class=\"input-group-addon\"><span class=\"glyphicon glyphicon-time fa\"></span></span></div></td><td><div class=\"input-group clockpicker\"><input readonly name=\"" . $prefix ."end_$shift_id\" type=\"text\" size=\"8\" maxlength=\"8\" value=\"{$shift['end']}\" class=\"form-control\"/><span class=\"input-group-addon\"><span class=\"glyphicon glyphicon-time fa\"></span></span></div></td><td class=\"text-center\"><input name=\"" . $prefix ."use_$shift_id\" type=\"checkbox\" class=\"form-control fa\" data-toggle=\"toggle\" data-size=\"\" data-on=" . TQ_("Yes") . " data-off=" . TQ_("No") . " $checked/></td></tr>";
|
||||||
$count++;
|
$count++;
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<!--<tr><td/><td/><td/><td>Select all</td></tr>-->
|
<!--<tr><td/><td/><td/><td>Select all</td></tr>-->
|
||||||
</table>
|
</table></br>
|
||||||
<!--<p><input type="submit" name="addshift" value="Add Shift"/></p>-->
|
<!--<p><input type="submit" name="addshift" value="Add Shift"/></p>-->
|
||||||
<p><input type="submit" name="submit" value="<?php echo T_("Submit changes"); ?>"/></p>
|
<input type="submit" name="submit" value="<?php echo T_("Save changes"); ?>" class="btn btn-primary"/>
|
||||||
<p><input type="hidden" name="year" value="<?php echo $year; ?>"/></p>
|
<input type="hidden" name="year" value="<?php echo $year; ?>"/>
|
||||||
<p><input type="hidden" name="woy" value="<?php echo $woy; ?>"/></p>
|
<input type="hidden" name="woy" value="<?php echo $woy; ?>"/>
|
||||||
<p><input type="hidden" name="qid" value="<?php echo $questionnaire_id; ?>"/></p>
|
<input type="hidden" name="qid" value="<?php echo $questionnaire_id; ?>"/>
|
||||||
</form>
|
</form>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
print "</div>";
|
||||||
xhtml_foot();
|
xhtml_foot();
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$('.clockpicker').clockpicker({
|
||||||
|
autoclose: true
|
||||||
|
});
|
||||||
|
</script>
|
||||||
@@ -118,7 +118,7 @@ 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 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>";
|
print "<div><a class='btn btn-default' href='availabilitygroup.php'>" . T_("Go back") . "</a></div><br/>";
|
||||||
|
|
||||||
|
|
||||||
$sql = "SELECT description
|
$sql = "SELECT description
|
||||||
@@ -129,9 +129,8 @@ $rs = $db->GetRow($sql);
|
|||||||
|
|
||||||
$description = $rs['description'];
|
$description = $rs['description'];
|
||||||
|
|
||||||
print "<h3>" . T_("Time slot name") . " : <span class = 'text-primary'>" . $rs['description'] . "</span></h3>";
|
print "<h3>" . T_("Time slot") . " : <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
|
* Begin displaying currently loaded restriction times
|
||||||
*/
|
*/
|
||||||
@@ -151,9 +150,12 @@ translate_array($daysofweek,array("description"));
|
|||||||
|
|
||||||
?>
|
?>
|
||||||
<div class=" panel-body col-sm-4"><form method="post" action="">
|
<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>
|
<p><label class="control-label"for="description"><?php echo T_("Edit 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">
|
<table class="table-hover table-condensed "><thead class="highlight">
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
print "<div class='well text-info'>" . T_("Enter the start and end times for each day of the week to restrict calls within") . "</div>";
|
||||||
|
|
||||||
print "<tr><th>" . T_("Day") . "</th><th>" . T_("Start") . "</th><th>" . T_("End") . "</th></tr></thead><tbody>";
|
print "<tr><th>" . T_("Day") . "</th><th>" . T_("Start") . "</th><th>" . T_("End") . "</th></tr></thead><tbody>";
|
||||||
$count = 0;
|
$count = 0;
|
||||||
foreach($availabilitys as $availability)
|
foreach($availabilitys as $availability)
|
||||||
|
|||||||
@@ -1,160 +1,162 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Modify the call restriction times
|
* Modify the call restriction times
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* This file is part of queXS
|
* This file is part of queXS
|
||||||
*
|
*
|
||||||
* queXS is free software; you can redistribute it and/or modify
|
* queXS is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* queXS is distributed in the hope that it will be useful,
|
* queXS is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with queXS; if not, write to the Free Software
|
* along with queXS; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @author Adam Zammit <adam.zammit@deakin.edu.au>
|
* @author Adam Zammit <adam.zammit@deakin.edu.au>
|
||||||
* @copyright Deakin University 2007,2008
|
* @copyright Deakin University 2007,2008
|
||||||
* @package queXS
|
* @package queXS
|
||||||
* @subpackage admin
|
* @subpackage admin
|
||||||
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility
|
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility
|
||||||
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configuration file
|
* Configuration file
|
||||||
*/
|
*/
|
||||||
include ("../config.inc.php");
|
include ("../config.inc.php");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Database file
|
* Database file
|
||||||
*/
|
*/
|
||||||
include ("../db.inc.php");
|
include ("../db.inc.php");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* XHTML functions
|
* XHTML functions
|
||||||
*/
|
*/
|
||||||
include ("../functions/functions.xhtml.php");
|
include ("../functions/functions.xhtml.php");
|
||||||
|
|
||||||
$css = array(
|
$css = array(
|
||||||
"../include/bootstrap-3.3.2/css/bootstrap.min.css",
|
"../include/bootstrap-3.3.2/css/bootstrap.min.css",
|
||||||
//"../include/bootstrap-3.3.2/css/bootstrap-theme.min.css",
|
//"../include/bootstrap-3.3.2/css/bootstrap-theme.min.css",
|
||||||
"../include/clockpicker/dist/bootstrap-clockpicker.min.css",
|
"../include/clockpicker/dist/bootstrap-clockpicker.min.css",
|
||||||
"../css/custom.css"
|
"../css/custom.css"
|
||||||
);
|
);
|
||||||
$js_head = array(
|
$js_head = array(
|
||||||
"../js/jquery-2.1.3.min.js",
|
"../js/jquery-2.1.3.min.js",
|
||||||
"../include/bootstrap-3.3.2/js/bootstrap.min.js",
|
"../include/bootstrap-3.3.2/js/bootstrap.min.js",
|
||||||
"../js/addrow-v2.js",
|
"../js/addrow-v2.js",
|
||||||
);
|
);
|
||||||
$js_foot = array(
|
$js_foot = array(
|
||||||
"../include/clockpicker/dist/bootstrap-clockpicker.js",
|
"../include/clockpicker/dist/bootstrap-clockpicker.js",
|
||||||
"../js/custom.js"
|
"../js/custom.js"
|
||||||
);
|
);
|
||||||
|
|
||||||
global $db;
|
global $db;
|
||||||
|
|
||||||
$year="2008";
|
$year="2008";
|
||||||
$woy="1";
|
$woy="1";
|
||||||
|
|
||||||
|
|
||||||
if (isset($_POST['day']))
|
if (isset($_POST['day']))
|
||||||
{
|
{
|
||||||
$db->StartTrans();
|
$db->StartTrans();
|
||||||
|
|
||||||
$sql = "DELETE FROM call_restrict
|
$sql = "DELETE FROM call_restrict
|
||||||
WHERE 1";
|
WHERE 1";
|
||||||
|
|
||||||
$db->Execute($sql);
|
$db->Execute($sql);
|
||||||
|
|
||||||
foreach($_POST['day'] as $key => $val)
|
foreach($_POST['day'] as $key => $val)
|
||||||
{
|
{
|
||||||
if (!empty($val))
|
if (!empty($val))
|
||||||
{
|
{
|
||||||
$val = intval($val);
|
$val = intval($val);
|
||||||
$key = intval($key);
|
$key = intval($key);
|
||||||
|
|
||||||
$start = $db->qstr($_POST['start'][$key],get_magic_quotes_gpc());
|
$start = $db->qstr($_POST['start'][$key],get_magic_quotes_gpc());
|
||||||
$end = $db->qstr($_POST['end'][$key],get_magic_quotes_gpc());
|
$end = $db->qstr($_POST['end'][$key],get_magic_quotes_gpc());
|
||||||
|
|
||||||
$sql = "INSERT INTO call_restrict (day_of_week,start,end)
|
$sql = "INSERT INTO call_restrict (day_of_week,start,end)
|
||||||
VALUES ('$val',$start,$end)";
|
VALUES ('$val',$start,$end)";
|
||||||
|
|
||||||
$db->Execute($sql);
|
$db->Execute($sql);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$db->CompleteTrans();
|
$db->CompleteTrans();
|
||||||
}
|
}
|
||||||
|
|
||||||
xhtml_head(T_("Set call restriction times"),true,$css,$js_head);//,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
|
* 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(),'" . DEFAULT_TIME_ZONE . "','UTC') as t";//'Australia/Victoria'
|
||||||
$rs = $db->GetRow($sql);
|
$rs = $db->GetRow($sql);
|
||||||
|
|
||||||
if (empty($rs) || !$rs || empty($rs['t']))
|
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 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 class='well'>" . T_("Enter the start and end times for each day of the week to restrict calls within") . "</div>";
|
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
|
* 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
|
$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 call_restrict";
|
FROM call_restrict";
|
||||||
|
|
||||||
$shifts = $db->GetAll($sql);
|
$shifts = $db->GetAll($sql);
|
||||||
translate_array($shifts,array("dt"));
|
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";
|
FROM day_of_week";
|
||||||
|
|
||||||
$daysofweek = $db->GetAll($sql);
|
$daysofweek = $db->GetAll($sql);
|
||||||
translate_array($daysofweek,array("description"));
|
translate_array($daysofweek,array("description"));
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<div class=" panel-body col-sm-4"><form method="post" action="">
|
<div class=" panel-body col-sm-4"><form method="post" action="">
|
||||||
<table class="table-hover table-condensed " id="restrict"><thead class="highlight">
|
<table class="table-hover table-condensed " id="restrict"><thead class="highlight">
|
||||||
<?php
|
<?php
|
||||||
print "<tr><th>" . T_("Day") . "</th><th>" . T_("Start") . "</th><th>" . T_("End") . "</th></tr></thead><tbody>";
|
print "<tr><th>" . T_("Day") . "</th><th>" . T_("Start") . "</th><th>" . T_("End") . "</th></tr></thead><tbody>";
|
||||||
$count = 0;
|
$count = 0;
|
||||||
foreach($shifts as $shift)
|
foreach($shifts as $shift)
|
||||||
{
|
{
|
||||||
print "<tr id='row-$count' ><td>";//class='row_to_clone' /* these are not the rows to clone...*/
|
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']));
|
display_chooser($daysofweek, "day[$count]", false, true, false, false, false, array("description",$shift['dt']));
|
||||||
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>";
|
print "</td><td><div class=\"input-group clockpicker\"><input readonly class=\"form-control\" size=\"8\" name=\"start[$count]\" maxlength=\"8\" type=\"text\" value=\"{$shift['start']}\"/><span class=\"input-group-addon\"><span class=\"glyphicon glyphicon-time fa\"></span></span></div></td>
|
||||||
$count++;
|
<td><div class=\"input-group clockpicker\"><input readonly class=\"form-control\" name=\"end[$count]\" type=\"text\" size=\"8\" maxlength=\"8\" value=\"{$shift['end']}\"/><span class=\"input-group-addon\"><span class=\"glyphicon glyphicon-time fa\"></span></span></div></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 "<tr class='row_to_clone' id='row-$count'><td>";
|
||||||
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>";
|
display_chooser($daysofweek, "day[$count]", false, true, false, false, false, false);
|
||||||
|
print "</td><td><div class=\"input-group clockpicker\"><input readonly class=\"form-control\" size=\"8\" name=\"start[$count]\" maxlength=\"8\" type=\"text\" value=\"08:00:00\"/><span class=\"input-group-addon\"><span class=\"glyphicon glyphicon-time fa\"></span></span></div></td>
|
||||||
|
<td><div class=\"input-group clockpicker\"><input readonly class=\"form-control\" name=\"end[$count]\" type=\"text\" size=\"8\" maxlength=\"8\" value=\"20:00:00\"/><span class=\"input-group-addon\"><span class=\"glyphicon glyphicon-time fa\"></span></span></div></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-default " type="submit" name="submit" value="<?php echo T_("Save changes to restriction times"); ?>"/>
|
</tbody></table>
|
||||||
</form></div>
|
<a class="btn btn-default btn-sm" onclick="addRow(); return false;" href=""><?php echo T_("Add row"); ?></a><br/><br/>
|
||||||
<?php
|
<input class="btn btn-default " type="submit" name="submit" value="<?php echo T_("Save changes to restriction times"); ?>"/>
|
||||||
xhtml_foot($js_foot);
|
</form></div>
|
||||||
?>
|
<?php
|
||||||
<script type="text/javascript">
|
xhtml_foot($js_foot);
|
||||||
$('.clockpicker').clockpicker({
|
?>
|
||||||
autoclose: true
|
<script type="text/javascript">
|
||||||
});
|
$('.clockpicker').clockpicker({
|
||||||
|
autoclose: true
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
@@ -1,160 +1,159 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Modify the standard shift template
|
* Modify the standard shift template
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* This file is part of queXS
|
* This file is part of queXS
|
||||||
*
|
*
|
||||||
* queXS is free software; you can redistribute it and/or modify
|
* queXS is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* queXS is distributed in the hope that it will be useful,
|
* queXS is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with queXS; if not, write to the Free Software
|
* along with queXS; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @author Adam Zammit <adam.zammit@deakin.edu.au>
|
* @author Adam Zammit <adam.zammit@deakin.edu.au>
|
||||||
* @copyright Deakin University 2007,2008
|
* @copyright Deakin University 2007,2008
|
||||||
* @package queXS
|
* @package queXS
|
||||||
* @subpackage admin
|
* @subpackage admin
|
||||||
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility
|
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility
|
||||||
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configuration file
|
* Configuration file
|
||||||
*/
|
*/
|
||||||
include ("../config.inc.php");
|
include ("../config.inc.php");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Database file
|
* Database file
|
||||||
*/
|
*/
|
||||||
include ("../db.inc.php");
|
include ("../db.inc.php");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* XHTML functions
|
* XHTML functions
|
||||||
*/
|
*/
|
||||||
include ("../functions/functions.xhtml.php");
|
include ("../functions/functions.xhtml.php");
|
||||||
|
|
||||||
$css = array(
|
$css = array(
|
||||||
"../include/bootstrap-3.3.2/css/bootstrap.min.css",
|
"../include/bootstrap-3.3.2/css/bootstrap.min.css",
|
||||||
//"../include/bootstrap-3.3.2/css/bootstrap-theme.min.css",
|
//"../include/bootstrap-3.3.2/css/bootstrap-theme.min.css",
|
||||||
"../include/clockpicker/dist/bootstrap-clockpicker.min.css",
|
"../include/clockpicker/dist/bootstrap-clockpicker.min.css",
|
||||||
"../css/custom.css"
|
"../css/custom.css"
|
||||||
);
|
);
|
||||||
$js_head = array(
|
$js_head = array(
|
||||||
"../js/jquery-2.1.3.min.js",
|
"../js/jquery-2.1.3.min.js",
|
||||||
"../include/bootstrap-3.3.2/js/bootstrap.min.js",
|
"../include/bootstrap-3.3.2/js/bootstrap.min.js",
|
||||||
"../js/addrow-v2.js",
|
"../js/addrow-v2.js",
|
||||||
);
|
);
|
||||||
$js_foot = array(
|
$js_foot = array(
|
||||||
"../include/clockpicker/dist/bootstrap-clockpicker.js",
|
"../include/clockpicker/dist/bootstrap-clockpicker.js",
|
||||||
"../js/custom.js"
|
"../js/custom.js"
|
||||||
);
|
);
|
||||||
|
|
||||||
global $db;
|
global $db;
|
||||||
|
|
||||||
$year="2008";
|
$year="2008";
|
||||||
$woy="1";
|
$woy="1";
|
||||||
|
|
||||||
if (isset($_POST['day']))
|
if (isset($_POST['day']))
|
||||||
{
|
{
|
||||||
$db->StartTrans();
|
$db->StartTrans();
|
||||||
|
|
||||||
$sql = "DELETE FROM shift_template
|
$sql = "DELETE FROM shift_template
|
||||||
WHERE 1";
|
WHERE 1";
|
||||||
$db->Execute($sql);
|
$db->Execute($sql);
|
||||||
|
|
||||||
foreach($_POST['day'] as $key => $val)
|
foreach($_POST['day'] as $key => $val)
|
||||||
{
|
{
|
||||||
if (!empty($val))
|
if (!empty($val))
|
||||||
{
|
{
|
||||||
$val = intval($val);
|
$val = intval($val);
|
||||||
$key = intval($key);
|
$key = intval($key);
|
||||||
|
|
||||||
$start = $db->qstr($_POST['start'][$key],get_magic_quotes_gpc());
|
$start = $db->qstr($_POST['start'][$key],get_magic_quotes_gpc());
|
||||||
$end = $db->qstr($_POST['end'][$key],get_magic_quotes_gpc());
|
$end = $db->qstr($_POST['end'][$key],get_magic_quotes_gpc());
|
||||||
|
|
||||||
$sql = "INSERT INTO shift_template (day_of_week,start,end)
|
$sql = "INSERT INTO shift_template (day_of_week,start,end)
|
||||||
VALUES ('$val',$start,$end)";
|
VALUES ('$val',$start,$end)";
|
||||||
$db->Execute($sql);
|
$db->Execute($sql);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$db->CompleteTrans();
|
$db->CompleteTrans();
|
||||||
}
|
}
|
||||||
|
|
||||||
xhtml_head(T_("Set default shift times"),true,$css,$js_head);//T_("Modify shift template"),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")
|
||||||
|
|
||||||
$sql = "SELECT CONVERT_TZ(NOW(),'" . DEFAULT_TIME_ZONE . "','UTC') as t";//'Australia/Victoria'
|
$sql = "SELECT CONVERT_TZ(NOW(),'" . DEFAULT_TIME_ZONE . "','UTC') as t";//'Australia/Victoria'
|
||||||
|
|
||||||
$rs = $db->GetRow($sql);
|
$rs = $db->GetRow($sql);
|
||||||
|
|
||||||
if (empty($rs) || !$rs || empty($rs['t']))
|
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 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
|
* Display warning if timezone data not installed
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//print "<h1>" . T_("Set default shift times") . "</h1>";
|
//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>";
|
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
|
* 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";
|
FROM shift_template";
|
||||||
|
|
||||||
$shifts = $db->GetAll($sql);
|
$shifts = $db->GetAll($sql);
|
||||||
translate_array($shifts,array("dt"));
|
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";
|
FROM day_of_week";
|
||||||
|
|
||||||
$daysofweek = $db->GetAll($sql);
|
$daysofweek = $db->GetAll($sql);
|
||||||
translate_array($daysofweek,array("description"));
|
translate_array($daysofweek,array("description"));
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<div class="panel-body col-sm-4"><form method="post" action="" class="form-horizontal">
|
<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">
|
<table class="table-hover table-condensed " id="shifts"><thead class="text-center highlight">
|
||||||
<?php
|
<?php
|
||||||
print "<tr ><th >" . T_("Day") . "</th><th >" . T_("Start") . "</th><th >" . T_("End") . "</th></tr></thead><tbody>";
|
print "<tr ><th >" . T_("Day") . "</th><th >" . T_("Start") . "</th><th >" . T_("End") . "</th></tr></thead><tbody>";
|
||||||
$count = 0;
|
$count = 0;
|
||||||
foreach($shifts as $shift)
|
foreach($shifts as $shift)
|
||||||
{
|
{
|
||||||
print "<tr id='row-$count'><td>";// class='row_to_clone' /* these are not the rows to clone...*/
|
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']));
|
display_chooser($daysofweek, "day[$count]", false, true, false, false, false, array("description",$shift['dt']));
|
||||||
print "</td>
|
print "</td>
|
||||||
<td> <input class=\"form-control clockpicker\" size=\"8\" maxlength=\"8\" name=\"start[$count]\" type=\"text\" value=\"{$shift['start']}\"/></td>
|
<td><div class=\"input-group clockpicker\"><input readonly class=\"form-control\" size=\"8\" maxlength=\"8\" name=\"start[$count]\" type=\"text\" value=\"{$shift['start']}\"/><span class=\"input-group-addon\"><span class=\"glyphicon glyphicon-time fa\"></span></span></div></td>
|
||||||
<td> <input class=\"form-control clockpicker\" size=\"8\" maxlength=\"8\" name=\"end[$count]\" type=\"text\" value=\"{$shift['end']}\"/></td>
|
<td><div class=\"input-group clockpicker\"><input readonly class=\"form-control\" size=\"8\" maxlength=\"8\" name=\"end[$count]\" type=\"text\" value=\"{$shift['end']}\"/><span class=\"input-group-addon\"><span class=\"glyphicon glyphicon-time fa\"></span></span></div></td></tr>";
|
||||||
</tr>";
|
$count++;
|
||||||
$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);
|
||||||
display_chooser($daysofweek, "day[$count]", false, true, false, false, false, false);
|
print " </td><td><div class=\"input-group clockpicker\"><input readonly class=\"form-control\" size=\"8\" maxlength=\"8\" name=\"start[$count]\" type=\"text\" value=\"08:00:00\"/><span class=\"input-group-addon\"><span class=\"glyphicon glyphicon-time fa\"></span></span></div></td>
|
||||||
print " </td> <td><input class=\"form-control clockpicker\" size=\"8\" maxlength=\"8\" name=\"start[$count]\" type=\"text\" value=\"08:00:00\"/></td>
|
<td><div class=\"input-group clockpicker\"><input readonly class=\"form-control\" size=\"8\" maxlength=\"8\" name=\"end[$count]\" type=\"text\" value=\"20:00:00\"/><span class=\"input-group-addon\"><span class=\"glyphicon glyphicon-time fa\"></span></span></div></td></tr>";
|
||||||
<td><input class=\"form-control clockpicker\" size=\"8\" maxlength=\"8\" name=\"end[$count]\" type=\"text\" value=\"20:00:00\"/></td></tr>";
|
|
||||||
|
?>
|
||||||
?>
|
</tbody></table>
|
||||||
</tbody></table>
|
<a class="btn btn-default btn-sm" onclick="addRow(); return false;" href=""><?php echo T_("Add row"); ?></a><br/><br/>
|
||||||
<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"); ?>"/>
|
||||||
<input class="btn btn-default " type="submit" name="submit" value="<?php echo T_("Save changes to shifts"); ?>"/>
|
</form></div>
|
||||||
</form></div>
|
<?php
|
||||||
<?php
|
xhtml_foot($js_foot);
|
||||||
xhtml_foot($js_foot);
|
?>
|
||||||
?>
|
<script type="text/javascript">
|
||||||
<script type="text/javascript">
|
$('.clockpicker').clockpicker({
|
||||||
$('.clockpicker').clockpicker({
|
autoclose: true
|
||||||
autoclose: true
|
});
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
Reference in New Issue
Block a user