mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 11:05:53 +02:00
ENHANCEMENT: encapsulated getResultsTable from ResultsForm in ModelAdmin_CollectionController
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@77158 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
80d79e63b8
commit
fa69772112
@ -639,12 +639,16 @@ class ModelAdmin_CollectionController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows results from the "search" action in a TableListField.
|
||||
* Creates and returns the result table field for resultsForm.
|
||||
* Uses {@link resultsTableClassName()} to initialise the formfield.
|
||||
* Method is called from {@link ResultsForm}.
|
||||
*
|
||||
* @return Form
|
||||
* @param array $searchCriteria passed through from ResultsForm
|
||||
*
|
||||
* @return TableListField
|
||||
*/
|
||||
function ResultsForm($searchCriteria) {
|
||||
if($searchCriteria instanceof HTTPRequest) $searchCriteria = $searchCriteria->getVars();
|
||||
function getResultsTable($searchCriteria) {
|
||||
|
||||
$summaryFields = $this->getResultColumns($searchCriteria);
|
||||
|
||||
$className = $this->parentController->resultsTableClassName();
|
||||
@ -667,6 +671,22 @@ class ModelAdmin_CollectionController extends Controller {
|
||||
$url = '<a href=\"' . $this->Link() . '/$ID/edit\">$value</a>';
|
||||
$tf->setFieldFormatting(array_combine(array_keys($summaryFields), array_fill(0,count($summaryFields), $url)));
|
||||
|
||||
return $tf;
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows results from the "search" action in a TableListField.
|
||||
*
|
||||
* @uses getResultsTable()
|
||||
*
|
||||
* @return Form
|
||||
*/
|
||||
function ResultsForm($searchCriteria) {
|
||||
|
||||
if($searchCriteria instanceof HTTPRequest) $searchCriteria = $searchCriteria->getVars();
|
||||
|
||||
$tf = $this->getResultsTable($searchCriteria);
|
||||
|
||||
// implemented as a form to enable further actions on the resultset
|
||||
// (serverside sorting, export as CSV, etc)
|
||||
$form = new Form(
|
||||
|
Loading…
Reference in New Issue
Block a user