-all songs of the current show are now highlighted in the now playing datatable.

This commit is contained in:
martin 2011-01-30 20:12:07 -05:00
parent dc6fcec0e3
commit eeaa7da6f5
5 changed files with 30 additions and 18 deletions

View file

@ -140,6 +140,7 @@ $CC_CONFIG['backupTable'] = $CC_CONFIG['tblNamePrefix'].'backup';
$CC_CONFIG['playListTimeView'] = $CC_CONFIG['tblNamePrefix'].'playlisttimes'; $CC_CONFIG['playListTimeView'] = $CC_CONFIG['tblNamePrefix'].'playlisttimes';
$CC_CONFIG['showSchedule'] = $CC_CONFIG['tblNamePrefix'].'show_schedule'; $CC_CONFIG['showSchedule'] = $CC_CONFIG['tblNamePrefix'].'show_schedule';
$CC_CONFIG['showDays'] = $CC_CONFIG['tblNamePrefix'].'show_days'; $CC_CONFIG['showDays'] = $CC_CONFIG['tblNamePrefix'].'show_days';
$CC_CONFIG['showTable'] = $CC_CONFIG['tblNamePrefix'].'show';
$CC_CONFIG['playListSequence'] = $CC_CONFIG['playListTable'].'_id'; $CC_CONFIG['playListSequence'] = $CC_CONFIG['playListTable'].'_id';
$CC_CONFIG['filesSequence'] = $CC_CONFIG['filesTable'].'_id'; $CC_CONFIG['filesSequence'] = $CC_CONFIG['filesTable'].'_id';

View file

@ -22,6 +22,7 @@ class NowplayingController extends Zend_Controller_Action
public function getDataGridDataAction() public function getDataGridDataAction()
{ {
//$this->view->entries = json_encode(Application_Model_Nowplaying::GetDataGridData());
$this->view->entries = Application_Model_Nowplaying::GetDataGridData(); $this->view->entries = Application_Model_Nowplaying::GetDataGridData();
} }

View file

@ -18,23 +18,30 @@ class Application_Model_Nowplaying
array("sTitle"=>"Artist"), array("sTitle"=>"Artist"),
array("sTitle"=>"Album"), array("sTitle"=>"Album"),
array("sTitle"=>"Creator"), array("sTitle"=>"Creator"),
array("sTitle"=>"Playlist")); array("sTitle"=>"Playlist"),
array("sTitle"=>"bgcolor", "bVisible"=>false),
array("sTitle"=>"group_id", "bVisible"=>false));
$rows = array(); $rows = array();
$current_group_id = -1;
if (count($current) != 0){
$current_group_id = $current[0]["group_id"];
}
foreach ($previous as $item){ foreach ($previous as $item){
array_push($rows, array("p", $item["starts"], $item["starts"], $item["ends"], $item["clip_length"], $item["track_title"], $item["artist_name"], array_push($rows, array("p", $item["starts"], $item["starts"], $item["ends"], $item["clip_length"], $item["track_title"], $item["artist_name"],
$item["album_title"], "x" , $item["name"])); $item["album_title"], "x" , $item["name"], ($item["group_id"] == $current_group_id ? $item["background_color"] : ""), $item["group_id"]));
} }
foreach ($current as $item){ foreach ($current as $item){
array_push($rows, array("c", $item["starts"], $item["starts"], $item["ends"], $item["clip_length"], $item["track_title"], $item["artist_name"], array_push($rows, array("c", $item["starts"], $item["starts"], $item["ends"], $item["clip_length"], $item["track_title"], $item["artist_name"],
$item["album_title"], "x" , $item["name"])); $item["album_title"], "x" , $item["name"], $item["background_color"], $item["group_id"]));
} }
foreach ($next as $item){ foreach ($next as $item){
array_push($rows, array("n", $item["starts"], $item["starts"], $item["ends"], $item["clip_length"], $item["track_title"], $item["artist_name"], array_push($rows, array("n", $item["starts"], $item["starts"], $item["ends"], $item["clip_length"], $item["track_title"], $item["artist_name"],
$item["album_title"], "x" , $item["name"])); $item["album_title"], "x" , $item["name"], ($item["group_id"] == $current_group_id ? $item["background_color"] : ""), $item["group_id"]));
} }
return array("columnHeaders"=>$columnHeaders, "rows"=>$rows); return array("columnHeaders"=>$columnHeaders, "rows"=>$rows);

View file

