diff --git a/application/configs/conf.php b/application/configs/conf.php index 8f077ab81..0c3081d38 100644 --- a/application/configs/conf.php +++ b/application/configs/conf.php @@ -138,6 +138,8 @@ $CC_CONFIG['prefTable'] = $CC_CONFIG['tblNamePrefix'].'pref'; $CC_CONFIG['scheduleTable'] = $CC_CONFIG['tblNamePrefix'].'schedule'; $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['playListSequence'] = $CC_CONFIG['playListTable'].'_id'; $CC_CONFIG['filesSequence'] = $CC_CONFIG['filesTable'].'_id'; diff --git a/application/controllers/plugins/Acl_plugin.php b/application/controllers/plugins/Acl_plugin.php index 2587d2501..28d944435 100644 --- a/application/controllers/plugins/Acl_plugin.php +++ b/application/controllers/plugins/Acl_plugin.php @@ -110,8 +110,11 @@ class Zend_Controller_Plugin_Acl extends Zend_Controller_Plugin_Abstract public function preDispatch(Zend_Controller_Request_Abstract $request) { $controller = strtolower($request->getControllerName()); - - if (!Zend_Auth::getInstance()->hasIdentity()){ + + if ($controller == 'api'){ + $this->setRoleName("G"); + + } else if (!Zend_Auth::getInstance()->hasIdentity()){ if ($controller !== 'login') { diff --git a/application/models/Nowplaying.php b/application/models/Nowplaying.php index 759bbb0d7..5266e5284 100644 --- a/application/models/Nowplaying.php +++ b/application/models/Nowplaying.php @@ -23,18 +23,18 @@ class Application_Model_Nowplaying 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["playlistname"])); + $item["album_title"], "x" , $item["name"])); } 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["playlistname"])); + $item["album_title"], "x" , $item["name"])); } 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["playlistname"])); + $item["album_title"], "x" , $item["name"])); } return array("columnHeaders"=>$columnHeaders, "rows"=>$rows); diff --git a/application/models/Schedule.php b/application/models/Schedule.php index 52d72337f..76adbaa73 100644 --- a/application/models/Schedule.php +++ b/application/models/Schedule.php @@ -479,10 +479,13 @@ class Schedule { public static function GetPreviousItems($timeNow, $prevCount = 1){ global $CC_CONFIG, $CC_DBC; - $sql = "SELECT *, pt.name as playlistname FROM $CC_CONFIG[scheduleTable] st, $CC_CONFIG[filesTable] ft, $CC_CONFIG[playListTable] pt" + $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" ." WHERE (st.ends < TIMESTAMP '$timeNow')" - ." AND (st.file_id = ft.id)" ." 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)" ." ORDER BY st.starts DESC" ." LIMIT $prevCount"; $rows = $CC_DBC->GetAll($sql); @@ -492,21 +495,28 @@ class Schedule { 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" + $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" ." WHERE (st.starts < TIMESTAMP '$timeNow')" ." AND (st.ends > TIMESTAMP '$timeNow')" ." 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 (sdt.show_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 as playlistname FROM $CC_CONFIG[scheduleTable] st, $CC_CONFIG[filesTable] ft, $CC_CONFIG[playListTable] pt" + $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" ." WHERE (st.starts > TIMESTAMP '$timeNow')" - ." AND (st.file_id = ft.id)" ." 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)" ." ORDER BY st.starts" ." LIMIT $nextCount"; $rows = $CC_DBC->GetAll($sql); diff --git a/application/views/scripts/nowplaying/index.phtml b/application/views/scripts/nowplaying/index.phtml index 7ca964c38..cc05408eb 100644 --- a/application/views/scripts/nowplaying/index.phtml +++ b/application/views/scripts/nowplaying/index.phtml @@ -49,10 +49,10 @@ function notifySongEnd(){ function createDataGrid(){ - datagridData.columnHeaders[0]["fnRender"] = getDateText; - datagridData.columnHeaders[1]["fnRender"] = getTimeText; + datagridData.columnHeaders[1]["fnRender"] = getDateText; datagridData.columnHeaders[2]["fnRender"] = getTimeText; - datagridData.columnHeaders[3]["fnRender"] = changeTimePrecisionInit; + datagridData.columnHeaders[3]["fnRender"] = getTimeText; + datagridData.columnHeaders[4]["fnRender"] = changeTimePrecisionInit; $('#demo').html( '