[solved] Show events on map for a Group?

More
8 years 6 months ago #30037 by nordmograph
Hi

No, no other file is called
The module calls the eventmarkers model of the component
in the module you can add the groupid var to vars that are sent to the eventmarkers model

- 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.
The following user(s) said Thank You: timmyers15

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

More
8 years 6 months ago #30043 by timmyers15
Got it! It's working now, here's what I did. In the mod_geommunity3js.php file, I made the following edits in bold to the original file at ~line 986:

if($show_events)
{
$groupId = JRequest::getInt('groupid', '');
$script .="function loadEventMarkersFromCurrentBounds(map) {
dropOutofBoundsMarkers(map);
var bounds = map.getBounds();
var swPoint = bounds.getSouthWest();
var nePoint = bounds.getNorthEast();
var swLat = swPoint.lat();
var swLng = swPoint.lng();
var neLat = nePoint.lat();
var neLng = nePoint.lng();
var groupId = ".$groupId.";
jQuery.ajax({
url: 'index.php?option=com_geommunity3js&view=eventmarkers&format=json' ,
data: {
mapid: ".$mapid.",
swLat: swLat,
swLng: swLng,
neLat: neLat,
neLng: neLng,
groupId: groupId

},
type: 'POST',
dataType: 'json',
success: function (data) {
populateEventMarkers(data, map);
}
});
}

...................then in the eventmarkers.php file in the component I made these edits:

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";
$groupId = $jinput->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;
}

Works now. Thanks for the advice on helping me with this.

Tim

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

More
8 years 6 months ago - 8 years 6 months ago #30047 by nordmograph
Well done :)
I might add this feature to the core so you can still update the component when new updates come.
If you like the extensions and appreciated support, feel free to leave a review at the JED, it always help (but not a requirement :) )
extensions.joomla.org/extensions/extensi...unity3-for-jomsocial

- 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.
Last edit: 8 years 6 months ago by nordmograph. Reason: actually it could also be a interesting filter for users and medias

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

Time to create page: 0.322 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.