|
1
|
|
|
<?php |
|
2
|
|
|
/*************************************************************** |
|
3
|
|
|
* Copyright notice |
|
4
|
|
|
* |
|
5
|
|
|
* (c) 2009 AOE media ([email protected]) |
|
6
|
|
|
* All rights reserved |
|
7
|
|
|
* |
|
8
|
|
|
* This script is part of the TYPO3 project. The TYPO3 project is |
|
9
|
|
|
* free software; you can redistribute it and/or modify |
|
10
|
|
|
* it under the terms of the GNU General Public License as published by |
|
11
|
|
|
* the Free Software Foundation; either version 2 of the License, or |
|
12
|
|
|
* (at your option) any later version. |
|
13
|
|
|
* |
|
14
|
|
|
* The GNU General Public License can be found at |
|
15
|
|
|
* http://www.gnu.org/copyleft/gpl.html. |
|
16
|
|
|
* |
|
17
|
|
|
* This script is distributed in the hope that it will be useful, |
|
18
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
19
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
20
|
|
|
* GNU General Public License for more details. |
|
21
|
|
|
* |
|
22
|
|
|
* This copyright notice MUST APPEAR in all copies of the script! |
|
23
|
|
|
***************************************************************/ |
|
24
|
|
|
|
|
25
|
|
|
class tx_crawler_view_pagination |
|
26
|
|
|
{ |
|
27
|
|
|
|
|
28
|
|
|
/** |
|
29
|
|
|
* @var string template path |
|
30
|
|
|
*/ |
|
31
|
|
|
protected $template = 'EXT:crawler/template/pagination.php'; |
|
32
|
|
|
|
|
33
|
|
|
/** |
|
34
|
|
|
* @var int $perpage number of items perPage |
|
35
|
|
|
*/ |
|
36
|
|
|
protected $perPage; |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* @var int $currentOffset current offset |
|
40
|
|
|
*/ |
|
41
|
|
|
protected $currentOffset; |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* @var int $totalItemCount number of total item |
|
45
|
|
|
*/ |
|
46
|
|
|
protected $totalItemCount; |
|
47
|
|
|
|
|
48
|
|
|
/** |
|
49
|
|
|
* @var string $baseUrl |
|
50
|
|
|
*/ |
|
51
|
|
|
protected $baseUrl; |
|
52
|
|
|
|
|
53
|
|
|
/** |
|
54
|
|
|
* Method to render the view. |
|
55
|
|
|
* |
|
56
|
|
|
* @return string html content |
|
57
|
|
|
*/ |
|
58
|
|
|
public function render() |
|
59
|
|
|
{ |
|
60
|
|
|
ob_start(); |
|
61
|
|
|
$this->template = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($this->template); |
|
|
|
|
|
|
62
|
|
|
include($this->template); |
|
63
|
|
|
$content = ob_get_contents(); |
|
64
|
|
|
ob_end_clean(); |
|
65
|
|
|
|
|
66
|
|
|
return $content; |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
/** |
|
70
|
|
|
* Returns the currently configured offset- |
|
71
|
|
|
* @return int |
|
72
|
|
|
*/ |
|
73
|
|
|
public function getCurrentOffset() |
|
74
|
|
|
{ |
|
75
|
|
|
return $this->currentOffset; |
|
76
|
|
|
} |
|
77
|
|
|
|
|
78
|
|
|
/** |
|
79
|
|
|
* Method to read the number of items per page |
|
80
|
|
|
* |
|
81
|
|
|
* @return int |
|
82
|
|
|
*/ |
|
83
|
|
|
public function getPerPage() |
|
84
|
|
|
{ |
|
85
|
|
|
return $this->perPage; |
|
86
|
|
|
} |
|
87
|
|
|
|
|
88
|
|
|
/** |
|
89
|
|
|
* Method to set the current offset from start |
|
90
|
|
|
* |
|
91
|
|
|
* @param int $currentOffset |
|
92
|
|
|
*/ |
|
93
|
|
|
public function setCurrentOffset($currentOffset) |
|
94
|
|
|
{ |
|
95
|
|
|
$this->currentOffset = $currentOffset; |
|
96
|
|
|
} |
|
97
|
|
|
|
|
98
|
|
|
/** |
|
99
|
|
|
* Number of items per page. |
|
100
|
|
|
* |
|
101
|
|
|
* @param int $perPage |
|
102
|
|
|
*/ |
|
103
|
|
|
public function setPerPage($perPage) |
|
104
|
|
|
{ |
|
105
|
|
|
$this->perPage = $perPage; |
|
106
|
|
|
} |
|
107
|
|
|
|
|
108
|
|
|
/** |
|
109
|
|
|
* returns the total number of items |
|
110
|
|
|
* @return int |
|
111
|
|
|
*/ |
|
112
|
|
|
public function getTotalItemCount() |
|
113
|
|
|
{ |
|
114
|
|
|
return $this->totalItemCount; |
|
115
|
|
|
} |
|
116
|
|
|
|
|
117
|
|
|
/** |
|
118
|
|
|
* Method to set the total number of items in the pagination |
|
119
|
|
|
* |
|
120
|
|
|
* @param int $totalItemCount |
|
121
|
|
|
*/ |
|
122
|
|
|
public function setTotalItemCount($totalItemCount) |
|
123
|
|
|
{ |
|
124
|
|
|
$this->totalItemCount = $totalItemCount; |
|
125
|
|
|
} |
|
126
|
|
|
|
|
127
|
|
|
/** |
|
128
|
|
|
* Returns the total number of pages needed to display all content which |
|
129
|
|
|
* is paginatable |
|
130
|
|
|
* |
|
131
|
|
|
* @return float |
|
132
|
|
|
*/ |
|
133
|
|
|
public function getTotalPagesCount() |
|
134
|
|
|
{ |
|
135
|
|
|
return ceil($this->getTotalItemCount() / $this->getPerPage()); |
|
136
|
|
|
} |
|
137
|
|
|
|
|
138
|
|
|
/** |
|
139
|
|
|
* This method is used to caluclate the label for a pageoffset, |
|
140
|
|
|
* in normal cases its the internal offset + 1 |
|
141
|
|
|
* |
|
142
|
|
|
* @param int $pageoffset |
|
143
|
|
|
* @return int |
|
144
|
|
|
*/ |
|
145
|
|
|
protected function getLabelForPageOffset($pageoffset) |
|
146
|
|
|
{ |
|
147
|
|
|
return $pageoffset + 1; |
|
148
|
|
|
} |
|
149
|
|
|
} |
|
150
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths