Ejemplo n.º 1
0
 /**
  * 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;
 }
Ejemplo n.º 2
0
<?php

/**
 * @package JEM
 * @subpackage JEM - Module-Wide
 * @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;
// get module helper
require_once __DIR__ . '/helper.php';
// require needed component classes
require_once JPATH_SITE . '/components/com_jem/helpers/helper.php';
require_once JPATH_SITE . '/components/com_jem/helpers/route.php';
require_once JPATH_SITE . '/components/com_jem/classes/image.class.php';
require_once JPATH_SITE . '/components/com_jem/classes/Zebra_Image.php';
require_once JPATH_SITE . '/components/com_jem/classes/output.class.php';
$list = modJEMwideHelper::getList($params);
$document = JFactory::getDocument();
$document->addStyleSheet(JUri::base(true) . '/modules/mod_jem_wide/tmpl/mod_jem_wide.css');
// check if any results returned
$items = count($list);
if (!$items) {
    return;
}
require JModuleHelper::getLayoutPath('mod_jem_wide');