2015-05-27 09:03:42 -04:00
|
|
|
<?php
|
|
|
|
|
2015-06-11 16:44:52 -04:00
|
|
|
/**
|
|
|
|
* Controller for manga list
|
|
|
|
*/
|
2015-05-27 09:03:42 -04:00
|
|
|
class MangaController extends BaseController {
|
|
|
|
|
2015-06-11 16:44:52 -04:00
|
|
|
/**
|
|
|
|
* The manga model
|
|
|
|
* @var object $model
|
|
|
|
*/
|
2015-05-27 09:03:42 -04:00
|
|
|
private $model;
|
|
|
|
|
2015-06-11 16:44:52 -04:00
|
|
|
/**
|
|
|
|
* Route mapping for main navigation
|
|
|
|
* @var array $nav_routes
|
|
|
|
*/
|
|
|
|
private $nav_routes = [
|
|
|
|
'Reading' => '/',
|
|
|
|
'Plan to Read' => '/plan_to_read',
|
|
|
|
'On Hold' => '/on_hold',
|
|
|
|
'Dropped' => '/dropped',
|
|
|
|
'Completed' => '/completed',
|
|
|
|
'All' => '/all'
|
|
|
|
];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Constructor
|
|
|
|
*/
|
2015-05-27 09:03:42 -04:00
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
parent::__construct();
|
|
|
|
$this->model = new MangaModel();
|
|
|
|
}
|
|
|
|
|
2015-06-11 16:44:52 -04:00
|
|
|
/**
|
|
|
|
* Get a section of the manga list
|
|
|
|
*
|
|
|
|
* @param string $status
|
|
|
|
* @param string $title
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function manga_list($status, $title)
|
2015-05-27 09:03:42 -04:00
|
|
|
{
|
2015-06-11 16:44:52 -04:00
|
|
|
$data = ($status !== 'all')
|
|
|
|
? [$status => $this->model->get_list($status)]
|
|
|
|
: $this->model->get_all_lists();
|
2015-05-27 09:03:42 -04:00
|
|
|
|
2015-06-11 16:44:52 -04:00
|
|
|
$this->outputHTML('manga/list', [
|
2015-05-27 09:03:42 -04:00
|
|
|
'title' => $title,
|
2015-06-11 16:44:52 -04:00
|
|
|
'nav_routes' => $this->nav_routes,
|
|
|
|
'sections' => $data
|
2015-05-27 09:03:42 -04:00
|
|
|
]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// End of MangaController.php
|