| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- <?php
- namespace app\controllers;
- use app\models\Anime;
- class ContentController extends \lithium\action\Controller {
- public $publicActions = array('anime');
- public function index($type) //type has to equal something
- {
-
- switch($type) {
- case "anime": $content = Anime::all(compact('limit','page','order'));
- $total = Anime::count();
- break;
- case "manga":
- case "kdrama": $content = Kdrama::all(compact('limit', 'page', 'order'));
- $total = Kdrama::count();
- break;
- }
- return compact('content', 'total', 'page', 'limit');
- }
- public function manga($id = null)
- {
- if ($id != null)
- {
-
- }
- else
- {
- $content = Manga::all(compact('limit', 'page', 'order'));
- $total = Manga::count();
- }
- }
- public function anime($id = null)
- {
- $limit = 20;
- $page = $this->request->page ?: 1;
- $order = array('title' => 'ASC');
- $content;
- $total;
- if ($id != null)
- {
- $content = Anime::find('first', array('conditions' => array('special_id' => $id), 'order' => array('title' => 'ASC')));
- return compact('content');
- }
- else
- {
- $content = Anime::all(compact('limit','page','order'));
- $total = Anime::count();
- $this->render(array('template' => 'index', 'data' => compact('limit', 'page', 'content', 'total')));
- }
- }
- }
|