diff options
Diffstat (limited to '')
-rw-r--r-- | include/functions_calendar.inc.php | 44 |
1 files changed, 28 insertions, 16 deletions
diff --git a/include/functions_calendar.inc.php b/include/functions_calendar.inc.php index 73df86fbb..cc55578f6 100644 --- a/include/functions_calendar.inc.php +++ b/include/functions_calendar.inc.php @@ -290,23 +290,35 @@ WHERE id IN (' . implode(',',$page['items']) .')'; pwg_debug('end initialize_calendar'); } -/* - * callback to sort array with date comparaison - * - **/ -function date_compare(&$a, &$b) +function array_to_int($array) { - $parts = explode('-', $a); - foreach ($parts as &$p) { - $p = (int)$p; - } - $a = implode('-', $parts); - $parts = explode('-', $b); - foreach ($parts as &$p) { - $p = (int)$p; + foreach ($array as $k => $v) + { + if ((int)$k==$k) + { + $key = (int) $k; + } + else + { + $key = $k; + } + if (is_array($v)) + { + $result[$key] = array_to_int($v); + } + else + { + if (is_int($v)) + { + $value = (int) $v; + } + else + { + $value = $v; + } + $result[$key] = $value; + } } - $b = implode('-', $parts); - - return strcmp($a, $b); + return $result; } ?>
\ No newline at end of file |