From 994c36b8279480b6e3374017140e36d77401d3a4 Mon Sep 17 00:00:00 2001 From: raylu Date: Sat, 16 Jul 2011 22:58:09 -0700 Subject: add manga to search/index --- views/elements/animetable.html.php | 6 +++--- views/elements/mangatable.html.php | 29 +++++++++++++++++++++++++++++ views/search/index.html.php | 30 ++++++++++++++++-------------- 3 files changed, 48 insertions(+), 17 deletions(-) create mode 100644 views/elements/mangatable.html.php diff --git a/views/elements/animetable.html.php b/views/elements/animetable.html.php index 0d9f9fb..ea222a6 100644 --- a/views/elements/animetable.html.php +++ b/views/elements/animetable.html.php @@ -6,12 +6,12 @@ title ?> - foreign_titles || $a->alternative_titles): ?> + foreign_titles) || isset($a->alternative_titles)): ?> - foreign_titles): ?> + foreign_titles)): ?> foreign_titles[0] ?> - alternative_titles): ?> + alternative_titles)): ?>       alternative_titles[0] ?> diff --git a/views/elements/mangatable.html.php b/views/elements/mangatable.html.php new file mode 100644 index 0000000..c92ff83 --- /dev/null +++ b/views/elements/mangatable.html.php @@ -0,0 +1,29 @@ + + + + + + + + + + + +
TitleDateType
+ title ?> + foreign_titles) || isset($m->alternative_titles)): ?> + + foreign_titles)): ?> + foreign_titles[0] ?> + + alternative_titles)): ?> +       + alternative_titles[0] ?> + + + + + publish_period ?> + + author ?> +
diff --git a/views/search/index.html.php b/views/search/index.html.php index bee0bb8..1672570 100644 --- a/views/search/index.html.php +++ b/views/search/index.html.php @@ -5,27 +5,29 @@ $this->styles($this->html->style('search')); _render('element', 'search') ?> + 0): ?>

Anime

-_render('element', 'animetable', compact('anime')) ?> -

-More -

+ _render('element', 'animetable') ?> +

+ More +

+ + 0): ?>

Manga

-

results

- 0): ?> -

-More -

+ _render('element', 'mangatable') ?> +

+ More +

+ 0): ?>

K-Drama

-_render('element', 'kdramatable', compact('anime')) ?> - 0): ?> -

-More -

+ _render('element', 'kdramatable') ?> +

+ More +

