CC-5594 : Remove all date_default_timezone_get()
removing now unused old methods
This commit is contained in:
parent
c9773d2a0e
commit
e6808b0c12
3 changed files with 1 additions and 236 deletions
|
@ -239,91 +239,6 @@ SQL;
|
|||
return $newDateTime;
|
||||
}
|
||||
|
||||
public function moveShow($deltaDay, $deltaMin)
|
||||
{
|
||||
if ($this->getShow()->isRepeating()) {
|
||||
return _("Can't drag and drop repeating shows");
|
||||
}
|
||||
|
||||
$today_timestamp = time();
|
||||
$startsDateTime = new DateTime($this->getShowInstanceStart(), new DateTimeZone("UTC"));
|
||||
$endsDateTime = new DateTime($this->getShowInstanceEnd(), new DateTimeZone("UTC"));
|
||||
|
||||
if ($today_timestamp > $startsDateTime->getTimestamp()) {
|
||||
return _("Can't move a past show");
|
||||
}
|
||||
|
||||
//the user is moving the show on the calendar from the perspective of local time.
|
||||
//incase a show is moved across a time change border offsets should be added to the localtime
|
||||
//stamp and then converted back to UTC to avoid show time changes!
|
||||
$startsDateTime->setTimezone(new DateTimeZone(date_default_timezone_get()));
|
||||
$endsDateTime->setTimezone(new DateTimeZone(date_default_timezone_get()));
|
||||
|
||||
$newStartsDateTime = self::addDeltas($startsDateTime, $deltaDay, $deltaMin);
|
||||
$newEndsDateTime = self::addDeltas($endsDateTime, $deltaDay, $deltaMin);
|
||||
|
||||
//convert our new starts/ends to UTC.
|
||||
$newStartsDateTime->setTimezone(new DateTimeZone("UTC"));
|
||||
$newEndsDateTime->setTimezone(new DateTimeZone("UTC"));
|
||||
|
||||
if ($today_timestamp > $newStartsDateTime->getTimestamp()) {
|
||||
return _("Can't move show into past");
|
||||
}
|
||||
|
||||
//check if show is overlapping
|
||||
$overlapping = Application_Model_Schedule::checkOverlappingShows($newStartsDateTime, $newEndsDateTime, true, $this->getShowInstanceId());
|
||||
if ($overlapping) {
|
||||
return _("Cannot schedule overlapping shows");
|
||||
}
|
||||
|
||||
if ($this->isRecorded()) {
|
||||
|
||||
//rebroadcasts should start at max 1 hour after a recorded show has ended.
|
||||
$minRebroadcastStart = self::addDeltas($newEndsDateTime, 0, 60);
|
||||
//check if we are moving a recorded show less than 1 hour before any of its own rebroadcasts.
|
||||
$rebroadcasts = CcShowInstancesQuery::create()
|
||||
->filterByDbOriginalShow($this->_instanceId)
|
||||
->filterByDbStarts($minRebroadcastStart->format('Y-m-d H:i:s'), Criteria::LESS_THAN)
|
||||
->find();
|
||||
|
||||
if (count($rebroadcasts) > 0) {
|
||||
return _("Can't move a recorded show less than 1 hour before its rebroadcasts.");
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->isRebroadcast()) {
|
||||
|
||||
try {
|
||||
$recordedShow = new Application_Model_ShowInstance($this->_showInstance->getDbOriginalShow());
|
||||
}
|
||||
//recorded show doesn't exist.
|
||||
catch (Exception $e) {
|
||||
$this->_showInstance->delete();
|
||||
|
||||
return _("Show was deleted because recorded show does not exist!");
|
||||
}
|
||||
|
||||
$recordEndDateTime = new DateTime($recordedShow->getShowInstanceEnd(), new DateTimeZone("UTC"));
|
||||
$newRecordEndDateTime = self::addDeltas($recordEndDateTime, 0, 60);
|
||||
|
||||
if ($newStartsDateTime->getTimestamp() < $newRecordEndDateTime->getTimestamp()) {
|
||||
return _("Must wait 1 hour to rebroadcast.");
|
||||
}
|
||||
}
|
||||
|
||||
$this->setShowStart($newStartsDateTime);
|
||||
$this->setShowEnd($newEndsDateTime);
|
||||
$this->correctScheduleStartTimes();
|
||||
|
||||
$show = new Application_Model_Show($this->getShowId());
|
||||
if (!$show->isRepeating() && is_null($this->isRebroadcast())) {
|
||||
$show->setShowFirstShow($newStartsDateTime);
|
||||
$show->setShowLastShow($newEndsDateTime);
|
||||
}
|
||||
|
||||
Application_Model_RabbitMq::PushSchedule();
|
||||
}
|
||||
|
||||
public function resizeShow($deltaDay, $deltaMin)
|
||||
{
|
||||
$con = Propel::getConnection();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue