diff --git a/airtime_mvc/application/models/Dashboard.php b/airtime_mvc/application/models/Dashboard.php index d599b5c2b..18c239b92 100644 --- a/airtime_mvc/application/models/Dashboard.php +++ b/airtime_mvc/application/models/Dashboard.php @@ -10,8 +10,7 @@ class Application_Model_Dashboard //name. Else return the last item from the schedule. $showInstance = ShowInstance::GetLastShowInstance($p_timeNow); - $instanceId = $showInstance->getShowId(); - $row = Schedule::GetLastScheduleItem($p_timeNow, $instanceId); + $row = Schedule::GetLastScheduleItem($p_timeNow); if (is_null($showInstance)){ if (count($row) == 0){ @@ -48,10 +47,12 @@ class Application_Model_Dashboard //after the last item in the schedule table, then return the show's //name. Else return the last item from the schedule. + $row = array(); $showInstance = ShowInstance::GetCurrentShowInstance($p_timeNow); - $instanceId = $showInstance->getShowId(); - $row = Schedule::GetCurrentScheduleItem($p_timeNow, $instanceId); - + if (!is_null($showInstance)){ + $instanceId = $showInstance->getShowInstanceId(); + $row = Schedule::GetCurrentScheduleItem($p_timeNow, $instanceId); + } if (is_null($showInstance)){ if (count($row) == 0){ return null; @@ -84,8 +85,7 @@ class Application_Model_Dashboard //name. Else return the last item from the schedule. $showInstance = ShowInstance::GetNextShowInstance($p_timeNow); - $instanceId = $showInstance->getShowId(); - $row = Schedule::GetNextScheduleItem($p_timeNow, $instanceId); + $row = Schedule::GetNextScheduleItem($p_timeNow); if (is_null($showInstance)){ if (count($row) == 0){ diff --git a/airtime_mvc/application/models/Schedule.php b/airtime_mvc/application/models/Schedule.php index 71a6d9674..67c4d352e 100644 --- a/airtime_mvc/application/models/Schedule.php +++ b/airtime_mvc/application/models/Schedule.php @@ -378,7 +378,7 @@ class Schedule { "apiKey"=>$CC_CONFIG['apiKey'][0]); } - public static function GetLastScheduleItem($p_timeNow, $p_instanceId){ + public static function GetLastScheduleItem($p_timeNow){ global $CC_CONFIG, $CC_DBC; $sql = "SELECT *" @@ -386,7 +386,6 @@ class Schedule { ." LEFT JOIN $CC_CONFIG[filesTable] ft" ." ON st.file_id = ft.id" ." WHERE st.ends < TIMESTAMP '$p_timeNow'" - ." AND st.instance_id = $p_instanceId" ." ORDER BY st.ends DESC" ." LIMIT 1"; @@ -419,7 +418,7 @@ class Schedule { return $row; } - public static function GetNextScheduleItem($p_timeNow, $p_instanceId){ + public static function GetNextScheduleItem($p_timeNow){ global $CC_CONFIG, $CC_DBC; $sql = "SELECT *" @@ -427,7 +426,6 @@ class Schedule { ." LEFT JOIN $CC_CONFIG[filesTable] ft" ." ON st.file_id = ft.id" ." WHERE st.starts > TIMESTAMP '$p_timeNow'" - ." AND st.instance_id = $p_instanceId" ." ORDER BY st.starts" ." LIMIT 1";