-- cgit v1.2.3 From dcc965ab293655136c251afe4fb6f4f41ac5cb75 Mon Sep 17 00:00:00 2001 From: raylu Date: Sat, 16 Jul 2011 23:08:10 -0700 Subject: manga/kdrama individual search pages --- controllers/SearchController.php | 18 ++++++++++++++++-- models/Kdrama.php | 10 ++++------ models/Manga.php | 34 ++++++++++++++++++++++++++++++++-- views/search/kdrama.html.php | 16 ++++++++++++++++ views/search/manga.html.php | 16 ++++++++++++++++ 5 files changed, 84 insertions(+), 10 deletions(-) create mode 100644 views/search/kdrama.html.php create mode 100644 views/search/manga.html.php diff --git a/controllers/SearchController.php b/controllers/SearchController.php index abcaabd..efd25f3 100644 --- a/controllers/SearchController.php +++ b/controllers/SearchController.php @@ -25,8 +25,22 @@ class SearchController extends \lithium\action\Controller { public function anime($by = 'title') { - $q = isset($this->request->query['q']) ? '/' . $this->request->query['q'] . '/i' : ''; + $q = isset($this->request->query['q']) ? $this->request->query['q'] : ''; $page = isset($this->request->query['page']) ? $this->request->query['page'] : 1; - return Anime::search($q, $page, 'title'); + return Anime::search("/$q/i", $page, 'title'); + } + + public function manga($by = 'title') + { + $q = isset($this->request->query['q']) ? $this->request->query['q'] : ''; + $page = isset($this->request->query['page']) ? $this->request->query['page'] : 1; + return Manga::search("/$q/i", $page, 'title'); + } + + public function kdrama($by = 'title') + { + $q = isset($this->request->query['q']) ? $this->request->query['q'] : ''; + $page = isset($this->request->query['page']) ? $this->request->query['page'] : 1; + return Kdrama::search("/$q/i", $page, 'title'); } } diff --git a/models/Kdrama.php b/models/Kdrama.php index f1eee22..12c136d 100644 --- a/models/Kdrama.php +++ b/models/Kdrama.php @@ -13,7 +13,7 @@ class Kdrama extends \lithium\data\Model { switch($by) { case 'special_id': - $content = parent::find('first', + $kdrama = parent::find('first', array('conditions' => array( $by => $query ), @@ -21,13 +21,11 @@ class Kdrama extends \lithium\data\Model { 'page' => $page )); - - $total = parent::count(array($by => $query)); break; default: - $content = parent::find('all', + $kdrama = parent::find('all', array('conditions' => array( $by => array('like' => $query) ), @@ -36,6 +34,6 @@ class Kdrama extends \lithium\data\Model { )); $total = parent::count(array($by => array('like' => $query))); } - return compact('content', 'by', 'limit', 'total', 'page'); + return compact('kdrama', 'by', 'limit', 'total', 'page'); } -} \ No newline at end of file +} diff --git a/models/Manga.php b/models/Manga.php index 03c2d29..5f79bef 100644 --- a/models/Manga.php +++ b/models/Manga.php @@ -5,5 +5,35 @@ namespace app\models; class Manga extends \lithium\data\Model { protected $_meta = array('key' => '_id', 'source' => 'manga', 'connection' => 'mongo'); - -} \ No newline at end of file + public static function search($query, $page = 1, $by = 'title') + { + $defaults = array('limit' => 20); + $limit = 20; + + switch($by) { + case 'special_id': + + $manga = parent::find('first', + array('conditions' => array( + $by => $query + ), + 'limit' => $limit, + 'page' => $page + )); + + $total = parent::count(array($by => $query)); + break; + + default: + $manga = parent::find('all', + array('conditions' => array( + $by => array('like' => $query) + ), + 'limit' => $limit, + 'page' => $page + )); + $total = parent::count(array($by => array('like' => $query))); + } + return compact('manga', 'by', 'limit', 'total', 'page'); + } +} diff --git a/views/search/kdrama.html.php b/views/search/kdrama.html.php new file mode 100644 index 0000000..8736902 --- /dev/null +++ b/views/search/kdrama.html.php @@ -0,0 +1,16 @@ +styles($this->html->style('pagination')); +$this->styles($this->html->style('table')); +$this->styles($this->html->style('search')); +?> + +_render('element', 'search') ?> + +

K-Drama Search Results

+(search instead for ...) + +Paginator->paginate(array('separator' => '')) ?> + +_render('element', 'kdramatable') ?> + +Paginator->paginate(array('separator' => '')) ?> diff --git a/views/search/manga.html.php b/views/search/manga.html.php new file mode 100644 index 0000000..181994b --- /dev/null +++ b/views/search/manga.html.php @@ -0,0 +1,16 @@ +styles($this->html->style('pagination')); +$this->styles($this->html->style('table')); +$this->styles($this->html->style('search')); +?> + +_render('element', 'search') ?> + +

Manga Search Results

+(search instead for ...) + +Paginator->paginate(array('separator' => '')) ?> + +_render('element', 'mangatable') ?> + +Paginator->paginate(array('separator' => '')) ?> -- cgit v1.2.3 From 8fa4bab1dfd166fd567f2b1a3910f0628c6278e7 Mon Sep 17 00:00:00 2001 From: raylu Date: Sat, 16 Jul 2011 23:29:34 -0700 Subject: form styling --- webroot/css/base.css | 17 ++++------------- webroot/css/search.css | 8 ++++---- webroot/css/themes/light.css | 22 ++++++++++++++++++++++ 3 files changed, 30 insertions(+), 17 deletions(-) diff --git a/webroot/css/base.css b/webroot/css/base.css index 29fd2c3..da366c6 100644 --- a/webroot/css/base.css +++ b/webroot/css/base.css @@ -243,13 +243,16 @@ body.ie7 form, body.ie8 { form p { margin-bottom:15px; } -form input, form textarea { +form input, form textarea, form select { padding: 7px 5px; border: 1px solid #ccc; border-radius: 3px; -moz-border-radius: 3px; -webkit-border-radius: 3px; } +form select { + padding: 6px 5px; +} input[type="button"], input[type="submit"], button { padding: 6px 5px; /* looks high in FF at inherited 7 5 */ line-height: 18px; /* looks small in webkit at 6 5 */ @@ -257,24 +260,12 @@ input[type="button"], input[type="submit"], button { display: inline-block; font-weight: 700; outline: none; - background: #ddd; color: #444; text-shadow: 0 -1px 0 #eee; border-radius: 3px; -moz-border-radius: 3px; -webkit-border-radius: 3px; } -input[type="button"]:hover, input[type="submit"]:hover, button:hover { - background: #eee; -} -form select { - padding: 6px 5px; - border: 1px solid #ccc; - border-radius: 3px; - -moz-border-radius: 3px; - -webkit-border-radius: 3px; - background-color: #eee; -} div#login { text-align: center; diff --git a/webroot/css/search.css b/webroot/css/search.css index ff9907e..20ea164 100644 --- a/webroot/css/search.css +++ b/webroot/css/search.css @@ -16,13 +16,13 @@ p.more a { border-radius: 3px; background: #ddd; background: -moz-linear-gradient(top, #ddd, #bbb); - background: -webkit-linear-gradient(top, rgba(255,255,255,1), rgba(255,255,255,0)); - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffffff00', GradientType=1); + background: -webkit-linear-gradient(top, #ddd, #bbb); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#dddddd', endColorstr='#bbbbbb'); color: #111; } p.more a:hover { background: #eee; background: -moz-linear-gradient(top, #eee, #ccc); - background: -webkit-linear-gradient(top, rgba(255,255,255,1), rgba(255,255,255,0)); - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffffff00', GradientType=1); + background: -webkit-linear-gradient(top, #eee, #ccc); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#cccccc'); } diff --git a/webroot/css/themes/light.css b/webroot/css/themes/light.css index b3b95ae..677557a 100644 --- a/webroot/css/themes/light.css +++ b/webroot/css/themes/light.css @@ -48,6 +48,28 @@ a.gradient:hover { color: #fff; } +form input, form textarea, form select { + background: #f7f7f7; + background: -moz-linear-gradient(top, #eee, #fff); + background: -webkit-linear-gradient(top, #eee, #fff); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#eee', endColorstr='#fff'); +} +input[type="button"], input[type="submit"], button { + background: #ddd; + background: -moz-linear-gradient(top, #ddd, #eee); + background: -webkit-linear-gradient(top, #ddd, #eee); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ddd', endColorstr='#eee'); +} +form input:focus, form textarea:focus, select:focus { + border-color: #88c; +} +input[type="button"]:hover, input[type="submit"]:hover, button:hover { + background: #eee; + background: -moz-linear-gradient(top, #e0e0e0, #f7f7f7); + background: -webkit-linear-gradient(top, #e0e0e0, #f7f7f7); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#e0e0e0', endColorstr='#f7f7f7'); +} + footer { color: #666; } -- cgit v1.2.3 From 384834c9fb85d3a408c60dd38e8d1474116793ad Mon Sep 17 00:00:00 2001 From: raylu Date: Sun, 17 Jul 2011 16:41:22 -0700 Subject: some anime view styling --- controllers/AnimeController.php | 18 +++++-- views/anime/view.html.php | 117 +++++++++++++++++++++++----------------- views/layouts/default.html.php | 4 +- webroot/css/base.css | 6 ++- webroot/css/view.css | 21 ++++++++ 5 files changed, 110 insertions(+), 56 deletions(-) create mode 100644 webroot/css/view.css diff --git a/controllers/AnimeController.php b/controllers/AnimeController.php index bd29116..09c0828 100644 --- a/controllers/AnimeController.php +++ b/controllers/AnimeController.php @@ -16,10 +16,22 @@ class AnimeController extends \lithium\action\Controller { public function view($id = null) { - if (is_numeric($id)) { - return Anime::search($id, null, 'special_id'); + if (is_numeric($id)) + { + $data = Anime::search($id, null, 'special_id'); + $related = $data['anime']->related; + $str = ''; + for ($i = 0; $i < count($related); $i++) + { + if ($i > 0) $str .= ', '; + $ra = Anime::search($related[$i], null, 'special_id'); + $str .= '' . $ra['anime']->title . ''; + } + $data['related'] = $str; + return $data; } - else { + else + { return $this->redirect(array('controller' => 'search','q' => array('search' => $id))); } diff --git a/views/anime/view.html.php b/views/anime/view.html.php index 4a3b8c9..1b0eb0c 100644 --- a/views/anime/view.html.php +++ b/views/anime/view.html.php @@ -1,58 +1,77 @@ -

title ?>

+styles($this->html->style('view')); +?> + +

title ?>

-
+
-
- - -
- -

Synopsis

-
-synopsis ?> + +
-

Related Animes

-
+

Synopsis

+
+
+

synopsis ?>

-

Characters And VA's

-
-cast as $char): ?> +

Characters and VA's

+
+
+cast as $char): ?> character ?> role ?> Played by: @@ -65,4 +84,4 @@ Played by:

-
\ No newline at end of file + diff --git a/views/layouts/default.html.php b/views/layouts/default.html.php index 9464d80..9313414 100644 --- a/views/layouts/default.html.php +++ b/views/layouts/default.html.php @@ -69,9 +69,9 @@ use \lithium\security\Auth;
-
+
content() ?> -
+