Project structure change
This commit is contained in:
parent
bd1642957c
commit
837f126021
29 changed files with 298 additions and 254 deletions
32
app/Controllers/TagController.php
Normal file
32
app/Controllers/TagController.php
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
namespace App\Controllers;
|
||||
|
||||
use App\Helpers\ErrorHandler;
|
||||
use App\Helpers\Misc;
|
||||
use App\Helpers\RSS;
|
||||
use App\Models\FeedTemplate;
|
||||
|
||||
class TagController {
|
||||
static public function get(string $name) {
|
||||
$cursor = Misc::getCursor();
|
||||
$api = Misc::api();
|
||||
$feed = $api->getChallengeFeed($name, $cursor);
|
||||
if ($feed->meta->success) {
|
||||
$latte = Misc::latte();
|
||||
$latte->render(Misc::getView('tag'), new FeedTemplate('Tag', $feed));
|
||||
} else {
|
||||
ErrorHandler::show($feed->meta);
|
||||
}
|
||||
}
|
||||
|
||||
static public function rss(string $name) {
|
||||
$api = Misc::api();
|
||||
$feed = $api->getChallengeFeed($name);
|
||||
if ($feed->meta->success) {
|
||||
$feed = RSS::build("/tag/{$name}", "{$name} Tag", $feed->info->detail->challenge->desc, $feed->items);
|
||||
// Setup headers
|
||||
RSS::setHeaders('tag.rss');
|
||||
echo $feed;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue