-changes to now playing bar

This commit is contained in:
mkonecny 2011-01-24 19:19:51 -05:00
parent 5173674714
commit c8b7cffdc6
9 changed files with 200 additions and 110 deletions

View file

@ -53,6 +53,8 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
$view = $this->getResource('view');
$view->headScript()->appendFile('/js/libs/jquery-1.4.4.min.js','text/javascript');
$view->headScript()->appendFile('/js/libs/jquery-ui-1.8.8.custom.min.js','text/javascript');
$view->headScript()->appendFile('/js/progressbar/jquery.progressbar.min.js','text/javascript');
$view->headScript()->appendFile('/js/playlist/playlist.js','text/javascript');
}
}

View file

@ -11,14 +11,13 @@ class NowplayingController extends Zend_Controller_Action
public function indexAction()
{
$this->view->headScript()->appendFile('/js/playlist/playlist.js','text/javascript');
$this->view->headScript()->appendFile('/js/datatables/js/jquery.dataTables.min.js','text/javascript');
$this->view->headScript()->appendFile('/js/progressbar/jquery.progressbar.min.js','text/javascript');
$this->view->headLink()->appendStylesheet('/css/datatables/css/demo_page.css');
$this->view->headLink()->appendStylesheet('/css/datatables/css/demo_table.css');
$this->_helper->viewRenderer->setResponseSegment('nowplaying');
//$this->_helper->viewRenderer->setResponseSegment('nowplaying');
}
public function getDataGridDataAction()

View file

@ -9,7 +9,7 @@
</head>
<body>
<div id="nowplayingbar"><?php echo $this->layout()->nowplaying ?></div>
<div id="nowplayingbar"><?= $this->partial('partialviews/header.phtml') ?></div>
<div id="nav"><?php echo $this->navigation()->menu()->setRenderInvisible(true) ?></div>
<div id="content"><?php echo $this->layout()->content ?></div>

View file

@ -21,14 +21,14 @@ class Application_Model_Nowplaying
$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"],
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 ($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"));
$item["album_title"], "x" , "y"));
}
foreach ($next as $item){

View file

@ -502,9 +502,10 @@ class Schedule {
public static function GetNextItems($timeNow, $nextCount = 1) {
global $CC_CONFIG, $CC_DBC;
$sql = "SELECT * FROM $CC_CONFIG[scheduleTable] st, $CC_CONFIG[filesTable] ft"
$sql = "SELECT *, pt.name as playlistName FROM $CC_CONFIG[scheduleTable] st, $CC_CONFIG[filesTable] ft, $CC_CONFIG[playListTable] pt"
." WHERE (st.starts > TIMESTAMP '$timeNow')"
." AND (st.file_id = ft.id)"
." AND (st.playlist_id = pt.id)"
." ORDER BY st.starts"
." LIMIT $nextCount";
$rows = $CC_DBC->GetAll($sql);

View file

@ -1,29 +1,42 @@
<div id='col0' style='float:left; width: 10%; height: 100%;'>
<div>Listen</div>
<div>Volume</div>
</div>
<div id='col1' style='float:left; width: 25%; height: 100%;'>
<div>Show: <span id='show'></span></div>
<div>Playlist: <span id='playlist'></span></div>
<div>Host: <span id='host'></span></div>
</div>
<div id='col2' style='float:left; width: 30%; height: 100%;'>
<div>Previous: <span id='previous'></span></div>
<div>Current: <span id='current'></span></div>
<div>Upcoming: <span id='next'></span></div>
</div>
<div id='list0' style='float:left; width: 35%; height: 100%;'></div>
<div>Start: <span id='start'></span></div>
<div>End: <span id='end'></span></div>
<div><span id='progressbar'></span> <span id='songposition'></span> | <span id='songlength'></span></div>
</div>
<div id='demo'></div>
<script>
function getDateText(obj){
var str = obj.aData[ obj.iDataColumn ];
if (str.indexOf(" ") != -1){
return changeTimePrecision(str.substring(0, str.indexOf(" ")));
}
return str;
}
function getTimeText(obj){
var str = obj.aData[ obj.iDataColumn ];
if (str.indexOf(" ") != -1){
return changeTimePrecision(str.substring(str.indexOf(" ")+1));
}
return str;
}
function changeTimePrecisionInit(obj){
var str = obj.aData[ obj.iDataColumn ];
return changeTimePrecision(str);
}
function changeTimePrecision(str){
if (str.indexOf(".") != -1){
if (str.length - str.indexOf(".") > 2)
var extraLength = str.length - str.indexOf(".") -3;
return str.substring(0, str.length - extraLength);
}
return str;
}
function createDataGrid(obj){
obj.columnHeaders[0]["fnRender"] = getDateText;
obj.columnHeaders[1]["fnRender"] = getTimeText;
obj.columnHeaders[2]["fnRender"] = getTimeText;
obj.columnHeaders[3]["fnRender"] = changeTimePrecisionInit;
$('#demo').html( '<table cellpadding="0" cellspacing="0" border="0" class="display" id="example"></table>' );
$('#example').dataTable( {
"bSort" : false,
@ -38,15 +51,12 @@ function createDataGrid(obj){
function init2(){
$.ajax({ url: "/Nowplaying/get-data-grid-data/format/json", dataType:"json", success:function(data){
//alert(data);
createDataGrid(data.entries);
}});
//setTimeout(init2, 5000);
}
$(document).ready(function() {
//initialize the playlist bar in the included playlist.js
init("nowplayingbar");
init2();
});
</script>

View file

@ -0,0 +1,42 @@
<div id='col0' style='float:left; width: 10%; height: 100%;'>
<div><a href="Schedule" onClick="return popup(this)">Listen</a></div>
</div>
<div id='col1' style='float:left; width: 25%; height: 100%;'>
<div>Show: <span id='show'></span></div>
<div>Playlist: <span id='playlist'></span></div>
<div>Host: <span id='host'></span></div>
</div>
<div id='col2' style='float:left; width: 30%; height: 100%;'>
<div>Previous: <span id='previous'></span></div>
<div>Current: <span id='current'></span></div>
<div>Upcoming: <span id='next'></span></div>
</div>
<div id='list0' style='float:left; width: 35%; height: 100%;'></div>
<div>Start: <span id='start'></span></div>
<div>End: <span id='end'></span></div>
<div><span id='progressbar'></span> <span id='songposition'></span> | <span id='songlength'></span></div>
</div>
<script type="text/javascript">
function popup(mylink){
if (!window.focus)
return true;
var href;
if (typeof(mylink) == 'string')
href=mylink;
else
href=mylink.href;
window.open(href, "player", 'width=400,height=200,scrollbars=yes');
return false;
}
</script>
<script type="text/javascript">
$(document).ready(function() {
//initialize the playlist bar in the included playlist.js
init("nowplayingbar");
});
</script>