-begin adding datagrids
This commit is contained in:
parent
8d5aea0d14
commit
6553663051
249 changed files with 31982 additions and 11 deletions
43
application/models/Nowplaying.php
Normal file
43
application/models/Nowplaying.php
Normal file
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
|
||||
class Application_Model_Nowplaying
|
||||
{
|
||||
|
||||
public static function GetDataGridData(){
|
||||
$timeNow = Schedule::GetSchedulerTime();
|
||||
$previous = Schedule::GetPreviousItems($timeNow, 1);
|
||||
$current = Schedule::GetCurrentlyPlaying($timeNow);
|
||||
$next = Schedule::GetNextItems($timeNow, 10);
|
||||
|
||||
$columnHeaders = array(array("sTitle"=>"Date"),
|
||||
array("sTitle"=>"Start"),
|
||||
array("sTitle"=>"End"),
|
||||
array("sTitle"=>"Duration"),
|
||||
array("sTitle"=>"Song"),
|
||||
array("sTitle"=>"Artist"),
|
||||
array("sTitle"=>"Album"),
|
||||
array("sTitle"=>"Creator"),
|
||||
array("sTitle"=>"Playlist"));
|
||||
$rows = array();
|
||||
|
||||
foreach ($previous as $item){
|
||||
array_push($rows, array(substr($item["starts"], 0, strpos($item["starts"], " ")), $item["starts"], $item["ends"], $item["clip_length"], $item["track_title"], $item["artist_name"],
|
||||
$item["album_title"], "x" , "y"));
|
||||
}
|
||||
|
||||
|
||||
foreach ($current as $item){
|
||||
array_push($rows, array($item["starts"], $item["starts"], $item["ends"], $item["clip_length"], $item["track_title"], $item["artist_name"],
|
||||
$item["album_title"], "x" , "y"));
|
||||
}
|
||||
|
||||
foreach ($next as $item){
|
||||
array_push($rows, array($item["starts"], $item["starts"], $item["ends"], $item["clip_length"], $item["track_title"], $item["artist_name"],
|
||||
$item["album_title"], "x" , "y"));
|
||||
}
|
||||
|
||||
return array("columnHeaders"=>$columnHeaders, "rows"=>$rows);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -477,7 +477,7 @@ class Schedule {
|
|||
"next"=>Schedule::GetNextItems($timeNow));
|
||||
}
|
||||
|
||||
private static function GetPreviousItems($timeNow, $prevCount = 1){
|
||||
public static function GetPreviousItems($timeNow, $prevCount = 1){
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
$sql = "SELECT * FROM $CC_CONFIG[scheduleTable] st, $CC_CONFIG[filesTable] ft"
|
||||
." WHERE (st.ends < TIMESTAMP '$timeNow')"
|
||||
|
@ -488,7 +488,7 @@ class Schedule {
|
|||
return $rows;
|
||||
}
|
||||
|
||||
private static function GetCurrentlyPlaying($timeNow){
|
||||
public static function GetCurrentlyPlaying($timeNow){
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
|
||||
$sql = "SELECT *, pt.name as playlistName FROM $CC_CONFIG[scheduleTable] st, $CC_CONFIG[filesTable] ft, $CC_CONFIG[playListTable] pt"
|
||||
|
@ -500,7 +500,7 @@ class Schedule {
|
|||
return $rows;
|
||||
}
|
||||
|
||||
private static function GetNextItems($timeNow, $nextCount = 1) {
|
||||
public static function GetNextItems($timeNow, $nextCount = 1) {
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
$sql = "SELECT * FROM $CC_CONFIG[scheduleTable] st, $CC_CONFIG[filesTable] ft"
|
||||
." WHERE (st.starts > TIMESTAMP '$timeNow')"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue