CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Question for Google Map interface programming ideas..
Pages: [1]

Author Topic: Question for Google Map interface programming ideas..  (Read 1769 times)

Crusade

  • I’m new here
  • *
  • Posts: 5
  • Karma: 0
  • CiviCRM version: CiviCRM 4.0.6
  • CMS version: Drupal 7
  • MySQL version: 5.1
  • PHP version: 5.38
Question for Google Map interface programming ideas..
January 26, 2012, 11:27:57 am
I'm trying to do some custom Google Map applications along with CiviCRM, and am running into some roadblocks and was wondering if anyone could help, or point me in the right place.

I am trying to pull additional information from custom fields into $location from CiviCRM, and then utilize it to vary the images displayed by Google Maps for the markers on the map. My vision is to come up with ways to do up to 3 or 4 dimensions of variance on a marker, (Color/Size/Flag Icon) depending on the value of the fields.

I really have 2 questions, First in order to append a few fields into $location, where is the actual SQL call to pull the data into location that Map uses?

Second, conceptually, where's the logical place to put code that will utilize the data? Do I want to put it in Google.tpl and generate the name of the image to be used on the fly there? That seems the simplest way to do it, but that seems like a lot of "code" to put into Smarty.

Say I've got custom fields "Color_of_Car", "Make_of_Car", "Age_of_Car".

When Color_of_Car = 'Green', Make_of_Car = 'Mazda' and Age_of_Car ='3' Google Maps is to append the value of those fields and display the image named "GreenMazda3.png" 

GreenMazda3.png is a premade Green Icon of size "3", with an M in the flag representing a 3 year old Green Mazda on the map.

Assume I have permutated hundreds of combinations of colors, flags and sizes in my image directory to get a multitude of options.

Any help pointing the way, even to the right forum to post, would be much appreciated.

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Question for Google Map interface programming ideas..
January 26, 2012, 12:06:41 pm

might want to do a quick read of: http://book.civicrm.org/developer/

the maps are generated here: CRM/Contact/Form/Task/Map.php

Most of the work is done in the template here: templates/CRM/Contact/Form/Task/Map/Google.tpl

I'd do all the hard work in Map.php and keep the smarty stuff simple. a lot easier to code and debug

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Crusade

  • I’m new here
  • *
  • Posts: 5
  • Karma: 0
  • CiviCRM version: CiviCRM 4.0.6
  • CMS version: Drupal 7
  • MySQL version: 5.1
  • PHP version: 5.38
Re: Question for Google Map interface programming ideas..
January 26, 2012, 01:59:32 pm
I understand the simplicity of keeping hard programming out of Google.tpl, but it seems to be that adding an additional foreach into Map.php might have some performance issues, especially when dealing with large data sets.

So I'm going to keep any code into Google.tpl limited to Javascript and build the image file names there, when the item comes up for plotting. Thanks for the advice.

Now, any ideas on what I need to edit to access:

location.Color_of_Car
location.Make_of_Car
and
location.Age_of_Car

from Google.tpl just like you can access: location.displayName or location.displayAddress?



petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: Question for Google Map interface programming ideas..
January 27, 2012, 12:47:08 pm
Hi Crusade - another option if this seems to have lots of roadblocks and if you are on drupal would be to look at using OpenLayers and pulling the civi data in to Views. You may find this useful if you do want to go exploring that route - http://forum.civicrm.org/index.php/topic,18572.msg91263.html#msg91263
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

Crusade

  • I’m new here
  • *
  • Posts: 5
  • Karma: 0
  • CiviCRM version: CiviCRM 4.0.6
  • CMS version: Drupal 7
  • MySQL version: 5.1
  • PHP version: 5.38
Re: Question for Google Map interface programming ideas..
January 28, 2012, 12:01:47 pm
Frustrating.

Got the SQL and Smarty right. Know where to put the Smarty. Still not sure on the SQL.

Really thought /CRM/Contact/BAO/Contact/Location.php was where I needed to change the SQL joins to add new fields to the contact that is passed to Google.tpl in the $location box.

Any other ideas?

Crusade

  • I’m new here
  • *
  • Posts: 5
  • Karma: 0
  • CiviCRM version: CiviCRM 4.0.6
  • CMS version: Drupal 7
  • MySQL version: 5.1
  • PHP version: 5.38
Re: Question for Google Map interface programming ideas..
February 01, 2012, 05:17:55 pm
Still toooling away...

RM/Core/BAO/Address.php? Not really sure at this point. Straw grasping.

Any help?

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: Question for Google Map interface programming ideas..
February 01, 2012, 05:22:33 pm
sorry - no suggestions other than the one above which you won't like at this point about jumping ship to OpenLayers
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Question for Google Map interface programming ideas..
February 01, 2012, 06:21:21 pm

might want to get on IRC and chat with folks there. A bit easier to interact in real time :)

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Crusade

  • I’m new here
  • *
  • Posts: 5
  • Karma: 0
  • CiviCRM version: CiviCRM 4.0.6
  • CMS version: Drupal 7
  • MySQL version: 5.1
  • PHP version: 5.38
Re: Question for Google Map interface programming ideas..
February 01, 2012, 07:02:40 pm
Quote from: petednz on February 01, 2012, 05:22:33 pm
sorry - no suggestions other than the one above which you won't like at this point about jumping ship to OpenLayers

I wouldn't mind it if I wasn't so close. :)

Joining information on a lookup from another table in location.php function function &getMapInfo should be where Google.tpl actually gets the data to map, right? So Why can't the data I join that isn't "native" to $location being pulled in?

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Question for Google Map interface programming ideas..

This forum was archived on 2017-11-26.