function getEvents(&$params) { include_once REDEVENT_PATH_SITE . '/classes/output.class.php'; include_once REDEVENT_PATH_SITE . '/helpers/route.php'; include_once REDEVENT_PATH_SITE . '/helpers/helper.php'; include_once REDEVENT_PATH_SITE . '/classes/useracl.class.php'; include_once 'redevent/model.php'; // load language file $language = JFactory::getLanguage(); $language->load('com_redevent', JPATH_ROOT); $model = new RokMiniEvents3SourceRedEventModel($params); $rows = $model->getData(); $total_count = 1; $total_max = $params->get('redevent_total', 10); $events = array(); if (empty($rows)) { return $events; } foreach ($rows as $row) { if ($params->get('redevent_links') != 'link_no') { $link = array('internal' => $params->get('redevent_links') == 'link_internal' ? true : false, 'link' => JRoute::_(REdeventHelperRoute::getDetailsRoute($row->slug, $row->xslug))); } else { $link = false; } date_default_timezone_set('UTC'); $offset = 0; if ($params->get('redevent_dates_format', 'utc') == 'joomla') { $conf = JFactory::getConfig(); $timezone = $conf->get('offset'); $offset = $timezone * 3600 * -1; } $startdate = strtotime($row->dates . ' ' . $row->times) + $offset; $enddate = $row->enddates ? strtotime($row->enddates . ' ' . $row->endtimes) + $offset : strtotime($row->dates . ' ' . $row->endtimes) + $offset; $event = new RokMiniEvents3_Event($startdate, $enddate, $row->title, $row->summary, $link); if ($startdate === $enddate) { $event->setAllDay(true); } if (!$row->enddates && !$row->endtimes) { $event->setNoEndTime(true); } $events[] = $event; $total_count++; if ($total_count > $total_max) { break; } } return $events; }
function getEvents(&$params) { // Reuse existing language file from JomSocial $language = JFactory::getLanguage(); $language->load('com_eventlist', JPATH_ROOT); $query_start_date = null; $query_end_date = null; if ($params->get('time_range') == 'time_span' || $params->get('rangespan') != 'all_events') { $query_start_date = $params->get('startmin'); $startMax = $params->get('startmax', false); if ($startMax !== false) { $query_end_date = $startMax; } } $app = JFactory::getApplication(); $db = JFactory::getDBO(); $user = JFactory::getUser(); $user_gid = (int) $user->get('aid'); $catid = trim($params->get('eventlist_category', 0)); $venid = trim($params->get('eventlist_venue', 0)); $categories = ''; if ($catid != 0) { $categories = ' AND catsid = ' . $catid; } $venues = ''; if ($venid != 0) { $venues = ' AND locid = ' . $venid; } $dates_start = ''; if (!empty($query_start_date)) { $dates_start = ' AND a.dates >= ' . $db->Quote($query_start_date); } $dates_end = ''; if (!empty($query_end_date)) { $dates_end = ' AND a.enddates <= ' . $db->Quote($query_end_date); } $query = 'SELECT a.*,' . ' CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(\':\', a.id, a.alias) ELSE a.id END as slug' . ' FROM #__eventlist_events AS a' . ' WHERE a.published = 1 ' . $categories . $venues . $dates_start . $dates_end . ' ORDER BY a.dates ASC, a.times ASC'; $db->setQuery($query); $rows = $db->loadObjectList(); $total_count = 1; $total_max = $params->get('eventlist_total', 10); $events = array(); if (empty($rows)) { return $events; } foreach ($rows as $row) { if ($params->get('eventlist_links') != 'link_no') { $link = array('internal' => $params->get('eventlist_links') == 'link_internal' ? true : false, 'link' => JRoute::_(self::getRoute($row->slug))); } else { $link = false; } if (!ini_get('date.timezone')) { date_default_timezone_set('UTC'); } $offset = 0; if ($params->get('eventlist_dates_format', 'utc') == 'joomla') { $conf = JFactory::getConfig(); $timezone = $conf->get('offset'); $offset = $timezone * 3600 * -1; } $startdate = strtotime($row->dates . ' ' . $row->times) + $offset; $enddate = $row->enddates ? strtotime($row->enddates . ' ' . $row->endtimes) + $offset : strtotime($row->dates . ' ' . $row->endtimes) + $offset; $event = new RokMiniEvents3_Event($startdate, $enddate, $row->title, $row->datdescription, $link); if ($startdate === $enddate) { $event->setAllDay(true); } if (!$row->enddates && !$row->endtimes) { $event->setNoEndTime(true); } $events[] = $event; $total_count++; if ($total_count > $total_max) { break; } } //$events = array(); return $events; }
function getEvents(&$params) { // Reuse existing language file from JomSocial $language = JFactory::getLanguage(); $language->load('com_jevents', JPATH_ROOT); $query_start_date = null; $query_end_date = null; if ($params->get('time_range') == 'time_span' || $params->get('rangespan') != 'all_events') { $query_start_date = $params->get('startmin'); $startMax = $params->get('startmax', false); if ($startMax !== false) { $query_end_date = $startMax; } } // setup for all required function and classes $file = JPATH_SITE . '/components/com_jevents/mod.defines.php'; if (file_exists($file)) { include_once $file; include_once JEV_LIBS . "/modfunctions.php"; } else { die("JEvents Calendar\n<br />This module needs the JEvents component"); } $eventHelper = @new JEVHelper(); // load language constants @$eventHelper->loadLanguage('modlatest'); $datamodel = @new JEventsDataModel(); $showrepeats = $params->get('jevents_norepeats', 0) == 0 ? true : false; $catids = $params->get('jevents_category', array()); if (!empty($catids) && !in_array('0', $catids)) { $params->set('catidnew', $catids); } $myItemid = @$datamodel->setupModuleCatids($params); $catout = @$datamodel->getCatidsOutLink(true); $reg = @JevRegistry::getInstance("jevents"); $reg->setReference("jevents.datamodel", $datamodel); if (!empty($query_start_date)) { $rstartdate = new RokMiniEvents3_Date($query_start_date); if ($params->get('jevents_past', 0) == 0 && $rstartdate->toUnix() < time()) { $rstartdate = new RokMiniEvents3_Date(time()); } $dates_start = $rstartdate->toISO8601(); } else { if ($params->get('jevents_past', 0) == 0) { $rstartdate = new RokMiniEvents3_Date(time()); $dates_start = $rstartdate->toISO8601(); } else { $dates_start = date('Y-m-d\\T23:59:59', strtotime("-1 month")); } } if (empty($query_end_date)) { $dates_end = date('Y-m-d\\T23:59:59', strtotime("+1 year")); } else { $dates_end = $query_end_date; } $rows = @$datamodel->queryModel->listIcalEventsByRange($dates_start, $dates_end, 0, 20, $showrepeats); $events = array(); if (empty($rows)) { return $events; } $total_count = 1; $total_max = $params->get('jevents_total', 10); foreach ($rows as $row) { if ($params->get('jevents_links') != 'link_no') { $title = JFilterOutput::stringURLSafe($row->_title); $itemId = @$eventHelper->getItemid(); if ($params->get('jevents_links') == 'link_internal_event' || $params->get('jevents_links') == 'link_external_event') { $link = array('internal' => $params->get('jevents_links') == 'link_internal_event' ? true : false, 'link' => JRoute::_('index.php?option=' . JEV_COM_COMPONENT . '&task=icalrepeat.detail&rp_id=' . $row->_eventid . '&rp_id=' . $row->_rp_id . '&Itemid=' . $itemId . '&year=' . $row->_yup . '&month=' . $row->_mup . '&day=' . $row->_dup . 'title=' . $title)); } else { $link = array('internal' => $params->get('jevents_links') == 'link_internal' ? true : false, 'link' => JRoute::_('index.php?option=' . JEV_COM_COMPONENT . '&task=month.calendar&year' . $row->_yup . '&month=' . $row->_mup . '&day=' . $row->_dup . '&Itemid=' . $itemId)); } } else { $link = false; } $event = new RokMiniEvents3_Event($row->_unixstarttime, $row->_unixendtime, $row->_title, $row->_content, $link); $event->setAllDay($row->_alldayevent ? true : false); if ($row->_noendtime == "1") { $event->setNoEndTime(true); } $events[] = $event; $total_count++; if ($total_count > $total_max) { break; } } return $events; }