refactored additional wp coord initialization
This commit is contained in:
parent
bd01c96dfd
commit
f54ac45292
@ -75,7 +75,7 @@ class ChildWp_Controller
|
||||
{
|
||||
$presenter = new ChildWp_AddPresenter($this->request, $this->translator);
|
||||
/* set default waypoint coordinates to cache coordinates */
|
||||
$presenter->initCoordinates( $childWpHandler->getCacheCoordinates( $cacheId ) );
|
||||
$presenter->initCoordinate( Coordinate_Coordinate::getFromCache( $cacheId ) );
|
||||
|
||||
return $presenter;
|
||||
}
|
||||
|
@ -85,20 +85,6 @@ class ChildWp_Handler
|
||||
return $nameAndTypes;
|
||||
}
|
||||
|
||||
public function getCacheCoordinates( $cacheid )
|
||||
{
|
||||
$rs = sql("SELECT latitude, longitude FROM caches WHERE cache_id = &1", $cacheid);
|
||||
$r = sql_fetch_array($rs);
|
||||
|
||||
$ret = array();
|
||||
$ret['latitude'] = $r['latitude'];
|
||||
$ret['longitude'] = $r['longitude'];
|
||||
|
||||
mysql_free_result($rs);
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
private function recordToArray($r)
|
||||
{
|
||||
$ret = array();
|
||||
|
@ -63,9 +63,9 @@ abstract class ChildWp_Presenter
|
||||
$this->typeImages = $childWpHandler->getChildNamesAndImages();
|
||||
}
|
||||
|
||||
public function initCoordinates( $coords )
|
||||
public function initCoordinate( $coords )
|
||||
{
|
||||
$this->coordinate->init( $coords['latitude'], $coords['longitude'] );
|
||||
$this->coordinate->init( $coords->latitude(), $coords->longitude() );
|
||||
}
|
||||
|
||||
public function initChildWp($childId, $childWp)
|
||||
|
@ -34,6 +34,15 @@ class Coordinate_Coordinate
|
||||
return $hem ? $retval : -$retval;
|
||||
}
|
||||
|
||||
static public function getFromCache($cacheid)
|
||||
{
|
||||
$rs = sql("SELECT latitude, longitude FROM caches WHERE cache_id = &1", $cacheid);
|
||||
$r = sql_fetch_array($rs);
|
||||
mysql_free_result($rs);
|
||||
|
||||
return new Coordinate_Coordinate($r['latitude'], $r['longitude']);
|
||||
}
|
||||
|
||||
public function latitude()
|
||||
{
|
||||
return $this->latitude;
|
||||
|
Loading…
x
Reference in New Issue
Block a user