Merge branch 'devel' of dev.sourcefabric.org:airtime into devel

This commit is contained in:
Yuchen Wang 2011-11-16 15:52:31 -05:00
commit 4820bb617b
8 changed files with 18 additions and 20 deletions

View File

@ -426,7 +426,7 @@ class ApiController extends Zend_Controller_Action
$show_inst->setRecordedFile($file_id); $show_inst->setRecordedFile($file_id);
$show_name = $show_inst->getName(); $show_name = $show_inst->getName();
$show_genre = $show_inst->getGenre(); $show_genre = $show_inst->getGenre();
$show_start_time = ConvertToLocalDateTimeString($show_inst->getShowInstanceStart()); $show_start_time = Application_Model_DateHelper::ConvertToLocalDateTimeString($show_inst->getShowInstanceStart());
} catch (Exception $e){ } catch (Exception $e){
//we've reached here probably because the show was //we've reached here probably because the show was

View File

@ -112,8 +112,7 @@ class NowplayingController extends Zend_Controller_Action
{ {
// unset session // unset session
Zend_Session::namespaceUnset('referrer'); Zend_Session::namespaceUnset('referrer');
$now = date("Y-m-d H:i:s"); Application_Model_Preference::SetRemindMeDate();
Application_Model_Preference::SetRemindMeDate($now);
die(); die();
} }

View File

@ -435,10 +435,11 @@ class ScheduleController extends Zend_Controller_Action
//convert from UTC to user's timezone for display. //convert from UTC to user's timezone for display.
$originalDateTime = new DateTime($originalShowStart, new DateTimeZone("UTC")); $originalDateTime = new DateTime($originalShowStart, new DateTimeZone("UTC"));
$timestamp = strtotime(Application_Model_DateHelper::ConvertToLocalDateTimeString($originalDateTime->format("Y-m-d H:i:s"))); $originalDateTime->setTimezone(new DateTimeZone(date_default_timezone_get));
//$timestamp = Application_Model_DateHelper::ConvertToLocalDateTimeString($originalDateTime->format("Y-m-d H:i:s"));
$this->view->additionalShowInfo = $this->view->additionalShowInfo =
"Rebroadcast of show \"$originalShowName\" from " "Rebroadcast of show \"$originalShowName\" from "
.date("l, F jS", $timestamp)." at ".date("G:i", $timestamp); .$originalDateTime->format("l, F jS")." at ".$originalDateTime->format("G:i");
} }
$this->view->showContent = $show->getShowListContent(); $this->view->showContent = $show->getShowListContent();
$this->view->dialog = $this->view->render('schedule/show-content-dialog.phtml'); $this->view->dialog = $this->view->render('schedule/show-content-dialog.phtml');

View File

@ -24,10 +24,7 @@ class Application_Model_DateHelper
*/ */
function getUtcTimestamp() function getUtcTimestamp()
{ {
$dateTime = new DateTime("@".$this->_dateTime); return gmdate("Y-m-d H:i:s", $this->_dateTime);
$dateTime->setTimezone(new DateTimeZone("UTC"));
return $dateTime->format("Y-m-d H:i:s");
} }
/** /**
@ -36,7 +33,7 @@ class Application_Model_DateHelper
*/ */
function getDate() function getDate()
{ {
return date("Y-m-d", $this->_dateTime); return gmdate("Y-m-d", $this->_dateTime);
} }
/** /**
@ -45,7 +42,7 @@ class Application_Model_DateHelper
*/ */
function getTime() function getTime()
{ {
return date("H:i:s", $this->_dateTime); return gmdate("H:i:s", $this->_dateTime);
} }
/** /**
@ -53,7 +50,8 @@ class Application_Model_DateHelper
*/ */
function setDate($dateString) function setDate($dateString)
{ {
$this->_dateTime = strtotime($dateString); $dateTime = new DateTime($dateString, new DateTimeZone("UTC"));
$this->_dateTime = $dateTime->getTimestamp();
} }
/** /**
@ -66,7 +64,7 @@ class Application_Model_DateHelper
* @return End of day timestamp in local timezone * @return End of day timestamp in local timezone
*/ */
function getDayEndTimestamp() { function getDayEndTimestamp() {
$dateTime = new DateTime($this->getDate()); $dateTime = new DateTime($this->getDate(), new DateTimeZone("UTC"));
$dateTime->add(new DateInterval('P1D')); $dateTime->add(new DateInterval('P1D'));
return $dateTime->format('Y-m-d H:i:s'); return $dateTime->format('Y-m-d H:i:s');
} }

