Filter Events by Categories in Calendar View

  • hejeva
  • Topic Author
  • Offline
  • New Member
  • New Member
More
13 years 5 months ago - 13 years 5 months ago #12033 by hejeva
Is it possible to filter the events by categories in Calendar view?

Do something like this: index.php?option=com_eventbooking&task=view_calendar&category_id=1
or even better: in the Calendar have a dropdown to of categories when you user selects a category they only see the events for that category in the calendar.

Thanks
Last edit: 13 years 5 months ago by hejeva.

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

More
13 years 5 months ago #12039 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Re: Filter Events by Categories in Calendar View
Hi

If you want to show calendar of events from a category only, please create a menu item to link to Calendar Category Layout of Event Booking, choose the category you want to display from menu parameter and it will work as expected .

Regards,

Tuan

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

  • hejeva
  • Topic Author
  • Offline
  • New Member
  • New Member
More
13 years 5 months ago #12060 by hejeva
Thanks, totally missed that..

A suggestion to put at the bottom of the table (it could be optional setting) is a link to each category or selector. I have added code so each of my category is listed and links can be modified by css.

Code to add underneath table in: components\com_eventbooking\views\calendar\tmpl\default.php

<ul>
<?php $db = & JFactory::getDBO() ;
$sql = 'SELECT * FROM #__eb_categories' ;
$db->setQuery($sql) ;
$rows = $db->loadObjectList() ;


if (count($rows)) {
foreach ($rows as $row) {
$mylink = JText::_('index.php?option=com_eventbooking&task=view_category&layout=calendar&category_id=' . $row->id); ?>

<li><div id="category-<?php echo $row->id; ?>">
<a href="<?php echo $mylink; ?>"> <?php echo $row->name; ?> </a>
</div></li>
<?php
}
}
?>
</ul>

code to add underneath table in: components\com_eventbooking\views\category\tmpl\calendar.php

<ul>
<li><a href="<?php echo JText::_('index.php?option=com_eventbooking&task=view_calendar') ?>">Main Calendar</a></li>

<?php $db = & JFactory::getDBO() ;
$sql = 'SELECT * FROM #__eb_categories' ;
$db->setQuery($sql) ;
$rows = $db->loadObjectList() ;


if (count($rows)) {
foreach ($rows as $row) {
$mylink = JText::_('index.php?option=com_eventbooking&task=view_category&layout=calendar&category_id=' . $row->id);
if ($row->id != $this->category->id) { ?>
<li><div id="category-<?php echo $row->id; ?>">
<a href="<?php echo $mylink; ?>"> <?php echo $row->name; ?> </a>
</div></li>
<?php } ?>
<?php
}
}
?>
</ul>

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

More
3 years 6 months ago #146882 by Rusty
Now the extension is using Themes, whats the up to date method of doing this please?

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

More
3 years 6 months ago #146884 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Filter Events by Categories in Calendar View
Hello Rusty

The file is now in this new location components/com_eventbooking/themes/default/calendar/default.php. Somehow, you will need to write code yourself to add the categories filter to have it works in the way you want

Regards,

Tuan

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

Moderators: Tuan Pham Ngoc