CC-5594 : Remove all date_default_timezone_get()

resizing must calculate from displayed calendar settings.
This commit is contained in:
Naomi 2013-12-04 15:48:32 -05:00
parent e71f306c7d
commit e508d141ed

View file

@ -180,9 +180,8 @@ SQL;
return _("Shows can have a max length of 24 hours."); return _("Shows can have a max length of 24 hours.");
} }
$utc = new DateTimeZone("UTC"); $utcTimezone = new DateTimeZone("UTC");
$nowDateTime = new DateTime("now", $utcTimezone);
$nowDateTime = new DateTime("now", $utc);
//keep track of cc_show_day entries we need to update //keep track of cc_show_day entries we need to update
$showDayIds = array(); $showDayIds = array();
@ -256,6 +255,7 @@ SQL;
//keep track of instance ids for update show instances start/end times //keep track of instance ids for update show instances start/end times
$instanceIds = array(); $instanceIds = array();
$displayTimezone = new DateTimeZone(Application_Model_Preference::GetUserTimezone());
//check if new show time overlaps with any other shows //check if new show time overlaps with any other shows
foreach ($showInstances as $si) { foreach ($showInstances as $si) {
@ -268,8 +268,8 @@ SQL;
of local time. * incase a show is moved across a time change of local time. * incase a show is moved across a time change
border offsets should be added to the local * timestamp and border offsets should be added to the local * timestamp and
then converted back to UTC to avoid show time changes */ then converted back to UTC to avoid show time changes */
$startsDateTime->setTimezone(new DateTimeZone(date_default_timezone_get())); $startsDateTime->setTimezone($displayTimezone);
$endsDateTime->setTimezone(new DateTimeZone(date_default_timezone_get())); $endsDateTime->setTimezone($displayTimezone);
//$newStartsDateTime = Application_Model_ShowInstance::addDeltas($startsDateTime, $deltaDay, $deltaMin); //$newStartsDateTime = Application_Model_ShowInstance::addDeltas($startsDateTime, $deltaDay, $deltaMin);
$newEndsDateTime = Application_Model_ShowInstance::addDeltas($endsDateTime, $deltaDay, $deltaMin); $newEndsDateTime = Application_Model_ShowInstance::addDeltas($endsDateTime, $deltaDay, $deltaMin);
@ -280,7 +280,7 @@ SQL;
//convert our new starts/ends to UTC. //convert our new starts/ends to UTC.
//$newStartsDateTime->setTimezone($utc); //$newStartsDateTime->setTimezone($utc);
$newEndsDateTime->setTimezone($utc); $newEndsDateTime->setTimezone($utcTimezone);
$overlapping = Application_Model_Schedule::checkOverlappingShows( $overlapping = Application_Model_Schedule::checkOverlappingShows(
$startsDateTime, $newEndsDateTime, true, $si->getDbId()); $startsDateTime, $newEndsDateTime, true, $si->getDbId());
@ -979,8 +979,8 @@ SQL;
$isFull = Application_Model_ShowInstance::getIsFull($p_start, $p_end); $isFull = Application_Model_ShowInstance::getIsFull($p_start, $p_end);
$displayTimezone = new DateTimeZone(Application_Model_Preference::GetUserTimezone()); $displayTimezone = new DateTimeZone(Application_Model_Preference::GetUserTimezone());
$utc = new DateTimeZone("UTC"); $utcTimezone = new DateTimeZone("UTC");
$now = new DateTime("now", $utc); $now = new DateTime("now", $utcTimezone);
foreach ($shows as &$show) { foreach ($shows as &$show) {
$options = array(); $options = array();
@ -991,13 +991,13 @@ SQL;
} }
if (isset($show["parent_starts"])) { if (isset($show["parent_starts"])) {
$parentStartsDT = new DateTime($show["parent_starts"], $utc); $parentStartsDT = new DateTime($show["parent_starts"], $utcTimezone);
} }
$startsDT = DateTime::createFromFormat("Y-m-d G:i:s", $startsDT = DateTime::createFromFormat("Y-m-d G:i:s",
$show["starts"],$utc); $show["starts"], $utcTimezone);
$endsDT = DateTime::createFromFormat("Y-m-d G:i:s", $endsDT = DateTime::createFromFormat("Y-m-d G:i:s",
$show["ends"], $utc); $show["ends"], $utcTimezone);
if( $p_editable ) { if( $p_editable ) {
if ($show["record"] && $now > $startsDT) { if ($show["record"] && $now > $startsDT) {