Merge branch '2.2.x' of dev.sourcefabric.org:airtime into 2.2.x

This commit is contained in:
denise 2012-10-19 13:42:41 -04:00
commit 7356d4fe89
2 changed files with 25 additions and 3 deletions

View File

@ -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);

View File

@ -662,6 +662,27 @@ SQL;
}
public static function getContentCount($p_start, $p_end)
{
$sql = <<<SQL
SELECT instance_id,
count(*) AS instance_count
FROM cc_schedule
WHERE ends > :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 = <<<SQL