Hi all,
I'm trying to see if i can code up an Events Map module. Basically, it's just a simple extension of the Events module, but I need to grab the lat & long values from
#__eb_locations
I have duplicated the mod_eb_events module as a base for the code to see if it will work.
I'm hoping someone here may be able to assist with the DB Query, so i can get the following values from eb_locations:
lat, long, address, city, state, zip, country
here's the Query, any help is REALLY appreciated
Code:
$where = array();
$where[] = 'a.published =1 ';
$where[] = 'DATE(event_date) >= CURDATE()';
// $where[] = '(cut_off_date = "'.$db->getNullDate().'" OR DATE(cut_off_date) >= CURDATE())' ;
if ($categoryIds != '')
{
$where[] = ' a.id IN (SELECT event_id FROM #__eb_event_categories WHERE category_id IN (' . $categoryIds . '))';
}
$where[] = ' a.access IN (' . implode(',', $user->getAuthorisedViewLevels()) . ')';
if ($app->getLanguageFilter())
{
$where[] = ' a.language IN (' . $db->Quote(JFactory::getLanguage()->getTag()) . ',' . $db->Quote('*') . ')';
}
$sql = 'SELECT a.*, c.name AS location_name FROM #__eb_events AS a ' . ' LEFT JOIN #__eb_locations AS c ' . ' ON a.location_id = c.id ' . ' WHERE ' .
implode(' AND ', $where) . ' ORDER BY a.event_date ' . ' LIMIT ' . $numberEvents;
$db->setQuery($sql);
$rows = $db->loadObjectList();
for ($i = 0, $n = count($rows); $i < $n; $i++)
{
$row = $rows[$i];
// Get all categories
$sql = 'SELECT a.id, a.name FROM #__eb_categories AS a INNER JOIN #__eb_event_categories AS b ON a.id = b.category_id WHERE b.event_id=' . $row->id;
$db->setQuery($sql);
$categories = $db->loadObjectList();
if (count($categories))
{
$itemCategories = array();
foreach ($categories as $category)
{
$itemCategories[] = '<a href="' . EventbookingHelperRoute::getCategoryRoute($category->id, $itemId) . '"><strong>' . $category->name .
'</strong></a>';
}
$row->categories = implode(' | ', $itemCategories);
}
}