diff --git a/application/configs/conf.php b/application/configs/conf.php index 0c3081d38..12b253bfd 100644 --- a/application/configs/conf.php +++ b/application/configs/conf.php @@ -140,6 +140,7 @@ $CC_CONFIG['backupTable'] = $CC_CONFIG['tblNamePrefix'].'backup'; $CC_CONFIG['playListTimeView'] = $CC_CONFIG['tblNamePrefix'].'playlisttimes'; $CC_CONFIG['showSchedule'] = $CC_CONFIG['tblNamePrefix'].'show_schedule'; $CC_CONFIG['showDays'] = $CC_CONFIG['tblNamePrefix'].'show_days'; +$CC_CONFIG['showTable'] = $CC_CONFIG['tblNamePrefix'].'show'; $CC_CONFIG['playListSequence'] = $CC_CONFIG['playListTable'].'_id'; $CC_CONFIG['filesSequence'] = $CC_CONFIG['filesTable'].'_id'; diff --git a/application/controllers/NowplayingController.php b/application/controllers/NowplayingController.php index bde206e6f..0c8116d62 100644 --- a/application/controllers/NowplayingController.php +++ b/application/controllers/NowplayingController.php @@ -22,6 +22,7 @@ class NowplayingController extends Zend_Controller_Action public function getDataGridDataAction() { + //$this->view->entries = json_encode(Application_Model_Nowplaying::GetDataGridData()); $this->view->entries = Application_Model_Nowplaying::GetDataGridData(); } diff --git a/application/models/Nowplaying.php b/application/models/Nowplaying.php index 5266e5284..611e01b72 100644 --- a/application/models/Nowplaying.php +++ b/application/models/Nowplaying.php @@ -18,23 +18,30 @@ class Application_Model_Nowplaying array("sTitle"=>"Artist"), array("sTitle"=>"Album"), array("sTitle"=>"Creator"), - array("sTitle"=>"Playlist")); + array("sTitle"=>"Playlist"), + array("sTitle"=>"bgcolor", "bVisible"=>false), + array("sTitle"=>"group_id", "bVisible"=>false)); $rows = array(); + + $current_group_id = -1; + if (count($current) != 0){ + $current_group_id = $current[0]["group_id"]; + } foreach ($previous as $item){ 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){ 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){ 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); diff --git a/application/models/Schedule.php b/application/models/Schedule.php index 5c76d3dc4..f6e890d72 100644 --- a/application/models/Schedule.php +++ b/application/models/Schedule.php @@ -479,14 +479,15 @@ class Schedule { public static function GetPreviousItems($timeNow, $prevCount = 1){ 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" - ." FROM $CC_CONFIG[scheduleTable] st, $CC_CONFIG[filesTable] ft, $CC_CONFIG[playListTable] pt, $CC_CONFIG[showSchedule] sst, $CC_CONFIG[showDays] sdt" + $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, $CC_CONFIG[showTable] showt" ." 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.file_id = ft.id" ." AND st.group_id = sst.group_id" ." AND sdt.show_id = sst.show_id" + ." AND showt.id = sst.show_id" ." ORDER BY st.starts DESC" ." LIMIT $prevCount"; $rows = $CC_DBC->GetAll($sql); @@ -496,29 +497,31 @@ class Schedule { public static function GetCurrentlyPlaying($timeNow){ 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" + ."$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'" ." AND st.ends > TIMESTAMP '$timeNow'" ." AND st.playlist_id = pt.id" ." AND st.file_id = ft.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); return $rows; } public static function GetNextItems($timeNow, $nextCount = 1) { 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" - ." FROM $CC_CONFIG[scheduleTable] st, $CC_CONFIG[filesTable] ft, $CC_CONFIG[playListTable] pt, $CC_CONFIG[showSchedule] sst, $CC_CONFIG[showDays] sdt" + $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, $CC_CONFIG[showTable] showt" ." WHERE st.starts > TIMESTAMP '$timeNow'" ." AND st.ends < (TIMESTAMP '$timeNow' + INTERVAL '24 hours')" ." AND st.playlist_id = pt.id" ." AND st.file_id = ft.id" ." AND st.group_id = sst.group_id" ." AND sdt.show_id = sst.show_id" + ." AND showt.id = sst.show_id" ." ORDER BY st.starts" ." LIMIT $nextCount"; $rows = $CC_DBC->GetAll($sql); diff --git a/public/js/playlist/nowplayingdatagrid.js b/public/js/playlist/nowplayingdatagrid.js index 6f2689edb..b94aa54ee 100644 --- a/public/js/playlist/nowplayingdatagrid.js +++ b/public/js/playlist/nowplayingdatagrid.js @@ -62,12 +62,12 @@ function createDataGrid(){ "aaData": datagridData.rows, "aoColumns": datagridData.columnHeaders, "fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) { - if (aData[0] == "p"){ - //$(nRow).attr("style", "background-color:blue;"); - } else if (aData[0] == "c"){ - $(nRow).attr("style", "background-color:#61B329;"); - } else if (aData[0] == "n"){ - } + if (aData[aData.length-2] != ""){ + $(nRow).attr("style", "background-color:#166622"); + } + + if (aData[0] == "c") + $(nRow).attr("style", "background-color:#61B329"); return nRow; } } );