function getDisplayTab($tab, $user, $ui)
 {
     $db =& JFactory::getDBO();
     $language =& JFactory::getLanguage();
     //Get languagefile
     $language->load('com_eventlist');
     //Get EventList Route helper
     require_once JPATH_SITE . DS . 'components' . DS . 'com_eventlist' . DS . 'helpers' . DS . 'route.php';
     //Get params
     $limit = $this->params->get('limit', '5');
     $dateformat = $this->params->get('dateformat', '%d.%m.%Y');
     $timeformat = $this->params->get('timeformat', '%H.%M');
     $query = 'SELECT r.event, r.uid, s.title, s.dates, s.times, s.locid, l.venue, l.city,' . ' CASE WHEN CHAR_LENGTH(s.alias) THEN CONCAT_WS(\':\', s.id, s.alias) ELSE s.id END as slug,' . ' CASE WHEN CHAR_LENGTH(l.alias) THEN CONCAT_WS(\':\', l.id, l.alias) ELSE l.id END as venueslug' . ' FROM #__eventlist_register AS r' . ' LEFT JOIN #__eventlist_events AS s ON r.event = s.id' . ' LEFT JOIN #__eventlist_venues AS l ON s.locid = l.id' . ' WHERE r.uid = ' . (int) $user->id . ' AND r.event = s.id AND s.locid = l.id' . ' ORDER BY s.dates, s.times' . ' LIMIT ' . (int) $limit;
     $db->setQuery($query);
     $events = $db->loadObjectList();
     if (!count($events) > 0) {
         $return = JText::_('NO EVENTS');
         return $return;
     }
     $return = "<div style=\"padding:4px;\">" . "</div>" . "<table cellpadding=\"5\" cellspacing=\"0\" border=\"0\" width=\"95%\">" . "<tr class=\"sectiontableheader\">" . "<td>" . JText::_('TITLE') . "</td><td>" . JText::_('VENUE') . "</td><td>" . JText::_('CITY') . "</td><td>" . JText::_('DATE') . "</td>" . "</tr>";
     foreach ($events as $event) {
         $date = strftime($dateformat, strtotime($event->dates));
         $time = $event->times ? ' ' . strftime($timeformat, strtotime($event->times)) : '';
         $return .= "<tr><td>" . "<a href=\"" . JRoute::_(EventListHelperRoute::getRoute($event->slug)) . "\" />" . htmlspecialchars($event->title, ENT_COMPAT, 'UTF-8') . "</a></td>" . "<td><a href=\"" . JRoute::_(EventListHelperRoute::getRoute($event->venueslug, 'venueevents')) . "\" />" . htmlspecialchars($event->venue, ENT_COMPAT, 'UTF-8') . "</a></td>" . "<td>" . htmlspecialchars($event->city, ENT_COMPAT, 'UTF-8') . "</td>" . "<td>" . $date . $time . "</td>" . "</tr>";
     }
     $return .= "</table>";
     return $return;
 }
Example #2
0
 /**
  * Method to get the events
  *
  * @access public
  * @return array
  */
 function getList(&$params)
 {
     global $mainframe;
     $db =& JFactory::getDBO();
     $user =& JFactory::getUser();
     $user_gid = (int) $user->get('aid');
     if ($params->get('type', '0') == -1) {
         // upcoming events
         $where = ' WHERE a.published = 1 and a.dates >= CURDATE()';
         $order = ' ORDER BY a.dates ASC, a.times ASC';
     } else {
         if ($params->get('type', '0') == 1) {
             // archived events
             $where = ' WHERE a.published = -1';
             $order = ' ORDER BY a.dates DESC, a.times DESC';
         } else {
             // published events (default)
             $where = ' WHERE a.published = 1';
             $order = ' ORDER BY a.dates ASC, a.times ASC';
         }
     }
     $catid = trim($params->get('catid'));
     $venid = trim($params->get('venid'));
     if ($catid) {
         $ids = explode(',', $catid);
         JArrayHelper::toInteger($ids);
         $categories = ' AND (c.id=' . implode(' OR c.id=', $ids) . ')';
     }
     if ($venid) {
         $ids = explode(',', $venid);
         JArrayHelper::toInteger($ids);
         $venues = ' AND (l.id=' . implode(' OR l.id=', $ids) . ')';
     }
     //get $params->get( 'count', '2' ) nr of datasets
     $query = 'SELECT a.*, l.venue, l.city, l.url,' . ' CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(\':\', a.id, a.alias) ELSE a.id END as slug' . ' FROM #__eventlist_events AS a' . ' LEFT JOIN #__eventlist_venues AS l ON l.id = a.locid' . ' LEFT JOIN #__eventlist_categories AS c ON c.id = a.catsid' . $where . ' AND c.access <= ' . $user_gid . ($catid ? $categories : '') . ($venid ? $venues : '') . $order . ' LIMIT ' . (int) $params->get('count', '2');
     $db->setQuery($query);
     $rows = $db->loadObjectList();
     $i = 0;
     $lists = array();
     foreach ($rows as $row) {
         //cut titel
         $length = strlen(htmlspecialchars($row->title));
         if ($length > $params->get('cuttitle', '18')) {
             $row->title = substr($row->title, 0, $params->get('cuttitle', '18'));
             $row->title = htmlspecialchars($row->title . '...', ENT_COMPAT, 'UTF-8');
         }
         $lists[$i]->link = JRoute::_(EventListHelperRoute::getRoute($row->slug));
         $lists[$i]->dateinfo = modEventListHelper::_builddateinfo($row, $params);
         $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->url) ? modEventListHelper::_format_url($row->url) : null;
         $i++;
     }
     return $lists;
 }
Example #3
0
 /**
  * Determines an EventList Link
  *
  * @param int The id of an EventList item
  * @param string The view
  * @since 0.9
  *
  * @return string determined Link
  */
 function getRoute($id, $view = 'details')
 {
     //Not needed currently but kept because of a possible hierarchic link structure in future
     $needles = array($view => (int) $id);
     //Create the link
     $link = 'index.php?option=com_eventlist&view=' . $view . '&id=' . $id;
     if ($item = EventListHelperRoute::_findItem($needles)) {
         $link .= '&Itemid=' . $item->id;
     }
     return $link;
 }
Example #4
0
 /**
  * Method to get the events
  *
  * @access public
  * @return array
  */
 function getList(&$params)
 {
     global $mainframe;
     $db =& JFactory::getDBO();
     $user =& JFactory::getUser();
     $user_gid = (int) $user->get('aid');
     if ($params->get('type', '0') == 0) {
         $where = ' WHERE a.published = 1';
         if ($params->get('event_after', '0')) {
             $limit_date = strftime('%Y-%m-%d', time() + $params->get('event_after', '0') * 86400);
             $where .= ' AND a.dates >= ' . $db->Quote($limit_date);
         }
         $order = ' ORDER BY a.dates, a.times';
     } else {
         $where = ' WHERE a.published = -1';
         $order = ' ORDER BY a.dates DESC, a.times DESC';
     }
     $catid = trim($params->get('catid'));
     $venid = trim($params->get('venid'));
     if ($catid) {
         $ids = explode(',', $catid);
         JArrayHelper::toInteger($ids);
         $categories = ' AND (c.id=' . implode(' OR c.id=', $ids) . ')';
     }
     if ($venid) {
         $ids = explode(',', $venid);
         JArrayHelper::toInteger($ids);
         $venues = ' AND (l.id=' . implode(' OR l.id=', $ids) . ')';
     }
     //get $params->get( 'count', '2' ) nr of datasets
     $query = 'SELECT DISTINCT a.*, l.venue, l.city, l.url,' . ' CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(\':\', a.id, a.alias) ELSE a.id END as slug,' . ' CASE WHEN CHAR_LENGTH(l.alias) THEN CONCAT_WS(\':\', l.id, l.alias) ELSE l.id END as venueslug' . ' FROM #__eventlist_events AS a' . ' INNER JOIN #__eventlist_cats_event_relations AS rel ON rel.itemid = a.id' . ' INNER JOIN #__eventlist_categories AS c ON c.id = rel.catid' . ' LEFT JOIN #__eventlist_venues AS l ON l.id = a.locid' . $where . ' AND c.access <= ' . $user_gid . ($catid ? $categories : '') . ($venid ? $venues : '') . $order . ' LIMIT ' . (int) $params->get('count', '2');
     $db->setQuery($query);
     $rows = $db->loadObjectList();
     $i = 0;
     $lists = array();
     foreach ($rows as $row) {
         //cut titel
         $length = strlen(htmlspecialchars($row->title));
         if ($length > $params->get('cuttitle', '18')) {
             $row->title = substr($row->title, 0, $params->get('cuttitle', '18'));
             $row->title = htmlspecialchars($row->title . '...', ENT_COMPAT, 'UTF-8');
         }
         $lists[$i]->link = JRoute::_(EventListHelperRoute::getRoute($row->slug));
         $lists[$i]->dateinfo = modEventListHelper::_builddateinfo($row, $params);
         $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::_(EventListHelperRoute::getRoute($row->venueslug, 'venueevents')) : null;
         $i++;
     }
     return $lists;
 }
 function getObjectLink($id)
 {
     $db = JFactory::getDBO();
     $query = 'SELECT a.id, 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 id = ' . $id;
     $db->setQuery($query);
     $slug = $db->loadResult();
     require_once JPATH_SITE . '/includes/application.php';
     $eventListRouter = JPATH_SITE . '/components/com_eventlist/helpers/route.php';
     if (is_file($eventListRouter)) {
         require_once $eventListRouter;
         $link = JRoute::_(EventListHelperRoute::getRoute($slug));
     } else {
         $link = JRoute::_('index.php?option=com_eventlist&view=details&id=' . $slug);
     }
     return $link;
 }
Example #6
0
 function getObjectLink($id)
 {
     if (JCOMMENTS_JVERSION == '1.0') {
         $_Itemid = self::getItemid('com_eventlist');
         $link = sefRelToAbs("index.php?option=com_eventlist&amp;view=details&amp;id=" . $id . "&amp;Itemid=" . $_Itemid);
     } else {
         $db = JCommentsFactory::getDBO();
         $query = 'SELECT a.id, 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 id = ' . $id;
         $db->setQuery($query);
         $slug = $db->loadResult();
         require_once JPATH_SITE . DS . 'includes' . DS . 'application.php';
         $eventListRouter = JPATH_SITE . DS . 'components' . DS . 'com_eventlist' . DS . 'helpers' . DS . 'route.php';
         if (is_file($eventListRouter)) {
             require_once $eventListRouter;
             $link = JRoute::_(EventListHelperRoute::getRoute($slug));
         } else {
             $link = JRoute::_('index.php?option=com_eventlist&view=details&id=' . $slug);
         }
     }
     return $link;
 }
Example #7
0
 function getdays($greq_year, $greq_month, &$params)
 {
     $db =& JFactory::getDBO();
     $user =& JFactory::getUser();
     $catid = trim($params->get('catid'));
     $venid = trim($params->get('venid'));
     //Get eventdates
     if ($catid) {
         $ids = explode(',', $catid);
         JArrayHelper::toInteger($ids);
         $categories = ' AND (c.id=' . implode(' OR c.id=', $ids) . ')';
     }
     if ($venid) {
         $ids = explode(',', $venid);
         JArrayHelper::toInteger($ids);
         $venues = ' AND (l.id=' . implode(' OR l.id=', $ids) . ')';
     }
     $query = 'SELECT a.dates, a.times, a.enddates,a.title, DAYOFMONTH(a.dates) AS created_day, YEAR(a.dates) AS created_year, MONTH(a.dates) AS created_month' . ' FROM #__eventlist_events AS a' . ' LEFT JOIN #__eventlist_categories AS c ON c.id = a.catsid' . ' LEFT JOIN #__eventlist_venues AS l ON l.id = a.locid' . ' WHERE a.published = 1' . ' AND c.access <= ' . (int) $user->aid . ($catid ? $categories : '') . ($venid ? $venues : '');
     $db->setQuery($query);
     $events = $db->loadObjectList();
     $days = array();
     foreach ($events as $event) {
         // Cope with no end date set i.e. set it to same as start date
         if ($event->enddates == '0000-00-00' or is_null($event->enddates)) {
             $eyear = $event->created_year;
             $emonth = $event->created_month;
             $eday = $event->created_day;
         } else {
             list($eyear, $emonth, $eday) = explode('-', $event->enddates);
         }
         if ($greq_year >= $event->created_year && $greq_year <= $eyear && $greq_month >= $event->created_month && $greq_month <= $emonth) {
             // Set end day for current month
             if ($emonth > $greq_month) {
                 $emonth = $greq_month;
                 //			$eday = cal_days_in_month(CAL_GREGORIAN, $greq_month,$greq_year);
                 $eday = date('t', mktime(0, 0, 0, $greq_month, 1, $greq_year));
             }
             // Set start day for current month
             if ($event->created_month < $greq_month) {
                 $event->created_month = $greq_month;
                 $event->created_day = 1;
             }
             for ($count = $event->created_day; $count <= $eday; $count++) {
                 $uxdate = mktime(0, 0, 0, $event->created_month, $count, $event->created_year);
                 // Toni change
                 $tdate = strftime('%Y%m%d', $uxdate);
                 // Toni change Joomla 1.5
                 $created_day = $count;
                 //			$tt = $days[$count][1];
                 //			if (strlen($tt) == 0)
                 if (empty($days[$count][1])) {
                     $title = htmlspecialchars($event->title);
                 } else {
                     $tt = $days[$count][1];
                     $title = $tt . '&#013 +' . htmlspecialchars($event->title);
                 }
                 $link = EventListHelperRoute::getRoute($tdate, 'day');
                 $days[$count] = array($link, $title);
             }
         }
         // End of Toni modification
     }
     return $days;
 }