View File

@ -107,7 +107,7 @@ class Application_Model_Nowplaying
} }
public static function ShouldShowPopUp(){ public static function ShouldShowPopUp(){
$today = mktime(0, 0, 0, date("m") , date("d"), date("Y")); $today = mktime(0, 0, 0, gmdate("m"), gmdate("d"), gmdate("Y"));
$remindDate = Application_Model_Preference::GetRemindMeDate(); $remindDate = Application_Model_Preference::GetRemindMeDate();
if($remindDate == NULL || $today >= $remindDate){ if($remindDate == NULL || $today >= $remindDate){
return true; return true;

View File

@ -383,7 +383,7 @@ class Application_Model_Preference
$outputArray['NUM_OF_SONGS'] = Application_Model_StoredFile::getFileCount(); $outputArray['NUM_OF_SONGS'] = Application_Model_StoredFile::getFileCount();
$outputArray['NUM_OF_PLAYLISTS'] = Application_Model_Playlist::getPlaylistCount(); $outputArray['NUM_OF_PLAYLISTS'] = Application_Model_Playlist::getPlaylistCount();
$outputArray['NUM_OF_SCHEDULED_PLAYLISTS'] = Application_Model_Schedule::getSchduledPlaylistCount(); $outputArray['NUM_OF_SCHEDULED_PLAYLISTS'] = Application_Model_Schedule::getSchduledPlaylistCount();
$outputArray['NUM_OF_PAST_SHOWS'] = Application_Model_ShowInstance::GetShowInstanceCount(date("Y-m-d H:i:s")); $outputArray['NUM_OF_PAST_SHOWS'] = Application_Model_ShowInstance::GetShowInstanceCount(gmdate("Y-m-d H:i:s"));
$outputArray['UNIQUE_ID'] = self::GetUniqueId(); $outputArray['UNIQUE_ID'] = self::GetUniqueId();
$outputArray['SAAS'] = self::GetPlanLevel(); $outputArray['SAAS'] = self::GetPlanLevel();
$outputArray['INSTALL_METHOD'] = self::GetInstallMethod(); $outputArray['INSTALL_METHOD'] = self::GetInstallMethod();
@ -422,8 +422,8 @@ class Application_Model_Preference
} }
} }
public static function SetRemindMeDate($now){ public static function SetRemindMeDate(){
$weekAfter = mktime(0, 0, 0, date("m") , date("d")+7, date("Y")); $weekAfter = mktime(0, 0, 0, gmdate("m"), gmdate("d")+7, gmdate("Y"));
self::SetValue("remindme", $weekAfter); self::SetValue("remindme", $weekAfter);
} }

View File

@ -845,7 +845,7 @@ class Application_Model_Show {
//What we are doing here is checking if the show repeats or if //What we are doing here is checking if the show repeats or if
//any repeating days have been checked. If not, then by default //any repeating days have been checked. If not, then by default
//the "selected" DOW is the initial day. //the "selected" DOW is the initial day.
$startDow = date("w", $utcStartDateTime->getTimestamp()); $startDow = gmdate("w", $utcStartDateTime->getTimestamp());
if (!$data['add_show_repeats']) { if (!$data['add_show_repeats']) {
$data['add_show_day_check'] = array($startDow); $data['add_show_day_check'] = array($startDow);
} else if ($data['add_show_repeats'] && $data['add_show_day_check'] == "") { } else if ($data['add_show_repeats'] && $data['add_show_day_check'] == "") {
@ -1372,7 +1372,7 @@ class Application_Model_Show {
$shows = Application_Model_Show::getShows($start, $end); $shows = Application_Model_Show::getShows($start, $end);
$today_timestamp = Application_Model_DateHelper::ConvertToUtcDateTime(date("Y-m-d H:i:s"))->format("Y-m-d H:i:s"); $today_timestamp = gmdate("Y-m-d H:i:s");
foreach ($shows as $show) { foreach ($shows as $show) {
$options = array(); $options = array();

View File

@ -256,7 +256,7 @@ class Application_Model_ShowInstance {
$mins = abs($deltaMin%60); $mins = abs($deltaMin%60);
$today_timestamp = Application_Model_DateHelper::ConvertToUtcDateTime(date("Y-m-d H:i:s"))->format("Y-m-d H:i:s"); $today_timestamp = gmdate("Y-m-d H:i:s");
$starts = $this->getShowInstanceStart(); $starts = $this->getShowInstanceStart();
$ends = $this->getShowInstanceEnd(); $ends = $this->getShowInstanceEnd();