|
@@ -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;
|
|
|
|
|
+ }
|
|
|
|
|
+}
|