Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

All other Modules /

Discuss all other Modules here.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Mappable problem on dataobjectdecorator

Go to End

2 Posts   482 Views


Community Member, 201 Posts

12 April 2012 at 1:06am

Hi there,

Still having some problems trying to implement the mappable module on the members table. If i put my code directly onto the members.php file in sapphire i get it to work but if i try to use the same code but as an extension to the dataobject decorator the module fails to work. It would appear from firebug that the code fails to pick up the records in the members table. as i get a syntax error for the

 map.setCenter(new GlatLng(,),90;

so it looks like it falls over because it has no data to return even though the lat and long fields on the table have data in. Again if i just move this code to the member.php page it works fine. below is the code for the extension page.

class MemberLocExtension extends DataObjectDecorator implements Mappable  {

	public function extraStatics() {
		return array (
			'db' => array (
				'Lat' => 'Varchar',
        		'Lon' => 'Varchar',
	public function getLatitude() {
        return $this->Lat;

    public function getLongitude() {
        return $this->Lon;

    public function getMapContent() {
        return GoogleMapUtil::sanitize($this->renderWith('MapBubble'));

    public function getGridRef() {
        $ll2 = new LatLng($this->Lat, $this->Lon);
        $os2 = $ll2->toOSRef();
		//return $os2->toSixFigureString();
        $tobebroken = $os2->toSixFigureString();
		return substr($tobebroken,0,2) . " " .substr($tobebroken,2,5) . " " . substr($tobebroken,7,5);


    public function getMapCategory() {
        return $this->Type;

    public function getMapPin() {
		return "GIS/images/map1.png";
public function updateCMSFields( FieldSet &$fields ) 
		 $fields->addFieldToTab("Root.Location", new LatLongField(array(
    		new TextField('Lat','Latitude'),
    		new TextField('Lon','Longitude')





Community Member, 201 Posts

15 April 2012 at 12:42am