[solved] Show events on map for a Group?

More
8 years 6 months ago - 8 years 6 months ago #29956 by timmyers15
Hi. I'm trying to determine how I can limit markers to those of a Group. In other words, I would like to display the Geommunity Map Module on the JS Group page, and then limit the Events displayed on the map to just those events of the currently displayed Group.

I can't find a setting for this. Is there any way to do this in the back-end? Maybe via the Profile Types? If so, how?

If not, in the raw code which file (and line number) contains the code that queries the list of events to display? (I might want to edit/hack this code to filter the results)

Thanks for the help-

Tim
Last edit: 8 years 6 months ago by nordmograph.

Please Log in or Create an account to join the conversation.

More
8 years 6 months ago #29957 by nordmograph
Well there is no setting for this.
You could alter the eventmarkers.php model to receive the current page groupID, but the problem is that the page is loaded via ajax and the module deon't send this groupid variable.

- Need help? Post the URL of the related page (eventualy as confidential info), it will help solve your issue faster.
- An error, notice or warning? report the exact message including the line number
- If you get a white page , enable error reporting and / or check your server error logs.

Please Log in or Create an account to join the conversation.

More
8 years 6 months ago #29962 by timmyers15
Hmmmmm..ok, I will look at the code in this file and see if there is anyway to make it work. Thanks for the ajax info.

Please Log in or Create an account to join the conversation.

More
8 years 6 months ago #30003 by timmyers15
So I looked at the code and found the query in the eventsmarker file you referenced. If I may ask another question, out of all the files loaded from both the Geommunity component and module, which file is loaded first? In other words, when the page starts to load, which single Geommunity file is loaded first, regardless if it is from the component or the module? I'm thinking about trying to set a session variable to hold the group id......

Thanks!

Please Log in or Create an account to join the conversation.

More
8 years 6 months ago #30005 by nordmograph
The component is loaded vvia the module, so the module is loaded first.

- Need help? Post the URL of the related page (eventualy as confidential info), it will help solve your issue faster.
- An error, notice or warning? report the exact message including the line number
- If you get a white page , enable error reporting and / or check your server error logs.

Please Log in or Create an account to join the conversation.

More
8 years 6 months ago #30029 by timmyers15
So I was able to edit the query to only pull the events from a group (that was easy), but I am still struggling with how to use the Group id. In the module files, which single file is called first? I presumed it was mod_geommunity3js.php, where I inserted the following code before line 18:

$groupId = JRequest::getInt('groupid', '');
$session = JFactory::getSession();
$session->set('groupId', $groupId);

......so this sets the Group Id to the session (which I tested and confirmed it is being correctly set). I then added the code in bold to the getEventmarkers() function to the eventsventmarkers.php in the component file:

public function getEventmarkers()
{
$db = JFactory::getDBO();
$jinput = JFactory::getApplication()->input;
$mapid = $jinput->get('mapid');
$a = $swLat = $jinput->get('swLat');
$b = $swLng = $jinput->get('swLng');
$c = $neLat = $jinput->get('neLat');
$d = $neLng = $jinput->get('neLng');
$condition1 = $a < $c ? "latitude BETWEEN $a AND $c":"latitude BETWEEN $c AND $a";
$condition2 = $b < $d ? "longitude BETWEEN $b AND $d":"longitude BETWEEN $d AND $b";
$session = JFactory::getSession();
$groupId = $session->get('groupId');

$q ="SELECT id , title , latitude , longitude
FROM #__community_events
WHERE published='1' AND enddate>=NOW()
AND ( $condition1 ) AND ( $condition2 ) AND contentid=$groupId";
$db->setQuery($q);
$markers = $db->loadObjectList();
return $markers;
}

.......Unfortunately, the session isn't being referenced in the eventsmarkers file. I'm wondering if the eventsmarker is somehow being called before the session is being set in the mod_geommunity3js.php file? I browsed some of the other files and couldn't find where the eventsmarker.php file was called.

So my question is this, is some other Geommunity file first called when the page loads before the mod_geommunity3js.php file? If so, which one?

Thanks for the advice-

Tim

Please Log in or Create an account to join the conversation.

Time to create page: 0.337 seconds
Powered by Kunena Forum
Disclaimer: Nordmograph is not affiliated with or endorsed by The Joomla! Project™. Any products and services provided through this site are not supported or warrantied by The Joomla! Project or Open Source Matters, Inc. Use of the Joomla!® name, symbol, logo and related trademarks is permitted under a limited license granted by Open Source Matters, Inc.