-began adding grouping by shows for the datatable.
This commit is contained in:
parent
d22ab329d8
commit
38856c4af7
7 changed files with 126 additions and 12 deletions
|
@ -757,5 +757,33 @@ class Show_DAL{
|
|||
$rows = $CC_DBC->GetAll($sql);
|
||||
return $rows;
|
||||
}
|
||||
|
||||
public static function GetShowsInRange($timeNow, $start, $end){
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
$sql = "SELECT *,"
|
||||
." si.starts as start_timestamp,"
|
||||
." si.ends as end_timestamp,"
|
||||
." si.id as instance_id"
|
||||
." FROM "
|
||||
." $CC_CONFIG[showInstances] si,"
|
||||
." $CC_CONFIG[showTable] s"
|
||||
." WHERE si.show_id = s.id"
|
||||
." AND (si.ends > TIMESTAMP '$timeNow' - INTERVAL '$start seconds' OR si.starts < TIMESTAMP '$timeNow' + INTERVAL '$end seconds')"
|
||||
." ORDER BY si.starts";
|
||||
|
||||
$rows = $CC_DBC->GetAll($sql);
|
||||
|
||||
$showsMap = array();
|
||||
$rowsCount = count($rows);
|
||||
|
||||
for ($i=0; $i<$rowsCount; $i++){
|
||||
$rows[$i]['items'] = array();
|
||||
array_push($rows[$i]['items'],
|
||||
array("s", $rows[$i]["starts"], $rows[$i]["starts"], $rows[$i]["ends"], "", "", "", "", "", $rows[$i]["name"], $rows[$i]["instance_id"], ""));
|
||||
$showsMap[$rows[$i]['instance_id']] = $rows[$i];
|
||||
}
|
||||
|
||||
return $showsMap;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue