* babioon event * @package BABIOON_EVENT * @author Robert Deutz <*****@*****.**> * @copyright 2012 Robert Deutz Business Solution * @license GNU General Public License version 2 or later **/ // No direct access defined('_JEXEC') or die; JHtml::_('behavior.framework'); $displayData = new stdClass(); $form = $this->form; $params = JComponentHelper::getParams('com_babioonevent'); $keys = array_keys($form->getFieldset()); $showlocation = $params->get('showlocation', 2); $headerlevel = $params->get('headerlevel', 1); $Itemid = BabioonEventRouteHelper::getItemid('export'); $errors = $this->getModel()->getErrors(); $error = !empty($errors); if ($form->getValue('sdate') == '0000-00-00') { $form->setValue('sdate', ''); } if ($form->getValue('edate') == '0000-00-00') { $form->setValue('edate', ''); } $title = JLayoutHelper::render('html.title', $displayData, JPATH_ROOT . '/media/babioon/event/layouts'); ?> <!-- ************************** START: babioonevent ************************** --> <div class="babioonevent"> <?php if ($error) {
/** * get the event items * * @param JRegistry $params parameter object * * @return array */ public function getItems($params) { $eventcats = $params->get('eventcats', array()); $eventcount = $params->get('eventcount', 5); $order = $params->get('order', 1); $Itemid = BabioonEventRouteHelper::getItemid('events'); $db = JFactory::getDBO(); $user = JFactory::getUser(); $now = gmdate("Y-m-d"); $query = $db->getQuery(true); $query->select('MONTHNAME(e.sdate) AS mon')->select('YEAR(e.sdate) AS year')->select('e.*')->select('cc.title AS cctitle')->from('#__babioonevent_events AS e')->from('#__categories AS cc')->where('(e.sdate >= "' . $now . '" OR e.edate >= "' . $now . '")')->where('e.catid = cc.id')->where('e.enabled = 1')->where('cc.published = 1')->order('e.sdate, cc.title'); if (!empty($eventcats) && trim($eventcats[0]) != "") { $catfilter = 'catid in (' . implode(',', $eventcats) . ') '; $query->where($catfilter); } // Implement View Level Access if (!$user->authorise('core.admin')) { $groups = implode(',', $user->getAuthorisedViewLevels()); $query->where('cc.access IN (' . $groups . ')'); } $db->setQuery($query, 0, $eventcount); $c = $db->loadObjectList(); $ccount = count($c); $link = 'index.php?option=com_babioonevent&view=event' . '&Itemid=' . $Itemid . '&id='; $categorylist = array(); $nr = array(); for ($i = 0; $i < $ccount; $i++) { $obj = new stdClass(); $crow = $c[$i]; $obj = $crow; $obj->link = $link . $crow->babioonevent_event_id; $nr[] = $obj; $categorylist[$obj->catid] = $obj->cctitle; } if ($order == 2) { $result = array(); if (!empty($eventcats)) { foreach (explode(',', $eventcats) as $elm) { foreach ($nr as $r) { if ($elm == $r->catid) { $result[] = $r; } } } } else { if (asort($categorylist, SORT_LOCALE_STRING) === true) { foreach ($categorylist as $key => $value) { foreach ($nr as $r) { if ($key == $r->catid) { $result[] = $r; } } } } else { $result = $nr; } } } else { $result = $nr; } return $result; }
/** * onAfterSave redirects after save to the thank you page * * @return mixed true on sucess, exeception if something goes wrong */ protected function onAfterSave() { $model = $this->getThisModel(); $model->resetSavedState(); $Itemid = BabioonEventRouteHelper::getItemid('event'); $this->setRedirect('index.php?option=com_babioonevent&view=thankyou&Itemid=' . $Itemid); return true; }
/** * babioon event * @package BABIOON_EVENT * @author Robert Deutz <*****@*****.**> * @copyright 2012 Robert Deutz Business Solution * @license GNU General Public License version 2 or later **/ // No direct access defined('_JEXEC') or die; JHtml::_('behavior.framework'); $displayData = new stdClass(); $params = JComponentHelper::getParams('com_babioonevent'); $headerlevel = $params->get('headerlevel', 1); $slevel = $headerlevel + 1; $Itemid = BabioonEventRouteHelper::getItemid('events'); $title = JLayoutHelper::render('html.title', $displayData, JPATH_ROOT . '/media/babioon/event/layouts'); $month = ''; $close = ''; ?> <!-- ************************** START: babioonevent ************************** --> <div class="babioonevent"> <h<?php echo $headerlevel; ?> > <?php echo $title; ?> </h<?php
/** * Method to get a list of items. * * @param boolean $overrideLimits Should I override set limits? * @param string $group The group by clause * * @return array */ public function &getItemList($overrideLimits = false, $group = '') { $this->setState('limitstart', $this->input->get('limitstart', 0, 'UINT')); $items = parent::getItemList($overrideLimits, $group); if (FOFPlatform::getInstance()->isFrontend()) { $Itemid = BabioonEventRouteHelper::getItemid(); $link = 'index.php?option=com_babioonevent&view=event&layout=item&Itemid=' . $Itemid . '&id='; for ($i = 0, $ccount = count($items); $i < $ccount; $i++) { $items[$i]->link = $link . $items[$i]->babioonevent_event_id; } } return $items; }
* babioon event * @package BABIOON_EVENT * @author Robert Deutz <*****@*****.**> * @copyright 2012 Robert Deutz Business Solution * @license GNU General Public License version 2 or later **/ // No direct access defined('_JEXEC') or die; JHtml::_('behavior.framework'); $displayData = new stdClass(); $form = $this->form; $params = JComponentHelper::getParams('com_babioonevent'); $keys = array_keys($form->getFieldset()); $showlocation = $params->get('showlocation', 2); $headerlevel = $params->get('headerlevel', 1); $Itemid = BabioonEventRouteHelper::getItemid('search'); $errors = $this->getModel()->getErrors(); if ($form->getValue('sdate') == '0000-00-00') { $form->setValue('sdate', ''); } if ($form->getValue('edate') == '0000-00-00') { $form->setValue('edate', ''); } $title = JLayoutHelper::render('html.title', $displayData, JPATH_ROOT . '/media/babioon/event/layouts'); ?> <!-- ************************** START: babioonevent ************************** --> <div class="babioonevent"> <h<?php echo $headerlevel; ?>
/** * Event 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 $text Target search string * @param string $phrase matching option, exact|any|all * @param string $ordering ordering option, newest|oldest|popular|alpha|category * @param mixed $areas An array if the search it to be restricted to areas, null if search all * * @return array searchresults */ function onContentSearch($text, $phrase = '', $ordering = '', $areas = null) { if ($this->eventRouterLoaded == false) { return array(); } $db = JFactory::getDBO(); $user = JFactory::getUser(); $searchText = $text; $searchin = array(); if (is_array($areas)) { if (!array_intersect($areas, array_keys($this->onContentSearchAreas()))) { return array(); } } $limit = $this->params->def('search_limit', 50); $text = trim($text); if ($text == '') { return array(); } switch ($ordering) { case 'alpha': $order = 'a.name ASC'; break; case 'newest': $order = 'a.sdate DESC'; break; case 'category': case 'popular': case 'oldest': default: $order = 'a.sdate ASC'; } $today = gmdate("Y-m-d"); // Serach in $tags = array('name', 'organiser', 'teaser', 'text', 'contact', 'street', 'city', 'pcode', 'ainfo'); $wheres = array(); switch ($phrase) { case 'exact': $text = $db->Quote('%' . $db->getEscaped($text, true) . '%', false); $wheres2 = array(); for ($i = 0; $i < count($tags); $i++) { $t = $tags[$i]; if ($this->params->def('searchin' . $t, 1) == 1) { $wheres2[] = 'a.' . $t . ' LIKE ' . $text; $searchin[] = $t; } } $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(); for ($i = 0; $i < count($tags); $i++) { $t = $tags[$i]; if ($this->params->def('searchin' . $t, 1) == 1) { $wheres2[] = 'a.' . $t . ' LIKE ' . $word; $searchin[] = $t; } } $wheres[] = implode(' OR ', $wheres2); } $where = '(' . implode($phrase == 'all' ? ') AND (' : ') OR (', $wheres) . ')'; break; } $query = $db->getQuery(true); $query->select('a.babioonevent_event_id AS id')->select('a.name AS title')->select('CONCAT(a.teaser,a.text) AS text')->select('a.created AS created')->select('"2" AS browsernav')->select('c.title as section')->select('a.organiser')->select('a.contact')->select('a.name')->from('#__babioonevent_events as a')->join('LEFT', '#__categories AS c ON a.catid = c.id')->where($where)->where('a.sdate >= "' . $today . '"')->where('a.enabled = 1')->where('c.published = 1')->group('a.babioonevent_event_id')->order($order); $db->setQuery($query, 0, $limit); $rows = $db->loadObjectList(); $return = array(); if (!empty($rows)) { // Get an itemid $Itemid = BabioonEventRouteHelper::getItemid('events'); $link = 'index.php?option=com_babioonevent&view=event&layout=item&Itemid=' . $Itemid . '&id='; $count = count($rows); for ($i = 0; $i < $count; $i++) { $event = $rows[$i]; $event->href = $link . $event->id; if (searchHelper::checkNoHTML($event, $searchText, $searchin)) { $return[] = $event; } } } return $return; }