diff options
Diffstat (limited to 'models/Anime.php')
-rw-r--r-- | models/Anime.php | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/models/Anime.php b/models/Anime.php index 4543826..8281ea7 100644 --- a/models/Anime.php +++ b/models/Anime.php @@ -11,8 +11,7 @@ class Anime extends \lithium\data\Model { $limit = 20; switch($by) { - case 'special_id': - + case 'special_id': $content = self::find('first', array('conditions' => array( $by => $query @@ -22,20 +21,29 @@ class Anime extends \lithium\data\Model { )); - $total = self::count(array($by => $query)); break; - default: - $content = self::find('all', - array('conditions' => array( - $by => array('like' => $query) - ), + default: + if ($query) + { + $conditions = null; // TODO + $content = self::find('all', array( + 'conditions' => array($by => array('like' => $query)), 'limit' => $limit, 'page' => $page )); $total = Anime::count(array($by => array('like' => $query))); + } + else + { + $content = self::find('all', array( + 'limit' => $limit, + 'page' => $page + )); + $total = Anime::count(); + } + } + return compact('content', 'by', 'limit', 'total', 'page'); } - return compact('content', 'by', 'limit', 'total', 'page'); - } -}
\ No newline at end of file +} |