cc-2229-refactor-now-playing-code

-bug fixes
This commit is contained in:
mkonecny 2011-05-05 14:55:45 -04:00
parent 7010f2156e
commit 038f2e1c69
3 changed files with 19 additions and 11 deletions

View File

@ -11,10 +11,19 @@ class Application_Model_Nowplaying
$dataTablesRows = array();
$date = new DateHelper;
$timeNow = $date->getTimestamp();
foreach ($p_dbRows as $dbRow){
$dataTablesRows[] = array('a', $dbRow['show_starts'], $dbRow['show_starts'], $dbRow['show_ends'],
$status = ($dbRow['show_ends'] < $dbRow['item_ends']) ? "x" : "";
$type = "a";
$type .= ($dbRow['item_ends'] > $timeNow && $dbRow['item_starts'] <= $timeNow) ? "c" : "";
$dataTablesRows[] = array($type, $dbRow['show_starts'], $dbRow['item_starts'], $dbRow['item_ends'],
$dbRow['clip_length'], $dbRow['track_title'], $dbRow['artist_name'], $dbRow['album_title'],
$dbRow['playlist_name'], $dbRow['playlist_name'], $dbRow['show_name']);
$dbRow['playlist_name'], $dbRow['show_name'], $status);
}
return $dataTablesRows;

View File

@ -1649,7 +1649,8 @@ class ShowInstance {
."AND si.ends < TIMESTAMP '$p_timeNow' + INTERVAL '$p_end seconds') "
."OR (si.starts < TIMESTAMP '$p_timeNow' + INTERVAL '$p_end seconds' "
."AND si.ends > TIMESTAMP '$p_timeNow' + INTERVAL '$p_end seconds') "
.")";
.") "
." ORDER BY si.starts";
$rows = $CC_DBC->GetAll($sql);
return $rows;

View File

@ -55,6 +55,7 @@ function statusColumn(obj) {
if ( sReturn == "x" ) {
sReturn = '<img class="info-icon" src="/css/images/icon_overlap.png" width="51" height="15" alt="" />';
}
return sReturn;
}
@ -132,13 +133,10 @@ function createDataGrid(){
"bPaginate": false,
"aoColumns": columns,
"fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
if (aData[aData.length-2] == currentShowInstanceID)
$(nRow).addClass("playing-list");
if (aData[0] == "c")
//if (aData[aData.length-2] == currentShowInstanceID)
// $(nRow).addClass("playing-list");
if (aData[0].indexOf("c") != -1)
$(nRow).attr("class", "playing-song");
else if (aData[0] == "over"){
//$(nRow).attr("class", "over-booked-song");
}
return nRow;
},
"fnDrawCallback": function(oSettings){
@ -154,7 +152,7 @@ function createDataGrid(){
var iDisplayIndex = oSettings._iDisplayStart + i;
var sType = oSettings.aoData[ oSettings.aiDisplay[iDisplayIndex]]._aData[0];
if ( sType == "h" ){
if ( sType.indexOf("h") != -1 ){
//show header row found
var showName = oSettings.aoData[ oSettings.aiDisplay[iDisplayIndex]]._aData[1];
@ -168,7 +166,7 @@ function createDataGrid(){
nCell.innerHTML = showName + ": " + startTime + " - " + endTime;
nGroup.appendChild(nCell);
nTrs[i].parentNode.replaceChild(nGroup, nTrs[i]);
} else if ( sType == "g" ){
} else if ( sType.indexOf("g") != -1 ){
//gap row found
var gapTime = oSettings.aoData[ oSettings.aiDisplay[iDisplayIndex]]._aData[1];