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 addDropped() { $anime_id = Input::get("anime_id"); if (Sentry::check()) { $row = UserLibrary::firstOrNew(array('user_id' => Sentry::getUser()->id, 'anime_id' => $anime_id)); $row->library_status = 4; $row->save(); MasterAnime::addSocialList($anime_id, 0, 4); return 'true'; } return 'false'; }
/** * @brief showUser 显示某用户发布的文章 * * @param $params 传入参数 * * @return void */ public function showUser($params) { // 根据 uid 获取 用户信息 $user = new UserLibrary(); $user->setUID($params['uid']); if (!($u = $user->getUser())) { Response::error(404); return; } // 获取文章数据 Widget::initWidget('Post'); Widget::getWidget('Post')->setPerPage(8); Widget::getWidget('Post')->setCurrentPage(isset($params['page']) ? $params['page'] : 1); Widget::getWidget('Post')->setAuthor($u['uid']); Widget::getWidget('Post')->query(); // 设置标题、描述、关键词 Widget::getWidget('Global')->title = urldecode($u['username']); $this->display('index.php'); }
?> </th> <th><?php _e('Website'); ?> </th> <th class="radius-topright"><?php _e('Group'); ?> </th> </tr> </thead> <tbody> <?php $i = 0; $user = new UserLibrary(); $user->setPerPage(10); $user->setCurrentPage(1); $users = $user->getUsers(); foreach ($users as $u) { ?> <tr<?php if ($i % 2 == 0) { ?> class="even"<?php } ?> id="user-<?php echo $u['uid']; ?> ">
<?php $watched = UserLibrary::where('user_id', Sentry::getUser()->id)->where('last_watched_episode', '>', '')->where('library_status', '!=', 4)->where('last_watched_time', '>', \Carbon\Carbon::today()->subMonth())->orderBy('last_watched_time', 'DESC')->get(); ?> {{ View::make('child.anime_watched', ['series' => $watched]) }} </div> </div> </div> <div class="row-fluid"> <div class="span12"> <div class="clearfix"> <h3 class="met_title_with_childs pull-left"> PLAN TO WATCH<span class="met_subtitle">ANIME YOU STILL HAVE TO WATCH</span> </h3> </div> <?php $planned = UserLibrary::user(Sentry::getUser()->id)->status(6)->paginate(6); ?> @if(!empty($planned) && count($planned) > 0) <div class="row-fluid"> <div class="span12"> @foreach($planned as $plan) <?php $anime = Anime::findOrFail($plan->anime_id, array('id', 'name', 'mal_image')); ?> {{ View::make('child.card_anime', array("anime_id" => $anime->id, "anime_name" => $anime->name, "anime_episode" => 0, "anime_img" => $anime->mal_image, "display" => "list", "off_lazy" => true)) }} @endforeach </div> {{ $planned->links() }} </div> @else <div class="row-fluid">
public static function getFavorite($anime, $user) { return UserLibrary::whereRaw('anime_id = ? and user_id = ? and is_fav = ?', array($anime, $user, 1))->first(); }
/** * @brief postAuthor 输出文章作者 * * @return void */ public function postAuthor() { // 检查是否有文章 if (!$this->postHave()) { return; } $author = $this->posts[$this->currentPost - 1]['uid']; $user = new UserLibrary(); $user->setUID($author); $u = $user->getUser(); echo '<a href="' . Router::patch('Author', array('uid' => $author)) . '">' . $u['username'] . '</a>'; }