Пример #1
0
 /**
  * Album detail
  * 
  * @access  public
  * @params  integer
  * @return  Response
  */
 public function action_detail($id = null)
 {
     $id = (int) $id;
     $album = Model_Album::check_authority($id, null, 'member');
     $this->check_browse_authority($album->public_flag, $album->member_id);
     // 既読処理
     if (\Auth::check()) {
         $this->change_notice_status2read($this->u->id, 'album', $id);
     }
     $disabled_to_update = \Album\Site_Util::check_album_disabled_to_update($album->foreign_table);
     list($limit, $page) = $this->common_get_pager_list_params(\Config::get('articles.limit'), \Config::get('articles.limit_max'));
     $data = Model_AlbumImage::get_pager_list(array('related' => array('album'), 'where' => \Site_Model::get_where_params4list(0, \Auth::check() ? $this->u->id : 0, $this->check_is_mypage($album->member_id), array(array('album_id', $id))), 'limit' => $limit, 'order_by' => array('id' => 'desc')), $page);
     if (\Config::get('album.display_setting.detail.display_upload_form') && !$disabled_to_update && \Auth::check() && $album->member_id == $this->u->id) {
         $data['val'] = self::get_validation_public_flag();
     }
     $data['id'] = $id;
     $data['album'] = $album;
     $data['is_member_page'] = true;
     $data['disabled_to_update'] = $disabled_to_update;
     $data['liked_album_image_ids'] = conf('like.isEnabled') && \Auth::check() ? \Site_Model::get_liked_ids('album_image', $this->u->id, $data['list']) : array();
     $this->set_title_and_breadcrumbs($album->name, null, $album->member, 'album', null, false, false, array('title' => $album->name, 'description' => $album->body, 'image' => \Site_Util::get_image_uri4image_list($data['list'], 'ai', 'raw')));
     $this->template->subtitle = \View::forge('_parts/detail_subtitle', array('album' => $album, 'disabled_to_update' => $disabled_to_update));
     $this->template->post_footer = \View::forge('_parts/detail_footer');
     $this->template->post_footer = \View::forge('_parts/detail_footer', array('is_mypage' => check_uid($album->member_id)));
     $this->template->content = \View::forge('detail', $data);
 }
Пример #2
0
 /**
  * Site index
  * 
  * @access  public
  * @return  Response
  */
 public function action_index()
 {
     $data = array();
     if (Config::get('page.site.index.timeline.isEnabled') && is_enabled('timeline')) {
         $data['timelines'] = \Timeline\Site_Util::get_list4view(\Auth::check() ? $this->u->id : 0, 0, false, null, $this->common_get_list_params(array('desc' => 1, 'latest' => 1, 'limit' => Config::get('page.site.index.timeline.list.limit')), Config::get('page.site.index.timeline.list.limit_max'), true));
         $data['timelines']['see_more_link'] = array('uri' => 'timeline');
         //$this->template->post_footer = \View::forge('timeline::_parts/load_timelines');
     }
     if (Config::get('page.site.index.news.isEnabled') && is_enabled('news')) {
         list($limit, $page) = $this->common_get_pager_list_params(\Config::get('page.site.index.news.list.limit'), \Config::get('page.site.index.news.list.limit_max'));
         $data['news_list'] = \News\Site_Model::get_list($limit, $page, \Auth::check());
         $data['news_list']['see_more_link'] = array('uri' => 'news');
     }
     if (Config::get('page.site.index.albumImage.isEnabled') && is_enabled('album')) {
         list($limit, $page) = $this->common_get_pager_list_params(\Config::get('page.site.index.albumImage.list.limit'), \Config::get('page.site.index.albumImage.list.limit_max'));
         $data['album_images'] = \Album\Model_AlbumImage::get_pager_list(array('related' => array('album'), 'where' => \Site_Model::get_where_params4list(0, \Auth::check() ? $this->u->id : 0), 'order_by' => array('id' => 'desc'), 'limit' => $limit), $page);
         $data['album_images']['liked_album_image_ids'] = conf('like.isEnabled') && \Auth::check() ? \Site_Model::get_liked_ids('album_image', $this->u->id, $data['album_images']['list']) : array();
         $data['album_images']['column_count'] = \Config::get('page.site.index.albumImage.list.column_count');
         //$this->template->post_footer = \View::forge('image/_parts/list_footer');
     }
     $this->template->post_footer = \View::forge('site/_parts/index_footer');
     if (conf('site.index.slide.isEnabled', 'page')) {
         if (conf('site.index.slide.recentAlbumImage.isEnabled', 'page')) {
             $images = \Album\Site_Util::get_top_slide_image_uris();
         } else {
             $images = Config::get('page.site.index.slide.images');
         }
         $this->template->post_header_content = View::forge('site/_parts/slide', array('image_uris' => $images));
     }
     $this->set_title_and_breadcrumbs('', null, null, null, null, true, true);
     $this->template->content = View::forge('site/index', $data);
     if (!empty($data['news_list']['list'])) {
         $this->template->content->set_safe('html_bodys', \News\Site_Model::convert_raw_bodys($data['news_list']['list']));
     }
 }
Пример #3
0
 public static function get_list($limit, $page = 1, $self_member_id = 0, $target_member_obj = null, $is_mypage = false, $is_draft = 0)
 {
     if ($target_member_obj && !$target_member_obj instanceof \Model_Member) {
         throw new InvalidArgumentException('forth parameter is invalid.');
     }
     $is_published = \Util_toolkit::reverse_bool($is_draft, true);
     $data = Model_Note::get_pager_list(array('related' => 'member', 'where' => \Site_Model::get_where_params4list($target_member_obj ? $target_member_obj->id : 0, $self_member_id ?: 0, $is_mypage, array(array('is_published', $is_published))), 'limit' => $limit, 'order_by' => array('created_at' => 'desc')), $page);
     $data['is_draft'] = $is_draft;
     $data['member'] = $target_member_obj;
     $data['is_mypage'] = $is_mypage;
     $data['liked_note_ids'] = conf('like.isEnabled') && $self_member_id ? \Site_Model::get_liked_ids('note', $self_member_id, $data['list']) : array();
     return $data;
 }
Пример #4
0
 public static function get_album_images($limit, $page = 1, $self_member_id = 0, $target_member_obj = null, $is_mypage = false, $params = array(), $is_return_array = false, $is_asc = false)
 {
     if (!is_array($params)) {
         $params = (array) $params;
     }
     if ($target_member_obj && !$target_member_obj instanceof \Model_Member) {
         throw new InvalidArgumentException('parameter target_member_obj is invalid.');
     }
     if (!empty($params['select']) && !\DBUtil::field_exists('album_image', $params['select'])) {
         throw new \ValidationFailedException();
     }
     $params = array_merge($params, array('where' => \Site_Model::get_where_params4list($target_member_obj ? $target_member_obj->id : 0, $self_member_id ?: 0, $is_mypage, !empty($params['where']) ? $params['where'] : array(), $target_member_obj ? 'album.member_id' : 'member_id'), 'limit' => $limit, 'order_by' => array('id' => $is_asc ? 'asc' : 'desc')));
     if ($target_member_obj) {
         $params['related'] = array('album');
     }
     $data = Model_AlbumImage::get_pager_list($params, $page, $is_return_array);
     $data['liked_album_image_ids'] = conf('like.isEnabled') && $self_member_id ? \Site_Model::get_liked_ids('album_image', $self_member_id, $data['list']) : array();
     return $data;
 }
Пример #5
0
 public static function get_list($limit, $page = 1, $self_member_id = 0)
 {
     $data = Model_Thread::get_pager_list(array('related' => 'member', 'where' => \Site_Model::get_where_params4list(0, $self_member_id), 'limit' => $limit, 'order_by' => array('created_at' => 'desc')), $page);
     $data['liked_thread_ids'] = conf('like.isEnabled') && $self_member_id ? \Site_Model::get_liked_ids('thread', $self_member_id, $data['list']) : array();
     return $data;
 }
Пример #6
0
 private function get_query_params(Model_AlbumImage $album_image)
 {
     return array('where' => \Site_Model::get_where_params4list(0, \Auth::check() ? $this->u->id : 0, $this->check_is_mypage($album_image->album->member_id), array(array('album_id', $album_image->album->id))), 'order_by' => array('id' => 'desc'));
 }
Пример #7
0
 public static function get_list($self_member_id = 0, $target_member_id = 0, $is_mytimeline = false, $viewType = null, $max_id = 0, $limit = 0, $is_latest = true, $is_desc = true, $since_id = 0)
 {
     $follow_member_ids = null;
     $friend_member_ids = null;
     if (!$self_member_id || $target_member_id) {
         $is_mytimeline = false;
     }
     if ($is_mytimeline) {
         list($follow_member_ids, $friend_member_ids) = Site_Util::get_member_relation_member_ids($self_member_id, $viewType);
     }
     if (!$limit) {
         $limit = (int) \Config::get('timeline.articles.limit');
     }
     if ($limit > \Config::get('timeline.articles.limit_max')) {
         $limit = \Config::get('timeline.articles.limit_max');
     }
     $sort = array('id' => $is_desc ? 'desc' : 'asc');
     $query = Model_TimelineCache::query()->select('id', 'member_id', 'timeline_id', 'type', 'comment_count', 'like_count');
     if ($max_id || $since_id) {
         $query->and_where_open();
     }
     if ($is_mytimeline) {
         if ($follow_timeline_ids = Model_MemberFollowTimeline::get_cols('timeline_id', array('member_id' => $self_member_id))) {
             $query->or_where_open();
             $query->and_where_open();
             self::set_mytimeline_cond($query, $self_member_id, $follow_member_ids);
             $query->and_where_close();
             $query->where('timeline_id', 'in', $follow_timeline_ids);
             $query->where('is_follow', 1);
             $query->or_where_close();
             $query->or_where_open();
             $query->and_where_open();
             self::set_mytimeline_cond($query, $self_member_id, $follow_member_ids);
             $query->and_where_close();
             $query->where('timeline_id', 'not in', $follow_timeline_ids);
             $query->where('is_follow', 0);
             $query->or_where_close();
         } else {
             $query->and_where_open();
             self::set_mytimeline_cond($query, $self_member_id, $follow_member_ids);
             $query->and_where_close();
             $query->where('is_follow', 0);
         }
     } else {
         $is_mypage = $self_member_id && $target_member_id && $target_member_id == $self_member_id;
         $basic_cond = \Site_Model::get_where_params4list($target_member_id, $self_member_id, $is_mypage);
         $query->where($basic_cond);
         $query->where('is_follow', 0);
     }
     if ($max_id || $since_id) {
         $query->and_where_close();
     }
     $is_reverse = false;
     if ($limit && $is_latest && !$is_desc) {
         $is_desc = true;
         $is_reverse = true;
     }
     if ($since_id) {
         $query->where('id', '>', $since_id);
     }
     if ($max_id) {
         $query->where('id', '<=', $max_id);
     }
     $query->order_by($sort);
     if ($limit) {
         $rows_limit = $limit + 1;
         $query->rows_limit($rows_limit);
     }
     $list = $query->get();
     $next_id = 0;
     if ($limit && count($list) > $limit) {
         $next_obj = array_pop($list);
         $next_id = $next_obj->id;
     }
     return array($list, $next_id);
 }