Example #8
0
/**
 * Categories Search method
 *
 * The sql must return the following fields that are
 * used in a common display routine: href, title, section, created, text,
 * browsernav
 * @param string Target search string
 * @param string mathcing option, exact|any|all
 * @param string ordering option, newest|oldest|popular|alpha|category
 * @param mixed An array if restricted to areas, null if search all
 */
function plgSearchEventlist($text, $phrase = '', $ordering = '', $areas = null)
{
    $db =& JFactory::getDBO();
    $user =& JFactory::getUser();
    require_once JPATH_SITE . DS . 'components' . DS . 'com_eventlist' . DS . 'helpers' . DS . 'route.php';
    if (is_array($areas)) {
        if (!array_intersect($areas, array_keys(plgSearchEventlistAreas()))) {
            return array();
        }
    } else {
        $areas = array_keys(plgSearchEventlistAreas());
    }
    // load plugin params info
    $plugin =& JPluginHelper::getPlugin('search', 'eventlist');
    $pluginParams = new JParameter($plugin->params);
    $limit = $pluginParams->def('search_limit', 50);
    $text = trim($text);
    if ($text == '') {
        return array();
    }
    $searchEventList = $db->Quote(JText::_('EVENTLIST'));
    $rows = array();
    if (in_array('elevents', $areas)) {
        switch ($phrase) {
            case 'exact':
                $text = $db->Quote('%' . $db->getEscaped($text, true) . '%', false);
                $wheres2 = array();
                $wheres2[] = 'LOWER(a.title) LIKE ' . $text;
                $wheres2[] = 'LOWER(a.datdescription) LIKE ' . $text;
                $wheres2[] = 'LOWER(a.meta_keywords) LIKE ' . $text;
                $wheres2[] = 'LOWER(a.meta_description) LIKE ' . $text;
                $where = '(' . implode(') OR (', $wheres2) . ')';
                break;
            case 'all':
            case 'any':
            default:
                $words = explode(' ', $text);
                $wheres = array();
                foreach ($words as $word) {
                    $word = $db->Quote('%' . $db->getEscaped($word, true) . '%', false);
                    $wheres2 = array();
                    $wheres2[] = 'LOWER(a.title) LIKE ' . $word;
                    $wheres2[] = 'LOWER(a.datdescription) LIKE ' . $word;
                    $wheres2[] = 'LOWER(a.meta_keywords) LIKE ' . $word;
                    $wheres2[] = 'LOWER(a.meta_description) LIKE ' . $word;
                    $wheres[] = implode(' OR ', $wheres2);
                }
                $where = '(' . implode($phrase == 'all' ? ') AND (' : ') OR (', $wheres) . ')';
                break;
        }
        switch ($ordering) {
            case 'oldest':
                $order = 'a.dates, a.times ASC';
                break;
            case 'alpha':
                $order = 'a.title ASC';
                break;
            case 'category':
                $order = 'c.catname ASC, a.title ASC';
                break;
            case 'newest':
            default:
                $order = 'a.dates, a.times DESC';
        }
        $query = 'SELECT a.id, a.title AS title,' . ' a.datdescription AS text,' . ' a.dates AS created,' . ' "2" AS browsernav,' . ' CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(\':\', a.id, a.alias) ELSE a.id END as slug, ' . ' CONCAT_WS( " / ", ' . $searchEventList . ', c.catname, a.title ) AS section' . ' FROM #__eventlist_events AS a' . ' INNER JOIN #__eventlist_categories AS c' . ' LEFT JOIN #__eventlist_cats_event_relations AS rel ON rel.catid = c.id' . ' WHERE ( ' . $where . ' )' . ' AND rel.itemid = a.id' . ' AND a.published = 1' . ' AND c.published = 1' . ' AND c.access <= ' . (int) $user->get('aid') . ' ORDER BY ' . $order;
        $db->setQuery($query, 0, $limit);
        $list = $db->loadObjectList();
        foreach ((array) $list as $key => $row) {
            $list[$key]->href = EventListHelperRoute::getRoute($row->slug);
        }
        $rows[] = $list;
    }
    if (in_array('elvenues', $areas)) {
        switch ($phrase) {
            case 'exact':
                $text = $db->Quote('%' . $db->getEscaped($text, true) . '%', false);
                $wheres2 = array();
                $wheres2[] = 'LOWER(venue) LIKE ' . $text;
                $wheres2[] = 'LOWER(locdescription) LIKE ' . $text;
                $wheres2[] = 'LOWER(city) LIKE ' . $text;
                $wheres2[] = 'LOWER(meta_keywords) LIKE ' . $text;
                $wheres2[] = 'LOWER(meta_description) LIKE ' . $text;
                $where = '(' . implode(') OR (', $wheres2) . ')';
                break;
            case 'all':
            case 'any':
            default:
                $words = explode(' ', $text);
                $wheres = array();
                foreach ($words as $word) {
                    $word = $db->Quote('%' . $db->getEscaped($word, true) . '%', false);
                    $wheres2 = array();
                    $wheres2[] = 'LOWER(venue) LIKE ' . $word;
                    $wheres2[] = 'LOWER(locdescription) LIKE ' . $word;
                    $wheres2[] = 'LOWER(city) LIKE ' . $word;
                    $wheres2[] = 'LOWER(meta_keywords) LIKE ' . $word;
                    $wheres2[] = 'LOWER(meta_description) LIKE ' . $word;
                    $wheres[] = implode(' OR ', $wheres2);
                }
                $where = '(' . implode($phrase == 'all' ? ') AND (' : ') OR (', $wheres) . ')';
                break;
        }
        switch ($ordering) {
            case 'oldest':
                $order = 'created DESC';
                break;
            case 'alpha':
                $order = 'venue ASC';
                break;
            case 'newest':
                $order = 'created ASC';
                break;
            default:
                $order = 'venue ASC';
        }
        $query = 'SELECT venue AS title,' . ' locdescription AS text,' . ' created,' . ' "2" AS browsernav,' . ' CASE WHEN CHAR_LENGTH(alias) THEN CONCAT_WS(\':\', id, alias) ELSE id END as slug, ' . ' CONCAT_WS( " / ", ' . $searchEventList . ', venue )AS section' . ' FROM #__eventlist_venues' . ' WHERE ( ' . $where . ')' . ' AND published = 1' . ' ORDER BY ' . $order;
        $db->setQuery($query, 0, $limit);
        $list2 = $db->loadObjectList();
        foreach ((array) $list2 as $key => $row) {
            $list2[$key]->href = EventListHelperRoute::getRoute($row->slug, 'venueevents');
        }
        $rows[] = $list2;
    }
    if (in_array('elcategories', $areas)) {
        switch ($phrase) {
            case 'exact':
                $text = $db->Quote('%' . $db->getEscaped($text, true) . '%', false);
                $wheres2 = array();
                $wheres2[] = 'LOWER(catname) LIKE ' . $text;
                $wheres2[] = 'LOWER(catdescription) LIKE ' . $text;
                $wheres2[] = 'LOWER(meta_keywords) LIKE ' . $text;
                $wheres2[] = 'LOWER(meta_description) LIKE ' . $text;
                $where = '(' . implode(') OR (', $wheres2) . ')';
                break;
            case 'all':
            case 'any':
            default:
                $words = explode(' ', $text);
                $wheres = array();
                foreach ($words as $word) {
                    $word = $db->Quote('%' . $db->getEscaped($word, true) . '%', false);
                    $wheres2 = array();
                    $wheres2[] = 'LOWER(catname) LIKE ' . $word;
                    $wheres2[] = 'LOWER(catdescription) LIKE ' . $word;
                    $wheres2[] = 'LOWER(meta_keywords) LIKE ' . $word;
                    $wheres2[] = 'LOWER(meta_description) LIKE ' . $word;
                    $wheres[] = implode(' OR ', $wheres2);
                }
                $where = '(' . implode($phrase == 'all' ? ') AND (' : ') OR (', $wheres) . ')';
                break;
        }
        $query = 'SELECT catname AS title,' . ' catdescription AS text,' . ' "" AS created,' . ' "2" AS browsernav,' . ' CASE WHEN CHAR_LENGTH(alias) THEN CONCAT_WS(\':\', id, alias) ELSE id END as slug, ' . ' CONCAT_WS( " / ", ' . $searchEventList . ', catname )AS section' . ' FROM #__eventlist_categories' . ' WHERE ( ' . $where . ' )' . ' AND published = 1' . ' AND access <= ' . (int) $user->get('aid') . ' ORDER BY catname';
        $db->setQuery($query, 0, $limit);
        $list3 = $db->loadObjectList();
        foreach ((array) $list3 as $key => $row) {
            $list3[$key]->href = EventListHelperRoute::getRoute($row->slug, 'categoryevents');
        }
        $rows[] = $list3;
    }
    $count = count($rows);
    if ($count > 1) {
        switch ($count) {
            case 2:
                $results = array_merge((array) $rows[0], (array) $rows[1]);
                break;
            case 3:
                $results = array_merge((array) $rows[0], (array) $rows[1], (array) $rows[2]);
                break;
            case 4:
            default:
                $results = array_merge((array) $rows[0], (array) $rows[1], (array) $rows[2], (array) $rows[3]);
                break;
        }
        return $results;
    } else {
        if ($count == 1) {
            return $rows[0];
        }
    }
}
Example #9
0
 /**
  * Method to get the events
  *
  * @access public
  * @return array
  */
 function getList(&$params)
 {
     global $mainframe;
     $db =& JFactory::getDBO();
     $user =& JFactory::getUser();
     $user_gid = (int) $user->get('aid');
     //all upcoming events
     if ($params->get('type') == 1) {
         $where = ' WHERE a.dates > CURDATE()';
         //	$where = ' WHERE a.published = 1';
         $order = ' ORDER BY a.dates, a.times';
     }
     //archived events only
     if ($params->get('type') == 2) {
         $where = ' WHERE a.published = -1';
         $order = ' ORDER BY a.dates DESC, a.times DESC';
     }
     //currently running events only
     if ($params->get('type') == 3) {
         $where = ' WHERE a.published = 1';
         $where .= ' AND ( a.dates = CURDATE()';
         $where .= ' OR ( a.enddates >= CURDATE() AND a.dates <= CURDATE() ))';
         $order = ' ORDER BY a.dates, a.times';
     }
     //clean parameter data
     $catid = trim($params->get('catid'));
     $venid = trim($params->get('venid'));
     $state = JString::strtolower(trim($params->get('stateloc')));
     //Build category selection query statement
     if ($catid) {
         $ids = explode(',', $catid);
         JArrayHelper::toInteger($ids);
         $categories = ' AND (c.id=' . implode(' OR c.id=', $ids) . ')';
     }
     //Build venue selection query statement
     if ($venid) {
         $ids = explode(',', $venid);
         JArrayHelper::toInteger($ids);
         $venues = ' AND (l.id=' . implode(' OR l.id=', $ids) . ')';
     }
     //Build state selection query statement
     if ($state) {
         $rawstate = explode(',', $state);
         foreach ($rawstate as $val) {
             if ($val) {
                 $states[] = '"' . trim($db->getEscaped($val)) . '"';
             }
         }
         JArrayHelper::toString($states);
         $stat = ' AND (LOWER(l.state)=' . implode(' OR LOWER(l.state)=', $states) . ')';
     }
     //perform select query
     $query = 'SELECT a.title, a.dates, a.enddates, a.times, a.endtimes, a.datdescription, a.datimage, l.venue, l.state, l.locimage, l.city, l.locdescription, c.catname,' . ' CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(\':\', a.id, a.alias) ELSE a.id END as slug,' . ' CASE WHEN CHAR_LENGTH(l.alias) THEN CONCAT_WS(\':\', l.id, l.alias) ELSE l.id END as venueslug,' . ' CASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(\':\', c.id, c.alias) ELSE c.id END as categoryslug' . ' FROM #__eventlist_events AS a' . ' LEFT JOIN #__eventlist_venues AS l ON l.id = a.locid' . ' LEFT JOIN #__eventlist_categories AS c ON c.id = a.catsid' . $where . ' AND c.access <= ' . $user_gid . ($catid ? $categories : '') . ($venid ? $venues : '') . ($state ? $stat : '') . $order . ' LIMIT ' . (int) $params->get('count', '2');
     $db->setQuery($query);
     $rows = $db->loadObjectList();
     //assign datemethod value to jview
     jimport('joomla.application.component.view');
     JView::assignRef('datemethod', $params->get('datemethod', 1));
     JView::assignRef('use_modal', $params->get('use_modal', 0));
     if ($params->get('use_modal', 0)) {
         JHTML::_('behavior.modal');
     }
     //Loop through the result rows and prepare data
     $i = 0;
     $lists = array();
     foreach ($rows as $row) {
         //create thumbnails if needed and receive imagedata
         $dimage = ELImage::flyercreator($row->datimage, 'event');
         $limage = ELImage::flyercreator($row->locimage);
         //cut titel
         $length = strlen(htmlspecialchars($row->title));
         if ($length > $params->get('cuttitle', '25')) {
             $row->title = substr($row->title, 0, $params->get('cuttitle', '18'));
             $row->title = $row->title . '...';
         }
         $lists[$i]->title = htmlspecialchars($row->title, ENT_COMPAT, 'UTF-8');
         $lists[$i]->venue = htmlspecialchars($row->venue, ENT_COMPAT, 'UTF-8');
         $lists[$i]->catname = htmlspecialchars($row->catname, ENT_COMPAT, 'UTF-8');
         $lists[$i]->state = htmlspecialchars($row->state, ENT_COMPAT, 'UTF-8');
         $lists[$i]->eventlink = $params->get('linkevent', 1) ? JRoute::_(EventListHelperRoute::getRoute($row->slug)) : '';
         $lists[$i]->venuelink = $params->get('linkvenue', 1) ? JRoute::_(EventListHelperRoute::getRoute($row->venueslug, 'venueevents')) : '';
         $lists[$i]->categorylink = $params->get('linkcategory', 1) ? JRoute::_(EventListHelperRoute::getRoute($row->categoryslug, 'categoryevents')) : '';
         $lists[$i]->date = modEventListwideHelper::_format_date($row, $params);
         $lists[$i]->time = $row->times ? modEventListwideHelper::_format_time($row->dates, $row->times, $params) : '';
         $lists[$i]->eventimage = JURI::base(true) . '/' . $dimage['thumb'];
         $lists[$i]->eventimageorig = JURI::base(true) . '/' . $dimage['original'];
         $lists[$i]->venueimage = JURI::base(true) . '/' . $limage['thumb'];
         $lists[$i]->venueimageorig = JURI::base(true) . '/' . $limage['original'];
         $lists[$i]->eventdescription = strip_tags($row->datdescription);
         $lists[$i]->venuedescription = strip_tags($row->locdescription);
         $i++;
     }
     return $lists;
 }
