Code

- Yeah, we have complete svn build of GOsa, GOto, GOsa-si with svn tags and
[gosa.git] / gosa-core / include / class_listingSortIterator.inc
index 7f46512e51c9ed003f086500b5f30eb1062e5915..af18544aa898fe213b04fee7442e292b6c1fdaaa 100644 (file)
@@ -52,11 +52,27 @@ class listingSortIterator implements Iterator {
       // Take a look at the several types
       switch ($_sortType) {
         case 'string':
-          return strnatcmp($a, $b);
+          return strcoll($a, $b);
+
+        case 'integer':
+          return $b - $a;
+
+        case 'date':
+          if ($a == "") {
+            $a= "31.12.0000";
+          }
+          if ($b == "") {
+            $b= "31.12.0000";
+          }
+          list($d, $m, $y)= split('\.', $a);
+          $a= (int)sprintf("%04d%02d%02d", $y, $m, $d);
+          list($d, $m, $y)= split('\.', $b);
+          $b= (int)sprintf("%04d%02d%02d", $y, $m, $d);
+          return $b-$a;
 
         // Sort for string by default
         default:
-          return strnatcmp($a, $b);
+          return strcoll($a, $b);
       }
     }