New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set Calendar time zone #1179
Set Calendar time zone #1179
Conversation
look at the demo files at full calendar. get-timezones.php, get-events.php and utils.php. |
library/globals.inc.php
Outdated
array( | ||
date_default_timezone_get() => xl('Default - php.ini value'), | ||
'Asia/Dubai' => xl('Dubai'), | ||
'Asia/Kolkata' => xl('Kolkata'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
xlt table entry here is "Calcutta" I suppose, but I guess you would not need that if you live in the time zone! Were these values added for a particular reason? Is there a time-zone gui widget you can grab somewhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These were sample values added just for testing code initially. Added all valid time zones in second commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I knew that! :)
Used iteration through |
In the third commit:
Note about |
Good idea. This stuff has been on todo lists for a while. One place for time stuff, and only one place. |
Testing it with the developer mode in the updater. works great. |
@teryhill Also, this PR was first intended to be used to set time zone for Calendar only but now it can be applied to whole of EHR. So, should I let global option for setting the time zone remain under Calendar sub-section or should I shift it to somewhere else (and if shifting, then where)? |
Move it to under the Systems tab |
Also look at moving your function from globals.inc.php to edit_globals.php. |
@teryhill The code creating |
@apooravc it is not causing errors. It is just "Cleaner" to have it outside of globals. |
library/patient_tracker.inc.php
Outdated
@@ -19,6 +19,7 @@ | |||
* | |||
*/ | |||
require_once(dirname(__FILE__) . '/appointments.inc.php'); | |||
require_once("../interface/globals.php"); | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the code in globals.php uses ini_set
to set the user selected time zone in Globals as time zone for the script in which globals.php is included. So, wherever date/time functions, this should be included in script containing such functions.
It is called in a program that includes this one. |
@teryhill You mean that globals.php is called in edit_globals? Yes, but edit_globals only lets a user save his/her global option which could be then accessed by |
The time zone information is in globals.php, correct. Globals php is a main program that is loaded with the main code . Look at main.php, it is loaded there, look at patient_tracker.php , it is loaded there. patient_tracker.inc is used by patient tracker. Globals is called by the "Top" programs. |
@teryhill I looked up |
Changes done in last two commits:
@teryhill Please have a look. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am thinking that this will work for whatever conditions are required. It currently works. The idea to default to php.ini settings would be informational, but very often may be incorrect for the user. The real issue is cross-timezone organizations.
This option is a user specific item also @aethelwulffe so if the user is in another time zone they can set there system for the different zone. Needs to have the / put back in so the locations are easier to determine. |
@teryhill Added back One more thing I noticed is that after moving global from Calendar to System tab, the time zone option list now only appears in Admin > Globals (Edit Global Settings) > System and not also in User Preferences (Edit User Settings). Back then it used to do in User Preferences (Edit User Settings) > Calendar. |
@teryhill Thought so, on it. |
@teryhill Added System tab to Edit User Settings. Please have a look. |
OK, please tell me that these changes are final, and we can merge this. :) |
@aethelwulffe These changes are final. |
This PR adds a global
calendar_timezone
which the user could use to select his/her time zone for Calendar date/time functions. date_default_timezone_get (used as default time zone for Calendar) gets the value ofdate.timezone
in php.ini file if it is valid/supported (valid time zones given here) otherwise defaults to UTC. The user selected time zone from Main globals or User specific globals (given more preference when different values) is set asdate.timezone
configuration option value using ini_set.date
function is used to fill entries indate
&start_datetime
columns in patient_tracker and patient_tracker_element tables respectively. @teryhill Yet to add other time zones (list here). Should I add all of which are given there? Or go for a particular set covering major regions in time zones?