[2] | 1 | <?php |
---|
| 2 | /** |
---|
[4933] | 3 | * @copyright 2005-2008 OpenPNE Project |
---|
[2] | 4 | * @license http://www.php.net/license/3_01.txt PHP License 3.01 |
---|
| 5 | */ |
---|
| 6 | |
---|
| 7 | class ktai_page_h_friend_find_all extends OpenPNE_Action |
---|
| 8 | { |
---|
| 9 | function execute($requests) |
---|
| 10 | { |
---|
| 11 | $u = $GLOBALS['KTAI_C_MEMBER_ID']; |
---|
| 12 | |
---|
| 13 | // --- リクエスト変数 |
---|
| 14 | $nickname = $requests['nickname']; |
---|
| 15 | $birth_year = $requests['birth_year']; |
---|
| 16 | $birth_month = $requests['birth_month']; |
---|
| 17 | $birth_day = $requests['birth_day']; |
---|
| 18 | $page = $requests['page']; |
---|
| 19 | // ---------- |
---|
| 20 | |
---|
| 21 | $profiles = array(); |
---|
| 22 | if ($_REQUEST['profile']) { |
---|
[1268] | 23 | $profiles = db_member_search_check_profile($_REQUEST['profile']); |
---|
[2] | 24 | } |
---|
| 25 | $this->set('profiles', $profiles); |
---|
| 26 | |
---|
[3764] | 27 | $limit = 10; |
---|
[11712] | 28 | $this->set('page', $page); |
---|
[2] | 29 | |
---|
| 30 | //検索デフォルト値表示用 |
---|
| 31 | $cond = array( |
---|
| 32 | 'birth_year' => $birth_year, |
---|
| 33 | 'birth_month' => $birth_month, |
---|
| 34 | 'birth_day' => $birth_day, |
---|
| 35 | ); |
---|
| 36 | $cond_like = array( |
---|
| 37 | 'nickname' => $nickname, |
---|
| 38 | ); |
---|
[11712] | 39 | $this->set('cond', array_merge($cond, $cond_like)); |
---|
[2] | 40 | |
---|
[1268] | 41 | $result = db_member_search($cond, $cond_like, $limit, $page, $u, $profiles); |
---|
[11712] | 42 | $this->set('target_friend_list', $result[0]); |
---|
[2] | 43 | $pager = array( |
---|
[11712] | 44 | 'page_prev' => $result[1], |
---|
| 45 | 'page_next' => $result[2], |
---|
| 46 | 'total_num' => $result[3], |
---|
[2] | 47 | ); |
---|
| 48 | |
---|
| 49 | $pager["disp_start"] = $limit * ($page - 1) + 1; |
---|
| 50 | if (($disp_end = $limit * $page) > $pager['total_num']) { |
---|
| 51 | $pager['disp_end'] = $pager['total_num']; |
---|
| 52 | } else { |
---|
| 53 | $pager['disp_end'] = $disp_end; |
---|
| 54 | } |
---|
| 55 | |
---|
| 56 | $this->set("pager", $pager); |
---|
| 57 | |
---|
| 58 | |
---|
| 59 | $tmp = array(); |
---|
| 60 | foreach ($cond as $key => $value) { |
---|
| 61 | if ($value) { |
---|
| 62 | $tmp[] = $key . '=' . urlencode(mb_convert_encoding($value, 'SJIS-win', 'UTF-8')); |
---|
| 63 | } |
---|
| 64 | } |
---|
| 65 | foreach ($cond_like as $key => $value) { |
---|
| 66 | if ($value) { |
---|
| 67 | $tmp[] = $key . '=' . urlencode(mb_convert_encoding($value, 'SJIS-win', 'UTF-8')); |
---|
| 68 | } |
---|
| 69 | } |
---|
| 70 | foreach ($profiles as $key => $value) { |
---|
| 71 | if ($value['c_profile_option_id']) { |
---|
| 72 | $v = $value['c_profile_option_id']; |
---|
| 73 | } else { |
---|
[2846] | 74 | $v = urlencode(mb_convert_encoding($value['value'], 'SJIS-win', 'UTF-8')); |
---|
[2] | 75 | } |
---|
| 76 | $tmp[] = urlencode("profile[{$key}]") . '=' . $v; |
---|
| 77 | } |
---|
| 78 | $search_condition = implode("&", $tmp); |
---|
| 79 | $this->set("search_condition", $search_condition); |
---|
| 80 | |
---|
| 81 | |
---|
[1268] | 82 | $this->set('profile_list', db_member_c_profile_list()); |
---|
[2] | 83 | return 'success'; |
---|
| 84 | } |
---|
| 85 | } |
---|
| 86 | |
---|
| 87 | ?> |
---|