/** * Album image detail * * @access public * @params integer * @return Response */ public function action_detail($id = null) { $id = (int) $id; $album_image = Model_Albumimage::check_authority($id); $this->check_browse_authority($album_image->public_flag, $album_image->album->member_id); $locations = is_enabled_map('image/detail', 'album') ? Model_AlbumImageLocation::get_locations4album_image_id($id) : null; // 既読処理 if (\Auth::check()) { $this->change_notice_status2read($this->u->id, 'album_image', $id); } // album image_comment $default_params = array('latest' => 1); list($limit, $is_latest, $is_desc, $since_id, $max_id) = $this->common_get_list_params($default_params, conf('view_params_default.detail.comment.limit_max')); list($list, $next_id, $all_comment_count) = Model_AlbumImageComment::get_list(array('album_image_id' => $id), $limit, $is_latest, $is_desc, $since_id, $max_id, null, false, true); // album_image_like $is_liked_self = \Auth::check() ? Model_AlbumImageLike::check_liked($id, $this->u->id) : false; $data = array('album_image' => $album_image, 'locations' => $locations, 'comments' => $list, 'all_comment_count' => $all_comment_count, 'comment_next_id' => $next_id, 'is_liked_self' => $is_liked_self, 'liked_ids' => conf('like.isEnabled') && \Auth::check() && $list ? \Site_Model::get_liked_ids('album_image_comment', $this->u->id, $list) : array()); // get before and after album_image.id if (conf('display_setting.image.detail.displayNextPageButton', 'album')) { list($data['before_id'], $data['after_id']) = $this->get_before_after_ids($album_image->id); } $slide_file_names = array(); if (conf('display_setting.image.detail.displayGallery.isEnabled', 'album')) { if (conf('display_setting.image.detail.displayNextPageButton', 'album')) { Model_AlbumImage::clear_cache(); } $slide_file_names = $this->get_slide_file_names($album_image); } $title = Site_Util::get_album_image_display_name($album_image, term('album_image', 'site.detail')); $this->set_title_and_breadcrumbs($title, array('/album/' . $album_image->album_id => $album_image->album->name), $album_image->album->member, 'album', null, false, false, array('title' => $album_image->album->name, 'description' => $album_image->name ?: FBD_SITE_NAME, 'image' => \Site_Util::get_image_uri4image_list($album_image, 'ai', 'raw'))); $this->template->subtitle = \View::forge('image/_parts/detail_subtitle', array('album_image' => $album_image)); $this->template->post_header = \View::forge('image/_parts/detail_header'); $this->template->post_footer = \View::forge('image/_parts/detail_footer', array('album_image' => $album_image, 'locations' => $locations, 'slide_file_names' => $slide_file_names)); $this->template->content = \View::forge('image/detail', $data); }
/** * Get optional_info * * @access public * @param int $album_image_id * @return Response (json) * @throws Exception in Controller_Base::controller_common_api * @see Controller_Base::controller_common_api */ public function get_optional_info($album_image_id = null) { $this->controller_common_api(function () use($album_image_id) { $album_image = Model_AlbumImage::check_authority($album_image_id); $is_executed = \Auth::check() ? Model_AlbumImageLike::check_liked($album_image_id, $this->u->id) : false; $data = array('id' => $album_image_id, 'comment' => array('count' => $album_image->comment_count), 'like' => array('count' => $album_image->like_count, 'get_uri' => sprintf('album/image/like/api/member/%d.html', $album_image_id), 'post_uri' => sprintf('album/image/like/api/update/%d.json', $album_image_id), 'is_executed' => (int) $is_executed)); $this->set_response_body_api($data); }); }