diff --git a/.zfproject.xml b/.zfproject.xml
index c93acc463..d67219e7d 100644
--- a/.zfproject.xml
+++ b/.zfproject.xml
@@ -76,6 +76,7 @@
+
@@ -84,6 +85,7 @@
+
@@ -287,6 +289,12 @@
+
+
+
+
+
+
diff --git a/application/configs/navigation.php b/application/configs/navigation.php
index 56cd97696..1fc2ada39 100644
--- a/application/configs/navigation.php
+++ b/application/configs/navigation.php
@@ -10,10 +10,23 @@
$pages = array(
array(
'label' => 'Now Playing',
- 'module' => 'Nowplaying',
- 'controller' => 'index',
- 'action' => 'index',
- 'order' => -100 //make sure home is the first page
+ 'uri' => 'javascript:void(null)',
+ 'pages' => array(
+ array(
+ 'label' => 'Current',
+ 'module' => 'default',
+ 'controller' => 'Nowplaying',
+ 'action' => 'index',
+ 'resource' => 'Nowplaying'
+ ),
+ array(
+ 'label' => 'Daily View',
+ 'module' => 'default',
+ 'controller' => 'Nowplaying',
+ 'action' => 'day-view',
+ 'resource' => 'Nowplaying'
+ )
+ )
),
array(
'label' => 'Schedule',
diff --git a/application/controllers/NowplayingController.php b/application/controllers/NowplayingController.php
index 21741574b..4545787d4 100644
--- a/application/controllers/NowplayingController.php
+++ b/application/controllers/NowplayingController.php
@@ -6,27 +6,38 @@ class NowplayingController extends Zend_Controller_Action
public function init()
{
$ajaxContext = $this->_helper->getHelper('AjaxContext');
- $ajaxContext->addActionContext('get-data-grid-data', 'json')
- ->initContext();
+ $ajaxContext->addActionContext('get-data-grid-data', 'json')
+ ->initContext();
}
public function indexAction()
{
$this->view->headScript()->appendFile('/js/datatables/js/jquery.dataTables.min.js','text/javascript');
$this->view->headScript()->appendFile('/js/playlist/nowplayingdatagrid.js','text/javascript');
+ $this->view->headScript()->appendFile('/js/playlist/nowview.js','text/javascript');
}
public function getDataGridDataAction()
{
$viewType = $this->_request->getParam('view');
- $this->view->entries = Application_Model_Nowplaying::GetDataGridData($viewType);
+ $dateString = $this->_request->getParam('date');
+ $this->view->entries = Application_Model_Nowplaying::GetDataGridData($viewType, $dateString);
}
public function livestreamAction()
{
//use bare bones layout (no header bar or menu)
- $this->_helper->layout->setLayout('bare');
+ $this->_helper->layout->setLayout('bare');
}
+
+ public function dayViewAction()
+ {
+ $this->view->headScript()->appendFile('/js/datatables/js/jquery.dataTables.min.js','text/javascript');
+ $this->view->headScript()->appendFile('/js/playlist/nowplayingdatagrid.js','text/javascript');
+ $this->view->headScript()->appendFile('/js/playlist/dayview.js','text/javascript');
+ }
+
+
}
@@ -35,3 +46,5 @@ class NowplayingController extends Zend_Controller_Action
+
+
diff --git a/application/controllers/UserController.php b/application/controllers/UserController.php
index 9700f2077..8d8110897 100644
--- a/application/controllers/UserController.php
+++ b/application/controllers/UserController.php
@@ -5,43 +5,54 @@ class UserController extends Zend_Controller_Action
public function init()
{
- $ajaxContext = $this->_helper->getHelper('AjaxContext');
- $ajaxContext->addActionContext('get-hosts', 'json')
- ->initContext();
+ $ajaxContext = $this->_helper->getHelper('AjaxContext');
+ $ajaxContext->addActionContext('get-hosts', 'json')
+ ->addActionContext('get-user-data-table-info', 'json')
+ ->initContext();
}
public function indexAction()
{
-
}
public function addUserAction()
- {
+ {
+ $this->view->headScript()->appendFile('/js/datatables/js/jquery.dataTables.js','text/javascript');
+ $this->view->headScript()->appendFile('/js/airtime/user/user.js','text/javascript');
$request = $this->getRequest();
- $form = new Application_Form_AddUser();
-
- if ($request->isPost()) {
- if ($form->isValid($request->getPost())) {
-
- $formdata = $form->getValues();
- User::addUser($formdata);
- $form->reset();
- }
- }
-
- $this->view->form = $form;
+ $form = new Application_Form_AddUser();
+
+ if ($request->isPost()) {
+ if ($form->isValid($request->getPost())) {
+
+ $formdata = $form->getValues();
+ User::addUser($formdata);
+ $form->reset();
+ }
+ }
+
+ $this->view->form = $form;
}
public function getHostsAction()
{
- $search = $this->_getParam('term');
-
- $this->view->hosts = User::getHosts($search);
+ $search = $this->_getParam('term');
+
+ $this->view->hosts = User::getHosts($search);
}
+ public function getUserDataTableInfoAction()
+ {
+ $post = $this->getRequest()->getPost();
+ $users = User::getUsersDataTablesInfo($post);
+
+ die(json_encode($users));
+ }
}
+
+
diff --git a/application/forms/AddUser.php b/application/forms/AddUser.php
index 5fa76dcdb..20a6b5997 100644
--- a/application/forms/AddUser.php
+++ b/application/forms/AddUser.php
@@ -8,47 +8,54 @@ class Application_Form_AddUser extends Zend_Form
// Add login element
$this->addElement('text', 'login', array(
'label' => 'Username:',
+ 'class' => 'input_text',
'required' => true,
'filters' => array('StringTrim'),
'validators' => array('NotEmpty')
));
- // Add password element
+ // Add password element
$this->addElement('text', 'password', array(
'label' => 'Password:',
+ 'class' => 'input_text',
'required' => true,
'filters' => array('StringTrim'),
'validators' => array('NotEmpty')
));
- // Add first name element
+ // Add first name element
$this->addElement('text', 'first_name', array(
'label' => 'Firstname:',
+ 'class' => 'input_text',
'required' => true,
'filters' => array('StringTrim'),
'validators' => array('NotEmpty')
));
- // Add last name element
+ // Add last name element
$this->addElement('text', 'last_name', array(
'label' => 'Lastname:',
+ 'class' => 'input_text',
'required' => true,
'filters' => array('StringTrim'),
'validators' => array('NotEmpty')
));
- //Add type select
- $this->addElement('select', 'type', array(
+ //Add type select
+ $this->addElement('select', 'type', array(
'required' => true,
+ 'class' => 'input_select',
+ 'style' => 'width: 40%',
'multiOptions' => array(
- "A" => "admin",
+ "A" => "admin",
"H" => "host",
- "G" => "guest",
+ "G" => "guest",
),
));
- // Add the submit button
+ // Add the submit button
$this->addElement('submit', 'submit', array(
+ 'class' => 'ui-button ui-state-default right-floated',
'ignore' => true,
'label' => 'Submit',
));
diff --git a/application/models/DateHelper.php b/application/models/DateHelper.php
index 6dff44715..6c44dd055 100644
--- a/application/models/DateHelper.php
+++ b/application/models/DateHelper.php
@@ -12,6 +12,10 @@ class Application_Model_DateHelper
return date("Y-m-d H:i:s", $this->_timestamp);
}
+ function setDate($dateString){
+ $this->_timestamp = strtotime($dateString);
+ }
+
function getNowDayStartDiff(){
$dayStartTS = strtotime(date("Y-m-d", $this->_timestamp));
return $this->_timestamp - $dayStartTS;
diff --git a/application/models/Nowplaying.php b/application/models/Nowplaying.php
index 9aeb549d2..02dd6837c 100644
--- a/application/models/Nowplaying.php
+++ b/application/models/Nowplaying.php
@@ -42,13 +42,13 @@ class Application_Model_Nowplaying
return $rows;
}
- public static function GetDataGridData($viewType){
-
- $date = Schedule::GetSchedulerTime();
- $timeNow = $date->getDate();
-
+ public static function GetDataGridData($viewType, $dateString){
+
if ($viewType == "now"){
+ $date = new Application_Model_DateHelper;
+ $timeNow = $date->getDate();
+
/* When do "ORDER BY x DESC LIMIT 5" to ensure that we get the last 5 previously scheduled items.
* However using DESC, puts our scheduled items in reverse order, so we need to reverse it again
* with array_reverse.
@@ -58,6 +58,10 @@ class Application_Model_Nowplaying
$next = Schedule::Get_Scheduled_Item_Data($timeNow, 1, 10, "24 hours");
} else {
+ $date = new Application_Model_DateHelper;
+ $timeNow = $date->setDate($dateString);
+ $timeNow = $date->getDate();
+
$previous = array_reverse(Schedule::Get_Scheduled_Item_Data($timeNow, -1, "ALL", $date->getNowDayStartDiff()." seconds"));
$current = Schedule::Get_Scheduled_Item_Data($timeNow, 0);
$next = Schedule::Get_Scheduled_Item_Data($timeNow, 1, "ALL", $date->getNowDayEndDiff()." seconds");
diff --git a/application/models/Schedule.php b/application/models/Schedule.php
index 1383f4b23..d1f9830be 100644
--- a/application/models/Schedule.php
+++ b/application/models/Schedule.php
@@ -419,21 +419,6 @@ class Schedule {
return $rows;
}
-
- /**
- * Returns the date of the server in the format
- * "YYYY-MM-DD HH:mm:SS".
- *
- * Note: currently assuming that Web Server and Scheduler are on the
- * same host.
- *
- * @return date Current server time.
- */
- public static function GetSchedulerTime() {
- $date = new Application_Model_DateHelper;
- return $date;
- }
-
/**
* Returns data related to the scheduled items.
*
@@ -447,7 +432,7 @@ class Schedule {
return array();
}
- $date = Schedule::GetSchedulerTime();
+ $date = new Application_Model_DateHelper;
$timeNow = $date->getDate();
return array("env"=>APPLICATION_ENV,
"schedulerTime"=>gmdate("Y-m-d H:i:s"),
diff --git a/application/models/StoredFile.php b/application/models/StoredFile.php
index a5c730b88..0d2122eb8 100644
--- a/application/models/StoredFile.php
+++ b/application/models/StoredFile.php
@@ -1797,7 +1797,7 @@ class StoredFile {
return StoredFile::searchFiles($fromTable, $datatables);
}
- private static function searchFiles($fromTable, $data)
+ public static function searchFiles($fromTable, $data)
{
global $CC_CONFIG, $CC_DBC;
diff --git a/application/models/Users.php b/application/models/Users.php
index bcc8c5a8b..62a40e440 100644
--- a/application/models/Users.php
+++ b/application/models/Users.php
@@ -71,5 +71,11 @@ class User {
public static function getHosts($search=NULL) {
return User::getUsers(array('H', 'A'), $search);
}
+
+ public static function getUsersDataTablesInfo($datatables_post) {
+
+ $fromTable = "cc_subjs";
+ return StoredFile::searchFiles($fromTable, $datatables_post);
+ }
}
diff --git a/application/views/scripts/nowplaying/day-view.phtml b/application/views/scripts/nowplaying/day-view.phtml
new file mode 100644
index 000000000..3f23200ab
--- /dev/null
+++ b/application/views/scripts/nowplaying/day-view.phtml
@@ -0,0 +1,2 @@
+
+
diff --git a/application/views/scripts/nowplaying/index.phtml b/application/views/scripts/nowplaying/index.phtml
index b7faa8336..11d775d98 100644
--- a/application/views/scripts/nowplaying/index.phtml
+++ b/application/views/scripts/nowplaying/index.phtml
@@ -1,2 +1 @@
-
diff --git a/application/views/scripts/user/add-user.phtml b/application/views/scripts/user/add-user.phtml
index 161c48f78..62822df4a 100644
--- a/application/views/scripts/user/add-user.phtml
+++ b/application/views/scripts/user/add-user.phtml
@@ -1,3 +1,126 @@
form;
+//echo $this->form;
+?>
+
+
+ Manage users
+
+
+
+
+
+
+
+ id |
+ Name |
+ Role |
+ Delete |
+
+
+
+
+
+
+
+
+
+
+
diff --git a/application/views/scripts/user/get-user-data-table-info.phtml b/application/views/scripts/user/get-user-data-table-info.phtml
new file mode 100644
index 000000000..64b099bc2
--- /dev/null
+++ b/application/views/scripts/user/get-user-data-table-info.phtml
@@ -0,0 +1 @@
+
View script for controller User and script/action name getUserDataTableInfo
\ No newline at end of file
diff --git a/public/css/styles.css b/public/css/styles.css
index 9cae1ced0..4af5bf8ea 100644
--- a/public/css/styles.css
+++ b/public/css/styles.css
@@ -762,7 +762,7 @@ dt.block-display, dd.block-display {
width:98%
}
div.ui-datepicker {
- font-size: 75%;
+ /*font-size: 75%;*/
}
@@ -1059,4 +1059,61 @@ h2#scheduled_playlist_name span {
button, input {
margin-top:0;
margin-bottom:0;
+}
+
+.user-management {
+ width:810px;
+}
+.user-data {
+ float:left;
+ width:420px;
+}
+.user-list-wrapper {
+ float:left;
+ width:380px;
+ margin-right:10px;
+}
+
+.user-management div.user-list-wrapper .ui-widget-header:first-child {
+ background: none repeat scroll 0 0 transparent;
+ border-width: 0 0 1px;
+ color: #444444;
+ font-weight: bold;
+}
+.user-list-wrapper .ui-widget-header:first-child .dataTables_filter {
+ margin:0;
+}
+.user-management h2 {
+ font-size: 1.7em;
+ padding-bottom: 16px;
+}
+.user-management .dataTables_filter .auto-search {
+ width: 378px;
+}
+.user-data.simple-formblock dd {
+ width: 73%;
+}
+
+.user-data fieldset {
+ margin-bottom:8px;
+}
+.user-data fieldset:last-child {
+ margin-bottom:0;
+}
+
+.user-list-wrapper .button-holder {
+ padding:8px 0;
+ text-align:right;
+}
+.user-list-wrapper .button-holder .ui-button {
+ margin:0;
+}
+.ui-widget-content .user-list-wrapper .ui-icon.ui-icon-closethick {
+ background-image:url(redmond/images/ui-icons_666666_256x240.png);
+ cursor:pointer;
+ float:right;
+ margin-right:5px;
+}
+.ui-widget-content .user-list-wrapper .ui-icon.ui-icon-closethick:hover {
+ background-image:url(redmond/images/ui-icons_ff5d1a_256x240.png);
}
\ No newline at end of file
diff --git a/public/js/airtime/user/user.js b/public/js/airtime/user/user.js
new file mode 100644
index 000000000..7db393244
--- /dev/null
+++ b/public/js/airtime/user/user.js
@@ -0,0 +1,26 @@
+$(document).ready(function() {
+ $('#users_datatable').dataTable( {
+ "bProcessing": true,
+ "bServerSide": true,
+ "sAjaxSource": "/User/get-user-data-table-info/format/json",
+ "fnServerData": function ( sSource, aoData, fnCallback ) {
+ $.ajax( {
+ "dataType": 'json',
+ "type": "POST",
+ "url": sSource,
+ "data": aoData,
+ "success": fnCallback
+ } );
+ },
+ "aoColumns": [
+ /* Id */ { "sName": "id", "bSearchable": false, "bVisible": false },
+ /* user name */ { "sName": "login" },
+ /* user type */ { "sName": "type", "bSearchable": false },
+ /* del button */ { "sName": "first_name", "bSearchable": false, "bSortable": false}
+ ],
+ "bJQueryUI": true,
+ "bAutoWidth": false,
+ "bLengthChange": false,
+ //"bFilter": false
+ });
+});
diff --git a/public/js/playlist/dayview.js b/public/js/playlist/dayview.js
new file mode 100644
index 000000000..7deba409e
--- /dev/null
+++ b/public/js/playlist/dayview.js
@@ -0,0 +1 @@
+var viewType = "day";
diff --git a/public/js/playlist/nowplayingdatagrid.js b/public/js/playlist/nowplayingdatagrid.js
index 6dbe741a6..3467c5751 100644
--- a/public/js/playlist/nowplayingdatagrid.js
+++ b/public/js/playlist/nowplayingdatagrid.js
@@ -99,7 +99,6 @@ function createDataGrid(){
}
-var viewType = "now" //"day";
var mainLoopRegistered = false;
function setViewType(type){
@@ -111,8 +110,29 @@ function setViewType(type){
init2();
}
+function getDateString(){
+ var date0 = $("#datepicker").datepicker("getDate");
+ return (date0.getFullYear() + "-" + date0.getMonth() + "-" + date0.getDate());
+}
+
+function getAJAXURL(){
+ var url = "/Nowplaying/get-data-grid-data/format/json/view/"+viewType;
+
+ if (viewType == "day"){
+ url += "/date/" + getDateString();
+ }
+
+ return url;
+}
+
function init2(){
- $.ajax({ url: "/Nowplaying/get-data-grid-data/format/json/view/" + viewType, dataType:"json", success:function(data){
+
+ if (!mainLoopRegistered){
+ setTimeout(init2, 5000);
+ mainLoopRegistered = true;
+ }
+
+ $.ajax({ url: getAJAXURL(), dataType:"json", success:function(data){
datagridData = data.entries;
createDataGrid();
}});
@@ -121,13 +141,14 @@ function init2(){
registered = true;
registerSongEndListener(notifySongEnd);
}
-
- if (!mainLoopRegistered){
- setTimeout(init2, 5000);
- mainLoopRegistered = true;
- }
}
$(document).ready(function() {
- init2();
+ if (viewType == "day"){
+ $("#datepicker").datepicker();
+ var date = new Date();
+ $("#datepicker").datepicker("setDate", date);
+ }
+
+ init2();
});
diff --git a/public/js/playlist/nowview.js b/public/js/playlist/nowview.js
new file mode 100644
index 000000000..410cd4957
--- /dev/null
+++ b/public/js/playlist/nowview.js
@@ -0,0 +1 @@
+var viewType = "now";