summaryrefslogtreecommitdiffstats
path: root/controllers
diff options
context:
space:
mode:
authorMichael Francis <edude03@gmail.com>2011-06-20 18:56:23 -0400
committerMichael Francis <edude03@gmail.com>2011-06-20 18:56:23 -0400
commit9026954b4ea4e712d588907a637945c265345073 (patch)
tree3f9c614f68b3aabf0ce8b2e2b586f1112b095045 /controllers
parent1f6b832a67f6e4b1865fbe1ec6ea9b0babf7ead5 (diff)
downloadotakuhub-9026954b4ea4e712d588907a637945c265345073.tar.xz
Cleaned up Anime's find/search method (less code)
Diffstat (limited to 'controllers')
-rw-r--r--controllers/AnimeController.php27
1 files changed, 6 insertions, 21 deletions
diff --git a/controllers/AnimeController.php b/controllers/AnimeController.php
index 080a9c3..2fc35cc 100644
--- a/controllers/AnimeController.php
+++ b/controllers/AnimeController.php
@@ -9,27 +9,12 @@ class AnimeController extends \lithium\action\Controller {
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;
+
}
-} \ No newline at end of file
+} \ No newline at end of file