<h2 class="ribbon full"><a style="color: #FFFFFF" href="/profile/view/<?= $user->username ?>"><?= $user->username ?>'s</a> AnimeList</h2>
<div class="triangle-ribbon"></div>
<br class="cl" />
<table class="table"><tr>
<td><?= $this->html->link("Completed", "#finished", array('class' => 'anchorLink')); ?> </td>
<td><?= $this->html->link("Watching", "#watching", array('class' => 'anchorLink')); ?> </td>
<td><?= $this->html->link("Plans to Watch", "#planning", array('class' => 'anchorLink')); ?> </td>
<td><?= $this->html->link("On-Hold", "#paused", array('class' => 'anchorLink')); ?> </td>
<td><?= $this->html->link("Dropped", "#dropped", array('class' => 'anchorLink')); ?> </td>
</tr>
</table>
<?php function tableHelper($input, &$t) {
echo '<table class="table">';
echo "<tr><th>Entry #</th><th>Anime Title</th><th>Score</th><th>Type</th><th>Progress</th></tr>";
$i = 1;
foreach ($input as $anime) {
	echo '<tr>';
	echo "<td> $i </td>";
	echo "<td> <a href=\"/anime/view/$anime->series_animedb_id/\">$anime->series_title </a></td>";
	echo "<td>";
	echo ($anime->my_score != 0) ? $anime->my_score : "-"; 
	echo "</td>";
	echo "<td> $anime->series_type </td>";
	echo "<td>";
	echo $anime->my_watched_episodes;
	echo  "/"; 
	echo ($anime->series_episodes != 0) ? $anime->series_episodes : "-";
	echo "</td>";
	echo "</tr>";
$i += 1;
}
echo "</table>";
}
?>

<div class="two_col container_12">
<div class="grid_10">
<?php if (isset($watching)): ?>
<a name="watching" id="watching"><h2 class="ribbon">Watching</h2></a>
<div class="triangle-ribbon"></div>
<br class="cl" />	
</div>
<div class="grid_2">
<button class="large" style="margin-left:40px; margin-top:10px"><a href="/animelist/addsearch">Add</a></button>
</div>
</div>


<?php tableHelper($watching, $this); ?>
<?php endif; ?>

<?php if (isset($finished)): ?>
	<a name="finished" id="finished"><h2 class="ribbon">Finished Animes</h2></a>
	<div class="triangle-ribbon"></div>
	<br class="cl" />
	<?php tableHelper($finished, $this); ?>
<?php endif; ?>


<?php if (isset($planning)): ?>
<a name="planning" id="planning"><h2 class="ribbon">Plans to Watch</h2></a>
<div class="triangle-ribbon"></div>
<br class="cl" />

<?php tableHelper($planning, $this); ?>
<?php endif; ?>

<?php if(isset($paused)): ?>
<a name="paused" id="paused"><h2 class="ribbon">Paused</h2></a>
<div class="triangle-ribbon"></div>
<br class="cl" />

<?php tableHelper($paused, $this); ?>
<?php endif; ?>

<?php if (isset($dropped)): ?>


<a name="dropped" id="dropped"><h2 class="ribbon">Dropped</h2></a>
<div class="triangle-ribbon"></div>
<br class="cl" />

<?php tableHelper($dropped, $this); ?>
<?php endif; ?>