mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 11:05:53 +02:00
Added ModelAdmin_ClassController::getResultColumns() method, so that it can be overloaded
Fixed action handlers on fields of ResultsForm (notably the TableListField) by adding querystring arguments to the Link() of the form. git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@61066 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
e2eee05b83
commit
0771001c0b
@ -468,20 +468,29 @@ class ModelAdmin_CollectionController extends Controller {
|
||||
return $context->getQuery($searchCriteria);
|
||||
}
|
||||
|
||||
function getResultColumns($searchCriteria) {
|
||||
$model = singleton($this->modelClass);
|
||||
$summaryFields = $model->summaryFields();
|
||||
|
||||
$resultAssembly = $searchCriteria['ResultAssembly'];
|
||||
foreach($summaryFields as $fieldname=>$label){
|
||||
if(!$resultAssembly[$fieldname]){
|
||||
unset($summaryFields[$fieldname]);
|
||||
}
|
||||
}
|
||||
|
||||
return $summaryFields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows results from the "search" action in a TableListField.
|
||||
*
|
||||
* @return Form
|
||||
*/
|
||||
function ResultsForm($searchCriteria) {
|
||||
$model = singleton($this->modelClass);
|
||||
$summaryFields = $model->summaryFields();
|
||||
$resultAssembly = $_REQUEST['ResultAssembly'];
|
||||
foreach($summaryFields as $fieldname=>$label){
|
||||
if(!$resultAssembly[$fieldname]){
|
||||
unset($summaryFields[$fieldname]);
|
||||
}
|
||||
}
|
||||
if($searchCriteria instanceof HTTPRequest) $searchCriteria = $searchCriteria->getVars();
|
||||
$summaryFields = $this->getResultColumns($searchCriteria);
|
||||
|
||||
$tf = new TableListField(
|
||||
$this->modelClass,
|
||||
$this->modelClass,
|
||||
@ -515,6 +524,8 @@ class ModelAdmin_CollectionController extends Controller {
|
||||
unset($filteredParams['action_search']);
|
||||
$tf->setExtraLinkParams($filteredParams);
|
||||
|
||||
$form->setFormAction($this->Link() . '/ResultsForm?' . http_build_query($searchCriteria));
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user