Merge
This commit is contained in:
@@ -5,11 +5,9 @@ use Illuminate\Http\Request;
|
||||
|
||||
class NewsController extends Controller
|
||||
{
|
||||
private $EXTERNAL_NEWS_API;
|
||||
|
||||
private static $NEWS_CATEGORY = 1;
|
||||
private static $CALENDAR_CATEGORY = 42;
|
||||
private static $EXTERNAL_NEWS_CATEGORY = 44;
|
||||
private static $EXTERNAL_NEWS_CATEGORY = 0;
|
||||
private static $BLOG_CATEGORY = 45;
|
||||
|
||||
private static $BASE_SQL = <<<QUERY
|
||||
@@ -37,7 +35,20 @@ QUERY;
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->EXTERNAL_NEWS_API = env('EXTERNAL_NEWS_API', '//');
|
||||
}
|
||||
|
||||
/**
|
||||
* RSS-feed van alle podcasts
|
||||
*/
|
||||
public function rss(Request $request) {
|
||||
$page = (int)$request->get('page', 1);
|
||||
if($page <= 0) {
|
||||
return abort(400);
|
||||
}
|
||||
|
||||
$podcasts = $this->retrieveNewsItems($page, $count = 20, $filter = null, $params = []);
|
||||
$view = view('rss.news')->with('news', $podcasts)->with('url', $request->url())->with('page', $page);
|
||||
return response($view)->header('Content-Type', 'application/xml');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -275,13 +286,6 @@ QUERY
|
||||
|
||||
$data = array('version' => 1,
|
||||
'news' => new \Model\NewsItem($item['data'], $item['images'], $item['podcast']));
|
||||
if($externalId = (int)$item['data']->external_id) {
|
||||
$externalSource = json_decode(file_get_contents($this->EXTERNAL_NEWS_API . 'news?source=api&externalid=' . (int)$externalId));
|
||||
if($externalSource) {
|
||||
$data['version'] = 2;
|
||||
$data['source'] = $externalSource->news;
|
||||
}
|
||||
}
|
||||
|
||||
return response()->json($data);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user