Show linking
This commit is contained in:
parent
d0691b114c
commit
1eba09fc4c
|
@ -64,7 +64,7 @@ class Application_Service_ShowService
|
||||||
// schedule start/end times
|
// schedule start/end times
|
||||||
$this->applyShowStartEndDifference($showData);
|
$this->applyShowStartEndDifference($showData);
|
||||||
$this->deleteRebroadcastInstances();
|
$this->deleteRebroadcastInstances();
|
||||||
//$this->deleteCcShowDays();
|
$this->deleteCcShowDays();
|
||||||
$this->deleteCcShowHosts();
|
$this->deleteCcShowHosts();
|
||||||
if ($isRebroadcast) {
|
if ($isRebroadcast) {
|
||||||
//delete entry in cc_show_rebroadcast
|
//delete entry in cc_show_rebroadcast
|
||||||
|
@ -73,7 +73,7 @@ class Application_Service_ShowService
|
||||||
}
|
}
|
||||||
|
|
||||||
//update ccShowDays
|
//update ccShowDays
|
||||||
$this->setCcShowDays($showData, $repeatType, $isRecorded, $isRebroadcast, $isUpdate);
|
$this->setCcShowDays($showData, $repeatType, $isRecorded);
|
||||||
|
|
||||||
//update ccShowRebroadcasts
|
//update ccShowRebroadcasts
|
||||||
$this->setCcShowRebroadcasts($showData, $repeatType, $isRecorded);
|
$this->setCcShowRebroadcasts($showData, $repeatType, $isRecorded);
|
||||||
|
@ -104,14 +104,12 @@ class Application_Service_ShowService
|
||||||
* Receives a cc_show id and determines whether to create a
|
* Receives a cc_show id and determines whether to create a
|
||||||
* single show instance or repeating show instances
|
* single show instance or repeating show instances
|
||||||
*/
|
*/
|
||||||
public function delegateInstanceCreation($isRebroadcast=null, $isUpdate=false, $end=null, $ccShowDay=null)
|
public function delegateInstanceCreation($isRebroadcast=null, $isUpdate=false, $end=null)
|
||||||
{
|
{
|
||||||
$populateUntil = $this->getPopulateShowUntilDateTIme();
|
$populateUntil = $this->getPopulateShowUntilDateTIme();
|
||||||
|
|
||||||
if (is_null($this->ccShow)) {
|
if (is_null($this->ccShow)) {
|
||||||
$ccShowDays = $this->getShowDaysInRange($populateUntil, $end);
|
$ccShowDays = $this->getShowDaysInRange($populateUntil, $end);
|
||||||
} elseif ($isUpdate && !is_null($ccShowDay)) {
|
|
||||||
$ccShowDays = array(0 => $ccShowDay);
|
|
||||||
} else {
|
} else {
|
||||||
$ccShowDays = $this->ccShow->getCcShowDays();
|
$ccShowDays = $this->ccShow->getCcShowDays();
|
||||||
}
|
}
|
||||||
|
@ -681,10 +679,8 @@ SQL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!$isUpdate) {
|
$nextDate = $utcEndDateTime->add($repeatInterval);
|
||||||
$nextDate = $utcEndDateTime->add($repeatInterval);
|
$this->setNextRepeatingShowDate($nextDate->format("Y-m-d"), $day, $show_id);
|
||||||
$this->setNextRepeatingShowDate($nextDate->format("Y-m-d"), $day, $show_id);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function createMonthlyMonthlyRepeatInstances($showDay, $populateUntil,
|
private function createMonthlyMonthlyRepeatInstances($showDay, $populateUntil,
|
||||||
|
@ -943,7 +939,7 @@ SQL;
|
||||||
* @param $isRecorded
|
* @param $isRecorded
|
||||||
* @param $showDay ccShowDay object we are setting values on
|
* @param $showDay ccShowDay object we are setting values on
|
||||||
*/
|
*/
|
||||||
private function setCcShowDays($showData, $repeatType, $isRecorded, $isRebroadcast, $isUpdate)
|
private function setCcShowDays($showData, $repeatType, $isRecorded)
|
||||||
{
|
{
|
||||||
$showId = $this->ccShow->getDbId();
|
$showId = $this->ccShow->getDbId();
|
||||||
|
|
||||||
|
@ -970,13 +966,7 @@ SQL;
|
||||||
|
|
||||||
// Don't set day for monthly repeat type, it's invalid
|
// Don't set day for monthly repeat type, it's invalid
|
||||||
if ($showData['add_show_repeats'] && $showData['add_show_repeat_type'] == 2) {
|
if ($showData['add_show_repeats'] && $showData['add_show_repeat_type'] == 2) {
|
||||||
if ($this->hasCcShowDay($repeatType, null)) {
|
$showDay = new CcShowDays();
|
||||||
$showDay = $this->getCcShowDay($repeatType, null);
|
|
||||||
$newShowDay = false;
|
|
||||||
} else {
|
|
||||||
$showDay = new CcShowDays();
|
|
||||||
$newShowDay = true;
|
|
||||||
}
|
|
||||||
$showDay->setDbFirstShow($startDateTime->format("Y-m-d"));
|
$showDay->setDbFirstShow($startDateTime->format("Y-m-d"));
|
||||||
$showDay->setDbLastShow($endDate);
|
$showDay->setDbLastShow($endDate);
|
||||||
$showDay->setDbStartTime($startDateTime->format("H:i:s"));
|
$showDay->setDbStartTime($startDateTime->format("H:i:s"));
|
||||||
|
@ -989,9 +979,6 @@ SQL;
|
||||||
//so when editing, the date period iterator will start from the beginning
|
//so when editing, the date period iterator will start from the beginning
|
||||||
$showDay->setDbNextPopDate($startDateTime->format("Y-m-d"));
|
$showDay->setDbNextPopDate($startDateTime->format("Y-m-d"));
|
||||||
$showDay->save();
|
$showDay->save();
|
||||||
if ($newShowDay && $isUpdate) {
|
|
||||||
$this->delegateInstanceCreation($isRebroadcast, $isUpdate, $endDateTime, $showDay);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
foreach ($showData['add_show_day_check'] as $day) {
|
foreach ($showData['add_show_day_check'] as $day) {
|
||||||
$daysAdd=0;
|
$daysAdd=0;
|
||||||
|
@ -1005,13 +992,7 @@ SQL;
|
||||||
$startDateTimeClone->add(new DateInterval("P".$daysAdd."D"));
|
$startDateTimeClone->add(new DateInterval("P".$daysAdd."D"));
|
||||||
}
|
}
|
||||||
if (is_null($endDate) || $startDateTimeClone->getTimestamp() <= $endDateTime->getTimestamp()) {
|
if (is_null($endDate) || $startDateTimeClone->getTimestamp() <= $endDateTime->getTimestamp()) {
|
||||||
if ($this->hasCcShowDay($repeatType, $day)) {
|
$showDay = new CcShowDays();
|
||||||
$showDay = $this->getCcShowDay($repeatType, $day);
|
|
||||||
$newShowDay = false;
|
|
||||||
} else {
|
|
||||||
$showDay = new CcShowDays();
|
|
||||||
$newShowDay = true;
|
|
||||||
}
|
|
||||||
$showDay->setDbFirstShow($startDateTimeClone->format("Y-m-d"));
|
$showDay->setDbFirstShow($startDateTimeClone->format("Y-m-d"));
|
||||||
$showDay->setDbLastShow($endDate);
|
$showDay->setDbLastShow($endDate);
|
||||||
$showDay->setDbStartTime($startDateTimeClone->format("H:i"));
|
$showDay->setDbStartTime($startDateTimeClone->format("H:i"));
|
||||||
|
@ -1025,9 +1006,6 @@ SQL;
|
||||||
//so when editing, the date period iterator will start from the beginning
|
//so when editing, the date period iterator will start from the beginning
|
||||||
$showDay->setDbNextPopDate($startDateTimeClone->format("Y-m-d"));
|
$showDay->setDbNextPopDate($startDateTimeClone->format("Y-m-d"));
|
||||||
$showDay->save();
|
$showDay->save();
|
||||||
if ($newShowDay && $isUpdate) {
|
|
||||||
$this->delegateInstanceCreation($isRebroadcast, $isUpdate, $endDateTime, $showDay);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue