Code

Updated trustModes
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 7 Apr 2010 11:52:08 +0000 (11:52 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 7 Apr 2010 11:52:08 +0000 (11:52 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@17513 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/include/class_sortableListing.inc

index 64e122671193b01ebd1cba60d1bac349b157ab23..75de2bee55a554c2a227037a69c831217179bd85 100644 (file)
@@ -478,6 +478,8 @@ class sortableListing {
 
   public function sortData()
   {
+    if(!count($this->data)) return;
+
     // Extract data
     $tmp= array();
     foreach($this->displayData as $item) {
@@ -533,6 +535,23 @@ class sortableListing {
     $this->mapping[]= count($this->mapping);
     $this->modified= true;
 
+    // Find the number of coluns
+    reset($this->displayData);
+    $first= current($this->displayData);
+    if (is_array($first)) {
+        $this->columns= count($first);
+    } else {
+        $this->columns= 1;
+    }
+
+    // Preset sort orders to 'down'
+    for ($column= 0; $column<$this->columns; $column++) {
+        if(!isset($this->sortDirection[$column])){
+            $this->sortDirection[$column]= true;
+        }
+    }
+
+
     // Sort data after we've added stuff
     $this->sortData();
   }