@ -479,14 +479,15 @@ class Schedule {
public static function GetPreviousItems($timeNow, $prevCount = 1){ public static function GetPreviousItems($timeNow, $prevCount = 1){
global $CC_CONFIG, $CC_DBC; global $CC_CONFIG, $CC_DBC;
$sql = "SELECT pt.name, ft.track_title, ft.artist_name, ft.album_title, st.starts, st.ends, st.clip_length, sdt.start_time, sdt.end_time" $sql = "SELECT pt.name, ft.track_title, ft.artist_name, ft.album_title, st.starts, st.ends, st.clip_length, st.group_id, sdt.start_time, sdt.end_time, showt.background_color"
." FROM $CC_CONFIG[scheduleTable] st, $CC_CONFIG[filesTable] ft, $CC_CONFIG[playListTable] pt, $CC_CONFIG[showSchedule] sst, $CC_CONFIG[showDays] sdt" ." FROM $CC_CONFIG[scheduleTable] st, $CC_CONFIG[filesTable] ft, $CC_CONFIG[playListTable] pt, $CC_CONFIG[showSchedule] sst, $CC_CONFIG[showDays] sdt, $CC_CONFIG[showTable] showt"
." WHERE st.ends < TIMESTAMP '$timeNow'" ." WHERE st.ends < TIMESTAMP '$timeNow'"
." AND st.ends > (TIMESTAMP '$timeNow' - INTERVAL '1 days')" ." AND st.ends > (TIMESTAMP '$timeNow' - INTERVAL '24 hours')"
." AND st.playlist_id = pt.id" ." AND st.playlist_id = pt.id"
." AND st.file_id = ft.id" ." AND st.file_id = ft.id"
." AND st.group_id = sst.group_id" ." AND st.group_id = sst.group_id"
." AND sdt.show_id = sst.show_id" ." AND sdt.show_id = sst.show_id"
." AND showt.id = sst.show_id"
." ORDER BY st.starts DESC" ." ORDER BY st.starts DESC"
." LIMIT $prevCount"; ." LIMIT $prevCount";
$rows = $CC_DBC->GetAll($sql); $rows = $CC_DBC->GetAll($sql);
@ -496,29 +497,31 @@ class Schedule {
public static function GetCurrentlyPlaying($timeNow){ public static function GetCurrentlyPlaying($timeNow){
global $CC_CONFIG, $CC_DBC; global $CC_CONFIG, $CC_DBC;
$sql = "SELECT pt.name, ft.track_title, ft.artist_name, ft.album_title, st.starts, st.ends, st.clip_length, sdt.start_time, sdt.end_time" $sql = "SELECT pt.name, ft.track_title, ft.artist_name, ft.album_title, st.starts, st.ends, st.clip_length, st.group_id, sdt.start_time, sdt.end_time, showt.background_color"
." FROM $CC_CONFIG[scheduleTable] st," ." FROM $CC_CONFIG[scheduleTable] st,"
."$CC_CONFIG[filesTable] ft, $CC_CONFIG[playListTable] pt, $CC_CONFIG[showSchedule] sst, $CC_CONFIG[showDays] sdt" ."$CC_CONFIG[filesTable] ft, $CC_CONFIG[playListTable] pt, $CC_CONFIG[showSchedule] sst, $CC_CONFIG[showDays] sdt, $CC_CONFIG[showTable] showt"
." WHERE st.starts < TIMESTAMP '$timeNow'" ." WHERE st.starts < TIMESTAMP '$timeNow'"
." AND st.ends > TIMESTAMP '$timeNow'" ." AND st.ends > TIMESTAMP '$timeNow'"
." AND st.playlist_id = pt.id" ." AND st.playlist_id = pt.id"
." AND st.file_id = ft.id" ." AND st.file_id = ft.id"
." AND st.group_id = sst.group_id" ." AND st.group_id = sst.group_id"
." AND sdt.show_id = sst.show_id"; ." AND sdt.show_id = sst.show_id"
." AND showt.id = sst.show_id";
$rows = $CC_DBC->GetAll($sql); $rows = $CC_DBC->GetAll($sql);
return $rows; return $rows;
} }
public static function GetNextItems($timeNow, $nextCount = 1) { public static function GetNextItems($timeNow, $nextCount = 1) {
global $CC_CONFIG, $CC_DBC; global $CC_CONFIG, $CC_DBC;
$sql = "SELECT pt.name, ft.track_title, ft.artist_name, ft.album_title, st.starts, st.ends, st.clip_length, sdt.start_time, sdt.end_time" $sql = "SELECT pt.name, ft.track_title, ft.artist_name, ft.album_title, st.starts, st.ends, st.clip_length, st.group_id, sdt.start_time, sdt.end_time, showt.background_color"
." FROM $CC_CONFIG[scheduleTable] st, $CC_CONFIG[filesTable] ft, $CC_CONFIG[playListTable] pt, $CC_CONFIG[showSchedule] sst, $CC_CONFIG[showDays] sdt" ." FROM $CC_CONFIG[scheduleTable] st, $CC_CONFIG[filesTable] ft, $CC_CONFIG[playListTable] pt, $CC_CONFIG[showSchedule] sst, $CC_CONFIG[showDays] sdt, $CC_CONFIG[showTable] showt"
." WHERE st.starts > TIMESTAMP '$timeNow'" ." WHERE st.starts > TIMESTAMP '$timeNow'"
." AND st.ends < (TIMESTAMP '$timeNow' + INTERVAL '24 hours')" ." AND st.ends < (TIMESTAMP '$timeNow' + INTERVAL '24 hours')"
." AND st.playlist_id = pt.id" ." AND st.playlist_id = pt.id"
." AND st.file_id = ft.id" ." AND st.file_id = ft.id"
." AND st.group_id = sst.group_id" ." AND st.group_id = sst.group_id"
." AND sdt.show_id = sst.show_id" ." AND sdt.show_id = sst.show_id"
." AND showt.id = sst.show_id"
." ORDER BY st.starts" ." ORDER BY st.starts"
." LIMIT $nextCount"; ." LIMIT $nextCount";
$rows = $CC_DBC->GetAll($sql); $rows = $CC_DBC->GetAll($sql);

View file

@ -62,12 +62,12 @@ function createDataGrid(){
"aaData": datagridData.rows, "aaData": datagridData.rows,
"aoColumns": datagridData.columnHeaders, "aoColumns": datagridData.columnHeaders,
"fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) { "fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
if (aData[0] == "p"){ if (aData[aData.length-2] != ""){
//$(nRow).attr("style", "background-color:blue;"); $(nRow).attr("style", "background-color:#166622");
} else if (aData[0] == "c"){ }
$(nRow).attr("style", "background-color:#61B329;");
} else if (aData[0] == "n"){ if (aData[0] == "c")
} $(nRow).attr("style", "background-color:#61B329");
return nRow; return nRow;
} }
} ); } );