CC-1990: Widget to display schedule and "Now Playing" on any website

-First working version, needs to be called using:

<script>
    $(document).ready(function() {
        $("#headerLiveHolder").airtimeLiveInfo();
        $("#onAirToday").airtimeShowSchedule();
    });
</script>
This commit is contained in:
martin 2011-03-22 18:04:27 -04:00
parent 278938f746
commit e92be3c186
4 changed files with 146 additions and 83 deletions

View file

@ -109,6 +109,16 @@ class ApiController extends Zend_Controller_Action
$this->_helper->viewRenderer->setNoRender(true);
$result = Schedule::GetPlayOrderRange(0, 1);
$date = new Application_Model_DateHelper;
$timeNow = $date->getDate();
$result = array("env"=>APPLICATION_ENV,
"schedulerTime"=>gmdate("Y-m-d H:i:s"),
"currentShow"=>Show_DAL::GetCurrentShow($timeNow),
"nextShow"=>Show_DAL::GetNextShows($timeNow, 5),
"timezone"=> date("T"),
"timezoneOffset"=> date("Z"));
//echo json_encode($result);
header("Content-type: text/javascript");
echo $_GET['callback'].'('.json_encode($result).')';

View file

@ -436,7 +436,7 @@ class Schedule {
"current"=>Schedule::GetScheduledItemData($timeNow, 0),
"next"=>Schedule::GetScheduledItemData($timeNow, 1, $next, "48 hours"),
"currentShow"=>Show_DAL::GetCurrentShow($timeNow),
"nextShow"=>Show_DAL::GetNextShow($timeNow),
"nextShow"=>Show_DAL::GetNextShows($timeNow, 1),
"timezone"=> date("T"),
"timezoneOffset"=> date("Z"),
"apiKey"=>$CC_CONFIG['apiKey'][0]);

View file

@ -889,7 +889,7 @@ class Show_DAL {
return $rows;
}
public static function GetNextShow($timeNow)
public static function GetNextShows($timeNow, $limit)
{
global $CC_CONFIG, $CC_DBC;
@ -899,7 +899,7 @@ class Show_DAL {
." AND si.starts >= TIMESTAMP '$timeNow'"
." AND si.starts < TIMESTAMP '$timeNow' + INTERVAL '48 hours'"
." ORDER BY si.starts"
." LIMIT 1";
." LIMIT $limit";
$rows = $CC_DBC->GetAll($sql);
return $rows;