Hi Michal,
as you suggested in Community I post here my question ;-)
Is there a way or solution for the Events Module to show upcomming Events by Category?
Example - I have more News Categories built with K2 at the website and I want to show for each K2 Category a seperate Events Module - here I created exactly the same Categories in Jomsocial for Events - which displays just the Events specially for these Categories...
Example:
K2 News Category I - Module Event Category I
K2 News Catgory II - Module Event Category II
.....
.....
Greets Karl
Hi, Karl.
I think it could be done... I'll add your thread to my TODO list.
I'll prepare hack in my spare time...
I'll update you with solution - but be aware that it could take some time ;)
Hi, Karl.
First you need to add Alternative layout feature to Community - Events module.
Please, follow this instruction:
mod_community_events.php (line 50)
+ replace: require( JModuleHelper::getLayoutPath('mod_community_events') );
+ with: require( JModuleHelper::getLayoutPath('mod_community_events', $params->get('layout', 'default')) );
mod_community_events.xml (line 25)
+ add:
<fieldset name="advanced">
<field name="layout" type="modulelayout" label="JFIELD_ALT_LAYOUT_LABEL" description="JFIELD_ALT_MODULE_LAYOUT_DESC" />
</fieldset>
Or use my demo files (upload them to ROOT/modules/mod_community_events.
This is a core file hack so you need to have copy of modified files ans they will be overwritten after next upgrade.
Alternative layout feature will be available in JomSocial 3.3.
Now as you have alternative layout feature you can set as many modules for Events as you need and every one could be set to display other category of events.
Copy this file:
ROOT/modules/mod_community_events/tmpl/default.php
to:
ROOT/templates/your-template/html/mod_community_events (if you don't have "html" or "mod_community_events" folders, feel free to create them).
Now rename file to something similar to this: events-category-3.php so you'll know which file is for which category.
Then edit file and replace this:
<div>
<div class="app-box-content">
<ul class="cThumbDetails cResetList">
<?php foreach ($events as $event) { ?>
<li <?php if (!empty($event->summary)): ?>class="jomNameTips" title="<?php echo CStringHelper::escape($event->summary); ?>" <?php endif; ?>>
<b class="cThumb-Calendar cFloat-L">
<b><?php echo CEventHelper::formatStartDate($event, JText::_('M')); ?></b>
<b><?php echo CEventHelper::formatStartDate($event, JText::_('d')); ?></b>
</b>
<div class="cThumb-Detail">
<a href="<?php echo $event->getLink(); ?>" class="cThumb-Title"><?php echo CStringHelper::escape($event->title); ?></a>
<div class="cThumb-Location">
<?php echo CStringHelper::escape($event->location); ?>
</div>
<div class="cThumb-Members small">
<a href="<?php echo $event->getGuestLink(COMMUNITY_EVENT_STATUS_ATTEND); ?>">
<?php echo JText::sprintf((!CStringHelper::isSingular($event->confirmedcount)) ? 'COM_COMMUNITY_EVENTS_ATTANDEE_COUNT_MANY' : 'COM_COMMUNITY_EVENTS_ATTANDEE_COUNT', $event->confirmedcount); ?>
</a>
</div>
</div>
</li>
<?php } ?>
</ul>
</div>
<div class="app-box-footer">
<a href="<?php echo CRoute::_('index.php?option=com_community&view=events'); ?>"><?php echo JText::_('COM_COMMUNITY_FRONTPAGE_VIEW_ALL_EVENTS'); ?></a>
</div>
</div>
<div>
<div class="app-box-content">
<ul class="cThumbDetails cResetList">
<?php foreach ($events as $event) { ?>
<?php if($event->catid == 3) { ?>
<li <?php if (!empty($event->summary)): ?>class="jomNameTips" title="<?php echo CStringHelper::escape($event->summary); ?>" <?php endif; ?>>
<b class="cThumb-Calendar cFloat-L">
<b><?php echo CEventHelper::formatStartDate($event, JText::_('M')); ?></b>
<b><?php echo CEventHelper::formatStartDate($event, JText::_('d')); ?></b>
</b>
<div class="cThumb-Detail">
<a href="<?php echo $event->getLink(); ?>" class="cThumb-Title"><?php echo CStringHelper::escape($event->title); ?></a>
<div class="cThumb-Location">
<?php echo CStringHelper::escape($event->location); ?>
</div>
<div class="cThumb-Members small">
<a href="<?php echo $event->getGuestLink(COMMUNITY_EVENT_STATUS_ATTEND); ?>">
<?php echo JText::sprintf((!CStringHelper::isSingular($event->confirmedcount)) ? 'COM_COMMUNITY_EVENTS_ATTANDEE_COUNT_MANY' : 'COM_COMMUNITY_EVENTS_ATTANDEE_COUNT', $event->confirmedcount); ?>
</a>
</div>
</div>
</li>
<?php } ?>
<?php } ?>
</ul>
</div>
<div class="app-box-footer">
<a href="<?php echo CRoute::_('index.php?option=com_community&view=events'); ?>"><?php echo JText::_('COM_COMMUNITY_FRONTPAGE_VIEW_ALL_EVENTS'); ?></a>
</div>
</div>