[fusion-trac] #92: Bug fix suggestion: Selection widget fail with DateTime

Fusion trac_fusion at osgeo.org
Mon Jul 28 13:13:54 EDT 2008


#92: Bug fix suggestion: Selection widget fail with DateTime
--------------------------+-------------------------------------------------
   Reporter:  poulet1212  |       Owner:  madair            
       Type:  defect      |      Status:  new               
   Priority:  P1          |   Milestone:  1.1               
  Component:  Core        |     Version:  1.0.6             
   Severity:  Critical    |    Keywords:  selection datetime
External_id:              |       State:  New               
    Browser:  All         |          Os:  All               
--------------------------+-------------------------------------------------
 By Querying features on the map which contain DateTime Attribute, Fusion
 generate a callback error:

 Reason:
 MapGuide/php/Query.php uses MapGuide\php\Utilities.php
 to retrieve via GetPropertyValueFromFeatReader, properties values.
 Look at (about) line 881 MapGuide\php\Utilities.php:

 {{{
 $value =  GetPropertyValueFromFeatReader($featureReader,
                 $properties->$layerName->propertytypes[$j],
                                                  $propname);
 $value = htmlentities($value,ENT_COMPAT,'UTF-8');
 }}}

 this will only work if $value is a string. But
 GetPropertyValueFromFeatReader() returns a DateTime Object, that's why
 Fusion causes this callback error.


 Proposition is: Getting a string representation of this DateTime Object:


 {{{
 $value =  GetPropertyValueFromFeatReader($featureReader,
                 $properties->$layerName->propertytypes[$j],
                                                    $propname);
 if($value instanceof MgDateTime)
   $value = printDateTime($value);
 $value = htmlentities($value,ENT_COMPAT,'UTF-8');
 }}}

 where: printDateTime($value) is:


 {{{
 function printDateTime($mgDateTime)
 {
    $dayToday = $mgDateTime->GetDay();
    $month = $mgDateTime->GetMonth();
    $year = $mgDateTime->GetYear();
    return $dayToday.".".$month.".".$year;
 }
 }}}


 it goes nice then,
 Rémy

-- 
Ticket URL: <http://trac.osgeo.org/fusion/ticket/92>
Fusion <http://trac.osgeo.org/fusion>
Fusion is a web-mapping application development framework for MapServer and MapGuide OS.


More information about the fusion-trac mailing list