Merge branch '2.3.x' into devel
This commit is contained in:
commit
2069da64c1
|
@ -1753,7 +1753,9 @@ SQL;
|
||||||
$nowEpoch = time();
|
$nowEpoch = time();
|
||||||
$content_count = Application_Model_ShowInstance::getContentCount(
|
$content_count = Application_Model_ShowInstance::getContentCount(
|
||||||
$p_start, $p_end);
|
$p_start, $p_end);
|
||||||
|
$isFull = Application_Model_ShowInstance::getIsFull($p_start, $p_end);
|
||||||
$timezone = date_default_timezone_get();
|
$timezone = date_default_timezone_get();
|
||||||
|
$utc = new DateTimeZone("UTC");
|
||||||
|
|
||||||
foreach ($shows as $show) {
|
foreach ($shows as $show) {
|
||||||
$options = array();
|
$options = array();
|
||||||
|
@ -1763,8 +1765,6 @@ SQL;
|
||||||
$options["percent"] = Application_Model_Show::getPercentScheduled($show["starts"], $show["ends"], $show["time_filled"]);
|
$options["percent"] = Application_Model_Show::getPercentScheduled($show["starts"], $show["ends"], $show["time_filled"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$utc = new DateTimeZone("UTC");
|
|
||||||
|
|
||||||
if (isset($show["parent_starts"])) {
|
if (isset($show["parent_starts"])) {
|
||||||
$parentStartsDT = new DateTime($show["parent_starts"], $utc);
|
$parentStartsDT = new DateTime($show["parent_starts"], $utc);
|
||||||
$parentStartsEpoch = intval($parentStartsDT->format("U"));
|
$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'],
|
$options["show_empty"] = (array_key_exists($show['instance_id'],
|
||||||
$content_count)) ? 0 : 1;
|
$content_count)) ? 0 : 1;
|
||||||
|
|
||||||
$options["show_partial_filled"] = $showInstance->showPartialFilled();
|
$options["show_partial_filled"] = $isFull[$show['instance_id']];
|
||||||
|
|
||||||
$events[] = &self::makeFullCalendarEvent($show, $options,
|
$events[] = &self::makeFullCalendarEvent($show, $options,
|
||||||
$startsDT, $endsDT, $startsEpochStr, $endsEpochStr);
|
$startsDT, $endsDT, $startsEpochStr, $endsEpochStr);
|
||||||
|
|
|
@ -661,10 +661,8 @@ SQL;
|
||||||
return $returnStr;
|
return $returnStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static function getContentCount($p_start, $p_end)
|
public static function getContentCount($p_start, $p_end)
|
||||||
{
|
{
|
||||||
$sql = <<<SQL
|
$sql = <<<SQL
|
||||||
SELECT instance_id,
|
SELECT instance_id,
|
||||||
count(*) AS instance_count
|
count(*) AS instance_count
|
||||||
|
@ -687,20 +685,26 @@ SQL;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function showPartialFilled()
|
public static function getIsFull($p_start, $p_end)
|
||||||
{
|
{
|
||||||
$sql = <<<SQL
|
$sql = <<<SQL
|
||||||
SELECT time_filled > '00:00:00'
|
SELECT id, ends-starts < time_filled as filled
|
||||||
AND time_filled < ends - starts
|
from cc_show_instances
|
||||||
AND file_id IS null AS partial_filled
|
WHERE ends > :p_start::TIMESTAMP
|
||||||
FROM cc_show_instances
|
AND starts < :p_end::TIMESTAMP
|
||||||
WHERE id = :instance_id
|
|
||||||
SQL;
|
SQL;
|
||||||
|
|
||||||
$res = Application_Common_Database::prepareAndExecute($sql,
|
$res = Application_Common_Database::prepareAndExecute($sql, array(
|
||||||
array(':instance_id' => $this->_instanceId), 'all');
|
':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()
|
public function showEmpty()
|
||||||
|
|
Loading…
Reference in New Issue