Example #10
0
$date_where = ' AND DATEDIFF(IF (a.enddates IS NOT NULL AND a.enddates <> ' . $db->Quote('0000-00-00') . ', a.enddates, a.dates), ' . $filter_date_from . ') >= 0';
$filter_date_to = $db->Quote(strftime('%Y-%m-%d', $monthend));
$date_where .= ' AND DATEDIFF(a.dates, ' . $filter_date_to . ') <= 0';
$query = 'SELECT DATEDIFF(a.enddates, a.dates) AS datediff, a.title, a.dates, a.times, DAYOFMONTH(a.dates) AS day, YEAR(a.dates) AS year, MONTH(a.dates) AS month' . ' FROM #__eventlist_events AS a' . ' INNER JOIN #__eventlist_cats_event_relations AS rel ON rel.itemid = a.id' . ' INNER JOIN #__eventlist_categories AS c ON c.id = rel.catid' . ' WHERE a.published = 1' . $date_where . ' AND c.access <= ' . (int) $user->aid . ' GROUP BY a.id';
$db->setQuery($query);
$events = $db->loadObjectList();
$days = array();
foreach ($events as $event) {
    $day = $event->day;
    for ($counter = 0; $counter <= $event->datediff + 1; $counter++) {
        $thisday = mktime(0, 0, 0, $event->month, $day, $event->year);
        if ($thisday < $monthend) {
            if (isset($days[$day])) {
                $days[$day]['events'][] = htmlspecialchars($event->title);
            } else {
                $link = JRoute::_(EventListHelperRoute::getRoute(strftime('%Y%m%d', $thisday), 'day'));
                $days[$day] = array();
                $days[$day]['events'] = array(htmlspecialchars($event->title));
                $days[$day]['link'] = $link;
            }
            $day++;
        } else {
            break;
        }
    }
}
//Month Names
$first_of_month = gmmktime(0, 0, 0, $prev_month, 1, $year);
list($tmp, $year, $prev_month, $weekday) = explode(',', gmstrftime('%m,%Y,%b,%w', $first_of_month));
$first_of_month = gmmktime(0, 0, 0, $next_month, 1, $year);
list($tmp, $year, $next_month, $weekday) = explode(',', gmstrftime('%m,%Y,%b,%w', $first_of_month));
 function indexerGetData()
 {
     /* 
       Returns next Document to be indexed for indexer.
       Indexer will call this method unless it gets a boolean false.
     
       Every time this method is called it must return a document to be indexed
       Until no more documents are to be indexed. Then you should return a boolean false;
     */
     if (!isset($this->counter)) {
         $this->counter = 0;
     }
     $sql = sprintf($this->query, ' a.id > ' . $this->counter, 100);
     $this->db->setQuery($sql);
     $articles = $this->db->loadObjectList();
     $resultset = array('resultset' => array());
     foreach ($articles as $article) {
         $lastid = $article->id;
         $article->link = EventListHelperRoute::getRoute($article->slug);
         $resultset['resultset'][] = $article;
     }
     unset($articles);
     if ($resultset['resultset'] != null && count($resultset['resultset']) > 0) {
         $this->counter = $lastid;
         return $resultset;
     } else {
         unset($this->counter);
         return false;
     }
 }