CC-5323: User's Timezone Can Improperly Edit Show

This commit is contained in:
denise 2013-09-24 15:04:25 -04:00
parent 2ab5e6b26a
commit 107263ae20
7 changed files with 99 additions and 5 deletions

View file

@ -150,6 +150,7 @@ class Application_Service_ShowFormService
'add_show_end_date_no_repeat' => $showEnd->format("Y-m-d"),
'add_show_end_time' => $showEnd->format("H:i"),
'add_show_duration' => $ccShowDay->formatDuration(true),
'add_show_timezone' => $ccShowDay->getDbTimezone(),
'add_show_repeats' => $ccShowDay->isRepeating() ? 1 : 0));
return $showStart;
@ -159,7 +160,10 @@ class Application_Service_ShowFormService
{
$ccShowInstance = CcShowInstancesQuery::create()->findPk($this->instanceId);
$timezone = new DateTimeZone(Application_Model_Preference::GetTimezone());
//get timezone the show is created in
$timezone = $ccShowInstance->getCcShow()->getFirstCcShowDay()->getDbTimezone();
//$timezone = new DateTimeZone(Application_Model_Preference::GetDefaultTimezone());
//DateTime object in UTC
$showStart = $ccShowInstance->getDbStarts(null);
$showStart->setTimezone($timezone);
@ -180,6 +184,7 @@ class Application_Service_ShowFormService
'add_show_end_time' => $showEnd->format("H:i"),
'add_show_duration' => $this->calculateDuration(
$showStart->format("Y-m-d H:i:s"), $showEnd->format("Y-m-d H:i:s")),
'add_show_timezone' => $timezone,
'add_show_repeats' => 0));
$form->getElement('add_show_repeats')->setOptions(array("disabled" => true));
@ -482,4 +487,24 @@ class Application_Service_ShowFormService
return "Invalid Date";
}
}
/**
*
* Enter description here ...
* @param $date String
* @param $time String
* @param $timezone String
*/
public function localizeDateTime($date, $time, $timezone)
{
$dt = new DateTime($date." ".$time, new DateTimeZone(
$this->ccShow->getFirstCcShowDay()->getDbTimezone()));
$dt->setTimeZone(new DateTimeZone($timezone));
return array(
"date" => $dt->format("Y-m-d"),
"time" => $dt->format("h:i")
);
}
}