Generate_pagination::get_links()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 33

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 33
rs 9.392
c 0
b 0
f 0
cc 1
nc 1
nop 3
1
<?php
2
3
class Generate_pagination
4
{
5
	private $CI;
6
7
	// ページネーションの生成
8
	public function get_links($path, $total, $uri_segment)
9
	{
10
# ページネーションクラスをロードします。
11
		$this->CI =& get_instance();
12
		$this->CI->load->library('pagination');
13
14
		$config = [];
15
# リンク先のURLを指定します。
16
		$config['base_url']       = $this->CI->config->site_url($path);
0 ignored issues
show
Bug introduced by
The property config does not seem to exist in CI_Controller.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
17
# 総件数を指定します。
18
		$config['total_rows']     = $total;
19
# 1ページに表示する件数を指定します。
20
		$config['per_page']       = $this->CI->limit;
0 ignored issues
show
Bug introduced by
The property limit does not seem to exist in CI_Controller.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
21
# ページ番号情報がどのURIセグメントに含まれるか指定します。
22
		$config['uri_segment']    = $uri_segment;
23
# ページネーションでクエリ文字列を使えるようにします。
24
		$config['reuse_query_string'] = TRUE;
25
# 生成するリンクのテンプレートを指定します。
26
		$config['first_link']      = '&laquo;最初';
27
		$config['last_link']       = '最後&raquo;';
28
		$config['full_tag_open']   = '<p>';
29
		$config['full_tag_close']  = '</p>';
30
		$config['num_tag_open']    = ' ';
31
		$config['num_tag_close']   = ' ';
32
		$config['last_tag_open']   = ' ';
33
		$config['last_tag_close']  = ' ';
34
		$config['first_tag_open']  = ' ';
35
		$config['first_tag_close'] = ' ';
36
# $configでページネーションを初期化します。
37
		$this->CI->pagination->initialize($config);
0 ignored issues
show
Bug introduced by
The property pagination does not seem to exist in CI_Controller.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
38
# 生成したリンクの文字列を返します。
39
		return $this->CI->pagination->create_links();
40
	}
41
}
42