Changed all other buttons that says "Submit" to "Save.
Also added some CSS stuff so that the "Save" button at the top of Preference page
have some space between itself and the form below.
Not only were frontend widgets showing UTC time,
the SQL query was also comparing UTC timestamp with local timestamps,
causing widgets to display shows in the wrong day, etc.
Another problem was that "On air today" widget was simply calling
GetNextShows which returns shows within next 48 hours.
Fixed by:
1. Under models/Show.php:
In the GetCurrentShow/GetNextShows/GetShowsByDayOfWeek functions,
added code to convert UTC timestamp to local timestamp or vice versa,
depending on which one is more suitable, in SQL queries, thus
removing inconsistency in timezones. Also, before returning query result,
added code to convert result to local timezone.
In GetNextShows, added an optional parameter endTime to limit the interval
of shows to get. This is useful for the "On air today" widget.
2. Under models/DateHelper.php:
Added a few timezone functions to help converting timezones easier in Show.php.
3. Under controller/ApiController.php:
Added todayInfoAction which is to be used by "On Air Today" widget.
Added StringLength validators for the UI fields. This way when user gave more than what
they should gave as the input, it's going to display an error msg.
The maximum length for the fields is queried from the database before the
fields were initialized.
1. If the preference is not user-specific, or if id is null, set subjid to null
2. Rewrote the code for the setValue logic, added comments. Should be easier
to read and understand
Added system preference in Preference page for user to select the start day of a week
(defaults to Sunday).
Calendar will utilize this information and update the calendar UI accordingly.
For week and day views under Calendar page, save the change to pref db table when
user updates the interval dropdown. Same thing goes for the "show XXX entries"
dropdown found under Playlist Builder page.
When visiting these pages, we retrieves the entry from database for current user
and use those values. Defaults to 30m for interval and 10 entries for "show xxx entries"
if values were never set.
Updated the calendar page so that when user chooses a different time scale to display(day/week/month),
the new setting is stored in the pref database. Each user id has its own entry in the database.
When visiting the calendar, we retrieves the entry from database for current user
and show that time scale; defaults to monthly view if no entry found.