Browse Source

kdrama search results on search/index

raylu 14 years ago
parent
commit
5cc64bc633

+ 1 - 1
controllers/SearchController.php

@@ -6,7 +6,7 @@ use app\models\Manga;
 use app\models\Kdrama;
 
 class SearchController extends \lithium\action\Controller {
-	public $publicActions = array('index', 'anime');
+	public $publicActions = array('index', 'anime', 'manga', 'kdrama');
 
 	public function index() {
 		if (isset($this->request->query['q']))

+ 0 - 4
views/elements/animesearch.html.php

@@ -1,4 +0,0 @@
-<tr><th>img</th><th>Name</th><th>Episodes</th><th>Type</th><th>Score</th></tr>
-		<?php foreach($content as $item): ?>
-			<tr><td>"image"</td><td><a href="/anime/view/<?= $item->special_id ?>"><?= $item->title ?></a></td> <td><?= $item->episode_count ?></td><td><?= $item->view_type ?></td><td><?= $item->mal_score ?></td></tr>
-<?php endforeach; ?>

+ 28 - 0
views/elements/kdramatable.html.php

@@ -0,0 +1,28 @@
+<table>
+<th>Title</th>
+<th>Date</th>
+<?php foreach ($kdrama as $k): ?>
+	<tr>
+		<td>
+			<a href="/kdrama/view/<?= $k->special_id ?>"><?= $k->title ?></a>
+			<?php if (isset($k->foreign_titles) || isset($k->alternative_titles)): ?>
+				<span class="alt_titles">
+				<?php if (isset($k->foreign_titles)): ?>
+					<?= $k->foreign_titles[0] ?>
+				<?php endif ?>
+				<?php if (isset($k->alternative_titles)): ?>
+					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+					<?= $k->alternative_titles[0] ?>
+				<?php endif ?>
+				</span>
+			<?php endif ?>
+		</td>
+		<td>
+			<?php
+			$network = array_values($k->networks->data());
+			?>
+			<?= $network[0]['broadcast_period'] ?>
+		</td>
+	</tr>
+<?php endforeach ?>
+</table>

+ 4 - 4
views/search/index.html.php

@@ -9,7 +9,7 @@ $this->styles($this->html->style('search'));
 <div class="triangle-ribbon"></div>
 <?= $this->_render('element', 'animetable', compact('anime')) ?>
 <p class="more">
-<a href="/search/anime/<?= $q ?>">More</a>
+<a href="/search/anime/?q=<?= $q ?>">More</a>
 </p>
 
 <h2 class="ribbon">Manga</h2>
@@ -17,15 +17,15 @@ $this->styles($this->html->style('search'));
 <p>results</p>
 <?php if(count($manga) > 0): ?>
 <p class="more">
-<a href="/search/manga/<?= $q ?>">More</a>
+<a href="/search/manga/?q=<?= $q ?>">More</a>
 </p>
 <?php endif ?>
 
 <h2 class="ribbon">K-Drama</h2>
 <div class="triangle-ribbon"></div>
-<p>results</p>
+<?= $this->_render('element', 'kdramatable', compact('anime')) ?>
 <?php if(count($kdrama) > 0): ?>
 <p class="more">
-<a href="/search/kdrama/<?= $q ?>">More</a>
+<a href="/search/kdrama/?q=<?= $q ?>">More</a>
 </p>
 <?php endif ?>