mirror of
https://github.com/silverstripe/silverstripe-contentreview
synced 2024-10-22 17:05:47 +02:00
ENH: play nicer with subsites module
This commit is contained in:
parent
2b98e7b7d9
commit
4f1d9f15f8
@ -116,7 +116,7 @@ class PagesDueForReviewReport extends SS_Report {
|
||||
* @param array $params
|
||||
* @param string $sort
|
||||
* @param array $limit
|
||||
* @return DataList
|
||||
* @return SS_List
|
||||
*/
|
||||
public function sourceRecords($params, $sort, $limit) {
|
||||
Versioned::reading_stage('Stage');
|
||||
@ -159,6 +159,18 @@ class PagesDueForReviewReport extends SS_Report {
|
||||
$records = $records->filter('OwnerNames:PartialMatch', $ownerNames);
|
||||
}
|
||||
|
||||
return $records->sort('NextReviewDate', 'DESC');
|
||||
// Make sure we get results from all subsites, because only the main site has the Reports section
|
||||
$subsiteFilterBefore = null;
|
||||
if(class_exists('Subsite')){
|
||||
$subsiteFilterBefore = Subsite::disable_subsite_filter(true);
|
||||
}
|
||||
|
||||
$r = new ArrayList($records->sort('NextReviewDate', 'DESC')->toArray());
|
||||
|
||||
if(class_exists('Subsite')){
|
||||
Subsite::disable_subsite_filter($subsiteFilterBefore);
|
||||
}
|
||||
|
||||
return $r;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ class PagesWithoutReviewScheduleReport extends SS_Report {
|
||||
* @param array $params
|
||||
* @param string $sort
|
||||
* @param array $limit
|
||||
* @return DataList
|
||||
* @return SS_List
|
||||
*/
|
||||
public function sourceRecords($params, $sort, $limit) {
|
||||
Versioned::reading_stage('Stage');
|
||||
@ -110,6 +110,20 @@ class PagesWithoutReviewScheduleReport extends SS_Report {
|
||||
|
||||
|
||||
$records->sort('ParentID');
|
||||
|
||||
// Make sure we get results from all subsites, because only the main site has the Reports section
|
||||
$subsiteFilterBefore = null;
|
||||
if(class_exists('Subsite')){
|
||||
$subsiteFilterBefore = Subsite::disable_subsite_filter(true);
|
||||
}
|
||||
|
||||
$records = $records->toArray();
|
||||
|
||||
if(class_exists('Subsite')){
|
||||
Subsite::disable_subsite_filter($subsiteFilterBefore);
|
||||
}
|
||||
|
||||
|
||||
// Trim out calculated values
|
||||
$list = new ArrayList();
|
||||
foreach($records as $record) {
|
||||
|
Loading…
Reference in New Issue
Block a user