@@ -122,8 +122,7 @@ |
||
122 | 122 | if ($this->email->send()) |
123 | 123 | { |
124 | 124 | return TRUE; |
125 | - } |
|
126 | - else |
|
125 | + } else |
|
127 | 126 | { |
128 | 127 | // echo $this->email->print_debugger(); |
129 | 128 | return FALSE; |
@@ -12,8 +12,8 @@ discard block |
||
12 | 12 | */ |
13 | 13 | class Shop extends MY_Controller { |
14 | 14 | |
15 | - public $limit; // 1ページに表示する商品の数 |
|
16 | - public $admin; // 管理者のメールアドレス |
|
15 | + public $limit; // 1ページに表示する商品の数 |
|
16 | + public $admin; // 管理者のメールアドレス |
|
17 | 17 | |
18 | 18 | public function __construct() |
19 | 19 | { |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | |
68 | 68 | # モデルよりそのカテゴリの商品数を取得し、ページネーションを生成します。 |
69 | 69 | $this->load->library('generate_pagination'); |
70 | - $path = '/shop/index/' . $cat_id; |
|
70 | + $path = '/shop/index/'.$cat_id; |
|
71 | 71 | $total = $this->inventory_model->get_product_count($cat_id); |
72 | 72 | $data['pagination'] = $this->generate_pagination->get_links($path, $total, 4); |
73 | 73 | |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | ); |
150 | 150 | |
151 | 151 | # 検索キーワードをクエリ文字列から取得します。 |
152 | - $q = (string) $this->input->get('q'); |
|
152 | + $q = (string)$this->input->get('q'); |
|
153 | 153 | # 全角スペースを半角スペースに変換します。 |
154 | 154 | $q = trim(mb_convert_kana($q, 's')); |
155 | 155 | # 検索キーワードを検証します。 |
@@ -168,13 +168,13 @@ discard block |
||
168 | 168 | |
169 | 169 | # ページネーションを生成します。 |
170 | 170 | $this->load->library('generate_pagination'); |
171 | - $path = '/shop/search'; |
|
171 | + $path = '/shop/search'; |
|
172 | 172 | $data['pagination'] = $this->generate_pagination->get_links($path, $total, 3); |
173 | 173 | |
174 | 174 | $data['q'] = $q; |
175 | 175 | $data['total'] = $total; |
176 | 176 | |
177 | - $data['main'] = 'shop_search'; |
|
177 | + $data['main'] = 'shop_search'; |
|
178 | 178 | $data['item_count'] = $this->cart_model->count(); |
179 | 179 | $this->twig->display('shop_tmpl_shop', $data); |
180 | 180 | } |
@@ -216,8 +216,7 @@ discard block |
||
216 | 216 | |
217 | 217 | $data['action'] = '注文内容の確認'; |
218 | 218 | $data['main'] = 'shop_confirm'; |
219 | - } |
|
220 | - else |
|
219 | + } else |
|
221 | 220 | { |
222 | 221 | $data = [ |
223 | 222 | 'action' => 'お客様情報の入力', |
@@ -245,8 +244,7 @@ discard block |
||
245 | 244 | $this->twig->display('shop_tmpl_checkout', $data); |
246 | 245 | # 注文が完了したので、セッションを破棄します。 |
247 | 246 | $this->session->sess_destroy(); |
248 | - } |
|
249 | - else |
|
247 | + } else |
|
250 | 248 | { |
251 | 249 | echo 'システムエラー'; |
252 | 250 | } |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | } |
26 | 26 | |
27 | 27 | # 携帯端末からのアクセスを判定するためユーザエージェントクラスをロードします。 |
28 | - $agent =& load_class('User_agent'); |
|
28 | + $agent = & load_class('User_agent'); |
|
29 | 29 | |
30 | 30 | # 携帯端末からの入力文字エンコードを変換します。 |
31 | 31 | if (count($_POST) > 1 && $agent->is_mobile()) |
@@ -41,13 +41,13 @@ discard block |
||
41 | 41 | return; |
42 | 42 | } |
43 | 43 | |
44 | - if (! $this->check_route()) { |
|
44 | + if ( ! $this->check_route()) { |
|
45 | 45 | return; |
46 | 46 | } |
47 | 47 | |
48 | 48 | // load_class()でuser_agentをロードしたため、$this->user_agentとして |
49 | 49 | // して代入されているので、それを$this->agentに変更する |
50 | - $CI =& get_instance(); |
|
50 | + $CI = & get_instance(); |
|
51 | 51 | $CI->agent = $CI->user_agent; |
52 | 52 | unset($CI->user_agent); |
53 | 53 | } |
@@ -8,7 +8,7 @@ |
||
8 | 8 | public function get_links($path, $total, $uri_segment) |
9 | 9 | { |
10 | 10 | # ページネーションクラスをロードします。 |
11 | - $this->CI =& get_instance(); |
|
11 | + $this->CI = & get_instance(); |
|
12 | 12 | $this->CI->load->library('pagination'); |
13 | 13 | |
14 | 14 | $config = []; |
@@ -5,6 +5,12 @@ |
||
5 | 5 | private $CI; |
6 | 6 | |
7 | 7 | // ページネーションの生成 |
8 | + |
|
9 | + /** |
|
10 | + * @param string $path |
|
11 | + * @param integer $total |
|
12 | + * @param integer $uri_segment |
|
13 | + */ |
|
8 | 14 | public function get_links($path, $total, $uri_segment) |
9 | 15 | { |
10 | 16 | # ページネーションクラスをロードします。 |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | |
17 | 17 | public function __construct() |
18 | 18 | { |
19 | - $this->CI =& get_instance(); |
|
19 | + $this->CI = & get_instance(); |
|
20 | 20 | $this->CI->load->database(); |
21 | 21 | $this->CI->load->dbforge(); |
22 | 22 | $this->db = $this->CI->db; |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | */ |
31 | 31 | public function call($seeder) |
32 | 32 | { |
33 | - $file = APPPATH . 'database/seeds/' . $seeder . '.php'; |
|
33 | + $file = APPPATH.'database/seeds/'.$seeder.'.php'; |
|
34 | 34 | require_once $file; |
35 | 35 | $obj = new $seeder; |
36 | 36 | $obj->run(); |
@@ -6,7 +6,7 @@ |
||
6 | 6 | |
7 | 7 | public function __construct() |
8 | 8 | { |
9 | - $this->CI =& get_instance(); |
|
9 | + $this->CI = & get_instance(); |
|
10 | 10 | $this->CI->load->library('form_validation'); |
11 | 11 | |
12 | 12 | $this->set_validation_rules(); |
@@ -20,6 +20,9 @@ |
||
20 | 20 | $this->CI->form_validation->set_error_delimiters($prefix, $suffix); |
21 | 21 | } |
22 | 22 | |
23 | + /** |
|
24 | + * @param string $field |
|
25 | + */ |
|
23 | 26 | protected function set_rules( |
24 | 27 | $field, $label = '', $rules = array(), $errors = array() |
25 | 28 | ) |
@@ -6,7 +6,7 @@ |
||
6 | 6 | |
7 | 7 | public function __construct() |
8 | 8 | { |
9 | - $this->CI =& get_instance(); |
|
9 | + $this->CI = & get_instance(); |
|
10 | 10 | $this->CI->load->library('form_validation'); |
11 | 11 | } |
12 | 12 |
@@ -24,8 +24,7 @@ |
||
24 | 24 | if ($this->CI->form_validation->run() === FALSE) |
25 | 25 | { |
26 | 26 | show_error('不正な入力です。'); |
27 | - } |
|
28 | - else |
|
27 | + } else |
|
29 | 28 | { |
30 | 29 | return TRUE; |
31 | 30 | } |
@@ -10,6 +10,9 @@ |
||
10 | 10 | $this->CI->load->library('form_validation'); |
11 | 11 | } |
12 | 12 | |
13 | + /** |
|
14 | + * @param string $rules |
|
15 | + */ |
|
13 | 16 | public function validate($value, $rules, $errors = []) |
14 | 17 | { |
15 | 18 | $this->CI->form_validation->reset_validation(); |
@@ -25,13 +25,13 @@ discard block |
||
25 | 25 | # unset_userdata()メソッドで、セッションデータからその商品を削除します。 |
26 | 26 | if ($qty <= 0) |
27 | 27 | { |
28 | - $this->session->unset_userdata('item' . $id); |
|
28 | + $this->session->unset_userdata('item'.$id); |
|
29 | 29 | } |
30 | 30 | # 指定の数量が1以上の場合は、その商品が存在するかチェックした後に、商品と数量を |
31 | 31 | # セッションデータに追加します。セッションの項目名は「item+商品ID」とします。 |
32 | 32 | elseif ($this->inventory_model->is_available_product_item($id)) |
33 | 33 | { |
34 | - $this->session->set_userdata('item' . $id, $qty); |
|
34 | + $this->session->set_userdata('item'.$id, $qty); |
|
35 | 35 | } |
36 | 36 | } |
37 | 37 | |
@@ -42,9 +42,9 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public function get_all() |
44 | 44 | { |
45 | - $items = []; // 商品情報の配列 |
|
46 | - $total = 0; // 合計金額 |
|
47 | - $line = 0; // 行数 |
|
45 | + $items = []; // 商品情報の配列 |
|
46 | + $total = 0; // 合計金額 |
|
47 | + $line = 0; // 行数 |
|
48 | 48 | |
49 | 49 | # セッションクラスのuserdata()メソッドですべてのセッションデータを取得し、 |
50 | 50 | # ループで回して必要な情報を取り出します。 |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | { |
56 | 56 | $line++; |
57 | 57 | # 配列のキーから商品IDを取り出します。 |
58 | - $id = (int) substr($key, 4); |
|
58 | + $id = (int)substr($key, 4); |
|
59 | 59 | # get_product_item()メソッドを使い、商品データを取得します。 |
60 | 60 | $item = $this->inventory_model->get_product_item($id); |
61 | 61 | # 単価に数量を掛けて金額を計算します。 |
@@ -74,9 +74,9 @@ discard block |
||
74 | 74 | } |
75 | 75 | |
76 | 76 | $cart = []; |
77 | - $cart['items'] = $items; // 商品情報の配列 |
|
78 | - $cart['line'] = $line; // 商品アイテム数 |
|
79 | - $cart['total'] = $total; // 合計金額 |
|
77 | + $cart['items'] = $items; // 商品情報の配列 |
|
78 | + $cart['line'] = $line; // 商品アイテム数 |
|
79 | + $cart['total'] = $total; // 合計金額 |
|
80 | 80 | |
81 | 81 | return $cart; |
82 | 82 | } |
@@ -56,8 +56,7 @@ |
||
56 | 56 | if ($query->num_rows() == 1) |
57 | 57 | { |
58 | 58 | return TRUE; |
59 | - } |
|
60 | - else |
|
59 | + } else |
|
61 | 60 | { |
62 | 61 | return FALSE; |
63 | 62 | } |
@@ -18,6 +18,9 @@ discard block |
||
18 | 18 | return $query->result(); |
19 | 19 | } |
20 | 20 | |
21 | + /** |
|
22 | + * @param string $id |
|
23 | + */ |
|
21 | 24 | public function get_category_name($id) |
22 | 25 | { |
23 | 26 | $this->db->select('name'); |
@@ -27,6 +30,11 @@ discard block |
||
27 | 30 | return $row->name; |
28 | 31 | } |
29 | 32 | |
33 | + /** |
|
34 | + * @param string $cat_id |
|
35 | + * @param string|null $limit |
|
36 | + * @param string $offset |
|
37 | + */ |
|
30 | 38 | public function get_product_list($cat_id, $limit, $offset) |
31 | 39 | { |
32 | 40 | $this->db->where('category_id', $cat_id); |
@@ -35,6 +43,9 @@ discard block |
||
35 | 43 | return $query->result(); |
36 | 44 | } |
37 | 45 | |
46 | + /** |
|
47 | + * @param string $cat_id |
|
48 | + */ |
|
38 | 49 | public function get_product_count($cat_id) |
39 | 50 | { |
40 | 51 | $this->db->where('category_id', $cat_id); |
@@ -49,6 +60,9 @@ discard block |
||
49 | 60 | return $query->row(); |
50 | 61 | } |
51 | 62 | |
63 | + /** |
|
64 | + * @param integer $id |
|
65 | + */ |
|
52 | 66 | public function is_available_product_item($id) |
53 | 67 | { |
54 | 68 | $this->db->where('id', $id); |
@@ -63,6 +77,11 @@ discard block |
||
63 | 77 | } |
64 | 78 | } |
65 | 79 | |
80 | + /** |
|
81 | + * @param string $q |
|
82 | + * @param string|null $limit |
|
83 | + * @param string $offset |
|
84 | + */ |
|
66 | 85 | public function get_product_by_search($q, $limit, $offset) |
67 | 86 | { |
68 | 87 | # 検索キーワードをスペースで分割し、like()メソッドでLIKE句を指定します。 |
@@ -78,6 +97,9 @@ discard block |
||
78 | 97 | return $query->result(); |
79 | 98 | } |
80 | 99 | |
100 | + /** |
|
101 | + * @param string $q |
|
102 | + */ |
|
81 | 103 | public function get_count_by_search($q) |
82 | 104 | { |
83 | 105 | $this->db->select('name'); |