summaryrefslogtreecommitdiffstats
path: root/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'controllers')
-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