-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathAppPaginatorHelper.php
More file actions
48 lines (42 loc) · 1.37 KB
/
AppPaginatorHelper.php
File metadata and controls
48 lines (42 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
/**
* NetCommons用に拡張したページネーション Helper
*
* @author Noriko Arai <arai@nii.ac.jp>
* @author Shohei Nakajima <nakajimashouhei@gmail.com>
* @link http://www.netcommons.org NetCommons Project
* @license http://www.netcommons.org/license.txt NetCommons License
* @copyright Copyright 2014, NetCommons Project
*/
App::uses('PaginatorHelper', 'View/Helper');
App::uses('NetCommonsUrl', 'NetCommons.Utility');
/**
* NetCommons用に拡張したページネーション Helper
*
* @author Shohei Nakajima <nakajimashouhei@gmail.com>
* @package NetCommons\NetCommons\View\Helper
*/
class AppPaginatorHelper extends PaginatorHelper {
/**
* Converts the keys being used into the format set by options.paramType
*
* @param array $url Array of URL params to convert
* @param string $type Keys type.
* @return array converted URL params.
*/
protected function _convertUrlKeys($url, $type) {
$url = parent::_convertUrlKeys($url, $type);
if (array_key_exists('block_id', $this->request->params)) {
$url['block_id'] = $this->request->params['block_id'];
}
if (array_key_exists('key', $this->request->params)) {
$url['key'] = $this->request->params['key'];
}
if (array_key_exists('block_id', $this->request->params)) {
$url = NetCommonsUrl::blockUrl($url);
} else {
$url = NetCommonsUrl::actionUrlAsArray($url);
}
return $url;
}
}