diff --git a/admin/timezonetemplate.php b/admin/timezonetemplate.php index 963de5bd..7773c2f5 100644 --- a/admin/timezonetemplate.php +++ b/admin/timezonetemplate.php @@ -1,137 +1,137 @@ - - * @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"); - -/** - * Display functions - */ -include("../functions/functions.display.php"); - -/** - * Input functions - */ -include("../functions/functions.input.php"); - -global $db; - - -if (isset($_POST['dtime_zone'])) -{ - set_setting('DEFAULT_TIME_ZONE', $_POST['dtime_zone']); -} - -if (isset($_GET['time_zone'])) -{ - //need to add sample to questionnaire - - $tz = $db->qstr($_GET['time_zone'],get_magic_quotes_gpc()); - - $sql = "INSERT INTO timezone_template(Time_zone_name) - VALUES($tz)"; - - $db->Execute($sql); - -} - -if (isset($_GET['tz'])) -{ - //need to remove rsid from questionnaire - - $tz = $db->qstr($_GET['tz'],get_magic_quotes_gpc()); - - $sql = "DELETE FROM timezone_template - WHERE Time_zone_name = $tz"; - - $db->Execute($sql); -} - - -xhtml_head(T_("Add/Remove Timezones"),true,array("../css/shifts.css"),array("../js/window.js")); - -$dtz = get_setting("DEFAULT_TIME_ZONE"); - -$sql = "SELECT name as value, name as description, - CASE WHEN name LIKE '$dtz' THEN 'selected=\'selected\'' ELSE '' END AS selected - FROM mysql.time_zone_name"; - -$tzl = $db->GetAll($sql); - -if (empty($tzl) || !$tzl) -{ - print "
" . T_("Your database does not have timezones installed, please see here for details") . "
"; -} - -print "

" . T_("Set default timezone") . ":

"; - ?> -

- - "/>

-
- " . T_("Click to remove a Timezone from the default list") . ""; - -$sql = "SELECT Time_zone_name - FROM timezone_template"; - -$qs = $db->GetAll($sql); - -foreach($qs as $q) -{ - print "

{$q['Time_zone_name']}

"; -} - -print "

" . T_("Add a Timezone:") . "

"; - ?> -

- - "/>

-
- + + * @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"); + +/** + * Display functions + */ +include("../functions/functions.display.php"); + +/** + * Input functions + */ +include("../functions/functions.input.php"); + +global $db; + +if (isset($_POST['dtime_zone'])) +{ + set_setting('DEFAULT_TIME_ZONE', $_POST['dtime_zone']); + +} + +if (isset($_GET['time_zone'])) +{ + //need to add sample to questionnaire + + $tz = $db->qstr($_GET['time_zone'],get_magic_quotes_gpc()); + + $sql = "INSERT INTO timezone_template(Time_zone_name) + VALUES($tz)"; + + $db->Execute($sql); + +} + +if (isset($_GET['tz'])) +{ + //need to remove rsid from questionnaire + + $tz = $db->qstr($_GET['tz'],get_magic_quotes_gpc()); + + $sql = "DELETE FROM timezone_template + WHERE Time_zone_name = $tz"; + + $db->Execute($sql); +} + + +xhtml_head(T_("Set Timezones"),true,array("../include/bootstrap-3.3.2/css/bootstrap.min.css","../css/custom.css"),array("../js/window.js")); //,"../include/bootstrap-3.3.2/css/bootstrap-theme.min.css" + +$dtz = get_setting("DEFAULT_TIME_ZONE"); + +$sql = "SELECT name as value, name as description, + CASE WHEN name LIKE '$dtz' THEN 'selected=\'selected\'' ELSE '' END AS selected + FROM mysql.time_zone_name + WHERE `Name` LIKE 'Europe%' OR `Name` LIKE 'Asia%' "; + +$tzl = $db->GetAll($sql); + +if (empty($tzl) || !$tzl) +{ + print "
" . T_("Your database does not have timezones installed, please see here for details") . " ...
"; +} + +print "

" . T_("Default Timezone: ") . " $dtz

";//
+ ?> +
+   + "/> +
+ "; + +print "

" . T_("Timezone list") . "

"; + +$sql = "SELECT Time_zone_name, TIME_FORMAT(CONVERT_TZ(NOW(),@@session.time_zone,Time_zone_name),'". TIME_FORMAT ."') as time, CONCAT('

', TIME_FORMAT(TIMEDIFF( CONVERT_TZ(NOW(),'$dtz','$dtz'),CONVERT_TZ(NOW(), Time_zone_name,'$dtz')),' %H : %i'), '

') AS timediff, +CONCAT('" . T_("Remove") . "') as link + FROM timezone_template ORDER BY time ASC"; + +$qs = $db->GetAll($sql); + xhtml_table($qs, array("Time_zone_name","timediff","time","link"), array(T_("Timezone name"),T_("Time diff to Default Time zone"),T_("Current time"),T_("Remove"))); +print "
"; + +print "

" . T_("Add a Timezone:") . " 

"; + ?> +
+   + "/> +
+ "; + +xhtml_foot(); +?>