* @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"); /** * Authentication file */ require ("auth-admin.php"); /** * XHTML functions */ include ("../functions/functions.xhtml.php"); $css = array( "../include/bootstrap/css/bootstrap.min.css", //"../include/bootstrap/css/bootstrap-theme.min.css", "../include/clockpicker/dist/bootstrap-clockpicker.min.css", "../css/custom.css" ); $js_head = array( "../include/jquery/jquery.min.js", "../include/bootstrap/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(),'" . get_setting("DEFAULT_TIME_ZONE") . "','UTC') as t";//'Australia/Victoria' $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 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 "


"/>