Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
PSDI Army
yii2
Commits
dc893ec6
Commit
dc893ec6
authored
Jul 28, 2013
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added DataProvider::id
parent
f4f57bf0
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
3 deletions
+28
-3
DataProvider.php
framework/yii/data/DataProvider.php
+27
-2
LinkPager.php
framework/yii/widgets/LinkPager.php
+1
-1
No files found.
framework/yii/data/DataProvider.php
View file @
dc893ec6
...
@@ -21,6 +21,13 @@ use yii\base\InvalidParamException;
...
@@ -21,6 +21,13 @@ use yii\base\InvalidParamException;
*/
*/
abstract
class
DataProvider
extends
Component
implements
IDataProvider
abstract
class
DataProvider
extends
Component
implements
IDataProvider
{
{
/**
* @var string an ID that uniquely identifies the data provider among all data providers.
* You should set this property if the same page contains two or more different data providers.
* Otherwise, the [[pagination]] and [[sort]] mainly not work properly.
*/
public
$id
;
private
$_sort
;
private
$_sort
;
private
$_pagination
;
private
$_pagination
;
...
@@ -31,6 +38,9 @@ abstract class DataProvider extends Component implements IDataProvider
...
@@ -31,6 +38,9 @@ abstract class DataProvider extends Component implements IDataProvider
{
{
if
(
$this
->
_pagination
===
null
)
{
if
(
$this
->
_pagination
===
null
)
{
$this
->
_pagination
=
new
Pagination
;
$this
->
_pagination
=
new
Pagination
;
if
(
$this
->
id
!==
null
)
{
$this
->
_pagination
->
pageVar
=
$this
->
id
.
'-page'
;
}
}
}
return
$this
->
_pagination
;
return
$this
->
_pagination
;
}
}
...
@@ -50,7 +60,13 @@ abstract class DataProvider extends Component implements IDataProvider
...
@@ -50,7 +60,13 @@ abstract class DataProvider extends Component implements IDataProvider
public
function
setPagination
(
$value
)
public
function
setPagination
(
$value
)
{
{
if
(
is_array
(
$value
))
{
if
(
is_array
(
$value
))
{
$this
->
_pagination
=
Yii
::
createObject
(
array_merge
(
array
(
'class'
=>
'yii\data\Pagination'
),
$value
));
$config
=
array
(
'class'
=>
Pagination
::
className
(),
);
if
(
$this
->
id
!==
null
)
{
$config
[
'pageVar'
]
=
$this
->
id
.
'-page'
;
}
$this
->
_pagination
=
Yii
::
createObject
(
array_merge
(
$config
,
$value
));
}
elseif
(
$value
instanceof
Pagination
||
$value
===
false
)
{
}
elseif
(
$value
instanceof
Pagination
||
$value
===
false
)
{
$this
->
_pagination
=
$value
;
$this
->
_pagination
=
$value
;
}
else
{
}
else
{
...
@@ -65,6 +81,9 @@ abstract class DataProvider extends Component implements IDataProvider
...
@@ -65,6 +81,9 @@ abstract class DataProvider extends Component implements IDataProvider
{
{
if
(
$this
->
_sort
===
null
)
{
if
(
$this
->
_sort
===
null
)
{
$this
->
_sort
=
new
Sort
;
$this
->
_sort
=
new
Sort
;
if
(
$this
->
id
!==
null
)
{
$this
->
_sort
->
pageVar
=
$this
->
id
.
'-sort'
;
}
}
}
return
$this
->
_sort
;
return
$this
->
_sort
;
}
}
...
@@ -84,7 +103,13 @@ abstract class DataProvider extends Component implements IDataProvider
...
@@ -84,7 +103,13 @@ abstract class DataProvider extends Component implements IDataProvider
public
function
setSort
(
$value
)
public
function
setSort
(
$value
)
{
{
if
(
is_array
(
$value
))
{
if
(
is_array
(
$value
))
{
$this
->
_sort
=
Yii
::
createObject
(
array_merge
(
array
(
'class'
=>
'yii\data\Sort'
),
$value
));
$config
=
array
(
'class'
=>
Sort
::
className
(),
);
if
(
$this
->
id
!==
null
)
{
$config
[
'sortVar'
]
=
$this
->
id
.
'-sort'
;
}
$this
->
_sort
=
Yii
::
createObject
(
array_merge
(
$config
,
$value
));
}
elseif
(
$value
instanceof
Sort
||
$value
===
false
)
{
}
elseif
(
$value
instanceof
Sort
||
$value
===
false
)
{
$this
->
_sort
=
$value
;
$this
->
_sort
=
$value
;
}
else
{
}
else
{
...
...
framework/yii/widgets/LinkPager.php
View file @
dc893ec6
...
@@ -101,7 +101,7 @@ class LinkPager extends Widget
...
@@ -101,7 +101,7 @@ class LinkPager extends Widget
throw
new
InvalidConfigException
(
'The "pagination" property must be set.'
);
throw
new
InvalidConfigException
(
'The "pagination" property must be set.'
);
}
}
if
(
$this
->
template
===
null
)
{
if
(
$this
->
template
===
null
)
{
$this
->
template
=
'
<label>'
.
Yii
::
t
(
'yii'
,
'Go to page:'
)
.
'</label>
{pages}'
;
$this
->
template
=
'{pages}'
;
}
}
}
}
...
...
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