CC-1990: Widget to display schedule and "Now Playing" on any website
-update to API controller to support new widget
This commit is contained in:
parent
ab5a6bc1c5
commit
2aa0cd22c6
|
@ -104,8 +104,6 @@ class ApiController extends Zend_Controller_Action
|
||||||
}
|
}
|
||||||
|
|
||||||
public function liveInfoAction(){
|
public function liveInfoAction(){
|
||||||
global $CC_CONFIG;
|
|
||||||
|
|
||||||
// disable the view and the layout
|
// disable the view and the layout
|
||||||
$this->view->layout()->disableLayout();
|
$this->view->layout()->disableLayout();
|
||||||
$this->_helper->viewRenderer->setNoRender(true);
|
$this->_helper->viewRenderer->setNoRender(true);
|
||||||
|
@ -126,6 +124,22 @@ class ApiController extends Zend_Controller_Action
|
||||||
echo $_GET['callback'].'('.json_encode($result).')';
|
echo $_GET['callback'].'('.json_encode($result).')';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function weekInfoAction(){
|
||||||
|
// disable the view and the layout
|
||||||
|
$this->view->layout()->disableLayout();
|
||||||
|
$this->_helper->viewRenderer->setNoRender(true);
|
||||||
|
|
||||||
|
$dow = array("sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday");
|
||||||
|
|
||||||
|
$result = array();
|
||||||
|
for ($i=0; $i<7; $i++){
|
||||||
|
$result[$dow[$i]] = Show_DAL::GetShowsByDayOfWeek($i);
|
||||||
|
}
|
||||||
|
|
||||||
|
header("Content-type: text/javascript");
|
||||||
|
echo $_GET['callback'].'('.json_encode($result).')';
|
||||||
|
}
|
||||||
|
|
||||||
public function scheduleAction()
|
public function scheduleAction()
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
global $CC_CONFIG;
|
||||||
|
|
|
@ -935,4 +935,28 @@ class Show_DAL {
|
||||||
return $CC_DBC->GetAll($sql);
|
return $CC_DBC->GetAll($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function GetShowsByDayOfWeek($day){
|
||||||
|
//DOW FROM TIMESTAMP
|
||||||
|
//The day of the week (0 - 6; Sunday is 0) (for timestamp values only)
|
||||||
|
|
||||||
|
//SELECT EXTRACT(DOW FROM TIMESTAMP '2001-02-16 20:38:40');
|
||||||
|
//Result: 5
|
||||||
|
|
||||||
|
global $CC_CONFIG, $CC_DBC;
|
||||||
|
$sql = "SELECT"
|
||||||
|
." si.starts as show_starts,"
|
||||||
|
." si.ends as show_ends,"
|
||||||
|
." s.name as show_name,"
|
||||||
|
." s.url as url"
|
||||||
|
." FROM $CC_CONFIG[showInstances] si"
|
||||||
|
." LEFT JOIN $CC_CONFIG[showTable] s"
|
||||||
|
." ON si.show_id = s.id"
|
||||||
|
." WHERE EXTRACT(DOW FROM si.starts) = $day"
|
||||||
|
." AND EXTRACT(WEEK FROM si.starts) = EXTRACT(WEEK FROM localtimestamp)";
|
||||||
|
|
||||||
|
//echo $sql;
|
||||||
|
|
||||||
|
return $CC_DBC->GetAll($sql);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue