mirror of
https://github.com/ACSPRI/queXS
synced 2024-04-02 12:12:16 +00:00
New look,
Features: added diff time to default zone, current time in zone list (converted to usertimezone ) , timezone selector filtered by continent to have shorter options list
*to change continent filter edit row 99 (WHERE `Name` LIKE 'Europe%' OR `Name` LIKE 'Asia%')
- > substitute "Europe" &/or "Asia" with required continent names (as in timezones list)
to filter by single continent delete // OR `Name` LIKE 'Asia% //
to remove row, don't gorget to keep // "; // at thend of that querry
This commit is contained in:
@@ -1,137 +1,137 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Modify the default timezones
|
* Modify the default timezones
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* 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");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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;
|
||||||
|
|
||||||
|
if (isset($_POST['dtime_zone']))
|
||||||
if (isset($_POST['dtime_zone']))
|
{
|
||||||
{
|
set_setting('DEFAULT_TIME_ZONE', $_POST['dtime_zone']);
|
||||||
set_setting('DEFAULT_TIME_ZONE', $_POST['dtime_zone']);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_GET['time_zone']))
|
if (isset($_GET['time_zone']))
|
||||||
{
|
{
|
||||||
//need to add sample to questionnaire
|
//need to add sample to questionnaire
|
||||||
|
|
||||||
$tz = $db->qstr($_GET['time_zone'],get_magic_quotes_gpc());
|
$tz = $db->qstr($_GET['time_zone'],get_magic_quotes_gpc());
|
||||||
|
|
||||||
$sql = "INSERT INTO timezone_template(Time_zone_name)
|
$sql = "INSERT INTO timezone_template(Time_zone_name)
|
||||||
VALUES($tz)";
|
VALUES($tz)";
|
||||||
|
|
||||||
$db->Execute($sql);
|
$db->Execute($sql);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_GET['tz']))
|
if (isset($_GET['tz']))
|
||||||
{
|
{
|
||||||
//need to remove rsid from questionnaire
|
//need to remove rsid from questionnaire
|
||||||
|
|
||||||
$tz = $db->qstr($_GET['tz'],get_magic_quotes_gpc());
|
$tz = $db->qstr($_GET['tz'],get_magic_quotes_gpc());
|
||||||
|
|
||||||
$sql = "DELETE FROM timezone_template
|
$sql = "DELETE FROM timezone_template
|
||||||
WHERE Time_zone_name = $tz";
|
WHERE Time_zone_name = $tz";
|
||||||
|
|
||||||
$db->Execute($sql);
|
$db->Execute($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
xhtml_head(T_("Add/Remove Timezones"),true,array("../css/shifts.css"),array("../js/window.js"));
|
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");
|
$dtz = get_setting("DEFAULT_TIME_ZONE");
|
||||||
|
|
||||||
$sql = "SELECT name as value, name as description,
|
$sql = "SELECT name as value, name as description,
|
||||||
CASE WHEN name LIKE '$dtz' THEN 'selected=\'selected\'' ELSE '' END AS selected
|
CASE WHEN name LIKE '$dtz' THEN 'selected=\'selected\'' ELSE '' END AS selected
|
||||||
FROM mysql.time_zone_name";
|
FROM mysql.time_zone_name
|
||||||
|
WHERE `Name` LIKE 'Europe%' OR `Name` LIKE 'Asia%' ";
|
||||||
$tzl = $db->GetAll($sql);
|
|
||||||
|
$tzl = $db->GetAll($sql);
|
||||||
if (empty($tzl) || !$tzl)
|
|
||||||
{
|
if (empty($tzl) || !$tzl)
|
||||||
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'>" . T_("Your database does not have timezones installed, please see here for details") . "<a href='http://dev.mysql.com/doc/mysql/en/time-zone-support.html'> ... </a></div>";
|
||||||
|
}
|
||||||
print "<h1>" . T_("Set default timezone") . ": </h1>";
|
|
||||||
?>
|
print "<div class='col-sm-4 '><h3 class=''>" . T_("Default Timezone: ") . " <b class='text-primary'>$dtz</b></h3>";//<div class='panel-body'>
|
||||||
<form action="" method="post"><p>
|
?>
|
||||||
<label for="dtime_zone"><?php echo T_("Default Timezone: "); ?></label><?php display_chooser($tzl, 'dtime_zone', 'dtime_zone', false, false, false, false, false); ?>
|
<form action="" method="post" class="form-horizontal">
|
||||||
<input type="submit" name="set_dtimezone" value="<?php echo T_("Set default timezone"); ?>"/></p>
|
<?php display_chooser($tzl, 'dtime_zone', 'dtime_zone',false,false,false,true,false,true,"form-inline pull-left"); ?> 
|
||||||
</form>
|
<input type="submit" class='btn btn-default fa' name="set_dtimezone" value="<?php echo T_("Set default timezone"); ?>"/>
|
||||||
<?php
|
</form>
|
||||||
|
<?php
|
||||||
print "<h1>" . T_("Click to remove a Timezone from the default list") . "</h1>";
|
print "</div>";
|
||||||
|
|
||||||
$sql = "SELECT Time_zone_name
|
print "<div class='col-sm-5'><h3>" . T_("Timezone list") . "</h3>";
|
||||||
FROM timezone_template";
|
|
||||||
|
$sql = "SELECT Time_zone_name, TIME_FORMAT(CONVERT_TZ(NOW(),@@session.time_zone,Time_zone_name),'". TIME_FORMAT ."') as time, CONCAT('<p class=\'text-center\' style=\'margin-bottom: 3px;\'><b class=\'label label-default\' style=\'font-size:85%;\'>', TIME_FORMAT(TIMEDIFF( CONVERT_TZ(NOW(),'$dtz','$dtz'),CONVERT_TZ(NOW(), Time_zone_name,'$dtz')),' %H : %i'), '</b></p>') AS timediff,
|
||||||
$qs = $db->GetAll($sql);
|
CONCAT('<a href=\"?tz=', Time_zone_name ,'\" title=\"" . T_("Remove Timezone") . "\"><i class=\"fa fa-trash fa-lg text-danger\">" . T_("Remove") . "</i></a>') as link
|
||||||
|
FROM timezone_template ORDER BY time ASC";
|
||||||
foreach($qs as $q)
|
|
||||||
{
|
$qs = $db->GetAll($sql);
|
||||||
print "<p><a href=\"?tz={$q['Time_zone_name']}\">{$q['Time_zone_name']} </a></p>";
|
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 "</div>";
|
||||||
|
|
||||||
print "<h1>" . T_("Add a Timezone:") . "</h1>";
|
print "<div class='col-sm-3'><h3 class=''>" . T_("Add a Timezone:") . " </h3>";
|
||||||
?>
|
?>
|
||||||
<form action="" method="get"><p>
|
<form action="" method="get" class="form-horizontal">
|
||||||
<label for="time_zone"><?php echo T_("Timezone: "); ?></label><?php display_chooser($tzl, 'time_zone', 'time_zone', false, false, false, false, false); ?>
|
<?php display_chooser($tzl, 'time_zone', 'time_zone',false,false,false,true,false,true,"form-inline pull-left"); ?> 
|
||||||
<input type="submit" name="add_timezone" value="<?php echo T_("Add Timezone"); ?>"/></p>
|
<input type="submit" class='btn btn-default fa' name="add_timezone" value="<?php echo T_("Add Timezone"); ?>"/>
|
||||||
</form>
|
</form>
|
||||||
<?php
|
<?php
|
||||||
xhtml_foot();
|
print "</div>";
|
||||||
|
|
||||||
|
xhtml_foot();
|
||||||
?>
|
?>
|
||||||
|
|||||||
Reference in New Issue
Block a user