Show linking
This commit is contained in:
parent
5b69761833
commit
ef8f87df5d
|
@ -1664,7 +1664,9 @@ 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);
|
//Application_Model_Show::populateAllShowsInRange($showsPopUntil, $end_timestamp);
|
||||||
|
$service_show = new Application_Service_ShowService();
|
||||||
|
$service_show->delegateInstanceCreation(null, false, $end_timestamp);
|
||||||
Application_Model_Preference::SetShowsPopulatedUntil($end_timestamp);
|
Application_Model_Preference::SetShowsPopulatedUntil($end_timestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -93,11 +93,15 @@ 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
|
||||||
*/
|
*/
|
||||||
private function delegateInstanceCreation($isRebroadcast, $isUpdate)
|
public function delegateInstanceCreation($isRebroadcast=null, $isUpdate=false, $end=null)
|
||||||
{
|
{
|
||||||
$populateUntil = $this->getPopulateShowUntilDateTIme();
|
$populateUntil = $this->getPopulateShowUntilDateTIme();
|
||||||
|
|
||||||
$ccShowDays = $this->ccShow->getCcShowDays();
|
if (is_null($this->ccShow)) {
|
||||||
|
$ccShowDays = $this->getShowDaysInRange($populateUntil, $end);
|
||||||
|
} else {
|
||||||
|
$ccShowDays = $this->ccShow->getCcShowDays();
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($ccShowDays as $day) {
|
foreach ($ccShowDays as $day) {
|
||||||
switch ($day->getDbRepeatType()) {
|
switch ($day->getDbRepeatType()) {
|
||||||
|
@ -123,6 +127,32 @@ class Application_Service_ShowService
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function getShowDaysInRange($start, $end)
|
||||||
|
{
|
||||||
|
$endTimeString = $end->format("Y-m-d H:i:s");
|
||||||
|
if (!is_null($start)) {
|
||||||
|
$startTimeString = $start->format("Y-m-d H:i:s");
|
||||||
|
} else {
|
||||||
|
$today_timestamp = new DateTime("now", new DateTimeZone("UTC"));
|
||||||
|
$startTimeString = $today_timestamp->format("Y-m-d H:i:s");
|
||||||
|
}
|
||||||
|
|
||||||
|
return CcShowDaysQuery::create()
|
||||||
|
->add("last_show", null, "=")
|
||||||
|
->addOr("first_show", $endTimeString, "<")
|
||||||
|
->add("last_show", $startTimeString, ">")
|
||||||
|
->find();
|
||||||
|
/*$sql = <<< SQL
|
||||||
|
SELECT * FROM cc_show_days
|
||||||
|
WHERE last_show IS NULL
|
||||||
|
OR first_show < :endTimeString
|
||||||
|
AND last_show > :startTimeString
|
||||||
|
SQL;
|
||||||
|
|
||||||
|
return Application_Common_Database::prepareAndExecute($sql,
|
||||||
|
array( ':endTimeString' => $endTimeString, ':startTimeString' => $startTimeString ), 'all');*/
|
||||||
|
}
|
||||||
|
|
||||||
public static function formatShowDuration($duration)
|
public static function formatShowDuration($duration)
|
||||||
{
|
{
|
||||||
$hPos = strpos($duration, 'h');
|
$hPos = strpos($duration, 'h');
|
||||||
|
@ -650,7 +680,7 @@ SQL;
|
||||||
|
|
||||||
//DateTime local
|
//DateTime local
|
||||||
$start = $this->getNextRepeatingPopulateStartDateTime($showDay);
|
$start = $this->getNextRepeatingPopulateStartDateTime($showDay);
|
||||||
if (isset($last_how)) {
|
if (isset($last_show)) {
|
||||||
$end = new DateTime($last_show, new DateTimeZone($timezone));
|
$end = new DateTime($last_show, new DateTimeZone($timezone));
|
||||||
} else {
|
} else {
|
||||||
$end = $populateUntil;
|
$end = $populateUntil;
|
||||||
|
@ -1023,7 +1053,7 @@ SQL;
|
||||||
*
|
*
|
||||||
* @return DateTime object
|
* @return DateTime object
|
||||||
*/
|
*/
|
||||||
private function getPopulateShowUntilDateTIme()
|
private static function getPopulateShowUntilDateTIme()
|
||||||
{
|
{
|
||||||
$populateUntil = Application_Model_Preference::GetShowsPopulatedUntil();
|
$populateUntil = Application_Model_Preference::GetShowsPopulatedUntil();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue