diff options
author | Michael Francis <edude03@gmail.com> | 2011-07-17 20:38:31 -0400 |
---|---|---|
committer | Michael Francis <edude03@gmail.com> | 2011-07-17 20:38:31 -0400 |
commit | c9994190d2ba584e1eb95b6b47ff586da7b0f29f (patch) | |
tree | ff4d02327f8e988925036f7406c760dfba8791d3 /controllers/AnimeController.php | |
parent | 7be960630a8c0b4dab94245c73453b22db3f305e (diff) | |
parent | 2baaf56e140a06eed8fe0b1d28d744d34a537d49 (diff) | |
download | otakuhub-c9994190d2ba584e1eb95b6b47ff586da7b0f29f.tar.xz |
Merge branch 'master' of git.raylu.net:otakuhub
Diffstat (limited to 'controllers/AnimeController.php')
-rw-r--r-- | controllers/AnimeController.php | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/controllers/AnimeController.php b/controllers/AnimeController.php index bd29116..3a40cee 100644 --- a/controllers/AnimeController.php +++ b/controllers/AnimeController.php @@ -5,7 +5,7 @@ namespace app\controllers; use app\models\Anime; class AnimeController extends \lithium\action\Controller { - public $publicActions = array('index', 'view'); + public $publicActions = array('index', 'view', 'cast'); public function index() { @@ -16,12 +16,31 @@ class AnimeController extends \lithium\action\Controller { public function view($id = null) { - if (is_numeric($id)) { - return Anime::search($id, null, 'special_id'); + if (is_numeric($id)) + { + $data = Anime::search($id, null, 'special_id'); + $related = $data['anime']->related; + $str = ''; + for ($i = 0; $i < count($related); $i++) + { + if ($i > 0) $str .= ', '; + $ra = Anime::search($related[$i], null, 'special_id'); + $str .= '<a href="' . $related[$i] . '">' . $ra['anime']->title . '</a>'; + } + $data['related'] = $str; + return $data; } - else { + else + { return $this->redirect(array('controller' => 'search','q' => array('search' => $id))); } - + } + + public function cast($id = null) + { + if (is_numeric($id)) + { + return Anime::search($id, null, 'special_id'); + } } } |