CC-4961: Show linking

-moved show deletion into show service
This commit is contained in:
denise 2013-04-03 11:46:46 -04:00
parent ab10ae68a2
commit 81dbb17922
4 changed files with 179 additions and 39 deletions

View file

@ -147,12 +147,12 @@ class Application_Service_CalendarService
$menu["del"]["items"]["single"] = array(
"name"=> _("Delete This Instance"),
"icon" => "delete",
"url" => $baseUrl."schedule/delete-show");
"url" => $baseUrl."schedule/delete-show-instance");
$menu["del"]["items"]["following"] = array(
"name"=> _("Delete This Instance and All Following"),
"icon" => "delete",
"url" => $baseUrl."schedule/cancel-show");
"url" => $baseUrl."schedule/delete-show");
} else {
$menu["del"] = array(
"name"=> _("Delete"),
@ -164,4 +164,42 @@ class Application_Service_CalendarService
return $menu;
}
/*
* @param $dateTime
* php Datetime object to add deltas to
*
* @param $deltaDay
* php int, delta days show moved
*
* @param $deltaMin
* php int, delta mins show moved
*
* @return $newDateTime
* php DateTime, $dateTime with the added time deltas.
*/
public static function addDeltas($dateTime, $deltaDay, $deltaMin)
{
$newDateTime = clone $dateTime;
$days = abs($deltaDay);
$mins = abs($deltaMin);
$dayInterval = new DateInterval("P{$days}D");
$minInterval = new DateInterval("PT{$mins}M");
if ($deltaDay > 0) {
$newDateTime->add($dayInterval);
} elseif ($deltaDay < 0) {
$newDateTime->sub($dayInterval);
}
if ($deltaMin > 0) {
$newDateTime->add($minInterval);
} elseif ($deltaMin < 0) {
$newDateTime->sub($minInterval);
}
return $newDateTime;
}
}