/** * Loads the track for this walk (if any) */ public function loadTrack() { // Load the route if we don't have it already // TODO: Only try once, and catch exceptions if (!isset($this->track)) { $rt = Route::loadForWalkable($this, false, Route::Type_Logged, 1); if (!empty($rt)) { $this->track = $rt[0]; } } }
print $route->jsonEncode(); jexit(); } } // If we get here, we failed to load a route. // Get a route for a walkinstance (this means getting the walk) if (isset($walkinstanceid)) { $f = SWG::walkInstanceFactory(); $walk = $f->getSingle($walkinstanceid); } // Get the route for a particular walk if walkid is set if (isset($walkid)) { include_once JPATH_BASE . "/swg/Models/Walk.php"; $walk = Walk::getSingle($walkid); } if (isset($walk)) { $routes = Route::loadForWalkable($walk, true, $type, 1); // TODO: Support logged routes if (!empty($routes)) { $result = $routes[0]; } else { $result = false; } // Error condition - notify caller there are no routes available } if ($result instanceof SWGBaseModel) { echo $result->jsonEncode(); } else { echo json_encode($result); } jexit();