CC-4961: Show linking
This commit is contained in:
parent
a5264aac1e
commit
de8f7b0ff7
File diff suppressed because it is too large
Load Diff
|
@ -53,17 +53,20 @@ class Application_Model_Scheduler
|
||||||
$isDestinationLinked = $destinationCcShowInstance->getCcShow()->isLinked();
|
$isDestinationLinked = $destinationCcShowInstance->getCcShow()->isLinked();
|
||||||
|
|
||||||
foreach ($itemsToMove as $itemToMove) {
|
foreach ($itemsToMove as $itemToMove) {
|
||||||
|
$sourceInstanceId = $itemToMove["instance"];
|
||||||
$ccShowInstance = CcShowInstancesQuery::create()
|
$ccShowInstance = CcShowInstancesQuery::create()
|
||||||
->findPk($itemToMove["instance"]);
|
->findPk($sourceInstanceId);
|
||||||
|
|
||||||
//does the item being moved belong to a linked show
|
//does the item being moved belong to a linked show
|
||||||
$isSourceLinked = $ccShowInstance->getCcShow()->isLinked();
|
$isSourceLinked = $ccShowInstance->getCcShow()->isLinked();
|
||||||
|
|
||||||
if ($isSourceLinked && $itemToMove["instance"] != $destinationInstanceId) {
|
if ($isDestinationLinked && !$isSourceLinked) {
|
||||||
throw new Exception(_("Linked items can only be moved within its own show"));
|
throw new Exception("Cannot move items into linked shows");
|
||||||
} /*elseif ($isDestinationLinked && $isSourceLinked) {
|
} elseif (!$isDestinationLinked && $isSourceLinked) {
|
||||||
throw new Exception(_("Items can only be moved to and from unlinked shows"));
|
throw new Exception("Cannot move items out of linked shows");
|
||||||
}*/
|
} elseif ($isSourceLinked && $sourceInstanceId != $destinationInstanceId) {
|
||||||
|
throw new Exception(_("Cannot move items out of linked shows"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -496,7 +499,6 @@ class Application_Model_Scheduler
|
||||||
*/
|
*/
|
||||||
$instances = $this->getInstances($schedule["instance"]);
|
$instances = $this->getInstances($schedule["instance"]);
|
||||||
foreach($instances as $instance) {
|
foreach($instances as $instance) {
|
||||||
|
|
||||||
if ($id !== 0) {
|
if ($id !== 0) {
|
||||||
$schedItem = CcScheduleQuery::create()->findPK($id, $this->con);
|
$schedItem = CcScheduleQuery::create()->findPK($id, $this->con);
|
||||||
/* We use the selected cursor's position to find the same
|
/* We use the selected cursor's position to find the same
|
||||||
|
@ -537,12 +539,6 @@ class Application_Model_Scheduler
|
||||||
$pstart = microtime(true);
|
$pstart = microtime(true);
|
||||||
|
|
||||||
$initalStartDT = clone $nextStartDT;
|
$initalStartDT = clone $nextStartDT;
|
||||||
/*$followingSchedItems = CcScheduleQuery::create()
|
|
||||||
->filterByDBStarts($nextStartDT->format("Y-m-d H:i:s.u"), Criteria::GREATER_EQUAL)
|
|
||||||
->filterByDbInstanceId($instance->getDbId())
|
|
||||||
->filterByDbId($excludeIds, Criteria::NOT_IN)
|
|
||||||
->orderByDbStarts()
|
|
||||||
->find($this->con);*/
|
|
||||||
|
|
||||||
$pend = microtime(true);
|
$pend = microtime(true);
|
||||||
Logging::debug("finding all following items.");
|
Logging::debug("finding all following items.");
|
||||||
|
@ -559,11 +555,6 @@ class Application_Model_Scheduler
|
||||||
//item existed previously and is being moved.
|
//item existed previously and is being moved.
|
||||||
//need to keep same id for resources if we want REST.
|
//need to keep same id for resources if we want REST.
|
||||||
if (isset($file['sched_id'])) {
|
if (isset($file['sched_id'])) {
|
||||||
|
|
||||||
/*$sched = CcScheduleQuery::create()
|
|
||||||
->filterByDbInstanceId($instance->getDbId())
|
|
||||||
->filterByDbFileId($file["id"])
|
|
||||||
->findOne();*/
|
|
||||||
$sched = CcScheduleQuery::create()->findPk($file["sched_id"]);
|
$sched = CcScheduleQuery::create()->findPk($file["sched_id"]);
|
||||||
|
|
||||||
$excludeIds[] = intval($sched->getDbId());
|
$excludeIds[] = intval($sched->getDbId());
|
||||||
|
@ -590,8 +581,11 @@ class Application_Model_Scheduler
|
||||||
->setDbFadeIn($file['fadein'])
|
->setDbFadeIn($file['fadein'])
|
||||||
->setDbFadeOut($file['fadeout'])
|
->setDbFadeOut($file['fadeout'])
|
||||||
->setDbClipLength($file['cliplength'])
|
->setDbClipLength($file['cliplength'])
|
||||||
->setDbPosition($pos)
|
->setDbPosition($pos);
|
||||||
->setDbInstanceId($instance->getDbId());
|
//->setDbInstanceId($instance->getDbId());
|
||||||
|
if (!$moveAction) {
|
||||||
|
$sched->setDbInstanceId($instance->getDbId());
|
||||||
|
}
|
||||||
|
|
||||||
switch ($file["type"]) {
|
switch ($file["type"]) {
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -640,7 +634,10 @@ class Application_Model_Scheduler
|
||||||
$pstart = microtime(true);
|
$pstart = microtime(true);
|
||||||
|
|
||||||
//recalculate the start/end times after the inserted items.
|
//recalculate the start/end times after the inserted items.
|
||||||
|
Logging::info($excludeIds);
|
||||||
|
Logging::info($initalStartDT);
|
||||||
foreach ($followingSchedItems as $item) {
|
foreach ($followingSchedItems as $item) {
|
||||||
|
Logging::info($item);
|
||||||
$endTimeDT = $this->findEndTime($nextStartDT, $item->getDbClipLength());
|
$endTimeDT = $this->findEndTime($nextStartDT, $item->getDbClipLength());
|
||||||
|
|
||||||
$item->setDbStarts($nextStartDT);
|
$item->setDbStarts($nextStartDT);
|
||||||
|
@ -674,13 +671,6 @@ class Application_Model_Scheduler
|
||||||
$instance->updateScheduleStatus($this->con);
|
$instance->updateScheduleStatus($this->con);
|
||||||
}
|
}
|
||||||
|
|
||||||
// update is_scheduled flag for each cc_file
|
|
||||||
/*foreach ($filesToInsert as $file) {
|
|
||||||
$db_file = CcFilesQuery::create()->findPk($file['id'], $this->con);
|
|
||||||
$db_file->setDbIsScheduled(true);
|
|
||||||
$db_file->save($this->con);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
$endProfile = microtime(true);
|
$endProfile = microtime(true);
|
||||||
Logging::debug("updating show instances status.");
|
Logging::debug("updating show instances status.");
|
||||||
Logging::debug(floatval($endProfile) - floatval($startProfile));
|
Logging::debug(floatval($endProfile) - floatval($startProfile));
|
||||||
|
@ -849,7 +839,7 @@ class Application_Model_Scheduler
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function removeItems($scheduledItems, $adjustSched = true)
|
public function removeItems($scheduledItems, $adjustSched = true, $cancelShow=false)
|
||||||
{
|
{
|
||||||
$showInstances = array();
|
$showInstances = array();
|
||||||
$this->con->beginTransaction();
|
$this->con->beginTransaction();
|
||||||
|
@ -872,7 +862,7 @@ class Application_Model_Scheduler
|
||||||
|
|
||||||
//check if instance is linked and if so get the schedule items
|
//check if instance is linked and if so get the schedule items
|
||||||
//for all linked instances so we can delete them too
|
//for all linked instances so we can delete them too
|
||||||
if ($instance->getCcShow()->isLinked()) {
|
if (!$cancelShow && $instance->getCcShow()->isLinked()) {
|
||||||
//returns all linked instances if linked
|
//returns all linked instances if linked
|
||||||
$ccShowInstances = $this->getInstances($instance->getDbId());
|
$ccShowInstances = $this->getInstances($instance->getDbId());
|
||||||
$instanceIds = array();
|
$instanceIds = array();
|
||||||
|
@ -998,7 +988,7 @@ class Application_Model_Scheduler
|
||||||
$remove[$i]["id"] = $items[$i]->getDbId();
|
$remove[$i]["id"] = $items[$i]->getDbId();
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->removeItems($remove, false);
|
$this->removeItems($remove, false, true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$rebroadcasts = $instance->getCcShowInstancessRelatedByDbId(null, $this->con);
|
$rebroadcasts = $instance->getCcShowInstancessRelatedByDbId(null, $this->con);
|
||||||
|
|
|
@ -1664,7 +1664,6 @@ SQL;
|
||||||
$showsPopUntil = Application_Model_Preference::GetShowsPopulatedUntil();
|
$showsPopUntil = Application_Model_Preference::GetShowsPopulatedUntil();
|
||||||
//if application is requesting shows past our previous populated until date, generate shows up until this point.
|
//if application is requesting shows past our previous populated until date, generate shows up until this point.
|
||||||
if (is_null($showsPopUntil) || $showsPopUntil->getTimestamp() < $end_timestamp->getTimestamp()) {
|
if (is_null($showsPopUntil) || $showsPopUntil->getTimestamp() < $end_timestamp->getTimestamp()) {
|
||||||
//Application_Model_Show::populateAllShowsInRange($showsPopUntil, $end_timestamp);
|
|
||||||
$service_show = new Application_Service_ShowService();
|
$service_show = new Application_Service_ShowService();
|
||||||
$ccShow = $service_show->delegateInstanceCreation(null, $end_timestamp, true);
|
$ccShow = $service_show->delegateInstanceCreation(null, $end_timestamp, true);
|
||||||
Application_Model_Preference::SetShowsPopulatedUntil($end_timestamp);
|
Application_Model_Preference::SetShowsPopulatedUntil($end_timestamp);
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -163,6 +163,7 @@ class CcShow extends BaseCcShow {
|
||||||
$collCcShowInstancess = CcShowInstancesQuery::create(null, $criteria)
|
$collCcShowInstancess = CcShowInstancesQuery::create(null, $criteria)
|
||||||
->filterByCcShow($this)
|
->filterByCcShow($this)
|
||||||
->filterByDbModifiedInstance(false)
|
->filterByDbModifiedInstance(false)
|
||||||
|
->filterByDbStarts(gmdate("Y-m-d H:i:s"), criteria::GREATER_THAN)
|
||||||
->orderByDbId()
|
->orderByDbId()
|
||||||
->find($con);
|
->find($con);
|
||||||
if (null !== $criteria) {
|
if (null !== $criteria) {
|
||||||
|
|
|
@ -836,7 +836,10 @@ SQL;
|
||||||
$utcLastShowDateTime = $last_show ?
|
$utcLastShowDateTime = $last_show ?
|
||||||
Application_Common_DateHelper::ConvertToUtcDateTime($last_show, $timezone) : null;
|
Application_Common_DateHelper::ConvertToUtcDateTime($last_show, $timezone) : null;
|
||||||
|
|
||||||
|
$utcStartDateTime = new DateTime("now");
|
||||||
foreach ($datePeriod as $date) {
|
foreach ($datePeriod as $date) {
|
||||||
|
Logging::info($date);
|
||||||
|
Logging::info($duration);
|
||||||
list($utcStartDateTime, $utcEndDateTime) = $this->createUTCStartEndDateTime(
|
list($utcStartDateTime, $utcEndDateTime) = $this->createUTCStartEndDateTime(
|
||||||
$date, $duration);
|
$date, $duration);
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue