public static function getAnimeList($series, $is_admin = false) { $id = 0; if (Sentry::check()) { $id = Sentry::getUser()->id; } foreach ($series as $serie) { echo '<li class="item'; if (UserLibrary::getFavorite($serie->id, $id)) { echo ' favorite'; } if ($serie->status == 1) { echo ' ongoing'; } if ($serie->type == 2) { echo ' movie'; } echo '"><a href="' . URL::to('anime/' . $serie->id . '/' . str_replace(array(" ", "/", "?"), "_", $serie->name)) . '">'; $synonyms = Anime::getSynonyms($serie); if (!empty($synonyms)) { echo '<span data-toggle="tooltip-right" title="' . $synonyms . '">' . $serie->name . '</span>'; } else { echo '<span>' . $serie->name . '</span>'; } echo '<div class="pull-right" style="margin-top: -3px;">'; if ($serie->status == 1) { echo '<span class="tag-red">ongoing</span>'; } else { if ($serie->type == 2) { echo '<span class="tag-blue">movie</span>'; } } if ($is_admin) { echo '<button style="margin-left: 5px;" id="update_mirrors_button" class="btn-small btn-success"><input type="hidden" name="anime_id" value="' . $serie->id . '"/><span class="icon-download-alt"></span>' . $serie->id . '</button>'; } echo '</div></a></li>'; } }
public function addFavorite() { $user = Input::get('user_id'); $anime = Input::get('anime_id'); $favorite = UserLibrary::getFavorite($anime, $user); if (empty($favorite)) { $row = UserLibrary::firstOrNew(array('user_id' => $user, 'anime_id' => $anime)); $row->is_fav = true; $row->save(); return '<a data-toggle="tooltip" title="remove from favorites"><input type="hidden" name="user_id" value="' . $user . '"><input type="hidden" name="anime_id" value="' . $anime . '"><span class="icon-heart icon-large met_gray_icon"></span></a>'; } else { $favorite->delete(); return '<a data-toggle="tooltip" title="add to favorites"><input type="hidden" name="user_id" value="' . $user . '"><input type="hidden" name="anime_id" value="' . $anime . '"><span class="icon-heart icon-large"></span></a>'; } return '<a data-toggle="tooltip" title="add to favorites"><input type="hidden" name="0" value="0"><input type="hidden" name="anime_id" value="' . $anime . '"><span class="icon-heart icon-large"></span></a>'; }