Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
2fef2fd1
Commit
2fef2fd1
authored
Nov 26, 2007
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
--no commit message
--no commit message
parent
8711b287
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
32 deletions
+32
-32
Pager.php
lib/Doctrine/Pager.php
+30
-30
Sliding.php
lib/Doctrine/Pager/Range/Sliding.php
+2
-2
No files found.
lib/Doctrine/Pager.php
View file @
2fef2fd1
...
@@ -34,29 +34,29 @@
...
@@ -34,29 +34,29 @@
class
Doctrine_Pager
class
Doctrine_Pager
{
{
/**
/**
* @var Doctrine_Query $
query
Doctrine_Query object related to the pager
* @var Doctrine_Query $
_query
Doctrine_Query object related to the pager
*/
*/
protected
$query
;
protected
$
_
query
;
/**
/**
* @var int
$nbResults
Number of results found
* @var int
eger $_numResults
Number of results found
*/
*/
protected
$
nb
Results
;
protected
$
_num
Results
;
/**
/**
* @var int
$maxPerPage
Maximum number of itens per page
* @var int
eger $_maxPerPage
Maximum number of itens per page
*/
*/
protected
$maxPerPage
;
protected
$
_
maxPerPage
;
/**
/**
* @var int
$page
Current page
* @var int
eger $page
Current page
*/
*/
protected
$page
;
protected
$
_
page
;
/**
/**
* @var int
$lastPage
Last page (total of pages)
* @var int
eger $_lastPage
Last page (total of pages)
*/
*/
protected
$lastPage
;
protected
$
_
lastPage
;
...
@@ -69,7 +69,7 @@ class Doctrine_Pager
...
@@ -69,7 +69,7 @@ class Doctrine_Pager
* @param int $maxPerPage Maximum itens per page
* @param int $maxPerPage Maximum itens per page
* @return void
* @return void
*/
*/
public
function
__construct
(
$query
,
$page
,
$maxPerPage
=
0
)
public
function
__construct
(
$query
,
$page
,
$maxPerPage
=
0
)
{
{
$this
->
setQuery
(
$query
);
$this
->
setQuery
(
$query
);
...
@@ -91,7 +91,7 @@ class Doctrine_Pager
...
@@ -91,7 +91,7 @@ class Doctrine_Pager
{
{
// retrieve the number of items found
// retrieve the number of items found
$count
=
$this
->
getQuery
()
->
count
();
$count
=
$this
->
getQuery
()
->
count
();
$this
->
setN
b
Results
(
$count
);
$this
->
setN
um
Results
(
$count
);
$this
->
adjustOffset
();
$this
->
adjustOffset
();
}
}
...
@@ -108,7 +108,7 @@ class Doctrine_Pager
...
@@ -108,7 +108,7 @@ class Doctrine_Pager
{
{
// Define new total of pages
// Define new total of pages
$this
->
setLastPage
(
$this
->
setLastPage
(
max
(
1
,
ceil
(
$this
->
getN
b
Results
()
/
$this
->
getMaxPerPage
()))
max
(
1
,
ceil
(
$this
->
getN
um
Results
()
/
$this
->
getMaxPerPage
()))
);
);
$offset
=
(
$this
->
getPage
()
-
1
)
*
$this
->
getMaxPerPage
();
$offset
=
(
$this
->
getPage
()
-
1
)
*
$this
->
getMaxPerPage
();
...
@@ -120,29 +120,29 @@ class Doctrine_Pager
...
@@ -120,29 +120,29 @@ class Doctrine_Pager
/**
/**
* getN
b
Results
* getN
um
Results
*
*
* Returns the number of results found
* Returns the number of results found
*
*
* @return int the number of results found
* @return int the number of results found
*/
*/
public
function
getN
b
Results
()
public
function
getN
um
Results
()
{
{
return
$this
->
nb
Results
;
return
$this
->
_num
Results
;
}
}
/**
/**
* setN
b
Results
* setN
um
Results
*
*
* Defines the number of total results on initial query
* Defines the number of total results on initial query
*
*
* @param $nb Number of results found on initial query fetch
* @param $nb Number of results found on initial query fetch
* @return void
* @return void
*/
*/
protected
function
setN
b
Results
(
$nb
)
protected
function
setN
um
Results
(
$nb
)
{
{
$this
->
nb
Results
=
$nb
;
$this
->
_num
Results
=
$nb
;
}
}
...
@@ -168,7 +168,7 @@ class Doctrine_Pager
...
@@ -168,7 +168,7 @@ class Doctrine_Pager
*/
*/
public
function
getLastPage
()
public
function
getLastPage
()
{
{
return
$this
->
lastPage
;
return
$this
->
_
lastPage
;
}
}
...
@@ -182,7 +182,7 @@ class Doctrine_Pager
...
@@ -182,7 +182,7 @@ class Doctrine_Pager
*/
*/
protected
function
setLastPage
(
$page
)
protected
function
setLastPage
(
$page
)
{
{
$this
->
lastPage
=
$page
;
$this
->
_
lastPage
=
$page
;
if
(
$this
->
getPage
()
>
$page
)
{
if
(
$this
->
getPage
()
>
$page
)
{
$this
->
_setPage
(
$page
);
$this
->
_setPage
(
$page
);
...
@@ -199,7 +199,7 @@ class Doctrine_Pager
...
@@ -199,7 +199,7 @@ class Doctrine_Pager
*/
*/
public
function
getPage
()
public
function
getPage
()
{
{
return
$this
->
page
;
return
$this
->
_
page
;
}
}
...
@@ -238,7 +238,7 @@ class Doctrine_Pager
...
@@ -238,7 +238,7 @@ class Doctrine_Pager
*/
*/
public
function
haveToPaginate
()
public
function
haveToPaginate
()
{
{
return
$this
->
getN
b
Results
()
>
$this
->
getMaxPerPage
();
return
$this
->
getN
um
Results
()
>
$this
->
getMaxPerPage
();
}
}
...
@@ -268,7 +268,7 @@ class Doctrine_Pager
...
@@ -268,7 +268,7 @@ class Doctrine_Pager
private
function
_setPage
(
$page
)
private
function
_setPage
(
$page
)
{
{
$page
=
intval
(
$page
);
$page
=
intval
(
$page
);
$this
->
page
=
(
$page
<=
0
)
?
1
:
$page
;
$this
->
_
page
=
(
$page
<=
0
)
?
1
:
$page
;
}
}
...
@@ -281,7 +281,7 @@ class Doctrine_Pager
...
@@ -281,7 +281,7 @@ class Doctrine_Pager
*/
*/
public
function
getMaxPerPage
()
public
function
getMaxPerPage
()
{
{
return
$this
->
maxPerPage
;
return
$this
->
_
maxPerPage
;
}
}
...
@@ -311,11 +311,11 @@ class Doctrine_Pager
...
@@ -311,11 +311,11 @@ class Doctrine_Pager
private
function
_setMaxPerPage
(
$max
)
private
function
_setMaxPerPage
(
$max
)
{
{
if
(
$max
>
0
)
{
if
(
$max
>
0
)
{
$this
->
maxPerPage
=
$max
;
$this
->
_
maxPerPage
=
$max
;
}
else
if
(
$max
==
0
)
{
}
else
if
(
$max
==
0
)
{
$this
->
maxPerPage
=
25
;
$this
->
_
maxPerPage
=
25
;
}
else
{
}
else
{
$this
->
maxPerPage
=
abs
(
$max
);
$this
->
_
maxPerPage
=
abs
(
$max
);
}
}
}
}
...
@@ -329,7 +329,7 @@ class Doctrine_Pager
...
@@ -329,7 +329,7 @@ class Doctrine_Pager
*/
*/
public
function
getQuery
()
public
function
getQuery
()
{
{
return
$this
->
query
;
return
$this
->
_
query
;
}
}
...
@@ -348,7 +348,7 @@ class Doctrine_Pager
...
@@ -348,7 +348,7 @@ class Doctrine_Pager
$query
=
Doctrine_Query
::
create
()
->
parseQuery
(
$query
);
$query
=
Doctrine_Query
::
create
()
->
parseQuery
(
$query
);
}
}
$this
->
query
=
$query
;
$this
->
_
query
=
$query
;
}
}
...
...
lib/Doctrine/Pager/Range/Sliding.php
View file @
2fef2fd1
...
@@ -102,7 +102,7 @@ class Doctrine_Pager_Range_Sliding extends Doctrine_Pager_Range
...
@@ -102,7 +102,7 @@ class Doctrine_Pager_Range_Sliding extends Doctrine_Pager_Range
$endPage
=
(
$startPage
+
$this
->
getChunkLength
())
-
1
;
$endPage
=
(
$startPage
+
$this
->
getChunkLength
())
-
1
;
// Check for EndPage out-range
// Check for EndPage out-range
if
(
$endPage
>
$pager
->
getLastPage
()
)
{
if
(
$endPage
>
$pager
->
getLastPage
()
)
{
$offset
=
$endPage
-
$pager
->
getLastPage
();
$offset
=
$endPage
-
$pager
->
getLastPage
();
$endPage
=
$pager
->
getLastPage
();
$endPage
=
$pager
->
getLastPage
();
...
@@ -110,7 +110,7 @@ class Doctrine_Pager_Range_Sliding extends Doctrine_Pager_Range
...
@@ -110,7 +110,7 @@ class Doctrine_Pager_Range_Sliding extends Doctrine_Pager_Range
}
}
// Check for StartPage out-range
// Check for StartPage out-range
if
(
$startPage
<
$pager
->
getFirstPage
()
)
{
if
(
$startPage
<
$pager
->
getFirstPage
()
)
{
$startPage
=
$pager
->
getFirstPage
();
$startPage
=
$pager
->
getFirstPage
();
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment