示例#1
0
 /**
  * Mmeber_Profile_Image index
  * 
  * @access  public
  * @return  Response
  */
 public function action_index($member_id = null)
 {
     list($is_mypage, $member, $access_from) = $this->check_auth_and_is_mypage($member_id);
     $member_profiles = Model_MemberProfile::get4member_id($member->id, true);
     $title = term('profile', 'site.picture', $is_mypage ? 'site.setting' : '');
     $this->set_title_and_breadcrumbs($title, array('/member/' . $member_id => sprintf('%sさんの%s', $member->name, term('site.page.kana'))), $member);
     $images = array();
     if (is_enabled('album') && conf('upload.types.img.types.m.save_as_album_image')) {
         $album_id = \Album\Model_Album::get_id_for_foreign_table($member->id, 'member');
         $images = \Album\Model_AlbumImage::query()->related('album')->where('album_id', $album_id)->order_by('id', 'desc')->get();
         $this->template->post_footer = \View::forge('_parts/load_masonry');
     }
     $this->template->content = View::forge('member/profile/image/index', array('is_mypage' => $is_mypage, 'member' => $member, 'access_from' => $access_from, 'images' => $images, 'member_profiles' => $member_profiles));
 }
示例#2
0
 public static function get_album_image4note_id($note_id, $limit = 0, $sort = array('id' => 'asc'), $with_count_all = false)
 {
     $album_image_ids = \Util_db::conv_col(\DB::select('album_image_id')->from('note_album_image')->where('note_id', $note_id)->execute()->as_array());
     if (!$album_image_ids) {
         return $with_count_all ? array(array(), 0) : array();
     }
     $query = \Album\Model_AlbumImage::query()->related(array('album'))->where(array('id', 'in', $album_image_ids));
     if ($with_count_all) {
         $count_all = $query->count();
     }
     if ($sort) {
         foreach ($sort as $column => $order) {
             $query->order_by($column, $order);
         }
     }
     if ($limit) {
         $query->rows_limit($limit);
     }
     $list = $query->get();
     return $with_count_all ? array($list, $count_all) : $list;
 }