Merge branch '2.3.x' into devel

This commit is contained in:
denise 2013-01-23 16:19:00 -05:00
commit 2069da64c1
2 changed files with 20 additions and 20 deletions

View File

@ -1753,7 +1753,9 @@ SQL;
$nowEpoch = time();
$content_count = Application_Model_ShowInstance::getContentCount(
$p_start, $p_end);
$isFull = Application_Model_ShowInstance::getIsFull($p_start, $p_end);
$timezone = date_default_timezone_get();
$utc = new DateTimeZone("UTC");
foreach ($shows as $show) {
$options = array();
@ -1763,8 +1765,6 @@ SQL;
$options["percent"] = Application_Model_Show::getPercentScheduled($show["starts"], $show["ends"], $show["time_filled"]);
}
$utc = new DateTimeZone("UTC");
if (isset($show["parent_starts"])) {
$parentStartsDT = new DateTime($show["parent_starts"], $utc);
$parentStartsEpoch = intval($parentStartsDT->format("U"));
@ -1795,14 +1795,10 @@ SQL;
}
}
$showInstance = new Application_Model_ShowInstance(
$show["instance_id"]);
$options["show_empty"] = (array_key_exists($show['instance_id'],
$content_count)) ? 0 : 1;
$options["show_partial_filled"] = $showInstance->showPartialFilled();
$options["show_partial_filled"] = $isFull[$show['instance_id']];
$events[] = &self::makeFullCalendarEvent($show, $options,
$startsDT, $endsDT, $startsEpochStr, $endsEpochStr);

View File

@ -661,10 +661,8 @@ SQL;
return $returnStr;
}
public static function getContentCount($p_start, $p_end)
{
{
$sql = <<<SQL
SELECT instance_id,
count(*) AS instance_count
@ -687,20 +685,26 @@ SQL;
}
public function showPartialFilled()
public static function getIsFull($p_start, $p_end)
{
$sql = <<<SQL
SELECT time_filled > '00:00:00'
AND time_filled < ends - starts
AND file_id IS null AS partial_filled
FROM cc_show_instances
WHERE id = :instance_id
SELECT id, ends-starts < time_filled as filled
from cc_show_instances
WHERE ends > :p_start::TIMESTAMP
AND starts < :p_end::TIMESTAMP
SQL;
$res = Application_Common_Database::prepareAndExecute($sql,
array(':instance_id' => $this->_instanceId), 'all');
$res = 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 $res[0]["partial_filled"];
$isFilled = array();
foreach ($res as $r) {
$isFilled[$r['id']] = $r['filled'];
}
return $isFilled;
}
public function showEmpty()