function getCategories($id) { $query = 'SELECT DISTINCT c.id, c.catname, c.checked_out AS cchecked_out' . ' FROM #__eventlist_categories AS c' . ' LEFT JOIN #__eventlist_cats_event_relations AS rel ON rel.catid = c.id' . ' WHERE rel.itemid = ' . (int) $id; $this->_db->setQuery($query); $this->_cats = $this->_db->loadObjectList(); $k = 0; $count = count($this->_cats); for ($i = 0; $i < $count; $i++) { $item =& $this->_cats[$i]; $cats = new eventlist_cats($item->id); $item->parentcats = $cats->getParentlist(); $k = 1 - $k; } return $this->_cats; }
/** * Creates the Categoryevents View * * @since 0.9 */ function display($tpl = null) { $app =& JFactory::getApplication(); //initialize variables $document =& JFactory::getDocument(); $menu =& JSite::getMenu(); $elsettings =& ELHelper::config(); $item = $menu->getActive(); $params =& $app->getParams(); $uri =& JFactory::getURI(); $pathway =& $app->getPathWay(); //add css file $document->addStyleSheet($this->baseurl . '/components/com_eventlist/assets/css/eventlist.css'); $document->addCustomTag('<!--[if IE]><style type="text/css">.floattext{zoom:1;}, * html #eventlist dd { height: 1%; }</style><![endif]-->'); // Request variables // $limitstart = JRequest::getInt('limitstart'); // $limit = $app->getUserStateFromRequest('com_eventlist.categoryevents.limit', 'limit', $params->def('display_num', 0), 'int'); $task = JRequest::getWord('task'); $pop = JRequest::getBool('pop'); //get data from model $rows =& $this->get('Data'); $category =& $this->get('Category'); $categories =& $this->get('Childs'); //are events available? if (!$rows) { $noevents = 1; } else { $noevents = 0; } //does the category exist if ($category->id == 0) { return JError::raiseError(404, JText::sprintf('Category #%d not found', $category->id)); } //Set Meta data $document->setTitle($item->name . ' - ' . $category->catname); $document->setMetadata('keywords', $category->meta_keywords); $document->setDescription(strip_tags($category->meta_description)); //Print function $params->def('print', !$app->getCfg('hidePrint')); $params->def('icons', $app->getCfg('icons')); if ($pop) { $params->set('popup', 1); } //add alternate feed link $link = 'index.php?option=com_eventlist&view=categoryevents&format=feed&id=' . $category->id; $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); //create the pathway $cats = new eventlist_cats($category->id); $parents = $cats->getParentlist(); foreach ($parents as $parent) { $pathway->addItem($this->escape($parent->catname), JRoute::_('index.php?view=categoryevents&id=' . $parent->categoryslug)); } if ($task == 'archive') { $pathway->addItem(JText::_('ARCHIVE'), JRoute::_('index.php?option=com_eventlist&view=categoryevents&task=archive&id=' . $category->slug)); $link = JRoute::_('index.php?option=com_eventlist&view=categoryevents&task=archive&id=' . $category->slug); $print_link = JRoute::_('index.php?option=com_eventlist&view=categoryevents&id=' . $category->id . '&task=archive&pop=1&tmpl=component'); } //Check if the user has access to the form $maintainer = ELUser::ismaintainer(); $genaccess = ELUser::validate_user($elsettings->evdelrec, $elsettings->delivereventsyes); if ($maintainer || $genaccess) { $dellink = 1; } // Create the pagination object $pageNav =& $this->get('Pagination'); //Generate Categorydescription if (empty($category->catdescription)) { $catdescription = JText::_('NO DESCRIPTION'); } else { //execute plugins $category->text = $category->catdescription; $category->title = $category->catname; JPluginHelper::importPlugin('content'); $results = $app->triggerEvent('onPrepareContent', array(&$category, &$params, 0)); $catdescription = $category->text; } if ($category->image != '') { $category->image = JHTML::image('images/stories/' . $category->image, $category->catname); } //create select lists $lists = $this->_buildSortLists($elsettings); $this->assign('lists', $lists); $this->assign('action', $uri->toString()); $this->assignRef('rows', $rows); $this->assignRef('noevents', $noevents); $this->assignRef('category', $category); $this->assignRef('print_link', $print_link); $this->assignRef('params', $params); $this->assignRef('dellink', $dellink); $this->assignRef('task', $task); $this->assignRef('catdescription', $catdescription); $this->assignRef('pageNav', $pageNav); $this->assignRef('elsettings', $elsettings); $this->assignRef('item', $item); $this->assignRef('categories', $categories); if ($this->getLayout() == 'calendar') { //add css for calendar $document->addStyleSheet('components/com_eventlist/assets/css/eventlistcalendar.css'); $year = intval(JRequest::getVar('yearID', strftime("%Y"))); $month = intval(JRequest::getVar('monthID', strftime("%m"))); $day = intval(JRequest::getVar('dayID', strftime("%d"))); $this->assignRef('year', $year); $this->assignRef('month', $month); $this->assignRef('day', $day); } parent::display($tpl); }
function getCategories($id) { $user =& JFactory::getUser(); $gid = (int) $user->get('aid'); $query = 'SELECT DISTINCT c.id, c.catname, c.access, c.checked_out AS cchecked_out,' . ' CASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(\':\', c.id, c.alias) ELSE c.id END as catslug' . ' FROM #__eventlist_categories AS c' . ' LEFT JOIN #__eventlist_cats_event_relations AS rel ON rel.catid = c.id' . ' WHERE rel.itemid = ' . (int) $id . ' AND c.published = 1' . ' AND c.access <= ' . $gid; $this->_db->setQuery($query); $this->_cats = $this->_db->loadObjectList(); $k = 0; $count = count($this->_cats); for ($i = 0; $i < $count; $i++) { $item =& $this->_cats[$i]; $cats = new eventlist_cats($item->id); $item->parentcats = $cats->getParentlist(); $k = 1 - $k; } return $this->_cats; }
/** * Creates the output for the details view * * @since 0.9 */ function display($tpl = null) { $app =& JFactory::getApplication(); $document =& JFactory::getDocument(); $user =& JFactory::getUser(); $dispatcher =& JDispatcher::getInstance(); $elsettings =& ELHelper::config(); $row =& $this->get('Details'); $categories =& $this->get('Categories'); $registers =& $this->get('Registers'); $regcheck =& $this->get('Usercheck'); //get menu information $menu =& JSite::getMenu(); $item = $menu->getActive(); $params =& $app->getParams('com_eventlist'); //Check if the id exists if ($row->did == 0) { return JError::raiseError(404, JText::sprintf('Event #%d not found', $row->did)); } //Check if user has access to the details if ($elsettings->showdetails == 0) { return JError::raiseError(403, JText::_('NO ACCESS')); } $cid = JRequest::getInt('cid', 0); //add css file $document->addStyleSheet($this->baseurl . '/components/com_eventlist/assets/css/eventlist.css'); $document->addCustomTag('<!--[if IE]><style type="text/css">.floattext{zoom:1;}, * html #eventlist dd { height: 1%; }</style><![endif]-->'); //Print $pop = JRequest::getBool('pop'); $params->def('page_title', JText::_('DETAILS')); if ($pop) { $params->set('popup', 1); } $print_link = JRoute::_('index.php?view=details&cid=' . $cid . '&id=' . $row->slug . '&pop=1&tmpl=component'); //pathway $cats = new eventlist_cats($cid); $parents = $cats->getParentlist(); $pathway =& $app->getPathWay(); $pathway->setItemName(1, $item->name); foreach ($parents as $parent) { $pathway->addItem($this->escape($parent->catname), JRoute::_('index.php?view=categoryevents&id=' . $parent->categoryslug)); } $pathway->addItem($this->escape($row->title), JRoute::_('index.php?view=details&cid=' . $cid . '&id=' . $row->slug)); //Get images $dimage = ELImage::flyercreator($row->datimage, 'event'); $limage = ELImage::flyercreator($row->locimage); //Check user if he can edit $allowedtoeditevent = ELUser::editaccess($elsettings->eventowner, $row->created_by, $elsettings->eventeditrec, $elsettings->eventedit); $allowedtoeditvenue = ELUser::editaccess($elsettings->venueowner, $row->venueowner, $elsettings->venueeditrec, $elsettings->venueedit); //Timecheck for registration $jetzt = date("Y-m-d"); $now = strtotime($jetzt); $date = strtotime($row->dates); $timecheck = $now - $date; //let's build the registration handling $formhandler = 0; //is the user allready registered at the event if ($regcheck) { $formhandler = 3; } else { //no, he isn't $formhandler = 4; } //check if it is too late to register and overwrite $formhandler if ($timecheck > 0) { $formhandler = 1; } //is the user registered at joomla and overwrite $formhandler if not if (!$user->get('id')) { $formhandler = 2; } if ($formhandler >= 3) { $js = "function check(checkbox, senden) {\n\t\t\t\tif(checkbox.checked==true){\n\t\t\t\t\tsenden.disabled = false;\n\t\t\t\t} else {\n\t\t\t\t\tsenden.disabled = true;\n\t\t\t\t}}"; $document->addScriptDeclaration($js); } //Generate Eventdescription if (!$row->datdescription == '' || !$row->datdescription == '<br />') { //Execute Plugins $row->text = $row->datdescription; JPluginHelper::importPlugin('content'); $results = $dispatcher->trigger('onPrepareContent', array(&$row, &$params, 0)); $row->datdescription = $row->text; } //Generate Venuedescription if (!$row->locdescription == '' || !$row->locdescription == '<br />') { //execute plugins $row->text = $row->locdescription; JPluginHelper::importPlugin('content'); $results = $dispatcher->trigger('onPrepareContent', array(&$row, &$params, 0)); $row->locdescription = $row->text; } // generate Metatags $meta_keywords_content = ""; if (!empty($row->meta_keywords)) { $keywords = explode(",", $row->meta_keywords); foreach ($keywords as $keyword) { if ($meta_keywords_content != "") { $meta_keywords_content .= ", "; } if (preg_match("/[\\/[\\/]/", $keyword)) { $keyword = trim(str_replace("[", "", str_replace("]", "", $keyword))); $buffer = $this->keyword_switcher($keyword, $row, $categories, $elsettings->formattime, $elsettings->formatdate); if ($buffer != "") { $meta_keywords_content .= $buffer; } else { $meta_keywords_content = substr($meta_keywords_content, 0, strlen($meta_keywords_content) - 2); // remove the comma and the white space } } else { $meta_keywords_content .= $keyword; } } } if (!empty($row->meta_description)) { $description = explode("[", $row->meta_description); $description_content = ""; foreach ($description as $desc) { $keyword = substr($desc, 0, strpos($desc, "]", 0)); if ($keyword != "") { $description_content .= $this->keyword_switcher($keyword, $row, $categories, $elsettings->formattime, $elsettings->formatdate); $description_content .= substr($desc, strpos($desc, "]", 0) + 1); } else { $description_content .= $desc; } } } else { $description_content = ""; } //set page title and meta stuff $document->setTitle($row->title); $document->setMetadata('keywords', $meta_keywords_content); $document->setDescription(strip_tags($description_content)); //build the url if (!empty($row->url) && strtolower(substr($row->url, 0, 7)) != "http://") { $row->url = 'http://' . $row->url; } //create flag if ($row->country) { $row->countryimg = ELOutput::getFlag($row->country); } // load dispatcher for plugins JPluginHelper::importPlugin('eventlist'); $row->pluginevent = new stdClass(); $results = $dispatcher->trigger('onEventDetailsEnd', array($row->did, $this->escape($row->title))); $row->pluginevent->onEventDetailsEnd = trim(implode("\n", $results)); //assign vars to jview $this->assignRef('row', $row); $this->assignRef('categories', $categories); $this->assignRef('params', $params); $this->assignRef('allowedtoeditevent', $allowedtoeditevent); $this->assignRef('allowedtoeditvenue', $allowedtoeditvenue); $this->assignRef('dimage', $dimage); $this->assignRef('limage', $limage); $this->assignRef('print_link', $print_link); $this->assignRef('registers', $registers); $this->assignRef('formhandler', $formhandler); $this->assignRef('elsettings', $elsettings); $this->assignRef('item', $item); $this->assignRef('user', $user); $this->assignRef('dispatcher', $dispatcher); parent::display($tpl); }