Changeset 61721

Show
Ignore:
Timestamp:
29/08/08 10:57:18 (3 months ago)
Author:
sminnee
Message:

Show result-assembly columns so that you read down the column instead of zigzagging

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • modules/cms/trunk/code/ModelAdmin.php

    r61578 r61721  
    431431                        $value[] = $fieldName; 
    432432                } 
    433                 $checkboxes = new CheckboxSetField("ResultAssembly", false, $source, $value); 
     433                 
     434                // Reorder the source so that you read items down the column and then across 
     435                $columnisedSource = array(); 
     436                $keys = array_keys($source); 
     437                $midPoint = ceil(sizeof($source)/2); 
     438                for($i=0;$i<$midPoint;$i++) { 
     439                        $key1 = $keys[$i]; 
     440                        $columnisedSource[$key1] = $source[$key1]; 
     441                        // If there are an odd number of items, the last item will be unset 
     442                        if(isset($keys[$i+$midPoint])) { 
     443                                $key2 = $keys[$i+$midPoint]; 
     444                                $columnisedSource[$key2] = $source[$key2]; 
     445                        } 
     446                } 
     447                 
     448                $checkboxes = new CheckboxSetField("ResultAssembly", false, $columnisedSource, $value); 
    434449                 
    435450                $field = new CompositeField(