summaryrefslogtreecommitdiffstats
path: root/controllers/AnimeController.php
diff options
context:
space:
mode:
authorMichael Francis <edude03@gmail.com>2011-06-05 21:18:57 -0400
committerMichael Francis <edude03@gmail.com>2011-06-05 21:18:57 -0400
commit06ecfbea905d7bc006dbe19243673209bb69c8f6 (patch)
treed84da99ebe04837cac14d0f1ea7426ccd659b3d8 /controllers/AnimeController.php
parentae36b3317b31a1d8f4bc235b53b70889e1cf3da3 (diff)
downloadotakuhub-06ecfbea905d7bc006dbe19243673209bb69c8f6.tar.xz
Implemented a proper anime controller
Diffstat (limited to 'controllers/AnimeController.php')
-rw-r--r--controllers/AnimeController.php35
1 files changed, 35 insertions, 0 deletions
diff --git a/controllers/AnimeController.php b/controllers/AnimeController.php
new file mode 100644
index 0000000..080a9c3
--- /dev/null
+++ b/controllers/AnimeController.php
@@ -0,0 +1,35 @@
+<?php
+
+namespace app\controllers;
+
+use app\models\Anime;
+
+class AnimeController extends \lithium\action\Controller {
+ public $publicActions = array('view');
+
+ public function view($id = null)
+ {
+ if($id = null) {
+ return $this->redirect("/anime");
+ }
+
+ //If the user search for a string
+ if (!is_numeric($id))
+ {
+ $anime = Anime::search($id);
+ var_dump($anime);
+ if (count($anime) == 1)
+ {
+ return $anime;
+ }
+
+ return $this->render(array('template' => '..search/index', 'data' => array('results' => $anime)));
+ /*//Pass it to search
+ return $this->redirect(array('controller' => 'search', 'action' => 'index', 'args' => array('anime'), 'query' => '' ))
+ */
+ }
+
+ $anime = Anime::find('first', array('conditions' => array('special_id' => $id)));
+ return $anime;
+ }
+} \ No newline at end of file