cc-2229-refactor-now-playing-code

-initial check-in
This commit is contained in:
mkonecny 2011-05-05 00:28:34 -04:00
parent 12e30820ae
commit 1492dcf283
2 changed files with 63 additions and 1 deletions

View file

@ -1636,6 +1636,28 @@ class ShowInstance {
return $items;
}
public static function GetShowsInstancesInRange($p_timeNow, $p_start, $p_end)
{
global $CC_DBC;
$sql = "SELECT id FROM cc_show_instances AS si "
."WHERE ("
."(si.starts < TIMESTAMP '$p_timeNow' - INTERVAL '$p_start seconds' "
."AND si.ends > TIMESTAMP '$p_timeNow' - INTERVAL '$p_start seconds') "
."OR (si.starts > TIMESTAMP '$p_timeNow' - INTERVAL '$p_start seconds' "
."AND si.ends < TIMESTAMP '$p_timeNow' + INTERVAL '$p_end seconds') "
."OR (si.starts < TIMESTAMP '$p_timeNow' + INTERVAL '$p_end seconds' "
."AND si.ends > TIMESTAMP '$p_timeNow' + INTERVAL '$p_end seconds') "
.")";
$rows = $CC_DBC->GetAll($sql);
$showInstances = array();
foreach ($rows as $row){
$shows[] = new ShowInstance($row['id']);
}
return $showInstances;
}
}
/* Show Data Access Layer */