From a4e32c4d666462edfb8fbd4afe168cd6eb7860ab Mon Sep 17 00:00:00 2001 From: Alex Date: Mon, 23 Mar 2015 16:59:35 +0300 Subject: [PATCH] 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) --- admin/addshift.php | 551 ++++++++++++++++++++-------------------- admin/availability.php | 10 +- admin/callrestrict.php | 320 +++++++++++------------ admin/shifttemplate.php | 317 ++++++++++++----------- 4 files changed, 603 insertions(+), 595 deletions(-) diff --git a/admin/addshift.php b/admin/addshift.php index 6b1d3060..ab838dd8 100644 --- a/admin/addshift.php +++ b/admin/addshift.php @@ -1,273 +1,278 @@ - - * @copyright Deakin University 2007,2008 - * @package queXS - * @subpackage admin - * @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 - * - */ - -/** - * Configuration file - */ -include ("../config.inc.php"); - -/** - * Database file - */ -include ("../db.inc.php"); - -/** - * XHTML functions - */ -include ("../functions/functions.xhtml.php"); - -/** - * Operator functions - */ -include ("../functions/functions.operator.php"); - -/** - * Display functions - */ -include ("../functions/functions.display.php"); - -/** - * Input functions - */ -include("../functions/functions.input.php"); - -global $db; - - -/** - * 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['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($_GET['year'])) $year = bigintval($_GET['year']); -if (isset($_GET['woy'])) $woy = bigintval($_GET['woy']); -if (isset($_GET['questionnaire_id'])) $questionnaire_id = bigintval($_GET['questionnaire_id']); - -$y = $db->GetRow("SELECT $year as y"); -$year = $y['y']; -$y = $db->GetRow("SELECT $woy as y"); -$woy = $y['y']; - - -$operator_id = get_operator_id(); - -if (!$operator_id) -{ - xhtml_head(T_("Add shifts")); - print "

" . T_("You must be an operator (as well as have administrator access) to add/edit shifts") . "

"; - xhtml_foot(); - exit(); -} - - -if (isset($_POST['submit'])) -{ - //process - //update or delete existing shifts - foreach($_POST as $key => $val) - { - if (substr($key,0,5) == "start") - { - $num = bigintval(substr($key,6)); - if (isset($_POST["use_$num"])) - { - $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'), - 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' - AND shift_id = '$num'"; - - $db->Execute($sql); - } - else - { - $sql = "DELETE FROM shift - WHERE shift_id = '$num'"; - $db->Execute($sql); - } - } - } - //insert new shifts - foreach($_POST as $key => $val) - { - if (substr($key,0,7) == "NEW_use") - { - if ($val == "on") - { - $num = bigintval(substr($key,8)); - $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') - FROM operator - WHERE operator_id = '$operator_id'"; - $db->Execute($sql); - } - } - } -} - - -xhtml_head(T_("Add shifts"),true,array("../css/shifts.css"),array("../js/window.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 "
" . T_("Your database does not have timezones installed, please see here for details") . "
"; - - -/** - * display years including current selected 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 - * when submitted, add checked shifts, and delete unchecked shifts if they exist - * - * @todo Use javascript to add shifts if necessarry outside the template - */ - -print "

" . T_("Add shifts in your Time Zone") . "

"; - - -print "

" . T_("Shifts allow you to restrict appointments being made, and interviewers to working on a particlar project at defined times.") . "

"; - -print "

" . T_("Select a questionnaire from the list below") . "

"; -display_questionnaire_chooser($questionnaire_id); - -if ($questionnaire_id != false) -{ - print "

" . T_("Select year") . ": "; - for ($i = $year - 1; $i < $year + 4; $i++) - { - if ($i == $year) - print "$i "; - else - print "$i "; - } - print "

"; - - - print "

" . T_("Select week of year") . ": "; - for ($i = 1; $i <= 53; $i++) - { - if ($i == $woy) - print "$i "; - else - print "$i "; - } - print "

"; - - - $sql = "SELECT shift_id, dt, dta,start,end - FROM ( - ( - 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, - TIME( CONVERT_TZ( s.start, 'UTC', o.Time_zone_name ) ) AS start, - TIME( CONVERT_TZ( s.end, 'UTC', o.Time_zone_name ) ) AS end - FROM shift AS s, operator AS o - 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 o.operator_id = '$operator_id' - AND s.questionnaire_id = '$questionnaire_id' - ) - UNION ( - 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, - STR_TO_DATE( CONCAT( '$year', ' ', '$woy', ' ', day_of_week -1 ) , '%x %v %w' ) AS dta, - start,end - FROM shift_template - ) - ) AS sb - GROUP BY dta,start,end"; - - - $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, - 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, - day_of_week - 1 as value - FROM day_of_week - GROUP BY value"; - - $daysofweek = $db->GetAll($sql); - translate_array($daysofweek,array("dtd")); - foreach($daysofweek as $key => $val) - $daysofweek[$key]['description'] = $val['dtd'] . " " . $val['dto']; - - ?> -
- - "; - $count = 1; - foreach($shifts as $shift) - { - $checked=""; - $shift_id=""; - $prefix=""; - if (!empty($shift['shift_id'])) - { - $checked="checked=\"checked\""; $shift_id = $shift['shift_id']; - } - else - { - $shift_id = $count; - $prefix = "NEW_"; - } - print ""; - $count++; - } - ?> - -
" . T_("Day") . "" . T_("Start") . "" . T_("End") . "" . T_("Use shift?") . "
"; - display_chooser($daysofweek, $prefix . "dow_$shift_id", false, true, false, false, false, array("dt",$shift['dt'])); - print "
- -

