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