Notice

The forum is in read only mode.

Support Forum

Welcome! Support Forums have been reactivated
Welcome the Technical Support section. Help us in assisting you by providing us with a concise and descriptive elaboration of your issues. Be specific and if possible, provide us with a step-by-step instruction in replicating your problem.

Event calendar in a module?

10 years 1 month ago
Licenses:
JomSocial Expired

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 :)


communauté VTT / MTB community => www. roulons.fr ;)
10 years 1 month ago
Licenses:

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>

to this:
<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>

Now calendar will appears as a module. :)

If you don't want to do any customizations, you could take a look for calendar-like module, try some of this extensions: www.jomsocial.com/addons/calendar-a-events they could work witch JomSocial.


- Instead of saying: 'it's not working', explain the problem in detail.
- Screenshots with the URL visible in them and the problem marked are more than welcome.
- Tell us how to replicate the problem, we can't fix it if we can't find it.
- Make sure that your site/server meets JomSocial System Requirements
- Make sure to setup JomSocial Cron Job
- Always provide us with access details to the backend and ftp. We need it to debug problems.
- If you have a similar problem, but a solution you found isn't working, open a new thread instead of 'merging' with an existing one.

- Use the "Thank You" feature on any post that helped you
The following user(s) said Thank You: zesharck, Todd Hunter
10 years 1 month ago
Licenses:
JomSocial Expired

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 ?? :))


communauté VTT / MTB community => www. roulons.fr ;)
10 years 1 month ago
Licenses:

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>

Just paste it to: ROOT/modules/mod_community_events/tmpl/default.php (use override jus like I advised before... but only one override could be done.

This condition is most important here:
<?php if($event->catid == 2) { ?>

It says: show all what is below (events) when id of event category is equal to 2.

So all you need to know is event category id (you'll find it here: Backend -> Extensions -> JomSocial -> Events -> Events category -> last column in table). Then just enter the number.

Did I pass? :D

Then I have a test for you: how to install a copy of an existing module in Joomla? :)


- Instead of saying: 'it's not working', explain the problem in detail.
- Screenshots with the URL visible in them and the problem marked are more than welcome.
- Tell us how to replicate the problem, we can't fix it if we can't find it.
- Make sure that your site/server meets JomSocial System Requirements
- Make sure to setup JomSocial Cron Job
- Always provide us with access details to the backend and ftp. We need it to debug problems.
- If you have a similar problem, but a solution you found isn't working, open a new thread instead of 'merging' with an existing one.

- Use the "Thank You" feature on any post that helped you
The following user(s) said Thank You: zesharck
10 years 1 month ago
Licenses:
JomSocial Expired

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


communauté VTT / MTB community => www. roulons.fr ;)
10 years 1 month ago
Licenses:

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 :)


- Instead of saying: 'it's not working', explain the problem in detail.
- Screenshots with the URL visible in them and the problem marked are more than welcome.
- Tell us how to replicate the problem, we can't fix it if we can't find it.
- Make sure that your site/server meets JomSocial System Requirements
- Make sure to setup JomSocial Cron Job
- Always provide us with access details to the backend and ftp. We need it to debug problems.
- If you have a similar problem, but a solution you found isn't working, open a new thread instead of 'merging' with an existing one.

- Use the "Thank You" feature on any post that helped you
Moderators: Piotr Garasiński
Powered by Kunena Forum

Join 180,000 websites creating Amazing communities

JomSocial is the most complete, easy-to-use addon that turns Joomla CMS into a
full -fledged, social networking site

TRY NOW BUY NOW