Ignore:
Timestamp:
Feb 3, 2010, 10:26:32 AM (14 years ago)
Author:
nikrou
Message:

Feature 511 : fix problems with calendar functions
add pwg_db_concat() function

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/functions_calendar.inc.php

    r4781 r4833  
    291291}
    292292
    293 /*
    294  * callback to sort array with date comparaison
    295  *
    296  **/
    297 function date_compare(&$a, &$b)
     293function array_to_int($array)
    298294{
    299   $parts = explode('-', $a);
    300   foreach ($parts as &$p) {
    301     $p = (int)$p;
    302   }
    303   $a = implode('-', $parts);
    304   $parts = explode('-', $b);
    305   foreach ($parts as &$p) {
    306     $p = (int)$p;
    307   }
    308   $b = implode('-', $parts);
    309 
    310   return strcmp($a, $b);
     295  foreach ($array as $k => $v)
     296  {
     297    if ((int)$k==$k)
     298    {
     299      $key = (int) $k;
     300    }
     301    else
     302    {
     303      $key = $k;
     304    }
     305    if (is_array($v))
     306    {
     307      $result[$key] = array_to_int($v);
     308    }
     309    else
     310    {
     311      if (is_int($v))
     312      {
     313        $value = (int) $v;
     314      }
     315      else
     316      {
     317        $value = $v;
     318      }
     319      $result[$key] = $value;
     320    }
     321  }
     322  return $result;
    311323}
    312324?>
Note: See TracChangeset for help on using the changeset viewer.