diff --git a/application/models/Nowplaying.php b/application/models/Nowplaying.php index 02dd6837c..a3441c47d 100644 --- a/application/models/Nowplaying.php +++ b/application/models/Nowplaying.php @@ -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")); diff --git a/application/models/Users.php b/application/models/Users.php index 594f2e9bc..6cb618cbc 100644 --- a/application/models/Users.php +++ b/application/models/Users.php @@ -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; } diff --git a/public/js/playlist/nowplayingdatagrid.js b/public/js/playlist/nowplayingdatagrid.js index 3467c5751..ec003fbfc 100644 --- a/public/js/playlist/nowplayingdatagrid.js +++ b/public/js/playlist/nowplayingdatagrid.js @@ -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