"/>

-

-

-

-
- + + * @copyright Deakin University 2007,2008 + * @package queXS + * @subpackage admin + * @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 + * + */ + +/** + * Configuration file + */ +include ("../config.inc.php"); + +/** + * Database file + */ +include ("../db.inc.php"); + +/** + * XHTML functions + */ +include ("../functions/functions.xhtml.php"); + +/** + * Operator functions + */ +include ("../functions/functions.operator.php"); + +/** + * Display functions + */ +include ("../functions/functions.display.php"); + +/** + * Input functions + */ +include("../functions/functions.input.php"); + +global $db; + + +/** + * 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['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($_GET['year'])) $year = bigintval($_GET['year']); +if (isset($_GET['woy'])) $woy = bigintval($_GET['woy']); +if (isset($_GET['questionnaire_id'])) $questionnaire_id = bigintval($_GET['questionnaire_id']); + +$y = $db->GetRow("SELECT $year as y"); +$year = $y['y']; +$y = $db->GetRow("SELECT $woy as y"); +$woy = $y['y']; + + +$operator_id = get_operator_id(); + +if (!$operator_id) +{ + xhtml_head(T_("Add shifts")); + print "

" . T_("You must be an operator (as well as have administrator access) to add/edit shifts") . "

"; + xhtml_foot(); + exit(); +} + + +if (isset($_POST['submit'])) +{ + //process + //update or delete existing shifts + foreach($_POST as $key => $val) + { + if (substr($key,0,5) == "start") + { + $num = bigintval(substr($key,6)); + if (isset($_POST["use_$num"])) + { + $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'), + 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' + AND shift_id = '$num'"; + + $db->Execute($sql); + } + else + { + $sql = "DELETE FROM shift + WHERE shift_id = '$num'"; + $db->Execute($sql); + } + } + } + //insert new shifts + foreach($_POST as $key => $val) + { + if (substr($key,0,7) == "NEW_use") + { + if ($val == "on") + { + $num = bigintval(substr($key,8)); + $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') + FROM operator + WHERE operator_id = '$operator_id'"; + $db->Execute($sql); + } + } + } +} + + +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 + * + */ + +$sql = "SELECT CONVERT_TZ(NOW(),'SYSTEM','UTC') as t"; +$rs = $db->GetRow($sql); + +if (empty($rs) || !$rs || empty($rs['t'])) + print "
" . T_("Your database does not have timezones installed, please see here for details") . "
"; + + +/** + * display years including current selected 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 + * when submitted, add checked shifts, and delete unchecked shifts if they exist + * + * @todo Use javascript to add shifts if necessarry outside the template + */ + +print "

" . T_("Add shifts in your Time Zone") . "

"; + + +print "

" . T_("Shifts allow you to restrict appointments being made, and interviewers to working on a particlar project at defined times.") . "

"; + +print "

" . T_("Select a questionnaire") . ":

"; +display_questionnaire_chooser($questionnaire_id,false, "form-inline", "form-control"); +print "
"; + +if ($questionnaire_id != false) +{ + print "

" . T_("Select year") . ":  "; + for ($i = $year - 1; $i < $year + 4; $i++) + { + if ($i == $year) + print "$i"; + else + print " $i "; + } + print "

"; + + + print "

" . T_("Select week") . ": "; + for ($i = 1; $i <= 53; $i++) + { + if ($i == $woy) + print "$i"; + else + print " $i "; + } + print "

"; + + $sql = "SELECT shift_id, dt, dta,start,end + FROM ( + ( + 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, + TIME( CONVERT_TZ( s.start, 'UTC', o.Time_zone_name ) ) AS start, + TIME( CONVERT_TZ( s.end, 'UTC', o.Time_zone_name ) ) AS end + FROM shift AS s, operator AS o + 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 o.operator_id = '$operator_id' + AND s.questionnaire_id = '$questionnaire_id' + ) + UNION ( + 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, + STR_TO_DATE( CONCAT( '$year', ' ', '$woy', ' ', day_of_week -1 ) , '%x %v %w' ) AS dta, + start,end + FROM shift_template + ) + ) AS sb + GROUP BY dta,start,end"; + + + $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, + 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, + day_of_week - 1 as value + FROM day_of_week + GROUP BY value"; + + $daysofweek = $db->GetAll($sql); + translate_array($daysofweek,array("dtd")); + foreach($daysofweek as $key => $val) + $daysofweek[$key]['description'] = $val['dtd'] . " " . $val['dto']; + + ?> +
+ +  "; + $count = 1; + foreach($shifts as $shift) + { + $checked=""; + $shift_id=""; + $prefix=""; + if (!empty($shift['shift_id'])) + { + $checked="checked=\"checked\""; $shift_id = $shift['shift_id']; + } + else + { + $shift_id = $count; + $prefix = "NEW_"; + } + print ""; + $count++; + } + ?> + +
" . T_("Day") . "" . T_("Start") . "" . T_("End") . "" . T_("Use shift?") . "
"; + display_chooser($daysofweek, $prefix . "dow_$shift_id", false, true, false, false, false, array("dt",$shift['dt'])); + print "

