-list view updated
This commit is contained in:
parent
50054befd6
commit
c0d5cc4809
|
@ -43,7 +43,8 @@ class Application_Model_Nowplaying
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetDataGridData($viewType, $dateString){
|
public static function GetDataGridData($viewType, $dateString){
|
||||||
|
|
||||||
|
//echo $dateString;
|
||||||
if ($viewType == "now"){
|
if ($viewType == "now"){
|
||||||
|
|
||||||
$date = new Application_Model_DateHelper;
|
$date = new Application_Model_DateHelper;
|
||||||
|
@ -57,9 +58,8 @@ class Application_Model_Nowplaying
|
||||||
$current = Schedule::Get_Scheduled_Item_Data($timeNow, 0);
|
$current = Schedule::Get_Scheduled_Item_Data($timeNow, 0);
|
||||||
$next = Schedule::Get_Scheduled_Item_Data($timeNow, 1, 10, "24 hours");
|
$next = Schedule::Get_Scheduled_Item_Data($timeNow, 1, 10, "24 hours");
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$date = new Application_Model_DateHelper;
|
$date = new Application_Model_DateHelper;
|
||||||
$timeNow = $date->setDate($dateString);
|
$date->setDate($dateString);
|
||||||
$timeNow = $date->getDate();
|
$timeNow = $date->getDate();
|
||||||
|
|
||||||
$previous = array_reverse(Schedule::Get_Scheduled_Item_Data($timeNow, -1, "ALL", $date->getNowDayStartDiff()." seconds"));
|
$previous = array_reverse(Schedule::Get_Scheduled_Item_Data($timeNow, -1, "ALL", $date->getNowDayStartDiff()." seconds"));
|
||||||
|
|
|
@ -7,9 +7,9 @@ class User {
|
||||||
public function __construct($userId)
|
public function __construct($userId)
|
||||||
{
|
{
|
||||||
if (strlen($userId)==0){
|
if (strlen($userId)==0){
|
||||||
$this->userInstance = $this->createUser();
|
$this->_userInstance = $this->createUser();
|
||||||
} else {
|
} else {
|
||||||
$this->userInstance = CcSubjsQuery::create()->findPK($userId);
|
$this->_userInstance = CcSubjsQuery::create()->findPK($userId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,81 +19,74 @@ class User {
|
||||||
|
|
||||||
public function isHost($showId) {
|
public function isHost($showId) {
|
||||||
$userId = $this->_userInstance->getDbId();
|
$userId = $this->_userInstance->getDbId();
|
||||||
return CcShowHostsQuery::create()->filterByDbShow($showId)->filterByDbHost($_userId)->count() > 0;
|
return CcShowHostsQuery::create()->filterByDbShow($showId)->filterByDbHost($userId)->count() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isAdmin() {
|
public function isAdmin() {
|
||||||
return $userInstance->getDbType() === 'A';
|
return $this->_userInstance->getDbType() === 'A';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setLogin($login){
|
public function setLogin($login){
|
||||||
$user = $this->userInstance;
|
$user = $this->_userInstance;
|
||||||
$user->setDbLogin($login);
|
$user->setDbLogin($login);
|
||||||
//$user->save();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setPassword($password){
|
public function setPassword($password){
|
||||||
$user = $this->userInstance;
|
$user = $this->_userInstance;
|
||||||
$user->setDbPass(md5($password));
|
$user->setDbPass(md5($password));
|
||||||
//$user->save();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setFirstName($firstName){
|
public function setFirstName($firstName){
|
||||||
$user = $this->userInstance;
|
$user = $this->_userInstance;
|
||||||
$user->setDbFirstName($firstName);
|
$user->setDbFirstName($firstName);
|
||||||
//$user->save();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setLastName($lastName){
|
public function setLastName($lastName){
|
||||||
$user = $this->userInstance;
|
$user = $this->_userInstance;
|
||||||
$user->setDbLastName($lastName);
|
$user->setDbLastName($lastName);
|
||||||
//$user->save();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setType($type){
|
public function setType($type){
|
||||||
$user = $this->userInstance;
|
$user = $this->_userInstance;
|
||||||
$user->setDbType($type);
|
$user->setDbType($type);
|
||||||
//$user->save();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLogin(){
|
public function getLogin(){
|
||||||
$user = $this->userInstance;
|
$user = $this->_userInstance;
|
||||||
return $user->getDbLogin();
|
return $user->getDbLogin();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPassword(){
|
public function getPassword(){
|
||||||
$user = $this->userInstance;
|
$user = $this->_userInstance;
|
||||||
return $user->getDbPass();
|
return $user->getDbPass();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getFirstName(){
|
public function getFirstName(){
|
||||||
$user = $this->userInstance;
|
$user = $this->_userInstance;
|
||||||
return $user->getDbFirstName();
|
return $user->getDbFirstName();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLastName(){
|
public function getLastName(){
|
||||||
$user = $this->userInstance;
|
$user = $this->_userInstance;
|
||||||
return $user->getDbLastName();
|
return $user->getDbLastName();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getType(){
|
public function getType(){
|
||||||
$user = $this->userInstance;
|
$user = $this->_userInstance;
|
||||||
return $user->getDbType();
|
return $user->getDbType();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function save(){
|
public function save(){
|
||||||
$this->userInstance->save();
|
$this->_userInstance->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function delete(){
|
public function delete(){
|
||||||
if (!$this->userInstance->isDeleted())
|
if (!$this->_userInstance->isDeleted())
|
||||||
$this->userInstance->delete();
|
$this->_userInstance->delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
private function createUser() {
|
private function createUser() {
|
||||||
$user = new CcSubjs();
|
$user = new CcSubjs();
|
||||||
//$user->save();
|
|
||||||
|
|
||||||
return $user;
|
return $user;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,17 +3,17 @@ var datagridData;
|
||||||
|
|
||||||
function getDateText(obj){
|
function getDateText(obj){
|
||||||
var str = obj.aData[ obj.iDataColumn ].toString();
|
var str = obj.aData[ obj.iDataColumn ].toString();
|
||||||
if (str.indexOf(" ") != -1){
|
datetime = str.split(" ");
|
||||||
return changeTimePrecision(str.substring(0, str.indexOf(" ")));
|
if (datetime.length == 2)
|
||||||
}
|
return datetime[0];
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getTimeText(obj){
|
function getTimeText(obj){
|
||||||
var str = obj.aData[ obj.iDataColumn ].toString();
|
var str = obj.aData[ obj.iDataColumn ].toString();
|
||||||
if (str.indexOf(" ") != -1){
|
datetime = str.split(" ");
|
||||||
return changeTimePrecision(str.substring(str.indexOf(" ")+1));
|
if (datetime.length == 2)
|
||||||
}
|
return changeTimePrecision(datetime[1]);
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,16 +23,16 @@ function changeTimePrecisionInit(obj){
|
||||||
}
|
}
|
||||||
|
|
||||||
function changeTimePrecision(str){
|
function changeTimePrecision(str){
|
||||||
if (str.indexOf(".") != -1){
|
|
||||||
if (str.length - str.indexOf(".") > 2)
|
var temp = str.split(".")
|
||||||
var extraLength = str.length - str.indexOf(".") -3;
|
if (temp.length == 2){
|
||||||
return str.substring(0, str.length - extraLength);
|
if (temp[1].length > 2)
|
||||||
}
|
return temp[0]+"."+temp[1].substr(0, 2);
|
||||||
return str;
|
}
|
||||||
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
function notifySongEnd(){
|
function notifySongEnd(){
|
||||||
//alert("length " + datagridData.rows.length);
|
|
||||||
for (var i=0; i<datagridData.rows.length; i++){
|
for (var i=0; i<datagridData.rows.length; i++){
|
||||||
if (datagridData.rows[i][0] == "c")
|
if (datagridData.rows[i][0] == "c")
|
||||||
datagridData.rows[i][0] = "p";
|
datagridData.rows[i][0] = "p";
|
||||||
|
@ -45,16 +45,6 @@ function notifySongEnd(){
|
||||||
createDataGrid();
|
createDataGrid();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
function updateDataGrid(){
|
|
||||||
var table = $('#nowplayingtable');
|
|
||||||
//table.dataTable().fnClearTable();
|
|
||||||
|
|
||||||
for (var i=0; i<datagridData.rows.length; i++){
|
|
||||||
table.dataTable().fnAddData(datagridData.rows[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
var columns = [{"sTitle": "type", "bVisible":false},
|
var columns = [{"sTitle": "type", "bVisible":false},
|
||||||
{"sTitle":"Date"},
|
{"sTitle":"Date"},
|
||||||
{"sTitle":"Start"},
|
{"sTitle":"Start"},
|
||||||
|
@ -99,20 +89,9 @@ function createDataGrid(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var mainLoopRegistered = false;
|
|
||||||
|
|
||||||
function setViewType(type){
|
|
||||||
if (type == 0){
|
|
||||||
viewType = "now";
|
|
||||||
} else {
|
|
||||||
viewType = "day";
|
|
||||||
}
|
|
||||||
init2();
|
|
||||||
}
|
|
||||||
|
|
||||||
function getDateString(){
|
function getDateString(){
|
||||||
var date0 = $("#datepicker").datepicker("getDate");
|
var date0 = $("#datepicker").datepicker("getDate");
|
||||||
return (date0.getFullYear() + "-" + date0.getMonth() + "-" + date0.getDate());
|
return (date0.getFullYear() + "-" + (parseInt(date0.getMonth())+1) + "-" + date0.getDate());
|
||||||
}
|
}
|
||||||
|
|
||||||
function getAJAXURL(){
|
function getAJAXURL(){
|
||||||
|
@ -125,27 +104,29 @@ function getAJAXURL(){
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
|
|
||||||
function init2(){
|
function updateData(){
|
||||||
|
$.ajax({ url: getAJAXURL(), dataType:"json", success:function(data){
|
||||||
if (!mainLoopRegistered){
|
|
||||||
setTimeout(init2, 5000);
|
|
||||||
mainLoopRegistered = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
$.ajax({ url: getAJAXURL(), dataType:"json", success:function(data){
|
|
||||||
datagridData = data.entries;
|
datagridData = data.entries;
|
||||||
createDataGrid();
|
createDataGrid();
|
||||||
}});
|
}});
|
||||||
|
}
|
||||||
|
|
||||||
|
function init2(){
|
||||||
|
updateData();
|
||||||
|
|
||||||
if (typeof registerSongEndListener == 'function' && !registered){
|
if (typeof registerSongEndListener == 'function' && !registered){
|
||||||
registered = true;
|
registered = true;
|
||||||
registerSongEndListener(notifySongEnd);
|
registerSongEndListener(notifySongEnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setTimeout(init2, 5000);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
if (viewType == "day"){
|
if (viewType == "day"){
|
||||||
$("#datepicker").datepicker();
|
$("#datepicker").datepicker({
|
||||||
|
onSelect: function(dateText, inst) { updateData();}});
|
||||||
var date = new Date();
|
var date = new Date();
|
||||||
$("#datepicker").datepicker("setDate", date);
|
$("#datepicker").datepicker("setDate", date);
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,4 +66,4 @@ function initShowListView(){
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
initShowListView();
|
initShowListView();
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue