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