+ + " class="btn btn-primary"/> + + + +
+ "; +xhtml_foot(); + +?> + \ No newline at end of file diff --git a/admin/availability.php b/admin/availability.php index 6d48dd3f..91bbb460 100644 --- a/admin/availability.php +++ b/admin/availability.php @@ -118,7 +118,7 @@ if (empty($rs) || !$rs || empty($rs['t'])) print ""; -print "
" . T_("Go back") . "
"; +print "
" . T_("Go back") . "

"; $sql = "SELECT description @@ -129,9 +129,8 @@ $rs = $db->GetRow($sql); $description = $rs['description']; -print "

" . T_("Time slot name") . " : " . $rs['description'] . "

"; +print "

" . T_("Time slot") . " : " . $rs['description'] . "

"; -print "
" . T_("Enter the start and end times for each day of the week to restrict calls within") . "
"; /** * Begin displaying currently loaded restriction times */ @@ -151,9 +150,12 @@ translate_array($daysofweek,array("description")); ?>
-

+

" . T_("Enter the start and end times for each day of the week to restrict calls within") . ""; + print ""; $count = 0; foreach($availabilitys as $availability) diff --git a/admin/callrestrict.php b/admin/callrestrict.php index 634a9f42..c06c0e46 100644 --- a/admin/callrestrict.php +++ b/admin/callrestrict.php @@ -1,160 +1,162 @@ - - * @copyright Deakin University 2007,2008 - * @package queXS - * @subpackage admin - * @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 - * - */ - -/** - * 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($_POST['day'])) -{ - $db->StartTrans(); - - $sql = "DELETE FROM call_restrict - WHERE 1"; - - $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 call_restrict (day_of_week,start,end) - VALUES ('$val',$start,$end)"; - - $db->Execute($sql); - } - } - - $db->CompleteTrans(); -} - -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(),'" . DEFAULT_TIME_ZONE . "','UTC') as t";//'Australia/Victoria' -$rs = $db->GetRow($sql); - -if (empty($rs) || !$rs || empty($rs['t'])) - print ""; - - -print "
" . T_("Enter the start and end times for each day of the week to restrict calls within") . "
"; - -/** - * 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 call_restrict"; - -$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 - FROM day_of_week"; - -$daysofweek = $db->GetAll($sql); -translate_array($daysofweek,array("description")); - -?> -
-
" . T_("Day") . "" . T_("Start") . "" . T_("End") . "
-"; - $count = 0; - foreach($shifts as $shift) - { - print ""; - $count++; - } - print ""; - - -?> -
" . T_("Day") . "" . T_("Start") . "" . T_("End") . "
";//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 "
"; - display_chooser($daysofweek, "day[$count]", false, true, false, false, false, false); - print "
-

- "/> -
- - \ No newline at end of file diff --git a/admin/shifttemplate.php b/admin/shifttemplate.php index 64e8d6d3..468cd543 100644 --- a/admin/shifttemplate.php +++ b/admin/shifttemplate.php @@ -1,160 +1,159 @@ - - * @copyright Deakin University 2007,2008 - * @package queXS - * @subpackage admin - * @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 - * - */ - -/** - * 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($_POST['day'])) -{ - $db->StartTrans(); - - $sql = "DELETE FROM shift_template - WHERE 1"; - $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 shift_template (day_of_week,start,end) - VALUES ('$val',$start,$end)"; - $db->Execute($sql); - } - } - $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") - -$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 ""; - -/** - * Display warning if timezone data not installed - - */ - -//print "

" . T_("Set default shift times") . "

"; -print "
" . T_("Enter standard shift start and end times for each day of the week in local time") . "
"; - -/** - * 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 - 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 - FROM day_of_week"; - -$daysofweek = $db->GetAll($sql); -translate_array($daysofweek,array("description")); - -?> -
- -"; - $count = 0; - foreach($shifts as $shift) - { - print " - - - "; - $count++; - } - print " - "; - -?> -
" . T_("Day") . "" . T_("Start") . "" . T_("End") . "
";// 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 "
"; - display_chooser($daysofweek, "day[$count]", false, true, false, false, false, false); - print "
-

- "/> -
- - \ No newline at end of file