|
@@ -9,27 +9,12 @@ class AnimeController extends \lithium\action\Controller {
|
|
|
|
|
|
|
|
public function view($id = null)
|
|
public function view($id = null)
|
|
|
{
|
|
{
|
|
|
- if($id = null) {
|
|
|
|
|
- return $this->redirect("/anime");
|
|
|
|
|
|
|
+ if (is_numeric($id)) {
|
|
|
|
|
+ return Anime::search($id, null, 'special_id');
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- //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' => '' ))
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ else {
|
|
|
|
|
+ return $this->redirect(array('controller' => 'search','q' => array('search' => $id)));
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- $anime = Anime::find('first', array('conditions' => array('special_id' => $id)));
|
|
|
|
|
- return $anime;
|
|
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
-}
|
|
|
|
|
|
|
+}
|