-begin adding datagrids
This commit is contained in:
parent
8d5aea0d14
commit
6553663051
249 changed files with 31982 additions and 11 deletions
|
@ -18,6 +18,7 @@ $ccAcl->add(new Zend_Acl_Resource('library'))
|
|||
->add(new Zend_Acl_Resource('plupload'))
|
||||
->add(new Zend_Acl_Resource('schedule'))
|
||||
->add(new Zend_Acl_Resource('api'))
|
||||
->add(new Zend_Acl_Resource('nowplaying'))
|
||||
->add(new Zend_Acl_Resource('search'));
|
||||
|
||||
/** Creating permissions */
|
||||
|
@ -25,6 +26,7 @@ $ccAcl->allow('guest', 'index')
|
|||
->allow('guest', 'login')
|
||||
->allow('guest', 'error')
|
||||
->allow('guest', 'library')
|
||||
->allow('guest', 'nowplaying')
|
||||
->allow('guest', 'search')
|
||||
->allow('guest', 'api')
|
||||
->allow('host', 'plupload')
|
||||
|
|
|
@ -48,8 +48,8 @@ $pages = array(
|
|||
array(
|
||||
'label' => 'Now Playing',
|
||||
'module' => 'default',
|
||||
'controller' => 'Schedule',
|
||||
'action' => 'view-playlist'
|
||||
'controller' => 'Nowplaying',
|
||||
'action' => 'index'
|
||||
),
|
||||
array(
|
||||
'label' => 'Schedule',
|
||||
|
|
35
application/controllers/NowplayingController.php
Normal file
35
application/controllers/NowplayingController.php
Normal file
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
class NowplayingController extends Zend_Controller_Action
|
||||
{
|
||||
|
||||
public function init()
|
||||
{
|
||||
$ajaxContext = $this->_helper->getHelper('AjaxContext');
|
||||
$ajaxContext->addActionContext('get-data-grid-data', 'json')->initContext();
|
||||
}
|
||||
|
||||
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');
|
||||
}
|
||||
|
||||
public function getDataGridDataAction()
|
||||
{
|
||||
$this->view->entries = Application_Model_Nowplaying::GetDataGridData();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -193,13 +193,18 @@ class ScheduleController extends Zend_Controller_Action
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
public function viewPlaylistAction()
|
||||
{
|
||||
$this->view->headScript()->appendFile('/js/playlist/playlist.js','text/javascript');
|
||||
$this->view->headScript()->appendFile('/js/progressbar/jquery.progressbar.min.js','text/javascript');
|
||||
|
||||
$this->_helper->viewRenderer->setResponseSegment('nowplaying');
|
||||
|
||||
this->_helper->actionStack('', '');
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
public function getCurrentPlaylistAction()
|
||||
{
|
||||
|
|
43
application/models/Nowplaying.php
Normal file
43
application/models/Nowplaying.php
Normal file
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
|
||||
class Application_Model_Nowplaying
|
||||
{
|
||||
|
||||
public static function GetDataGridData(){
|
||||
$timeNow = Schedule::GetSchedulerTime();
|
||||
$previous = Schedule::GetPreviousItems($timeNow, 1);
|
||||
$current = Schedule::GetCurrentlyPlaying($timeNow);
|
||||
$next = Schedule::GetNextItems($timeNow, 10);
|
||||
|
||||
$columnHeaders = array(array("sTitle"=>"Date"),
|
||||
array("sTitle"=>"Start"),
|
||||
array("sTitle"=>"End"),
|
||||
array("sTitle"=>"Duration"),
|
||||
array("sTitle"=>"Song"),
|
||||
array("sTitle"=>"Artist"),
|
||||
array("sTitle"=>"Album"),
|
||||
array("sTitle"=>"Creator"),
|
||||
array("sTitle"=>"Playlist"));
|
||||
$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"],
|
||||
$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"));
|
||||
}
|
||||
|
||||
foreach ($next 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"));
|
||||
}
|
||||
|
||||
return array("columnHeaders"=>$columnHeaders, "rows"=>$rows);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -477,7 +477,7 @@ class Schedule {
|
|||
"next"=>Schedule::GetNextItems($timeNow));
|
||||
}
|
||||
|
||||
private static function GetPreviousItems($timeNow, $prevCount = 1){
|
||||
public static function GetPreviousItems($timeNow, $prevCount = 1){
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
$sql = "SELECT * FROM $CC_CONFIG[scheduleTable] st, $CC_CONFIG[filesTable] ft"
|
||||
." WHERE (st.ends < TIMESTAMP '$timeNow')"
|
||||
|
@ -488,7 +488,7 @@ class Schedule {
|
|||
return $rows;
|
||||
}
|
||||
|
||||
private static function GetCurrentlyPlaying($timeNow){
|
||||
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"
|
||||
|
@ -500,7 +500,7 @@ class Schedule {
|
|||
return $rows;
|
||||
}
|
||||
|
||||
private static function GetNextItems($timeNow, $nextCount = 1) {
|
||||
public static function GetNextItems($timeNow, $nextCount = 1) {
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
$sql = "SELECT * FROM $CC_CONFIG[scheduleTable] st, $CC_CONFIG[filesTable] ft"
|
||||
." WHERE (st.starts > TIMESTAMP '$timeNow')"
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
<?php
|
||||
echo $this->entries;
|
||||
?>
|
52
application/views/scripts/nowplaying/index.phtml
Normal file
52
application/views/scripts/nowplaying/index.phtml
Normal file
|
@ -0,0 +1,52 @@
|
|||
<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 createDataGrid(obj){
|
||||
$('#demo').html( '<table cellpadding="0" cellspacing="0" border="0" class="display" id="example"></table>' );
|
||||
$('#example').dataTable( {
|
||||
"bSort" : false,
|
||||
"bJQueryUI": true,
|
||||
"bFilter": true,
|
||||
"bInfo": false,
|
||||
"bLengthChange": false,
|
||||
"aaData": obj.rows,
|
||||
"aoColumns": obj.columnHeaders
|
||||
} );
|
||||
}
|
||||
|
||||
function init2(){
|
||||
$.ajax({ url: "/Nowplaying/get-data-grid-data/format/json", dataType:"json", success:function(data){
|
||||
//alert(data);
|
||||
createDataGrid(data.entries);
|
||||
}});
|
||||
}
|
||||
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
//initialize the playlist bar in the included playlist.js
|
||||
init("nowplayingbar");
|
||||
});
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue