summaryrefslogtreecommitdiffstats
path: root/controllers/AnimeController.php
blob: bd291162536aae1596980c5c98afd5898a35f27e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php

namespace app\controllers;

use app\models\Anime;

class AnimeController extends \lithium\action\Controller {
	public $publicActions = array('index', 'view');

	public function index()
	{
		$page = isset($this->request->query['page']) ? $this->request->query['page'] : 1;
		$anime = Anime::find('all', array('limit' => '10'), compact('page'));
		return compact('page', 'anime');
	}

	public function view($id = null)
	{
		if (is_numeric($id)) {
			return Anime::search($id, null, 'special_id');
		}
		else {
			return $this->redirect(array('controller' => 'search','q' => array('search' => $id)));
		}
	
	}
}