Changeset 20035


Ignore:
Timestamp:
Jan 10, 2013, 12:03:08 PM (8 years ago)
Author:
cljosse
Message:

[extensions] edit_gmaps Minor corrections

Location:
extensions/edit_gmaps/admin/include
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • extensions/edit_gmaps/admin/include/XML.php

    r9412 r20035  
    139139        // This is very difficult to work with, so it needs to be
    140140        // converted to a tree structure before being returned
    141         return xml_get_children($newvals, $i=0);
     141         $i=0;
     142        return xml_get_children($newvals, $i);
    142143
    143144}
  • extensions/edit_gmaps/admin/include/fonctions.php

    r12126 r20035  
    7272    }
    7373    $num = (int)$num;
    74 
     74 if(empty($ret1)) $ret1=(object) '';
    7575    // whole number, just return it
    76     if( $den == 1 ) return $num;
    77 
     76    if( $den == 1 ) {
     77        $ret1->Numerator =($num ) ;
     78        $ret1->Denominator=($den);
     79    return $ret1;
     80    }
    7881    $num2 = $num;
    7982    $den2 = $den;
     
    8588     $den2 = $rem;
    8689    }
    87     if( $den2 != $den ) $rem = $den2;
    88 
    89     $ret1->Numerator =($num / $rem ) ;
     90        if( $den2 != $den ) $rem = $den2;
     91       
     92        $ret1->Numerator =($num / $rem ) ;
    9093        $ret1->Denominator=($den / $rem);
    91 
     94     
    9295    // now $rem holds the gcd of the numerator and denominator of our fraction
    9396    return $ret1;
     
    104107        $seconds= round(($tmp-$minutes)*6000)/100;
    105108       
    106         $sec=  dec2frac($seconds);
    107  
     109        $sec =  dec2frac($seconds);
     110
     111   //if(empty($ret1)) $ret1=(object) ;
     112   $ret=array();
     113
    108114        $ret[0]['Numerator'] =$degrees ;
    109115        $ret[0]['Denominator'] = 1 ;       
    110         $ret[1]['Numerator']  =$minutes ;
    111         $ret[1]['Denominator']=1; 
    112         $ret[2]['Numerator']  =$sec->Numerator ;
    113         $ret[2]['Denominator']=$sec->Denominator;
     116        $ret[1]['Numerator']  = $minutes ;
     117        $ret[1]['Denominator']= 1; 
     118        if($sec->Numerator){
     119            $ret[2]['Numerator']  = $sec->Numerator ;
     120            $ret[2]['Denominator']= $sec->Denominator;
     121        }
    114122  $ret[3]= " Deg: " . $degrees . " Min: " . $minutes . " Sec: " . $seconds."  " ;
    115123        $ret[4]= " " . $degrees . "/1 " . $minutes . "/1 " . $sec->Numerator."/".$sec->Denominator ;
     124
    116125return( $ret);
    117126
Note: See TracChangeset for help on using the changeset viewer.