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