/** * Creates the Event Feed of the Category */ function display() { $app = JFactory::getApplication(); $doc = JFactory::getDocument(); // Get some data from the model $app->input->set('limit', $app->getCfg('feed_limit')); $rows = $this->get('Items'); if (!empty($rows)) { foreach ($rows as $row) { // strip html from feed item title $title = $this->escape($row->title); $title = html_entity_decode($title); // strip html from feed item category if (!empty($row->categories)) { $category = array(); foreach ($row->categories AS $category2) { $category[] = $category2->catname; } // adding the , to the list when there are multiple category's $category = $this->escape(implode(', ', $category)); $category = html_entity_decode($category); } else { $category = ''; } //Format date and time $displaydate = JemOutput::formatLongDateTime($row->dates, $row->times,$row->enddates, $row->endtimes); // url link to event $link = JRoute::_(JemHelperRoute::getEventRoute($row->id)); // feed item description text $description = JText::_('COM_JEM_TITLE').': '.$title.'<br />'; $description .= JText::_('COM_JEM_VENUE').': '.$row->venue.' / '.$row->city.'<br />'; $description .= JText::_('COM_JEM_CATEGORY').': '.$category.'<br />'; $description .= JText::_('COM_JEM_DATE').': '.$displaydate.'<br />'; $description .= JText::_('COM_JEM_DESCRIPTION').': '.$row->fulltext; $created = ($row->created ? date('r', strtotime($row->created)) : ''); // load individual item creator class $item = new JFeedItem(); $item->title = $title; $item->link = $link; $item->description = $description; $item->date = $created; $item->category = $category; // loads item info into rss array $doc->addItem($item); } } }
<?php /** * @version 2.1.5 * @package JEM * @copyright (C) 2013-2015 joomlaeventmanager.net * @copyright (C) 2005-2009 Christoph Lukes * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL */ defined('_JEXEC') or die; ?> <div id="jem" class="jem_myvenues<?php echo $this->pageclass_sfx;?>"> <div class="buttons"> <?php $btn_params = array('task' => $this->task, 'print_link' => $this->print_link); echo JemOutput::createButtonBar($this->getName(), $this->permissions, $btn_params); ?> </div> <?php if ($this->params->get('show_page_heading', 1)) : ?> <h1 class="componentheading"> <?php echo $this->escape($this->params->get('page_heading')); ?> </h1> <?php endif; ?> <!--table--> <?php echo $this->loadTemplate('venues');?> <!--footer--> <div class="copyright"> <?php echo JEMOutput::footer( ); ?>
/** * Method to get the events * * @access public * @return array */ public static function getList(&$params) { mb_internal_encoding('UTF-8'); $db = JFactory::getDBO(); $user = JFactory::getUser(); $levels = $user->getAuthorisedViewLevels(); $settings = JemHelper::config(); // Use (short) format saved in module settings or in component settings or format in language file otherwise $dateFormat = $params->get('formatdate', ''); if (empty($dateFormat)) { // on empty format long format will be used but we need short format if (isset($settings->formatShortDate) && $settings->formatShortDate) { $dateFormat = $settings->formatShortDate; } else { $dateFormat = JText::_('COM_JEM_FORMAT_SHORT_DATE'); } } $timeFormat = $params->get('formattime', ''); $addSuffix = false; if (empty($timeFormat)) { // on empty format component's format will be used, so also use component's time suffix $addSuffix = true; } # Retrieve Eventslist model for the data $model = JModelLegacy::getInstance('Eventslist', 'JemModel', array('ignore_request' => true)); # Set params for the model # has to go before the getItems function $model->setState('params', $params); # filter published # 0: unpublished # 1: published # 2: archived # -2: trashed $type = $params->get('type'); # All events $cal_from = ""; // TODO: Add parameter to specify start and end dates for showing events // (used for schools league) // All events, default order if ($type == 3) { $cal_from = ""; } elseif ($type == 2) { $model->setState('filter.published', 2); $model->setState('filter.orderby', array('a.dates DESC', 'a.times DESC')); $cal_from = ""; } else { $model->setState('filter.published', 1); $model->setState('filter.orderby', array('a.dates ASC', 'a.times ASC')); $offset_minutes = 60 * $params->get('offset_hours', 0); $cal_from = "((TIMESTAMPDIFF(MINUTE, NOW(), CONCAT(a.dates,' ',IFNULL(a.times,'00:00:00'))) > {$offset_minutes}) "; $cal_from .= $type == 1 ? " OR (TIMESTAMPDIFF(MINUTE, NOW(), CONCAT(IFNULL(a.enddates,a.dates),' ',IFNULL(a.endtimes,'23:59:59'))) > {$offset_minutes})) " : ") "; } $model->setState('filter.calendar_from', $cal_from); $model->setState('filter.groupby', 'a.id'); # filter category's $catids = JemHelper::getValidIds($params->get('catid')); if ($catids) { $model->setState('filter.category_id', $catids); $model->setState('filter.category_id.include', true); } # filter venue's $venids = JemHelper::getValidIds($params->get('venid')); if ($venids) { $model->setState('filter.venue_id', $venids); $model->setState('filter.venue_id.include', true); } # count $count = $params->get('count', '2'); $model->setState('list.limit', $count); # Retrieve the available Events $events = $model->getItems(); # Loop through the result rows and prepare data $i = 0; $lists = array(); foreach ($events as $row) { //cut titel $length = mb_strlen($row->title); if ($length > $params->get('cuttitle', '18')) { $row->title = mb_substr($row->title, 0, $params->get('cuttitle', '18')); $row->title = $row->title . '...'; } $lists[$i] = new stdClass(); $lists[$i]->link = JRoute::_(JemHelperRoute::getEventRoute($row->slug)); # time/date list($lists[$i]->date, $lists[$i]->time) = self::_format_date_time($row, $params->get('datemethod', 1), $dateFormat, $timeFormat, $addSuffix); $lists[$i]->dateinfo = JEMOutput::formatDateTime($row->dates, $row->times, $row->enddates, $row->endtimes, $dateFormat, $timeFormat, $addSuffix); $lists[$i]->dateinfo = JemOutput::formatDateTime($row->dates, $row->times, $row->enddates, $row->endtimes, $dateFormat, $timeFormat, $addSuffix); $lists[$i]->text = $params->get('showtitloc', 0) ? $row->title : htmlspecialchars($row->venue, ENT_COMPAT, 'UTF-8'); $lists[$i]->city = htmlspecialchars($row->city, ENT_COMPAT, 'UTF-8'); $lists[$i]->venueurl = !empty($row->venueslug) ? JRoute::_(JEMHelperRoute::getVenueRoute($row->venueslug)) : null; $i++; } return $lists; }
</td> <?php endif; ?> <?php if ($this->jemsettings->showcity == 1) : ?> <td headers="jem_city" align="left" valign="top"> <?php echo !empty($row->city) ? $this->escape($row->city) : '-'; ?> </td> <?php endif; ?> <?php if ($this->jemsettings->showstate == 1) : ?> <td headers="jem_state" align="left" valign="top"> <?php echo !empty($row->state) ? $this->escape($row->state) : '-'; ?> </td> <?php endif; ?> <?php if ($this->jemsettings->showcat == 1) : ?> <td headers="jem_category" align="left" valign="top"> <?php echo implode(", ", JemOutput::getCategoryList($row->categories, $this->jemsettings->catlinklist)); ?> </td> <?php endif; ?> <?php if ($this->jemsettings->showatte == 1) : ?> <td headers="jem_attendees" align="left" valign="top"> <?php echo !empty($row->regCount) ? $this->escape($row->regCount) : '-'; ?> </td> <?php endif; ?> </tr> <?php endforeach; ?> <?php endif; ?> </tbody> </table>
/** * Creates the button bar shown on frontend view's top right corner. * * @param string $view Name of the view * ('attendees', 'calendar', 'categories', 'category', 'category-cal', 'day', * 'editevent', 'editvenue', 'event', 'eventslist', 'myattendances', 'myevents', 'myvenues', * 'search', 'venue', 'venue-cal', 'venues', 'weekcal') * @param object $permissions Object holding relevant permissions * (canAddEvent, canAddVenue, canPublishEvent, canPublishVenue) * @param object $params Object containing other relevant parameters * (id: for '&id=', for Archive and Export button, * slug: for '&id=', for Mail and iCal button, * task: e.g. 'archive', for Archive button, * print_link: for Print button * show, hide: to override button visibility; array of one or more of * 'addEvent', 'addVenue', * 'archive' 'mail', 'print', 'ical', ('export', 'back',) * 'publish', 'unpublish', 'trash' - note: some buttons may not work or need additional changes) * * @return string Resulting HTML code. */ static function createButtonBar($view, $permissions, $params) { foreach (array('canAddEvent', 'canAddVenue', 'canPublishEvent', 'canPublishVenue') as $key) { ${$key} = isset($permissions->$key) ? $permissions->$key: null; } if (is_object($params)) { foreach (array('id', 'slug', 'task', 'print_link', 'show', 'hide') as $key) { ${$key} = isset($params->$key) ? $params->$key : null; } } elseif (is_array($params)) { foreach (array('id', 'slug', 'task', 'print_link', 'show', 'hide') as $key) { ${$key} = key_exists($key, $params) ? $params[$key] : null; } } else { foreach (array('id', 'slug', 'task', 'print_link') as $key) { ${$key} = null; } } $btns_show = isset($show) ? (array)$show : array(); $btns_hide = isset($hide) ? (array)$hide : array(); $archive = !empty($task) && ($task == 'archive'); $buttons = array(); $idx = 0; # Left block ------------------ if (!$archive) { if (in_array('addEvent', $btns_show) || (!in_array('addEvent', $btns_hide) && in_array($view, array('categories', 'category', 'day', 'event', 'eventslist', 'myevents', 'myvenues', 'venue', 'venues')))) { $buttons[$idx][] = JemOutput::submitbutton(!empty($canAddEvent), null); } if (in_array('addVenue', $btns_show) || (!in_array('addVenue', $btns_hide) && in_array($view, array('categories', 'category', 'day', 'event', 'eventslist', 'myevents', 'myvenues', 'venue', 'venues')))) { $buttons[$idx][] = JemOutput::addvenuebutton(!empty($canAddVenue), null, null); } } ++$idx; # Middle block ---------------- if (in_array('archive', $btns_show) || (!in_array('archive', $btns_hide) && in_array($view, array('categories', 'category', 'eventslist', 'myattendances', 'myevents', 'venue')))) { $buttons[$idx][] = JemOutput::archivebutton(null, $task, $id); // task: archive, id: for '&id=' } if (in_array('mail', $btns_show) || (!in_array('mail', $btns_hide) && in_array($view, array('category', 'event', 'venue')))) { $buttons[$idx][] = JemOutput::mailbutton($slug, $view, null); // slug: for '&id=' } if (in_array('print', $btns_show) || (!in_array('print', $btns_hide) && in_array($view, array('attendees', 'calendar', 'categories', 'category', 'category-cal', 'day', 'event', 'eventslist', 'myattendances', 'myevents', 'myvenues', 'venue', 'venue-cal', 'venues', 'weekcal')))) { $buttons[$idx][] = JemOutput::printbutton($print_link, null); } if (in_array('ical', $btns_show) || (!in_array('ical', $btns_hide) && in_array($view, array('event')))) { $buttons[$idx][] = JemOutput::icalbutton($slug, $view); // slug: for '&id=' } if (in_array('export', $btns_show) || (!in_array('export', $btns_hide) && in_array($view, array('attendees')))) { $buttons[$idx][] = JemOutput::exportbutton($id); // id: for '&id=' } if (in_array('back', $btns_show) || (!in_array('back', $btns_hide) && in_array($view, array('attendees')))) { $buttons[$idx][] = JemOutput::backbutton(null, $view); } ++$idx; # Right block ----------------- if (!empty($canPublishEvent) || !empty($canPublishVenue)) { if (in_array('publish', $btns_show) || (!in_array('publish', $btns_hide) && in_array($view, array('myevents', 'myvenues')))) { $buttons[$idx][] = JemOutput::publishbutton($view); } if (in_array('unpublish', $btns_show) || (!in_array('unpublish', $btns_hide) && in_array($view, array('myevents', 'myvenues')))) { $buttons[$idx][] = JemOutput::unpublishbutton($view); } if (in_array('trash', $btns_show) || (!in_array('trash', $btns_hide) && in_array($view, array('myevents')))) { $buttons[$idx][] = JemOutput::trashbutton($view); } } # ----------------------------- foreach ($buttons as $i => $btns) { $buttons[$i] = implode('', array_filter($btns)); } $result = implode('<span class="gap"> </span>', array_filter($buttons)); return $result; }
/** * Method to get the events * * @access public * @return array */ public static function getList(&$params) { mb_internal_encoding('UTF-8'); $db = JFactory::getDBO(); $user = JemFactory::getUser(); $levels = $user->getAuthorisedViewLevels(); # Retrieve Eventslist model for the data $model = JModelLegacy::getInstance('Eventslist', 'JemModel', array('ignore_request' => true)); # Set params for the model # has to go before the getItems function $model->setState('params', $params); # filter published # 0: unpublished # 1: published # 2: archived # -2: trashed # type: # 0: upcoming (not started) - dates,times > now+offset # 1: unfinished (not ended) - enddates,endtimes > now+offset # 2: archived - no limit, but from now back to the past # 3: running (today) - enddates,endtimes > today+offset AND dates,times < tomorrow+offset # 4: featured - ? (same as upcoming yet) $type = (int)$params->get('type'); $offset_hours = (int)$params->get('offset_hours', 0); $max_title_length = (int)$params->get('cuttitle', '25'); # clean parameter data $catids = JemHelper::getValidIds($params->get('catid')); $venids = JemHelper::getValidIds($params->get('venid')); $eventids = JemHelper::getValidIds($params->get('eventid')); $stateloc = $params->get('stateloc'); $stateloc_mode = $params->get('stateloc_mode', 0); # Open date support $opendates = empty($eventids) ? 0 : 1; // allow open dates if limited to specific events $model->setState('filter.opendates', $opendates); # all upcoming or unfinished events if (($type == 0) || ($type == 1)) { $offset_minutes = $offset_hours * 60; $model->setState('filter.published',1); $model->setState('filter.orderby',array('a.dates ASC','a.times ASC')); $cal_from = "(a.dates IS NULL OR (TIMESTAMPDIFF(MINUTE, NOW(), CONCAT(a.dates,' ',IFNULL(a.times,'00:00:00'))) > $offset_minutes) "; $cal_from .= ($type == 1) ? " OR (TIMESTAMPDIFF(MINUTE, NOW(), CONCAT(IFNULL(a.enddates,a.dates),' ',IFNULL(a.endtimes,'23:59:59'))) > $offset_minutes)) " : ") "; } # archived events only elseif ($type == 2) { $model->setState('filter.published',2); $model->setState('filter.orderby',array('a.dates DESC','a.times DESC')); $cal_from = ""; } # currently running events only (today + offset is inbetween start and end date of event) elseif ($type == 3) { $offset_days = (int)round($offset_hours / 24); $model->setState('filter.published',1); $model->setState('filter.orderby',array('a.dates ASC','a.times ASC')); $cal_from = " ((DATEDIFF(a.dates, CURDATE()) <= $offset_days) AND (DATEDIFF(IFNULL(a.enddates,a.dates), CURDATE()) >= $offset_days))"; } # featured elseif ($type == 4) { $offset_minutes = $offset_hours * 60; $model->setState('filter.featured',1); $model->setState('filter.orderby',array('a.dates ASC','a.times ASC')); $cal_from = "((TIMESTAMPDIFF(MINUTE, NOW(), CONCAT(a.dates,' ',IFNULL(a.times,'00:00:00'))) > $offset_minutes) "; $cal_from .= " OR (TIMESTAMPDIFF(MINUTE, NOW(), CONCAT(IFNULL(a.enddates,a.dates),' ',IFNULL(a.endtimes,'23:59:59'))) > $offset_minutes)) "; } $model->setState('filter.calendar_from',$cal_from); $model->setState('filter.groupby','a.id'); # filter category's if ($catids) { $model->setState('filter.category_id', $catids); $model->setState('filter.category_id.include', true); } # filter venue's if ($venids) { $model->setState('filter.venue_id', $venids); $model->setState('filter.venue_id.include', true); } # filter event id's if ($eventids) { $model->setState('filter.event_id', $eventids); $model->setState('filter.event_id.include', true); } # filter venue's state/province if ($stateloc) { $model->setState('filter.venue_state', $stateloc); $model->setState('filter.venue_state.mode', $stateloc_mode); // 0: exact, 1: partial } # count $count = $params->get('count', '2'); $model->setState('list.limit', $count); if ($params->get('use_modal', 0)) { JHtml::_('behavior.modal', 'a.flyermodal'); } # date/time $dateFormat = $params->get('formatdate', ''); $timeFormat = $params->get('formattime', ''); $addSuffix = empty($timeFormat); // if we use component's default time format we can also add corresponding suffix # Retrieve the available Events $events = $model->getItems(); $color = $params->get('color'); $fallback_color = $params->get('fallbackcolor', '#EEEEEE'); # Loop through the result rows and prepare data $lists = array(); $i = 0; foreach ($events as $row) { # create thumbnails if needed and receive imagedata $dimage = $row->datimage ? JEMImage::flyercreator($row->datimage, 'event') : null; $limage = $row->locimage ? JEMImage::flyercreator($row->locimage, 'venue') : null; ################# ## DEFINE LIST ## ################# $lists[$i] = new stdClass(); # check view access if (in_array($row->access, $levels)) { # We know that user has the privilege to view the event $lists[$i]->link = JRoute::_(JEMHelperRoute::getEventRoute($row->slug)); $lists[$i]->linkText = JText::_('MOD_JEM_TEASER_READMORE'); } else { $lists[$i]->link = JRoute::_('index.php?option=com_users&view=login'); $lists[$i]->linkText = JText::_('MOD_JEM_TEASER_READMORE_REGISTER'); } # cut titel $fulltitle = htmlspecialchars($row->title, ENT_COMPAT, 'UTF-8'); if (mb_strlen($fulltitle) > $max_title_length) { $title = mb_substr($fulltitle, 0, $max_title_length) . '...'; } else { $title = $fulltitle; } $lists[$i]->title = $title; $lists[$i]->fulltitle = $fulltitle; $lists[$i]->venue = htmlspecialchars($row->venue, ENT_COMPAT, 'UTF-8'); $lists[$i]->catname = implode(", ", JemOutput::getCategoryList($row->categories, $params->get('linkcategory', 1))); $lists[$i]->state = htmlspecialchars($row->state, ENT_COMPAT, 'UTF-8'); $lists[$i]->city = htmlspecialchars($row->city, ENT_COMPAT, 'UTF-8'); $lists[$i]->eventlink = $params->get('linkevent', 1) ? JRoute::_(JEMHelperRoute::getEventRoute($row->slug)) : ''; $lists[$i]->venuelink = $params->get('linkvenue', 1) ? JRoute::_(JEMHelperRoute::getVenueRoute($row->venueslug)) : ''; # time/date static $formats = array('year' => 'Y', 'month' => 'F', 'day' => 'j', 'weekday' => 'l'); static $defaults = array('year' => ' ', 'month' => '', 'day' => '?', 'weekday' => ''); $lists[$i]->day = modJEMteaserHelper::_format_day($row, $params); $tmpdate = empty($row->dates) ? $defaults : self::_format_date_fields($row->dates, $formats); $lists[$i]->dayname = $tmpdate['weekday']; // keep them for backward compatibility $lists[$i]->daynum = $tmpdate['day']; $lists[$i]->month = $tmpdate['month']; $lists[$i]->year = $tmpdate['year']; $lists[$i]->startdate = $tmpdate; $lists[$i]->enddate = empty($row->enddates) ? $defaults : self::_format_date_fields($row->enddates, $formats); list($lists[$i]->date, $lists[$i]->time) = self::_format_date_time($row, $params->get('datemethod', 1), $dateFormat, $timeFormat, $addSuffix); $lists[$i]->dateinfo = JEMOutput::formatDateTime($row->dates, $row->times, $row->enddates, $row->endtimes, $dateFormat, $timeFormat, $addSuffix); if ($dimage == null) { $lists[$i]->eventimage = JUri::base(true).'/media/system/images/blank.png'; $lists[$i]->eventimageorig = JUri::base(true).'/media/system/images/blank.png'; } else { $lists[$i]->eventimage = JUri::base(true).'/'.$dimage['thumb']; $lists[$i]->eventimageorig = JUri::base(true).'/'.$dimage['original']; } if ($limage == null) { $lists[$i]->venueimage = JUri::base(true).'/media/system/images/blank.png'; $lists[$i]->venueimageorig = JUri::base(true).'/media/system/images/blank.png'; } else { $lists[$i]->venueimage = JUri::base(true).'/'.$limage['thumb']; $lists[$i]->venueimageorig = JUri::base(true).'/'.$limage['original']; } $length = $params->get('descriptionlength'); $length2 = 1; $etc = '...'; $etc2 = JText::_('MOD_JEM_TEASER_NO_DESCRIPTION'); //append <br /> tags on line breaking tags so they can be stripped below $description = preg_replace("'<(hr[^/>]*?/|/(div|h[1-6]|li|p|tr))>'si", "$0<br />", $row->introtext); //strip html tags but leave <br /> tags $description = strip_tags($description, "<br>"); //switch <br /> tags to space character if ($params->get('br') == 0) { $description = str_replace('<br />',' ', $description); } // if (strlen($description) > $length) { $length -= strlen($etc); $description = preg_replace('/\s+?(\S+)?$/', '', substr($description, 0, $length+1)); $lists[$i]->eventdescription = substr($description, 0, $length).$etc; } elseif (strlen($description) < $length2) { $length -= strlen($etc2); $description = preg_replace('/\s+?(\S+)?$/', '', substr($description, 0, $length+1)); $lists[$i]->eventdescription = substr($description, 0, $length).$etc2; } else { $lists[$i]->eventdescription = $description; } $lists[$i]->readmore = strlen(trim($row->fulltext)); $lists[$i]->colorclass = $color; if (($color == 'category') && !empty($row->categories)) { $colors = array(); foreach ($row->categories as $category) { if (!empty($category->color)) { $colors[$category->color] = $category->color; } } $lists[$i]->color = (count($colors) == 1) ? array_pop($colors) : $fallback_color; } $i++; } // foreach ($events as $row) return $lists; }
/** * Method to get the events * * @access public * @return array */ public static function getList(&$params) { mb_internal_encoding('UTF-8'); // Retrieve Eventslist model for the data $model = JModelLegacy::getInstance('Eventslist', 'JemModel', array('ignore_request' => true)); // Set params for the model // has to go before the getItems function $model->setState('params', $params); $model->setState('filter.access', true); // filter published // 0: unpublished // 1: published // 2: archived // -2: trashed $type = $params->get('type'); $offset_hourss = $params->get('offset_hours', 0); // all upcoming or unfinished events if ($type == 0 || $type == 1) { $offset_minutes = $offset_hourss * 60; $model->setState('filter.published', 1); $model->setState('filter.orderby', array('a.dates ASC', 'a.times ASC')); $cal_from = "((TIMESTAMPDIFF(MINUTE, NOW(), CONCAT(a.dates,' ',IFNULL(a.times,'00:00:00'))) > {$offset_minutes}) "; $cal_from .= $type == 1 ? " OR (TIMESTAMPDIFF(MINUTE, NOW(), CONCAT(IFNULL(a.enddates,a.dates),' ',IFNULL(a.endtimes,'23:59:59'))) > {$offset_minutes})) " : ") "; } elseif ($type == 2) { $model->setState('filter.published', 2); $model->setState('filter.orderby', array('a.dates DESC', 'a.times DESC')); $cal_from = ""; } elseif ($type == 3) { $offset_days = (int) round($offset_hourss / 24); $model->setState('filter.published', 1); $model->setState('filter.orderby', array('a.dates ASC', 'a.times ASC')); $cal_from = " ((DATEDIFF(a.dates, CURDATE()) <= {$offset_days}) AND (DATEDIFF(IFNULL(a.enddates,a.dates), CURDATE()) >= {$offset_days}))"; } $model->setState('filter.calendar_from', $cal_from); $model->setState('filter.groupby', 'a.id'); // clean parameter data $catids = $params->get('catid'); $venids = $params->get('venid'); $eventids = $params->get('eventid'); // filter category's if ($catids) { $model->setState('filter.category_id', $catids); $model->setState('filter.category_id.include', true); } // filter venue's if ($venids) { $model->setState('filter.venue_id', $venids); $model->setState('filter.venue_id.include', true); } // filter event id's if ($eventids) { $model->setState('filter.event_id', $eventids); $model->setState('filter.event_id.include', true); } // count $count = $params->get('count', '2'); $model->setState('list.limit', $count); if ($params->get('use_modal', 0)) { JHtml::_('behavior.modal', 'a.flyermodal'); } // Retrieve the available Events $events = $model->getItems(); if (!$events) { return array(); } // define list-array // in here we collect the row information $lists = array(); $i = 0; $FixItemID = $params->get('FixItemID', ''); $eventimg = $params->get('eventimg', 1); $venueimg = $params->get('venueimg', 1); /** * DEFINE FOREACH */ foreach ($events as $row) { // create thumbnails if needed and receive imagedata if ($row->datimage) { $dimage = JEMImage::flyercreator($row->datimage, 'event'); } else { $dimage = null; } if ($row->locimage) { $limage = JEMImage::flyercreator($row->locimage, 'venue'); } else { $limage = null; } // cut titel $length = mb_strlen($row->title); $maxlength = $params->get('cuttitle', '18'); if ($length > $maxlength && $maxlength > 0) { $row->title = mb_substr($row->title, 0, $maxlength); $row->title = $row->title . '...'; } $lists[$i] = new stdClass(); $lists[$i]->title = htmlspecialchars($row->title, ENT_COMPAT, 'UTF-8'); $lists[$i]->venue = htmlspecialchars($row->venue, ENT_COMPAT, 'UTF-8'); $lists[$i]->state = htmlspecialchars($row->state, ENT_COMPAT, 'UTF-8'); list($lists[$i]->date, $lists[$i]->time) = modJEMwideHelper::_format_date_time($row, $params); if ($FixItemID) { $lists[$i]->eventlink = $params->get('linkevent', 1) ? JRoute::_('index.php?option=com_jem&view=event&id=' . $row->slug . '&Itemid=' . $FixItemID) : ''; $lists[$i]->venuelink = $params->get('linkvenue', 1) ? JRoute::_('index.php?option=com_jem&view=venue&id=' . $row->venueslug . '&Itemid=' . $FixItemID) : ''; } else { $lists[$i]->eventlink = $params->get('linkevent', 1) ? JRoute::_(JEMHelperRoute::getEventRoute($row->slug)) : ''; $lists[$i]->venuelink = $params->get('linkvenue', 1) ? JRoute::_(JEMHelperRoute::getVenueRoute($row->venueslug)) : ''; } $lists[$i]->catname = implode(", ", JemOutput::getCategoryList($row->categories, $params->get('linkcategory', 1), false, $FixItemID)); // images if ($eventimg) { if ($dimage == null) { $lists[$i]->eventimage = ''; $lists[$i]->eventimageorig = ''; } else { $lists[$i]->eventimage = JURI::base(true) . '/' . $dimage['thumb']; $lists[$i]->eventimageorig = JURI::base(true) . '/' . $dimage['original']; } } else { $lists[$i]->eventimage = ''; $lists[$i]->eventimageorig = ''; } if ($venueimg) { if ($limage == null) { $lists[$i]->venueimage = ''; $lists[$i]->venueimageorig = ''; } else { $lists[$i]->venueimage = JURI::base(true) . '/' . $limage['thumb']; $lists[$i]->venueimageorig = JURI::base(true) . '/' . $limage['original']; } } else { $lists[$i]->venueimage = ''; $lists[$i]->venueimageorig = ''; } $lists[$i]->eventdescription = strip_tags($row->fulltext); $lists[$i]->venuedescription = strip_tags($row->locdescription); $i++; } return $lists; }
<tr class="row<?php echo $i % 2; ?>"> <td headers="jem_date" align="left"> <?php echo JEMOutput::formatShortDateTime($row->dates, $row->times, $row->enddates, $row->endtimes); ?> </td> <?php if (($this->jemsettings->showtitle == 1) && ($this->jemsettings->showdetails == 1)) : ?> <td headers="jem_title" align="left" valign="top"> <a href="<?php echo JRoute::_(JEMHelperRoute::getEventRoute($row->slug)); ?>"> <?php echo $this->escape($row->title) . JemOutput::recurrenceicon($row); ?> </a> </td> <?php endif; ?> <?php if (($this->jemsettings->showtitle == 1) && ($this->jemsettings->showdetails == 0)) : ?> <td headers="jem_title" align="left" valign="top"> <?php echo $this->escape($row->title) . JemOutput::recurrenceicon($row); ?> </td> <?php endif; ?> <?php if ($this->jemsettings->showlocate == 1) : ?> <td headers="jem_location" align="left" valign="top"> <?php if ($this->jemsettings->showlinkvenue == 1) : echo $row->locid != 0 ? "<a href='".JRoute::_(JEMHelperRoute::getVenueRoute($row->venueslug))."'>".$this->escape($row->venue)."</a>" : '-'; else : echo $row->locid ? $this->escape($row->venue) : '-'; endif; ?> </td> <?php endif; ?>
//Prepare time if (!$row->times) { $displaytime = '-'; } else { $time = strftime( $this->jemsettings->formattime, strtotime( $row->times )); $displaytime = $time.' '.$this->jemsettings->timename; } echo $displaytime; ?> </td> <td><?php echo $row->venue ? $this->escape($row->venue) : '-'; ?></td> <td><?php echo $row->city ? $this->escape($row->city) : '-'; ?></td> <td> <?php # we're referring to the helper due to the multi-cat feature echo implode(", ",JemOutput::getCategoryList($row->categories, false)); ?> </td> <td class="center"> <?php echo JHtml::_('jgrid.published', $row->published, $i,'',false); ?> </td> </tr> <?php endforeach; ?> </tbody> </table> <p class="copyright"> <?php echo JemAdmin::footer( ); ?> </p>
/** * structures the keywords */ function keyword_switcher($keyword, $row, $categories, $formattime, $formatdate) { switch ($keyword) { case "categories": $i = 0; $content = ''; $n = count($categories); foreach ($categories as $category) { $content .= $this->escape($category->catname); $i++; if ($i != $n) { $content .= ', '; } } break; case "a_name": $content = $row->venue; break; case "times": case "endtimes": $content = ''; if ($row->{$keyword}) { $content = JemOutput::formattime($row->{$keyword}); } break; case "dates": $content = JemOutput::formatdate($row->dates); break; case "enddates": $content = JemOutput::formatdate($row->enddates); break; case "title": $content = $row->title; break; default: $content = ""; if (isset($row->{$keyword})) { $content = $row->{$keyword}; } break; } return $content; }
/** * Creates the Event Feed */ function display($cachable = false, $urlparams = false) { $app = JFactory::getApplication(); $jinput = $app->input; $doc = JFactory::getDocument(); // Get some data from the model $jinput->set('limit', $app->getCfg('feed_limit')); $rows = $this->get('Items'); foreach ($rows as $row) { // strip html from feed item title $title = $this->escape($row->title); $title = html_entity_decode($title); // categories (object of stdclass to array), when there is something to show if (!empty($row->categories)) { $category = array(); foreach ($row->categories as $category2) { $category[] = $category2->catname; } // ading the , to the list when there are multiple category's $category = $this->escape(implode(', ', $category)); $category = html_entity_decode($category); } else { $category = ''; } //Format date and time $displaydate = JemOutput::formatLongDateTime($row->dates, $row->times, $row->enddates, $row->endtimes); // url link to event $link = JRoute::_(JemHelperRoute::getEventRoute($row->slug)); // Venue $venue = ""; if ($row->venue && $row->city) { $venue .= $row->venue . ' / ' . $row->city; } if ($row->venue && !$row->city) { $venue .= $row->venue; } if (!$row->venue && $row->city) { $venue .= $row->city; } if (!$row->venue && !$row->city) { $venue .= ""; } // combine description variable $description = JText::_('COM_JEM_TITLE') . ': ' . $title . '<br />'; if ($venue) { $description .= JText::_('COM_JEM_VENUE') . ': ' . $venue . '<br />'; } $description .= JText::_('COM_JEM_CATEGORY') . ': ' . $category . '<br />'; $description .= JText::_('COM_JEM_DATE') . ': ' . $displaydate . '<br />'; $description .= JText::_('COM_JEM_DESCRIPTION') . ': ' . $row->introtext . $row->fulltext; # define pubdate $date = false; // load individual item creator class $item = new JFeedItem(); $item->title = $title; $item->link = $link; $item->description = $description; $item->category = $category; if ($date) { $item->date = $date; } // loads item info into rss array $doc->addItem($item); } }
echo $this->escape($lang); ?> ',null);"> <?php echo $this->escape($item->title); ?> </a> </td> <td class="center"> <?php echo $this->escape($item->access_level); ?> </td> <td class="center"> <?php echo implode(", ", JemOutput::getCategoryList($item->categories, $this->jemsettings->catlinklist, true)); ?> </td> <td class="center nowrap"> <?php echo $displaydate; ?> </td> <td class="center"> <?php echo (int) $item->id; ?> </td> </tr> <?php }
<div class="clr"> </div> <p class="eventSubtitle">A <span><?php echo $this->escape($this->categories[0]->catname); ?> </span> event at <span itemprop="location"><?php echo $this->escape($this->item->venue); ?> </span></p> <p class="eventSubtitle">On <span> <?php echo JemOutput::formatLongDateTime($this->item->dates, $this->item->times, $this->item->enddates, $this->item->endtimes); ?> <?php echo JemOutput::formatSchemaOrgDateTime($this->item->dates, $this->item->times, $this->item->enddates, $this->item->endtimes); ?> </span></p> <!-- Event --> <dl class="event_info floattext"> <?php $first = false; for ($cr = 1; $cr <= 10; $cr++) { $currentRow = $this->item->{'custom' . $cr}; if ($currentRow) { if (!$first) { $first = true; echo "<hr />"; } $currentRowNew = '<a rel="nofollow" href="' . $this->escape($currentRow) . '">' . JText::_('TPL_SYO_JEM_EVENT_LINK_TEXT') . JText::_('COM_JEM_EVENT_CUSTOM_FIELD' . $cr) . '</a>';
" /> <input type="hidden" name="filter_order_Dir" value="<?php echo $this->lists['order_Dir']; ?> " /> <input type="hidden" name="view" value="category" /> <input type="hidden" name="task" value="<?php echo $this->task; ?> " /> <input type="hidden" name="id" value="<?php echo $this->category->id; ?> " /> </form> <!--pagination--> <div class="pagination"> <?php echo $this->pagination->getPagesLinks(); ?> </div> <!-- iCal --> <div id="iCal" class="iCal"> <?php echo JemOutput::icalbutton($this->category->id, 'category'); ?> </div> </div>
</div> <input type="hidden" name="removeimage" id="removeimage" value="0" /> <?php } ?> <?php # image output if ($this->item->datimage) { ?> <div id="hide_image" class="edit_imageflyer center"> <?php echo JemOutput::flyer($this->item, $this->dimage, 'event', 'hideimage'); ?> </div> <?php } ?> </fieldset> <!-- Recurrence --> <?php if (!$this->item->recurrence_groupcheck) { ?> <fieldset class="form-horizontal"> <legend><span class="legendcolor"><?php echo JText::_('COM_JEM_EDITEVENT_FIELD_RECURRENCE');
?> " /> <input type="hidden" name="view" value="eventslist" /> </form> <?php if ($this->params->get('showfootertext')) { ?> <div class="description no_space floattext"> <?php echo $this->params->get('footertext'); ?> </div> <?php } ?> <!--footer--> <div class="pagination"> <?php echo $this->pagination->getPagesLinks(); ?> </div> <!-- <div id="iCal" class="iCal"> <?php echo JemOutput::icalbutton('', 'eventslist'); ?> </div> --> </div>
/** * Method to get the events * * @access public * @return array */ public static function getList(&$params) { mb_internal_encoding('UTF-8'); $db = JFactory::getDBO(); $user = JFactory::getUser(); $levels = $user->getAuthorisedViewLevels(); # Retrieve Eventslist model for the data $model = JModelLegacy::getInstance('Eventslist', 'JemModel', array('ignore_request' => true)); # Set params for the model # has to go before the getItems function $model->setState('params', $params); # filter published # 0: unpublished # 1: published # 2: archived # -2: trashed $type = (int) $params->get('type'); $offset_hours = (int) $params->get('offset_hours', 0); $max_title_length = (int) $params->get('cuttitle', '25'); # clean parameter data $catids = JemHelper::getValidIds($params->get('catid')); $venids = JemHelper::getValidIds($params->get('venid')); # all upcoming or unfinished events if ($type == 0 || $type == 1) { $offset_minutes = $offset_hours * 60; $model->setState('filter.published', 1); $model->setState('filter.orderby', array('a.dates ASC', 'a.times ASC')); $cal_from = "((TIMESTAMPDIFF(MINUTE, NOW(), CONCAT(a.dates,' ',IFNULL(a.times,'23:59:59'))) > {$offset_minutes}) "; $cal_from .= $type == 1 ? " OR (TIMESTAMPDIFF(MINUTE, NOW(), CONCAT(IFNULL(a.enddates,a.dates),' ',IFNULL(a.endtimes,'23:59:59'))) > {$offset_minutes})) " : ") "; } elseif ($type == 2) { $model->setState('filter.published', 2); $model->setState('filter.orderby', array('a.dates DESC', 'a.times DESC')); $cal_from = ""; } elseif ($type == 3) { $offset_days = (int) round($offset_hours / 24); $model->setState('filter.published', 1); $model->setState('filter.orderby', array('a.dates ASC', 'a.times ASC')); $cal_from = " ((DATEDIFF(a.dates, CURDATE()) <= {$offset_days}) AND (DATEDIFF(IFNULL(a.enddates,a.dates), CURDATE()) >= {$offset_days}))"; } $model->setState('filter.calendar_from', $cal_from); $model->setState('filter.groupby', 'a.id'); # filter category's if ($catids) { $model->setState('filter.category_id', $catids); $model->setState('filter.category_id.include', true); } # filter venue's if ($venids) { $model->setState('filter.venue_id', $venids); $model->setState('filter.venue_id.include', true); } # count $count = $params->get('count', '2'); $model->setState('list.limit', $count); if ($params->get('use_modal', 0)) { JHtml::_('behavior.modal', 'a.flyermodal'); } # date/time $dateFormat = $params->get('formatdate', ''); $timeFormat = $params->get('formattime', ''); $addSuffix = empty($timeFormat); // if we use component's default time format we can also add corresponding suffix # Retrieve the available Events $events = $model->getItems(); # Loop through the result rows and prepare data $lists = array(); $i = 0; foreach ($events as $row) { # create thumbnails if needed and receive imagedata $dimage = $row->datimage ? JEMImage::flyercreator($row->datimage, 'event') : null; $limage = $row->locimage ? JEMImage::flyercreator($row->locimage, 'venue') : null; ################# ## DEFINE LIST ## ################# $lists[$i] = new stdClass(); # cut titel $fulltitle = htmlspecialchars($row->title, ENT_COMPAT, 'UTF-8'); if (mb_strlen($fulltitle) > $max_title_length) { $title = mb_substr($fulltitle, 0, $max_title_length) . '...'; } else { $title = $fulltitle; } ## Also trim venue name to same as title $fullvenuename = htmlspecialchars($row->venue, ENT_COMPAT, 'UTF-8'); if (mb_strlen($fullvenuename) > $max_title_length) { $venue = mb_substr($fullvenuename, 0, $max_title_length) . '...'; } else { $venue = $fullvenuename; } $lists[$i]->title = $title; $lists[$i]->fulltitle = $fulltitle; $lists[$i]->venue = $venue; $lists[$i]->fullvenue = $fullvenuename; $lists[$i]->catname = implode(", ", JemOutput::getCategoryList($row->categories, $params->get('linkcategory', 1))); $lists[$i]->state = htmlspecialchars($row->state, ENT_COMPAT, 'UTF-8'); $lists[$i]->city = htmlspecialchars($row->city, ENT_COMPAT, 'UTF-8'); $lists[$i]->eventlink = $params->get('linkevent', 1) ? JRoute::_(JEMHelperRoute::getEventRoute($row->slug)) : ''; $lists[$i]->venuelink = $params->get('linkvenue', 1) ? JRoute::_(JEMHelperRoute::getVenueRoute($row->venueslug)) : ''; # time/date list($lists[$i]->date, $lists[$i]->time) = self::_format_date_time($row, $params->get('datemethod', 1), $dateFormat, $timeFormat, $addSuffix); $lists[$i]->dateinfo = JEMOutput::formatDateTime($row->dates, $row->times, $row->enddates, $row->endtimes, $dateFormat, $timeFormat, $addSuffix); if ($dimage == null) { $lists[$i]->eventimage = JUri::base(true) . '/media/system/images/blank.png'; $lists[$i]->eventimageorig = JUri::base(true) . '/media/system/images/blank.png'; } else { $lists[$i]->eventimage = JUri::base(true) . '/' . $dimage['thumb']; $lists[$i]->eventimageorig = JUri::base(true) . '/' . $dimage['original']; } if ($limage == null) { $lists[$i]->venueimage = JUri::base(true) . '/media/system/images/blank.png'; $lists[$i]->venueimageorig = JUri::base(true) . '/media/system/images/blank.png'; } else { $lists[$i]->venueimage = JUri::base(true) . '/' . $limage['thumb']; $lists[$i]->venueimageorig = JUri::base(true) . '/' . $limage['original']; } $lists[$i]->eventdescription = strip_tags($row->fulltext); $lists[$i]->venuedescription = strip_tags($row->locdescription); $i++; } // foreach ($events as $row) return $lists; }
<?php $dimage = JemImage::flyercreator($row->datimage, 'event'); echo JemOutput::flyer($row, $dimage, 'event'); ?> <?php } ?> </td> <?php } ?> <td class="jem_date"> <?php echo JemOutput::formatShortDateTime($row->dates, $row->times, $row->enddates, $row->endtimes); echo JemOutput::formatSchemaOrgDateTime($row->dates, $row->times, $row->enddates, $row->endtimes); ?> </td> <?php if ($this->jemsettings->showtitle == 1 && $this->jemsettings->showdetails == 2) { ?> <?php if ($this->escape($row->introtext) != "") { ?> <td class="jem_title"> <a href="<?php echo JRoute::_(JemHelperRoute::getEventRoute($row->slug)); ?> " itemprop="url"> <span itemprop="name"><?php echo $this->escape($row->title);
$("meta_keywords").value = $keywords; $("meta_description").value = $description; } } </script> <form action="<?php echo JRoute::_('index.php?option=com_jem&layout=edit&id='.(int) $this->item->id); ?>" class="form-validate" method="post" name="adminForm" id="event-form" enctype="multipart/form-data"> <?php $recurr = empty($this->item->recurr_bak) ? $this->item : $this->item->recurr_bak; ?> <?php if (!empty($recurr->recurrence_number) || !empty($recurr->recurrence_type)) : ?> <div class="description"> <div style="float:left;"> <?php echo JemOutput::recurrenceicon($recurr, false, false); ?> </div> <div class="floattext" style="margin-left:36px;"> <strong><?php echo JText::_('COM_JEM_EDITEVENT_WARN_RECURRENCE_TITLE'); ?></strong> <br> <?php if (!empty($recurr->recurrence_type) && empty($recurr->recurrence_first_id)) { echo nl2br(JText::_('COM_JEM_EDITEVENT_WARN_RECURRENCE_FIRST_TEXT')); } else { echo nl2br(JText::_('COM_JEM_EDITEVENT_WARN_RECURRENCE_TEXT')); } ?> </div> </div> <div class="clear"></div> <?php endif; ?>
</div> <div class="col-sm-4 col-xs-6"> <button type="button" class="btn btn-danger btn-block" onclick="Joomla.submitbutton('event.cancel')"><?php echo JText::_('JCANCEL'); ?> </button> </div> </div> <?php if ($this->item->recurrence_type > 0) { ?> <div class="description"> <div class="pull-left;"> <?php echo JemOutput::recurrenceicon($this->item, false, false); ?> </div> <div class="floattext" style="margin-left:36px;"> <strong><?php echo JText::_('COM_JEM_EDITEVENT_WARN_RECURRENCE_TITLE'); ?> </strong> <br> <?php if (!empty($this->item->recurrence_type) && empty($this->item->recurrence_first_id)) { echo nl2br(JText::_('COM_JEM_EDITEVENT_WARN_RECURRENCE_FIRST_TEXT')); } else { echo nl2br(JText::_('COM_JEM_EDITEVENT_WARN_RECURRENCE_TEXT')); } ?>
/** * Creates the Day View */ function display($tpl = null) { // Initialize variables $app = JFactory::getApplication(); $jemsettings = JemHelper::config(); $settings = JemHelper::globalattribs(); $menu = $app->getMenu(); $menuitem = $menu->getActive(); $document = JFactory::getDocument(); $params = $app->getParams(); $uri = JFactory::getURI(); $jinput = $app->input; $task = $jinput->getCmd('task', ''); $print = $jinput->getBool('print', false); $pathway = $app->getPathWay(); $user = JemFactory::getUser(); $itemid = $jinput->getInt('id', 0) . ':' . $jinput->getInt('Itemid', 0); // Decide which parameters should take priority $useMenuItemParams = ($menuitem && $menuitem->query['option'] == 'com_jem' && $menuitem->query['view'] == 'day' && !isset($menuitem->query['id'])); // Retrieving data $requestVenueId = $jinput->getInt('locid', 0); $requestCategoryId = $jinput->getInt('catid', 0); $requestDate = $jinput->getInt('id', 0); // Load css JemHelper::loadCss('jem'); JemHelper::loadCustomCss(); JemHelper::loadCustomTag(); if ($print) { JemHelper::loadCss('print'); $document->setMetaData('robots', 'noindex, nofollow'); } // get variables $filter_order = $app->getUserStateFromRequest('com_jem.day.'.$itemid.'.filter_order', 'filter_order', 'a.dates', 'cmd'); $filter_order_Dir = $app->getUserStateFromRequest('com_jem.day.'.$itemid.'.filter_order_Dir', 'filter_order_Dir', '', 'word'); $filter_type = $app->getUserStateFromRequest('com_jem.day.'.$itemid.'.filter_type', 'filter_type', '', 'int'); $search = $app->getUserStateFromRequest('com_jem.day.'.$itemid.'.filter_search', 'filter_search', '', 'string'); // table ordering $lists['order_Dir'] = $filter_order_Dir; $lists['order'] = $filter_order; // Get data from model $rows = $this->get('Items'); $day = $this->get('Day'); $daydate = JemOutput::formatdate($day); $showdaydate = true; // show by default // Are events available? $noevents = (!$rows) ? 1 : 0; // Show page heading specified on menu item or TODAY as heading - idea taken from com_content. if ($useMenuItemParams) { $pagetitle = $params->get('page_title', $menuitem->title); $params->def('page_heading', $pagetitle); $pathway->setItemName(1, $menuitem->title); } else { // TODO: If we can integrate $daydate into page_heading we should set $showdaydate to false. $pagetitle = JText::_('COM_JEM_DEFAULT_PAGE_TITLE_DAY'); $params->set('page_heading', $pagetitle); $pathway->addItem($pagetitle); } $pageclass_sfx = $params->get('pageclass_sfx'); // Add site name to title if param is set if ($app->getCfg('sitename_pagetitles', 0) == 1) { $pagetitle = JText::sprintf('JPAGETITLE', $app->getCfg('sitename'), $pagetitle); } elseif ($app->getCfg('sitename_pagetitles', 0) == 2) { $pagetitle = JText::sprintf('JPAGETITLE', $pagetitle, $app->getCfg('sitename')); } // Set Page title $document->setTitle($pagetitle); if ($requestVenueId){ $print_link = JRoute::_('index.php?option=com_jem&view=day&tmpl=component&print=1&locid='.$requestVenueId.'&id='.$requestDate); } elseif ($requestCategoryId){ $print_link = JRoute::_('index.php?option=com_jem&view=day&tmpl=component&print=1&catid='.$requestCategoryId.'&id='.$requestDate); } else /*(!$requestCategoryId && !$requestVenueId)*/ { $print_link = JRoute::_('index.php?option=com_jem&view=day&tmpl=component&print=1&id='.$requestDate); } // Check if the user has permission to add things $permissions = new stdClass(); $permissions->canAddEvent = $user->can('add', 'event'); $permissions->canAddVenue = $user->can('add', 'venue'); // add alternate feed link (w/o specific date) $link = 'index.php?option=com_jem&view=day&format=feed'; $attribs = array('type' => 'application/rss+xml', 'title' => 'RSS 2.0'); $document->addHeadLink(JRoute::_($link.'&type=rss'), 'alternate', 'rel', $attribs); $attribs = array('type' => 'application/atom+xml', 'title' => 'Atom 1.0'); $document->addHeadLink(JRoute::_($link.'&type=atom'), 'alternate', 'rel', $attribs); // search filter $filters = array(); if ($jemsettings->showtitle == 1) { $filters[] = JHtml::_('select.option', '1', JText::_('COM_JEM_TITLE')); } if ($jemsettings->showlocate == 1 && !($requestVenueId)) { $filters[] = JHtml::_('select.option', '2', JText::_('COM_JEM_VENUE')); } if ($jemsettings->showcity == 1 && !($requestVenueId)) { $filters[] = JHtml::_('select.option', '3', JText::_('COM_JEM_CITY')); } if ($jemsettings->showcat == 1 && !($requestCategoryId)) { $filters[] = JHtml::_('select.option', '4', JText::_('COM_JEM_CATEGORY')); } if ($jemsettings->showstate == 1 && !($requestVenueId)) { $filters[] = JHtml::_('select.option', '5', JText::_('COM_JEM_STATE')); } $lists['filter'] = JHtml::_('select.genericlist', $filters, 'filter_type', array('size'=>'1','class'=>'inputbox'), 'value', 'text', $filter_type); $lists['search'] = $search; // Create the pagination object $pagination = $this->get('Pagination'); $this->lists = $lists; $this->rows = $rows; $this->noevents = $noevents; $this->print_link = $print_link; $this->params = $params; $this->dellink = $permissions->canAddEvent; // deprecated $this->pagination = $pagination; $this->action = $uri->toString(); $this->task = $task; $this->jemsettings = $jemsettings; $this->settings = $settings; $this->permissions = $permissions; $this->daydate = $daydate; $this->showdaydate = $showdaydate; // if true daydate will be shown as h2 sub heading $this->pageclass_sfx = htmlspecialchars($pageclass_sfx); // Doesn't really help - each view has less or more specific needs. //$this->prepareDocument(); parent::display($tpl); }
/** * structures the keywords */ function keyword_switcher($keyword, $row, $categories, $formattime, $formatdate) { $content = ''; switch ($keyword) { case 'categories': $catnames = array(); foreach ($categories as $category) { $catnames[] = $this->escape($category->catname); } $content = implode(', ', array_filter($catnames)); break; case 'a_name': $content = $row->venue; break; case 'times': case 'endtimes': if (isset($row->$keyword)) { $content = JemOutput::formattime($row->$keyword); } break; case 'dates': case 'enddates': if (isset($row->$keyword)) { $content = JemOutput::formatdate($row->$keyword); } break; case 'title': default: if (isset($row->$keyword)) { $content = $row->$keyword; } break; } return $content; }
?> <td headers="jem_state"> <?php echo !empty($row->state) ? $this->escape($row->state) : '-'; ?> </td> <?php } ?> <?php if ($this->jemsettings->showcat == 1) { ?> <td headers="jem_category"> <?php echo JemOutput::getCategoryList($row->categories, $this->jemsettings->catlinklist)[0]; ?> </td> <?php } ?> <?php if ($this->jemsettings->showatte == 1) { ?> <td headers="jem_attendees"> <?php echo !empty($row->regCount) ? $this->escape($row->regCount) : '-'; ?> </td> <?php
/** * Method to get the events * * @access public * @return array */ public static function getList(&$params) { mb_internal_encoding('UTF-8'); // Retrieve Eventslist model for the data $model = JModelLegacy::getInstance('Eventslist', 'JemModel', array('ignore_request' => true)); // Set params for the model // has to go before the getItems function $model->setState('params', $params); $model->setState('filter.access', true); // filter published // 0: unpublished // 1: published // 2: archived // -2: trashed $type = $params->get('type'); $offset_hourss = $params->get('offset_hours', 0); // all upcoming events if ($type == 0 || $type == 1) { $offset_minutes = $offset_hourss * 60; $model->setState('filter.published', 1); $model->setState('filter.orderby', array('a.dates ASC', 'a.times ASC')); $cal_from = "((TIMESTAMPDIFF(MINUTE, NOW(), CONCAT(a.dates,' ',IFNULL(a.times,'00:00:00'))) > {$offset_minutes}) "; $cal_from .= $type == 1 ? " OR (TIMESTAMPDIFF(MINUTE, NOW(), CONCAT(IFNULL(a.enddates,a.dates),' ',IFNULL(a.endtimes,'23:59:59'))) > {$offset_minutes})) " : ") "; } elseif ($type == 2) { $model->setState('filter.published', 2); $model->setState('filter.orderby', array('a.dates DESC', 'a.times DESC')); $cal_from = ""; } elseif ($type == 3) { $offset_days = (int) round($offset_hourss / 24); $model->setState('filter.published', 1); $model->setState('filter.orderby', array('a.dates ASC', 'a.times ASC')); $cal_from = " ((DATEDIFF(a.dates, CURDATE()) <= {$offset_days}) AND (DATEDIFF(IFNULL(a.enddates,a.dates), CURDATE()) >= {$offset_days}))"; } elseif ($type == 4) { $offset_minutes = $offset_hourss * 60; $model->setState('filter.featured', 1); $model->setState('filter.orderby', array('a.dates ASC', 'a.times ASC')); $cal_from = "((TIMESTAMPDIFF(MINUTE, NOW(), CONCAT(a.dates,' ',IFNULL(a.times,'00:00:00'))) > {$offset_minutes}) "; $cal_from .= " OR (TIMESTAMPDIFF(MINUTE, NOW(), CONCAT(IFNULL(a.enddates,a.dates),' ',IFNULL(a.endtimes,'23:59:59'))) > {$offset_minutes})) "; } $model->setState('filter.calendar_from', $cal_from); $model->setState('filter.groupby', 'a.id'); // clean parameter data $catids = $params->get('catid'); $venids = $params->get('venid'); $eventids = $params->get('eventid'); // filter category's if ($catids) { $model->setState('filter.category_id', $catids); $model->setState('filter.category_id.include', true); } // filter venue's if ($venids) { $model->setState('filter.venue_id', $venids); $model->setState('filter.venue_id.include', true); } // filter event id's if ($eventids) { $model->setState('filter.event_id', $eventids); $model->setState('filter.event_id.include', true); } // count $count = $params->get('count', '2'); if ($params->get('use_modal', 0)) { JHtml::_('behavior.modal', 'a.flyermodal'); } $model->setState('list.limit', $count); // Retrieve the available Events $events = $model->getItems(); if (!$events) { return array(); } // Loop through the result rows and prepare data $i = 0; $lists = array(); $FixItemID = $params->get('FixItemID', ''); $eventimg = $params->get('eventimg', 1); $venueimg = $params->get('venueimg', 1); foreach ($events as $row) { // create thumbnails if needed and receive imagedata if ($row->datimage) { $dimage = JEMImage::flyercreator($row->datimage, 'event'); } else { $dimage = null; } if ($row->locimage) { $limage = JEMImage::flyercreator($row->locimage, 'venue'); } else { $limage = null; } // cut titel $length = mb_strlen($row->title); $maxlength = $params->get('cuttitle', '18'); if ($length > $maxlength && $maxlength > 0) { $row->title = mb_substr($row->title, 0, $maxlength); $row->title = $row->title . '...'; } /** * DEFINE LIST **/ $settings = JEMHelper::globalattribs(); $access = !$settings->get('show_noauth', '0'); $authorised = JAccess::getAuthorisedViewLevels(JFactory::getUser()->get('id')); $lists[$i] = new stdClass(); $lists[$i]->title = htmlspecialchars($row->title, ENT_COMPAT, 'UTF-8'); $lists[$i]->venue = htmlspecialchars($row->venue, ENT_COMPAT, 'UTF-8'); $lists[$i]->state = htmlspecialchars($row->state, ENT_COMPAT, 'UTF-8'); $lists[$i]->city = htmlspecialchars($row->city, ENT_COMPAT, 'UTF-8'); // time/date $lists[$i]->date = modJEMteaserHelper::_format_date($row, $params); $lists[$i]->day = modJEMteaserHelper::_format_day($row, $params); $lists[$i]->dayname = modJEMteaserHelper::_format_dayname($row); $lists[$i]->daynum = modJEMteaserHelper::_format_daynum($row); $lists[$i]->month = modJEMteaserHelper::_format_month($row); $lists[$i]->year = modJEMteaserHelper::_format_year($row); $lists[$i]->time = $row->times ? modJEMteaserHelper::_format_time($row->dates, $row->times, $params) : ''; if ($access || in_array($row->access, $authorised)) { // We know that user has the privilege to view the event if ($FixItemID) { $lists[$i]->link = JRoute::_('index.php?option=com_jem&view=event&id=' . $row->slug . '&Itemid=' . $FixItemID); } else { $lists[$i]->link = JRoute::_(JEMHelperRoute::getEventRoute($row->slug)); } $lists[$i]->linkText = JText::_('MOD_JEM_TEASER_READMORE'); } else { $lists[$i]->link = JRoute::_('index.php?option=com_users&view=login'); $lists[$i]->linkText = JText::_('MOD_JEM_TEASER_READMORE_REGISTER'); } if ($FixItemID) { $lists[$i]->eventlink = $params->get('linkevent', 1) ? JRoute::_('index.php?option=com_jem&view=event&id=' . $row->slug . '&Itemid=' . $FixItemID) : ''; $lists[$i]->venuelink = $params->get('linkvenue', 1) ? JRoute::_('index.php?option=com_jem&view=venue&id=' . $row->venueslug . '&Itemid=' . $FixItemID) : ''; } else { $lists[$i]->eventlink = $params->get('linkevent', 1) ? JRoute::_(JEMHelperRoute::getEventRoute($row->slug)) : ''; $lists[$i]->venuelink = $params->get('linkvenue', 1) ? JRoute::_(JEMHelperRoute::getVenueRoute($row->venueslug)) : ''; } $lists[$i]->catname = implode(", ", JemOutput::getCategoryList($row->categories, $params->get('linkcategory', 1), false, $FixItemID)); // images if ($eventimg) { if ($dimage == null) { $lists[$i]->eventimage = ''; $lists[$i]->eventimageorig = ''; } else { $lists[$i]->eventimage = JURI::base(true) . '/' . $dimage['thumb']; $lists[$i]->eventimageorig = JURI::base(true) . '/' . $dimage['original']; } } else { $lists[$i]->eventimage = ''; $lists[$i]->eventimageorig = ''; } if ($venueimg) { if ($limage == null) { $lists[$i]->venueimage = ''; $lists[$i]->venueimageorig = ''; } else { $lists[$i]->venueimage = JURI::base(true) . '/' . $limage['thumb']; $lists[$i]->venueimageorig = JURI::base(true) . '/' . $limage['original']; } } else { $lists[$i]->venueimage = ''; $lists[$i]->venueimageorig = ''; } $length = $params->get('descriptionlength'); $length2 = 1; $etc = '...'; $etc2 = JText::_('MOD_JEM_TEASER_NO_DESCRIPTION'); //strip html tags but leave <br /> tags $description = strip_tags($row->introtext, "<br>"); //switch <br /> tags to space character if ($params->get('br') == 0) { $description = str_replace('<br />', ' ', $description); } // if (strlen($description) > $length) { $length -= strlen($etc); $description = preg_replace('/\\s+?(\\S+)?$/', '', substr($description, 0, $length + 1)); $lists[$i]->eventdescription = substr($description, 0, $length) . $etc; } else { if (strlen($description) < $length2) { $length -= strlen($etc2); $description = preg_replace('/\\s+?(\\S+)?$/', '', substr($description, 0, $length + 1)); $lists[$i]->eventdescription = substr($description, 0, $length) . $etc2; } else { $lists[$i]->eventdescription = $description; } } $lists[$i]->readmore = strlen(trim($row->fulltext)); $i++; } return $lists; }
</div> <div class="subcategorieslist"> <?php foreach ($row->subcats as $sub) : ?> <strong> <a href="<?php echo JRoute::_(JemHelperRoute::getCategoryRoute($sub->slug, $this->task)); ?>"> <?php echo $this->escape($sub->catname); ?></a> </strong> <?php echo '(' . ($sub->assignedevents != null ? $sub->assignedevents : 0) . (--$i ? '),' : ')'); ?> <?php endforeach; ?> </div> <?php endif; ?> <!--table--> <?php if ($this->params->get('detcat_nr', 0) > 0) { $this->catrow = $row; echo $this->loadTemplate('table'); } ?> <?php endforeach; ?> <!--pagination--> <div class="pagination"> <?php echo $this->pagination->getPagesLinks(); ?> </div> <!--copyright--> <div class="copyright"> <?php echo JemOutput::footer( ); ?> </div> </div>
if ($this->jemsettings->showatte == 1) { ?> <td class="jem_attendees center"> <?php echo !empty($row->regCount) ? $this->escape($row->regCount) : '-'; ?> </td> <?php } ?> <?php if ($admin && !$print) { ?> <td class="jem_edit center"> <?php echo JemOutput::editbutton($row, $params, $attribs, true, 'eventslist'); ?> </td> <?php } ?> </tr> <?php } ?> <?php } ?> </tbody> </table>
?> <div class="eventCat" id="cat<?php echo $cat->id; ?> "> <?php if (isset($cat->color) && $cat->color) { echo '<span class="colorpic" style="background-color: ' . $cat->color . ';"></span>'; } echo $cat->catname . ' (' . $countcatevents[$cat->id] . ')'; ?> </div> <?php } } } } } ?> </div> </div> <div class="clr"></div> <div class="poweredby"> <?php echo JemOutput::footer(); ?> </div> </div>
protected function _display($rows, $parameters, $listevents_id) { if (!$rows) { return $parameters["eventsmsgnone"]; } $html_list = '<div class="listevents" id="listevents-' . $listevents_id . '">'; $html_list .= '<ul>'; $n_event = 0; foreach ($rows as $event) { require_once JPATH_BASE . "/components/com_jem/helpers/route.php"; $linkdetails = JRoute::_(JEMHelperRoute::getEventRoute($event->slug)); $linkdate = JRoute::_(JEMHelperRoute::getRoute(str_replace('-', '', $event->dates), 'day')); $linkvenue = JRoute::_(JEMHelperRoute::getVenueRoute($event->venueslug)); $jemsettings = JemHelper::config(); if ($parameters["eventstype"] == 'regprev' || $parameters["eventstype"] == 'regnext') { require_once JPATH_BASE . "/components/com_jem/models/eventlist.php"; $eventsmodel = new EventListModelEventList(); $query = 'SELECT COUNT(uid) as attendees from #__eventlist_register WHERE event = ' . $event->eventid; $eventsmodel->_db->setQuery($query); $_event = $eventsmodel->_db->loadObject(); $attendees = $_event->attendees; if ($attendees == 0) { continue; } } $html_list .= '<li id="listevent' . ($n_event + 1) . '">'; if ($parameters["eventstitle"] != 'off') { $html_list .= '<span id="eventtitle">'; $html_list .= $parameters["eventstitle"] == 'link' ? '<a href="' . $linkdetails . '">' : ''; $html_list .= $event->title; $html_list .= $parameters["eventstitle"] == 'link' ? '</a>' : ''; $html_list .= '</span>'; } if ($parameters["eventsdate"] != 'off' && $event->dates) { # display startdate require_once JPATH_BASE . "/components/com_jem/helpers/helper.php"; require_once JPATH_BASE . "/components/com_jem/classes/output.class.php"; $html_list .= ' : ' . '<span id="eventdate">'; $html_list .= $parameters["eventsdate"] == 'link' ? '<a href="' . $linkdate . '">' : ''; $html_list .= JEMOutput::formatdate($event->dates); $html_list .= $parameters["eventsdate"] == 'link' ? '</a>' : ''; $html_list .= '</span>'; } if ($parameters["eventstime"] != 'off' && $event->times) { # display starttime require_once JPATH_BASE . "/components/com_jem/helpers/helper.php"; require_once JPATH_BASE . "/components/com_jem/classes/output.class.php"; $html_list .= ' ' . '<span id="eventtime">'; $html_list .= JEMOutput::formattime($event->times); $html_list .= '</span>'; } if ($parameters["eventsvenue"] != 'off' && $event->venue) { $html_list .= ' : ' . '<span id="eventvenue">'; $html_list .= $parameters["eventsvenue"] == 'link' ? '<a href="' . $linkvenue . '">' : ''; $html_list .= $event->venue; $html_list .= $parameters["eventsvenue"] == 'link' ? '</a>' : ''; $html_list .= '</span>'; } if ($parameters["eventscategory"] != 'off' && $event->categories) { if ($parameters["eventscategory"] == 'link') { $catlink = 1; } else { $catlink = false; } $html_list .= " "; $html_list .= implode(", ", JemOutput::getCategoryList($event->categories, $catlink)); } $html_list .= '</li>'; $n_event++; if ($parameters["eventsmax"] && $n_event >= $parameters["eventsmax"]) { break; } } if ($n_event == 0) { $html_list .= $parameters["eventsmsgnone"]; } $html_list .= '</ul>'; $html_list .= '</div>'; return $html_list; }