CC-4053: Widget not showing correct day on Sunday

- fixed weekly widget
- also fixed today's show widget
This commit is contained in:
james 2012-07-03 13:17:48 -04:00
parent bc569462ee
commit 7342ea4d4b
2 changed files with 20 additions and 12 deletions

View File

@ -53,7 +53,8 @@ class Application_Common_DateHelper
*/ */
function getWeekStartDate() function getWeekStartDate()
{ {
$startDate = date('w') == 0 ? date('Y-m-d') : date('Y-m-d', strtotime('monday this week')); // our week starts on monday, but php week starts on sunday.
$startDate = date('w') == 0 ? date('Y-m-d', strtotime('monday last week')) : date('Y-m-d', strtotime('monday this week'));
$startDateTime = new DateTime($startDate); $startDateTime = new DateTime($startDate);
return $startDateTime->format('Y-m-d H:i:s'); return $startDateTime->format('Y-m-d H:i:s');
} }

View File

@ -274,7 +274,12 @@ class ApiController extends Zend_Controller_Action
if($type == "endofday") { if($type == "endofday") {
// make GetNextShows use end of day // make GetNextShows use end of day
$utcTimeEnd = Application_Common_DateHelper::GetDayEndTimestampInUtc(); $utcTimeEnd = Application_Common_DateHelper::GetDayEndTimestampInUtc();
} $result = array("env"=>APPLICATION_ENV,
"schedulerTime"=>gmdate("Y-m-d H:i:s"),
"nextShow"=>Application_Model_Show::GetNextShows($utcTimeNow, 5, $utcTimeEnd));
Application_Model_Show::ConvertToLocalTimeZone($result["nextShow"], array("starts", "ends", "start_timestamp", "end_timestamp"));
}else{
$limit = $request->getParam('limit'); $limit = $request->getParam('limit');
if($limit == "" || !is_numeric($limit)) { if($limit == "" || !is_numeric($limit)) {
@ -282,11 +287,13 @@ class ApiController extends Zend_Controller_Action
} }
$result = Application_Model_Schedule::GetPlayOrderRange(); $result = Application_Model_Schedule::GetPlayOrderRange();
$result['AIRTIME_API_VERSION'] = AIRTIME_API_VERSION; //used by caller to determine if the airtime they are running or widgets in use is out of date.
//Convert from UTC to localtime for user. //Convert from UTC to localtime for user.
Application_Model_Show::ConvertToLocalTimeZone($result["currentShow"], array("starts", "ends", "start_timestamp", "end_timestamp")); Application_Model_Show::ConvertToLocalTimeZone($result["currentShow"], array("starts", "ends", "start_timestamp", "end_timestamp"));
Application_Model_Show::ConvertToLocalTimeZone($result["nextShow"], array("starts", "ends", "start_timestamp", "end_timestamp")); Application_Model_Show::ConvertToLocalTimeZone($result["nextShow"], array("starts", "ends", "start_timestamp", "end_timestamp"));
}
$result['AIRTIME_API_VERSION'] = AIRTIME_API_VERSION; //used by caller to determine if the airtime they are running or widgets in use is out of date.
//echo json_encode($result); //echo json_encode($result);
header("Content-type: text/javascript"); header("Content-type: text/javascript");