Hi all,
Is it possible to put the event calendar in a separate module and not on the jomsocial homepage ?
I would like to show it on nearly every pages of my website.
and if it is possible; is it possible to hide from the jomsocial homepage, not to have 2 calendars on the same page ?
thx for your help :)
Hi, zesharck.
There is a way, but tricky one :) There is module mod_community_events that dispalys JomSocial events (it's in JomSocial package).
You could create an override (copy this file: ROOT/modules/mod_community_events/tmpl/default.php to ROOT/templates/your_curren_template/html/mod_community_events)
Then change 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((cIsPlural($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>
<script src="./components/com_community/assets/joms.jquery-1.8.1.min.js" type="text/javascript"></script>
<script src="./components/com_community/assets/script-1.2.min.js" type="text/javascript"></script>
<div class="app-box-content">
<div class="community-calendar app-box">
<h3 class="app-box-header"><?php echo JText::_('COM_COMMUNITY_EVENTS_CAL');?></h3>
<script>
joms.jQuery(document).ready(function(){
init_calendar();
});
//return date in - format
function getDate(day){
if(day < 10){
day = '0'+day;
}
var raw = joms.jQuery('input.cal-month-year').val().split(';');
return raw[0] + '-' + raw[1]+ '-' + day ;
}
//initialize all listener on calendar
function init_calendar(){
// date listener
joms.jQuery('div#event>table>tbody>tr>td').click(function(){
joms.jQuery('div#event>table>tbody>tr>td').each(function(){
joms.jQuery(this).removeClass('selected');
});
if(joms.jQuery(this).html() > 0){ // to indicate this is a date
joms.jQuery(this).addClass('selected');
var date = getDate(joms.jQuery(this).html());
date = date.split('-');
var group_id = '<?php echo $group_id; ?>';
joms.events.getDayEvent(date[2],date[1],date[0],group_id);
}
});
//next or prev month listener
joms.jQuery('span.calendar-next').click(function(){
var raw = joms.jQuery('input.cal-month-year').val().split(';');
var month = parseFloat(raw[1]) + 1;
var year = parseFloat(raw[0]);
if(month > 12){ //month > dec, change to 1(january), add 1 to yr
month = 1;
year = year + 1;
}
joms.jQuery('.events-list').html('');
joms.events.getCalendar(month,year);
});
joms.jQuery('span.calendar-prev').click(function(){
var raw = joms.jQuery('input.cal-month-year').val().split(';');
var month = parseFloat(raw[1]) - 1;
var year = parseFloat(raw[0]);
if(month == 0){ //month > dec, change to 1(january), add 1 to yr
month = 12;
year = year - 1;
}
joms.jQuery('.events-list').html('');
joms.events.getCalendar(month,year);
});
}
</script>
<div id="event">
<?php
$time = time();
echo CCalendar::generate_calendar(date('Y', $time), date('n', $time));
?>
</div>
<div class="community-calendar-result">
<strong class="happening_title" style="display:none"><?php echo JText::_('COM_COMMUNITY_EVENTS_HAPPENING_TITLE'); ?> :</strong>
<img class="loading-icon" style="display:none" src="<?php echo JURI::root(); ?>components/com_community/assets/ajax-loader.gif"/>
<div class="small">
<ul class="cEventNearby cResetList events-list" ></ul>
</div>
</div>
</div>
</div>
thx Michal !
tricky but efficient probably i will try this this weekend :)
LOL i have an other question for you probably (just to test you :p )
Jomsocial has a Module for upcoming events BUT it dispplays all events from all categories ... My idea is to have as many module "upcoming events" as i have categories .
I mean if i have o category "MTB" I should have a Module Events displaying only upcoming MTB events ..and so one for others Categories...
ahah .....not easy ...so Michal ?? :))
Hi, zesharck.
Challenge accepted :P
There is only one obstacle - unfortunately in mod_community_events can't be used view override feature :/ So it means that if you want to have separated module for every event category... you'll need to install copy of mod_community_events for each event category.
Here is code:
<div>
<div class="app-box-content">
<ul class="cThumbDetails cResetList">
<?php foreach( $events as $event ){ ?>
<?php if($event->catid == 2) { ?>
<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((cIsPlural($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>
<?php if($event->catid == 2) { ?>
good question Michal ?!
Duplicate the module folder with another name and modify the name of the module in the xml ? But how about the database...
arff damned :p
Hi, zesharck.
joomla-and-more.com/2009/10/30/how-to-copy-a-joomla-module/
Or copy module folder with different name, change name in xml and Backend -> Extensions -> Extensions manager -> Discover :)