diff --git a/airtime_mvc/application/models/Show.php b/airtime_mvc/application/models/Show.php index 5da348b52..0006057f7 100644 --- a/airtime_mvc/application/models/Show.php +++ b/airtime_mvc/application/models/Show.php @@ -1743,7 +1743,8 @@ SQL; $days = $interval->format('%a'); $shows = Application_Model_Show::getShows($p_start, $p_end); $nowEpoch = time(); - + $content_count = Application_Model_ShowInstance::getContentCount( + $p_start, $p_end); $timezone = date_default_timezone_get(); foreach ($shows as $show) { @@ -1789,9 +1790,9 @@ SQL; $showInstance = new Application_Model_ShowInstance( $show["instance_id"]); - //$showContent = $showInstance->getShowListContent(); - $options["show_empty"] = ($showInstance->showEmpty()) ? 1 : 0; + $options["show_empty"] = (array_key_exists($show['instance_id'], + $content_count)) ? 1 : 0; $events[] = &self::makeFullCalendarEvent($show, $options, $startsDT, $endsDT, $startsEpochStr, $endsEpochStr); diff --git a/airtime_mvc/application/models/ShowInstance.php b/airtime_mvc/application/models/ShowInstance.php index e657494f9..8854f3896 100644 --- a/airtime_mvc/application/models/ShowInstance.php +++ b/airtime_mvc/application/models/ShowInstance.php @@ -662,6 +662,27 @@ SQL; } + + public static function getContentCount($p_start, $p_end) + { + $sql = << :p_start::TIMESTAMP + AND starts < :p_end::TIMESTAMP +GROUP BY instance_id; +SQL; + + $counts = Application_Common_Database::prepareAndExecute( $sql, array( + ':p_start' => $p_start->format("Y-m-d G:i:s"), + ':p_end' => $p_end->format("Y-m-d G:i:s")) + , 'all'); + + return $counts; + + } + public function showEmpty() { $sql = <<