_modid = $modid; $user = JFactory::getUser(); $cfg = JEVConfig::getInstance(); $jev_component_name = JEV_COM_COMPONENT; $db = JFactory::getDBO(); $this->datamodel = new JEventsDataModel(); // component config object $jevents_config = JEVConfig::getInstance(); $this->modparams = & $params; $this->aid = $user->aid; $tmplang = JFactory::getLanguage(); // get params exclusive to module $this->minical_showlink = $this->modparams->get('minical_showlink', 1);; $this->minical_prevyear = $this->modparams->get('minical_prevyear', 1);; $this->minical_prevmonth = $this->modparams->get('minical_prevmonth', 1);; $this->minical_actmonth = $this->modparams->get('minical_actmonth', 1);; $this->minical_actmonth = $this->modparams->get('minical_actmonth', 1);; $this->minical_actyear = $this->modparams->get('minical_actyear', 1);; $this->minical_nextmonth = $this->modparams->get('minical_nextmonth', 1);; $this->minical_nextyear = $this->modparams->get('minical_nextyear', 1);; // get params exclusive to component $this->com_starday = intval($jevents_config->get('com_starday',0)); // make config object (module or component) current if (intval($this->modparams->get('modcal_useLocalParam', 0)) == 1) { $myparam = & $this->modparams; } else { $myparam = & $jevents_config; } // get com_event config parameters for this module $this->displayLastMonth = $myparam->get('modcal_DispLastMonth', 'NO'); $this->disp_lastMonthDays = $myparam->get('modcal_DispLastMonthDays', 0); $this->linkCloaking = $myparam->get('modcal_LinkCloaking', 0); $t_datenow = JEVHelper::getNow(); $this->timeWithOffset = $t_datenow->toUnix(true); switch($this->displayLastMonth) { case 'YES_stop': $this->disp_lastMonth = 1; break; case 'YES_stop_events': $this->disp_lastMonth = 2; break; case 'ALWAYS': $this->disp_lastMonthDays = 0; $this->disp_lastMonth = 1; break; case 'ALWAYS_events': $this->disp_lastMonthDays = 0; $this->disp_lastMonth = 2; break; case 'NO': default: $this->disp_lastMonthDays = 0; $this->disp_lastMonth = 0; break; } $this->displayNextMonth = $myparam->get('modcal_DispNextMonth', 'NO'); $this->disp_nextMonthDays = $myparam->get('modcal_DispNextMonthDays', 0); switch($this->displayNextMonth) { case 'YES_stop': $this->disp_nextMonth = 1; break; case 'YES_stop_events': $this->disp_nextMonth = 2; break; case 'ALWAYS': $this->disp_nextMonthDays = 0; $this->disp_nextMonth = 1; break; case 'ALWAYS_events': $this->disp_nextMonthDays = 0; $this->disp_nextMonth = 2; break; case 'NO': default: $this->disp_nextMonthDays = 0; $this->disp_nextMonth = 0; break; } // find appropriate Itemid and setup catids for datamodel $this->myItemid = $this->datamodel->setupModuleCatids($this->modparams); $this->cat = $this->datamodel->getCatidsOutLink(true); $this->linkpref = 'index.php?option='.$jev_component_name.'&Itemid='.$this->myItemid.$this->cat.'&task='; } function getAjaxCal($modid=0, $month, $year){ // capture module id so that we can use it for ajax type navigation if ($modid!=0) { $this->_modid=$modid; } $document = JFactory::getDocument(); $user = JFactory::getUser(); $db = JFactory::getDBO(); $cfg = JEVConfig::getInstance(); $year = JRequest::getVar( 'jev_current_year', 0 ); $month = JRequest::getVar( 'jev_current_month', 0 ); $reg = JFactory::getConfig(); $reg->set("jev.modparams",$this->modparams); $data = $this->datamodel->getCalendarData($year,$month,1,false, 0); $events = $this->getEventsArray($data); $result = new JResponseJson($events); echo $result; } // function getSpecificCal function getTheme(){ $theme = JEV_CommonFunctions::getJEventsViewName(); return $theme; } function getEventsArray($data) { $events = array(); foreach ($data['dates'] as $day_index) { foreach($day_index['events'] as $event) { $eventArray['date'] = $day_index['year'] ."-".$day_index['month']."-".$day_index['d0']. " " .date("H:i",$event->getUnixStartTime()); $title = str_replace("'", "'", $event->title()); $eventArray['title'] = str_replace('"', """, $title); $eventArray['safeTitle'] = addslashes($event->title()); $link = $event->viewDetailLink($day_index['year'], $day_index['month'], $day_index['d0'], false, $this->myItemid) . $this->datamodel->getCatidsOutLink(); $eventArray['link'] = JRoute::_($link ); $eventArray['linkInPopup'] = JRoute::_($link . "&tmpl=component"); //$eventArray['link'] = $link; $events[] = $eventArray; } } return $events; } function getEventListFormatJS($detailInPopup=0) { if(!$detailInPopup) { if( $this->modparams->get('jevcalplus_newwindow', true) ) { $string = 'moment(event.date).format("HH:mm")+" - " + ""+event.title+""'; } else { $string = 'moment(event.date).format("HH:mm")+" - " + ""+event.title+""'; } } else { $string = 'moment(event.date).format("HH:mm")+" - " + ""+event.title+""'; } return $string; } function getCal($modid=0) { if ($modid!=0) { $this->_modid=$modid; } $detailInPopup = $this->modparams->get('detailInPopup', 0); $cfg = JEVConfig::getInstance(); $document = JFactory::getDocument(); $time = $this->timeWithOffset; $cal_year=date("Y",$time); $cal_month=date("m",$time); $reg = JFactory::getConfig(); $reg->set("jev.modparams",$this->modparams); $data = $this->datamodel->getCalendarData($cal_year,$cal_month,1,false, $this->modparams->get("noeventcheck",0)); $events = $this->getEventsArray($data); $eventsJSON = "var eventArray = ".json_encode(array_values($events)); $document->addScriptDeclaration($eventsJSON); if(!$this->modparams->get('jevcalplus_usebrowserlanguage', false)) { $calendarLanguage = $this->getLanguage(); $document->addScriptDeclaration($calendarLanguage); } $showYearControls = $this->modparams->get('jevcalplus_dispyearcontrols', false); $showScroll = $this->modparams->get('jevcalplus_scroll', false); $script = 'var calendars = {}; var checkedMonths = ["'.$cal_year.'-'.$cal_month.'"]; (function ($){ $(document).ready( function() { calendars.clndr1 = $(".jevcalendarplus_calendar").clndr({ template: $("#template-calendar").html(), events: eventArray, clickEvents: { click: function(target) { if(target.events.length) { var listTitle="'.JText::_("JEV_EVENTSFORTHE").' " + moment(target.events[0].date).format("D") + " " + moment(target.events[0].date).format("MMM"); listContainer = $("#jevcalendarplus-list-container"); $(".jevcalendarplus-row").remove(); $.each(target.events, function(index,event){ var eventdiv = "