/** * Mmeber_profile index * * @access public * @return Response */ public function action_index($id = null) { list($is_mypage, $member, $access_from) = $this->check_auth_and_is_mypage($id); $member_profiles = Model_MemberProfile::get4member_id($member->id, true); $this->set_title_and_breadcrumbs(sprintf('%sの%s', $is_mypage ? '自分' : $member->name . 'さん', term('profile')), null, $member); $this->template->content = View::forge('member/profile/index', array('member' => $member, 'is_mypage' => $is_mypage, 'access_from' => $access_from, 'member_profiles' => $member_profiles)); }
/** * The detail action. * * @access public * @params integer * @return Response */ public function action_detail($id = null) { $id = (int) $id; $member = \Model_Member::check_authority($id); $member_profiles = \Model_MemberProfile::get4member_id($member->id, true); $data = array('is_mypage' => true, 'access_from' => 'self', 'member' => $member, 'member_profiles' => $member_profiles, 'display_type' => 'detail', 'is_hide_fallow_btn' => true); $this->set_title_and_breadcrumbs($member->name . ' さんの詳細', array('admin/member' => term('member.view', 'site.management'))); $this->template->subtitle = \View::forge('member/_parts/detail_subtitle', array('member' => $member)); $this->template->content = \View::forge('member/home', $data); }
/** * Mmeber home * * @access public * @return Response */ public function action_home($id = null) { $id = (int) $id; list($is_mypage, $member, $access_from) = $this->check_auth_and_is_mypage($id); $member_profiles = Model_MemberProfile::get4member_id($member->id, true); $data = array('member' => $member, 'member_profiles' => $member_profiles, 'is_mypage' => $is_mypage, 'access_from' => $access_from, 'display_type' => 'summary'); if (is_enabled('timeline')) { $data['timeline'] = \Timeline\Site_Util::get_list4view(\Auth::check() ? $this->u->id : 0, $member->id, false, null, $this->common_get_list_params(array('desc' => 1, 'latest' => 1, 'limit' => conf('articles.limit', 'timeline')), conf('articles.limit_max', 'timeline'), true)); $data['timeline']['member'] = $member; $this->template->post_footer = \View::forge('timeline::_parts/load_timelines'); } $this->set_title_and_breadcrumbs($member->name . ' さんのページ', array('member/list' => term('member.view', 'site.list')), null, null, array(), false, false, array('title' => $member->name . ' さんのページ', 'image' => Site_Util::get_image_uri4file_name($member->get_image(), 'P_L', 'profile'))); $this->template->content = \View::forge('member/home', $data); }
/** * 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)); }
public static function check_saved_member_profile_required(Model_Member $member, $disp_type = 'regist') { if (!in_array($disp_type, array('regist'))) { throw new InvalidArgumentException('Second parameter is invalid.'); } if (conf('profile.sex.isRequired') && empty($member->sex)) { return false; } if (conf('profile.birthday.birthyear.isRequired') && empty($member->birthyear)) { return false; } if (conf('profile.birthday.birthday.isRequired') && empty($member->birthday)) { return false; } if (!($profiles = Model_Profile::get_assoc('id', 'is_required', array('is_required' => 1, 'is_disp_' . $disp_type => 1)))) { return true; } $profileds_for_check = $profiles; if (!($member_profiles = Model_MemberProfile::get4member_id($member->id))) { return false; } foreach ($member_profiles as $member_profile) { unset($profileds_for_check[$member_profile->profile_id]); if (empty($profiles[$member_profile->profile_id])) { continue; } if ($member_profile->profile_option_id) { continue; } if ($member_profile->value) { continue; } if (strlen($member_profile->value)) { continue; } return false; } if ($profileds_for_check) { return false; } return true; }
private function save_member_profile() { foreach ($this->profiles as $profile) { $profile_options = $profile->profile_option; if ($profile->form_type == 'checkbox') { $member_profiles = (array) $this->member_profiles_profile_id_indexed[$profile->id]; foreach ($profile_options as $profile_option) { if (isset($this->validated_values[$profile->name]) && in_array($profile_option->id, $this->validated_values[$profile->name])) { $member_profile = isset($member_profiles[$profile_option->id]) ? $member_profiles[$profile_option->id] : Model_MemberProfile::forge(); $member_profile->member_id = $this->member_obj->id; $member_profile->profile_id = $profile->id; $member_profile->profile_option_id = $profile_option->id; if ($profile->is_edit_public_flag) { $member_profile->public_flag = $this->member_profile_public_flags[$profile->id]; } else { $member_profile->public_flag = $profile->default_public_flag; } $member_profile->value = $profile_option->label; $member_profile->save(); } else { if (!isset($member_profiles[$profile_option->id])) { continue; } $member_profiles[$profile_option->id]->delete(); } } } else { $member_profile = $this->member_profiles_profile_id_indexed[$profile->id]; if (is_null($member_profile)) { $member_profile = Model_MemberProfile::forge(); } $member_profile->member_id = $this->member_obj->id; $member_profile->profile_id = $profile->id; if ($profile->is_edit_public_flag) { $member_profile->public_flag = $this->member_profile_public_flags[$profile->id]; } else { $member_profile->public_flag = $profile->default_public_flag; } if (in_array($profile->form_type, array('radio', 'select'))) { $profile_option_id = $this->validated_values[$profile->name]; $member_profile->profile_option_id = $profile_option_id; $member_profile->value = $profile_options[$profile_option_id]->label; } else { $member_profile->value = $this->validated_values[$profile->name]; } $member_profile->save(); } } }