function display($cachable = false, $urlparams = false) { $app = JFactory::getApplication(); $document = JFactory::getDocument(); $menuItem = $app->getMenu()->getActive(); if (is_object($menuItem)) { $mcatid = $menuItem->params->get('mcatid', ''); $filter_category = !is_array($mcatid) ? array($mcatid) : $mcatid; } else { $filter_category = ''; } $items = $this->get('Records'); // $Itemid = $app->input->getInt('Itemid'); $Itemid = JRequest::getInt('Itemid'); foreach ($items as $item) { if (!in_array('', $filter_category) && !in_array('0', $filter_category) && in_array($item->catid, $filter_category) || in_array('', $filter_category) || in_array('0', $filter_category)) { // Load individual item creator class. $feeditem = new JFeedItem(); $feeditem->title = $item->title . ' (' . $item->category . ')'; $feeditem->link = JROUTE::_('index.php?option=com_icagenda&view=list&layout=event&Itemid=' . (int) $Itemid . '&id=' . (int) $item->id . ':' . $item->alias); $feeditem->image = icagendaThumb::sizeMedium($item->image); $feeditem->description = '<img src="' . $feeditem->image . '" alt="" style="margin: 5px; float: left;">' . $item->desc; $feeditem->date = $item->next; $feeditem->category = $item->category; // Loads item information into RSS array $document->addItem($feeditem); } } }
function getStamp($params) { $iCparams = JComponentHelper::getParams('com_icagenda'); $eventTimeZone = null; // Itemid Request (automatic detection of the first iCagenda menu-link, by menuID) $iC_list_menus = icagendaMenus::iClistMenuItemsInfo(); $nb_menu = count($iC_list_menus); $nolink = $nb_menu ? false : true; $app = JFactory::getApplication(); $menu = $app->getMenu(); $isSef = $app->getCfg('sef'); $date_var = $isSef == 1 ? '?date=' : '&date='; // Check if GD is enabled on the server if (extension_loaded('gd') && function_exists('gd_info')) { $thumb_generator = $iCparams->get('thumb_generator', 1); } else { $thumb_generator = 0; } $datetime_today = JHtml::date('now', 'Y-m-d H:i'); $timeformat = $iCparams->get('timeformat', 1); $lang_time = $timeformat == 1 ? 'H:i' : 'h:i A'; // Check if fopen is allowed $result = ini_get('allow_url_fopen'); $fopen = empty($result) ? false : true; $this->start($params); // Get the database $db = JFactory::getDbo(); $query = $db->getQuery(true); // Build the query $query->select('e.*, e.place as place_name, c.title as cat_title, c.alias as cat_alias, c.color as cat_color, c.ordering as cat_order ')->from($db->qn('#__icagenda_events') . ' AS e')->leftJoin($db->qn('#__icagenda_category') . ' AS c ON ' . $db->qn('c.id') . ' = ' . $db->qn('e.catid')); // Where Category is Published $query->where('c.state = 1'); // Where State is Published $query->where('e.state = 1'); // Where event is Approved $query->where('e.approval = 0'); // Add filters if (isset($this->filter)) { foreach ($this->filter as $filter) { $query->where($filter); } } // Check Access Levels $user = JFactory::getUser(); $userID = $user->id; $userLevels = $user->getAuthorisedViewLevels(); if (version_compare(JVERSION, '3.0', 'lt')) { $userGroups = $user->getAuthorisedGroups(); } else { $userGroups = $user->groups; } $userAccess = implode(', ', $userLevels); if (!in_array('8', $userGroups)) { $query->where('e.access IN (' . $userAccess . ')'); } // Features - extract the number of displayable icons per event $query->select('feat.count AS features'); $sub_query = $db->getQuery(true); $sub_query->select('fx.event_id, COUNT(*) AS count'); $sub_query->from('`#__icagenda_feature_xref` AS fx'); $sub_query->innerJoin("`#__icagenda_feature` AS f ON fx.feature_id=f.id AND f.state=1 AND f.icon<>'-1'"); $sub_query->group('fx.event_id'); $query->leftJoin('(' . (string) $sub_query . ') AS feat ON e.id=feat.event_id'); // Registrations total $query->select('r.count AS registered, r.date AS reg_date'); $sub_query = $db->getQuery(true); $sub_query->select('r.eventid, sum(r.people) AS count, r.date AS date'); $sub_query->from('`#__icagenda_registration` AS r'); $sub_query->where('r.state > 0'); $sub_query->group('r.eventid'); $query->leftJoin('(' . (string) $sub_query . ') AS r ON e.id=r.eventid'); // Run the query $db->setQuery($query); // Invoke the query $result = $db->loadObjectList(); $registrations = icagendaEventsData::registeredList(); foreach ($result as $record) { $record_registered = array(); foreach ($registrations as $reg_by_event) { $ex_reg_by_event = explode('@@', $reg_by_event); if ($ex_reg_by_event[0] == $record->id) { $record_registered[] = $ex_reg_by_event[0] . '@@' . $ex_reg_by_event[1] . '@@' . $ex_reg_by_event[2]; } } $record->registered = $record_registered; } // Set start/end dates of the current month $days = self::getNbOfDaysInMonth($this->date_start); $current_date_start = $this->date_start; $month_start = date('m', strtotime($current_date_start)); $month_end = date('m', strtotime('+1 month', strtotime($current_date_start))); $day_end = date('m', strtotime('+' . $days . ' days', strtotime($current_date_start))); $year_end = $month_start == '12' ? date('Y', strtotime("+1 year", strtotime($this->date_start))) : date('Y', strtotime($this->date_start)); $current_date_end = $year_end . '-' . $month_end . '-' . $day_end; $days = $this->getDays($this->date_start, 'Y-m-d H:i'); $total_items = 0; $displayed_items = 0; foreach ($result as $item) { // Extract the feature details, if needed $features = array(); if (is_null($item->features) || empty($this->features_icon_size)) { $item->features = array(); } else { $item->features = icagendaEvents::featureIcons($item->id); } if (isset($item->features) && is_array($item->features)) { foreach ($item->features as $feature) { $features[] = array('icon' => $feature->icon, 'icon_alt' => $feature->icon_alt); } } // list calendar dates $AllDates = array(); $next = isset($next) ? $next : ''; $allSingleDates_array = $this->getDatelist($item->dates, $next); // If Single Dates, added to all dates for this event if (isset($datemultiplelist) && $datemultiplelist != NULL && is_array($datemultiplelist)) { $allSingleDates_array = array_merge($AllDates, $datemultiplelist); } foreach ($allSingleDates_array as $sd) { $this_date = JHtml::date($sd, 'Y-m-d', null); if (strtotime($this_date) >= strtotime($current_date_start) && strtotime($this_date) < strtotime($current_date_end)) { array_push($AllDates, $sd); } } // Get WeekDays Array $WeeksDays = iCDatePeriod::weekdaysToArray($item->weekdays); // Get Period Dates $StDate = JHtml::date($item->startdate, 'Y-m-d H:i', $eventTimeZone); $EnDate = JHtml::date($item->enddate, 'Y-m-d H:i', $eventTimeZone); $perioddates = iCDatePeriod::listDates($item->startdate, $item->enddate, $eventTimeZone); $onlyStDate = isset($this->onlyStDate) ? $this->onlyStDate : ''; // Check the period if individual dates $only_startdate = $item->weekdays || $item->weekdays == '0' ? false : true; // if (isset($perioddates) && $perioddates != NULL) // { if ($onlyStDate == 1) { if (strtotime($StDate) >= strtotime($current_date_start) && strtotime($StDate) < strtotime($current_date_end)) { array_push($AllDates, date('Y-m-d H:i', strtotime($item->startdate))); } } else { foreach ($perioddates as $Dat) { $this_date = JHtml::date($Dat, 'Y-m-d', null); if (in_array(date('w', strtotime($Dat)), $WeeksDays)) { $SingleDate = date('Y-m-d H:i', strtotime($Dat)); if (strtotime($this_date) >= strtotime($current_date_start) && strtotime($this_date) < strtotime($current_date_end)) { array_push($AllDates, $SingleDate); } } } } // } rsort($AllDates); // requête Itemid $iCmenuitem = $params->get('iCmenuitem', ''); if (is_numeric($iCmenuitem)) { $linkid = $iCmenuitem; } else { $linkid = icagendaMenus::thisEventItemid($item->next, $item->catid, $iC_list_menus); } $eventnumber = $item->id ? $item->id : null; $event_slug = $item->alias ? $item->id . ':' . $item->alias : $item->id; $total_items = $total_items + 1; if ($linkid && !$nolink && JComponentHelper::getComponent('com_icagenda', true)->enabled) { $displayed_items = $displayed_items + 1; $urlevent = JRoute::_('index.php?option=com_icagenda&view=list&layout=event&id=' . $event_slug . '&Itemid=' . (int) $linkid); } else { $urlevent = '#'; } $descShort = icagendaEvents::shortDescription($item->desc, true, $this->filtering_shortDesc, $this->limit); /** * Get Thumbnail */ // START iCthumb // Set if run iCthumb if ($item->image && $thumb_generator == 1) { // Generate small thumb if not exist $thumb_img = icagendaThumb::sizeSmall($item->image); } elseif ($item->image && $thumb_generator == 0) { $thumb_img = $item->image; } else { $thumb_img = $item->image ? 'media/com_icagenda/images/nophoto.jpg' : ''; } // END iCthumb $evtParams = ''; $evtParams = new JRegistry($item->params); // Display Time $r_time = $params->get('dp_time', 1) ? true : false; // Display City $r_city = $params->get('dp_city', 1) ? $item->city : false; // Display Country $r_country = $params->get('dp_country', 1) ? $item->country : false; // Display Venue Name $r_place = $params->get('dp_venuename', 1) ? $item->place_name : false; // Display Intro Text $dp_shortDesc = $params->get('dp_shortDesc', ''); // Short Description if ($dp_shortDesc == '1') { $descShort = $item->shortdesc ? $item->shortdesc : false; } elseif ($dp_shortDesc == '2') { $descShort = $descShort ? $descShort : false; } elseif ($dp_shortDesc == '0') { $descShort = false; } else { $e_shortdesc = $item->shortdesc ? $item->shortdesc : $descShort; $descShort = $e_shortdesc ? $e_shortdesc : $item->metadesc; } // Display Registration Infos $dp_regInfos = $params->get('dp_regInfos', 1); $maxTickets = $dp_regInfos == 1 ? $evtParams->get('maxReg', '1000000') : false; $typeReg = $dp_regInfos == 1 ? $evtParams->get('typeReg', '1') : false; $event = array('id' => (int) $item->id, 'Itemid' => (int) $linkid, 'title' => $item->title, 'next' => $this->formatDate($item->next), 'image' => $thumb_img, 'file' => $item->file, 'address' => $item->address, 'city' => $r_city, 'country' => $r_country, 'place' => $r_place, 'description' => $item->desc, 'descShort' => $descShort, 'cat_title' => $item->cat_title, 'cat_order' => $item->cat_order, 'cat_color' => $item->cat_color, 'nb_events' => count($item->id), 'no_image' => JTEXT::_('MOD_ICCALENDAR_NO_IMAGE'), 'params' => $item->params, 'features_icon_size' => $this->features_icon_size, 'features_icon_root' => $this->features_icon_root, 'show_icon_title' => $this->show_icon_title, 'features' => $features, 'item' => $item); // Access Control $access = $item->access ? $item->access : '1'; // Language Control $languages = array(JFactory::getLanguage()->getTag(), '*'); $eventLang = isset($item->language) ? $item->language : '*'; // Get Option Dislay Time $displaytime = isset($item->displaytime) ? $item->displaytime : ''; $events_per_day = array(); // Get List of Dates if ((in_array($access, $userLevels) || in_array('8', $userGroups)) && in_array($eventLang, $languages) && is_array($event) && $linkid) { $past_dates = 0; foreach ($AllDates as $d) { // Control if date is past if (strtotime($d) < strtotime($datetime_today)) { $past_dates = $past_dates + 1; } } foreach ($AllDates as $d) { $this_date_control = date('Y-m-d H:i', strtotime($d)); if ($only_startdate && in_array($this_date_control, $perioddates)) { $set_date_in_url = ''; } else { $set_date_in_url = $date_var . iCDate::dateToAlias($d, 'Y-m-d H:i'); } if ($r_time) { $time = array('time' => date($lang_time, strtotime($d)), 'displaytime' => $displaytime, 'url' => $urlevent . $set_date_in_url); } else { $time = array('time' => '', 'displaytime' => '', 'url' => $urlevent . $set_date_in_url); } $event = array_merge($event, $time); $this_date = $item->reg_date ? date('Y-m-d H:i:s', strtotime($d)) : 'period'; $registrations = $dp_regInfos == 1 ? true : false; $registered = $dp_regInfos == 1 ? self::getNbTicketsBooked($this_date, $item->registered, $eventnumber, $set_date_in_url) : false; $maxTickets = $maxTickets != '1000000' ? $maxTickets : false; $TicketsLeft = $dp_regInfos == 1 && $maxTickets ? $maxTickets - self::getNbTicketsBooked($this_date, $item->registered, $eventnumber, $set_date_in_url) : false; // If period started, and registration is set to "for all dates of the event" if ($maxTickets && $past_dates && $typeReg == 2) { $date_sold_out = JText::_('MOD_ICCALENDAR_REGISTRATION_CLOSED'); } elseif ($maxTickets) { $date_sold_out = $TicketsLeft <= 0 ? JText::_('MOD_ICCALENDAR_REGISTRATION_DATE_NO_TICKETS_LEFT') : false; } else { $date_sold_out = false; } $reg_infos = array('registrations' => $registrations, 'registered' => $registered, 'maxTickets' => $maxTickets, 'TicketsLeft' => $TicketsLeft, 'date_sold_out' => $date_sold_out); $event = array_merge($event, $reg_infos); foreach ($days as $k => $dy) { // $d_date = JHtml::date($d, 'Y-m-d', $eventTimeZone); $d_date = date('Y-m-d', strtotime($d)); $dy_date = date('Y-m-d', strtotime($dy['date'])); if ($d_date == $dy_date) { array_push($days[$k]['events'], $event); } } } } } $i = ''; if ($nolink || !JComponentHelper::getComponent('com_icagenda', true)->enabled) { do { echo '<div style="color:#a40505; text-align: center;"><b>info :</b></div><div style="color:#a40505; font-size: 0.8em; text-align: center;">' . JText::_('MOD_ICCALENDAR_COM_ICAGENDA_MENULINK_UNPUBLISHED_MESSAGE') . '</div>'; } while ($i > 0); } $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('id AS nbevt')->from('`#__icagenda_events` AS e')->where('e.state > 0'); $db->setQuery($query); $nbevt = $db->loadResult(); $nbevt = count($nbevt); $no_event_message = '<div class="ic-msg-no-event">' . JText::_('MOD_ICCALENDAR_NO_EVENT') . '</div>'; if ($nbevt == NULL) { echo $no_event_message; } // To be Checked $total_items = count($result); if ($displayed_items == '0' && $total_items > 0) { echo $no_event_message; } if ($total_items > $displayed_items) { $not_displayed = $total_items - $displayed_items; $user = JFactory::getUser(); if ($user->authorise('core.admin')) { echo '<div class="alert alert-warning">' . JText::sprintf('IC_MODULE_ALERT_EVENTS_NOT_DISPLAYED', $not_displayed) . '</div>'; } } return $days; }
} } /** * Event Image and Thumbnails */ $EVENT_IMAGE = $item->image; $EVENT_IMAGE_TAG = $item->imageTag; $IMAGE_LARGE = $IMAGE_MEDIUM = $IMAGE_SMALL = $IMAGE_XSMALL = ''; if ($EVENT_IMAGE) { $default_thumbnail = 'media/com_icagenda/images/nophoto.jpg'; if (icagendaClass::isLoaded('icagendaThumb')) { // $IMAGE_LARGE = icagendaThumb::sizeLarge($item->image, null, true); $IMAGE_MEDIUM = $ic_main_list ? icagendaThumb::sizeMedium($item->image) : ''; // $IMAGE_SMALL = icagendaThumb::sizeSmall($item->image); // $IMAGE_XSMALL = icagendaThumb::sizeXSmall($item->image); $IMAGE_LARGE_HTML = !$ic_main_list ? icagendaThumb::sizeLarge($item->image, 'imgTag', true) : ''; // $IMAGE_MEDIUM_HTML = icagendaThumb::sizeMedium($item->image, 'imgTag'); // $IMAGE_SMALL_HTML = icagendaThumb::sizeSmall($item->image, 'imgTag'); // $IMAGE_XSMALL_HTML = icagendaThumb::sizeXSmall($item->image, 'imgTag'); } else { $IMAGE_LARGE = $IMAGE_MEDIUM = $IMAGE_SMALL = $IMAGE_XSMALL = ''; $IMAGE_LARGE_HTML = $IMAGE_MEDIUM_HTML = $IMAGE_SMALL_HTML = $IMAGE_XSMALL_HTML = ''; } } /** * Event Details - Description, Meta-description and Intro Text */ $EVENT_DESC = $item->desc || $item->shortdesc ? true : false; // $EVENT_DESCRIPTION = $item->description; $EVENT_META = $item->metaAsShortDesc; $desc_display_event = $params->get('desc_display_event', '');