Corrected formatting

This commit is contained in:
UndefinedOffset 2012-10-12 09:36:45 -03:00
parent bdc7215bbd
commit d76ab46764
1 changed files with 23 additions and 23 deletions

View File

@ -116,18 +116,18 @@ class GridFieldSortableRows implements GridField_HTMLProvider, GridField_ActionP
protected function fixSortColumn($gridField, SS_List $dataList) { protected function fixSortColumn($gridField, SS_List $dataList) {
$list=clone $dataList; $list=clone $dataList;
$list->dataQuery()->limit(array()); $list->dataQuery()->limit(array());
$many_many = ($list instanceof ManyManyList); $many_many = ($list instanceof ManyManyList);
if (!$many_many) { if (!$many_many) {
$sng=singleton($gridField->getModelClass()); $sng=singleton($gridField->getModelClass());
$fieldType=$sng->db($this->sortColumn); $fieldType=$sng->db($this->sortColumn);
if(!$fieldType || !($fieldType=='Int' || is_subclass_of('Int', $fieldType))) { if(!$fieldType || !($fieldType=='Int' || is_subclass_of('Int', $fieldType))) {
user_error('Sort column '.$this->sortColumn.' must be an Int, column is of type '.$fieldType, E_USER_ERROR); user_error('Sort column '.$this->sortColumn.' must be an Int, column is of type '.$fieldType, E_USER_ERROR);
exit; exit;
} }
} }
$max = $list->Max($this->sortColumn); $max = $list->Max($this->sortColumn);
if($list->where('"'.$this->sortColumn.'"=0')->Count()>0) { if($list->where('"'.$this->sortColumn.'"=0')->Count()>0) {
//Start transaction if supported //Start transaction if supported
@ -140,17 +140,17 @@ class GridFieldSortableRows implements GridField_HTMLProvider, GridField_ActionP
$sortColumn = $this->sortColumn; $sortColumn = $this->sortColumn;
$i = 1; $i = 1;
if ($many_many) { if ($many_many) {
list($parentClass, $componentClass, $parentField, $componentField, $table) = $owner->many_many($gridField->getName()); list($parentClass, $componentClass, $parentField, $componentField, $table) = $owner->many_many($gridField->getName());
$extraFields=$owner->many_many_extraFields($gridField->getName()); $extraFields=$owner->many_many_extraFields($gridField->getName());
if(!$extraFields || !array_key_exists($this->sortColumn, $extraFields) || !($extraFields[$this->sortColumn]=='Int' || is_subclass_of('Int', $extraFields[$this->sortColumn]))) { if(!$extraFields || !array_key_exists($this->sortColumn, $extraFields) || !($extraFields[$this->sortColumn]=='Int' || is_subclass_of('Int', $extraFields[$this->sortColumn]))) {
user_error('Sort column '.$this->sortColumn.' must be an Int, column is of type '.$fieldType, E_USER_ERROR); user_error('Sort column '.$this->sortColumn.' must be an Int, column is of type '.$fieldType, E_USER_ERROR);
exit; exit;
} }
} }
//@TODO Need to optimize this to eliminate some of the resource load could use raw queries to be more efficient //@TODO Need to optimize this to eliminate some of the resource load could use raw queries to be more efficient
foreach($list as $obj) { foreach($list as $obj) {
if($many_many) { if($many_many) {