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>
public function ajaxGetCalendar($month, $year) { $response = new JAXResponse(); $filter = JFilterInput::getInstance(); $year = $filter->clean($year, 'int'); $month = $filter->clean($month, 'int'); $calendar_html = CCalendar::generate_calendar($year, $month); $response->addScriptCall('joms.events.displayCalendar', $calendar_html); return $response->sendResponse(); }