| Conditions | 2 |
| Paths | 2 |
| Total Lines | 14 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 8 | public function augmentSQL(SQLQuery &$query) |
||
| 9 | { |
||
| 10 | if (Controller::curr()->getRequest()->getVar('Address')) { // on frontend |
||
| 11 | $coords = GoogleGeocoding::address_to_point(Controller::curr()->getRequest()->getVar('Address')); |
||
| 12 | |||
| 13 | $Lat = $coords['lat']; |
||
| 14 | $Lng = $coords['lng']; |
||
| 15 | |||
| 16 | $query |
||
| 17 | ->addSelect(array( |
||
| 18 | '( 3959 * acos( cos( radians('.$Lat.') ) * cos( radians( `Lat` ) ) * cos( radians( `Lng` ) - radians('.$Lng.') ) + sin( radians('.$Lat.') ) * sin( radians( `Lat` ) ) ) ) AS distance', |
||
| 19 | )); |
||
| 20 | } |
||
| 21 | } |
||
| 22 | } |
||
| 23 |