1 | <?php |
---|
2 | |
---|
3 | /** |
---|
4 | * ユーザの状態をテストに合わせて変化させるユーティリティクラスです。 |
---|
5 | * |
---|
6 | */ |
---|
7 | class User_Utils |
---|
8 | { |
---|
9 | |
---|
10 | /** |
---|
11 | * 端末種別を設定します。 |
---|
12 | * |
---|
13 | * @static |
---|
14 | * @param deviceType 端末種別ID |
---|
15 | */ |
---|
16 | public static function setDeviceType($deviceType) |
---|
17 | { |
---|
18 | SC_Display_Ex::setDummyDevice($deviceType); |
---|
19 | } |
---|
20 | |
---|
21 | /** |
---|
22 | * ログイン状態を設定します。 |
---|
23 | * |
---|
24 | * @static |
---|
25 | * @param isLogin true:ログインしている、false:ログインしていない |
---|
26 | */ |
---|
27 | public static function setLoginState($isLogin, $customer = null, $objQuery = null) |
---|
28 | { |
---|
29 | if (!$isLogin) { |
---|
30 | $_SESSION['customer']['customer_id'] = null; |
---|
31 | $_SESSION['customer']['email'] = null; |
---|
32 | return; |
---|
33 | } |
---|
34 | $customer = array_merge(self::getDefaultCustomer(), $customer); |
---|
35 | $_SESSION['customer']['customer_id'] = $customer['customer_id']; |
---|
36 | $_SESSION['customer']['email'] = $customer['email']; |
---|
37 | $objQuery->delete('dtb_customer', 'customer_id = ?', array($customer['customer_id'])); |
---|
38 | $objQuery->insert('dtb_customer', $customer); |
---|
39 | } |
---|
40 | |
---|
41 | /** |
---|
42 | * ユーザ情報を外部から設定しなかった場合のデフォルト値を取得します。 |
---|
43 | */ |
---|
44 | private static function getDefaultCustomer() |
---|
45 | { |
---|
46 | $arrValue['customer_id'] = '999999998'; |
---|
47 | $arrValue['name01'] = '苗字'; |
---|
48 | $arrValue['name02'] = '名前'; |
---|
49 | $arrValue['kana01'] = 'みょうじ'; |
---|
50 | $arrValue['kana02'] = 'なまえ'; |
---|
51 | $arrValue['email'] = 'sample@sample.co.jp'; |
---|
52 | $arrValue['secret_key'] = 'aaaaaa'; |
---|
53 | $arrValue['status'] = 2; |
---|
54 | $arrValue['create_date'] = 'CURRENT_TIMESTAMP'; |
---|
55 | $arrValue['update_date'] = 'CURRENT_TIMESTAMP'; |
---|
56 | |
---|
57 | return $arrValue; |
---|
58 | } |
---|
59 | } |
---|
60 | |
---|