mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 09:05:53 +00:00
Show result-assembly columns so that you read down the column instead of zigzagging
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@61721 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
b4e681dc83
commit
ab5ea4c0f6
@ -430,7 +430,22 @@ class ModelAdmin_CollectionController extends Controller {
|
||||
if($source) foreach ($source as $fieldName => $label){
|
||||
$value[] = $fieldName;
|
||||
}
|
||||
$checkboxes = new CheckboxSetField("ResultAssembly", false, $source, $value);
|
||||
|
||||
// Reorder the source so that you read items down the column and then across
|
||||
$columnisedSource = array();
|
||||
$keys = array_keys($source);
|
||||
$midPoint = ceil(sizeof($source)/2);
|
||||
for($i=0;$i<$midPoint;$i++) {
|
||||
$key1 = $keys[$i];
|
||||
$columnisedSource[$key1] = $source[$key1];
|
||||
// If there are an odd number of items, the last item will be unset
|
||||
if(isset($keys[$i+$midPoint])) {
|
||||
$key2 = $keys[$i+$midPoint];
|
||||
$columnisedSource[$key2] = $source[$key2];
|
||||
}
|
||||
}
|
||||
|
||||
$checkboxes = new CheckboxSetField("ResultAssembly", false, $columnisedSource, $value);
|
||||
|
||||
$field = new CompositeField(
|
||||
new LiteralField(
|
||||
|
Loading…
x
Reference in New Issue
Block a user