Ejemplo n.º 1
0
 function display($tpl = null)
 {
     $app =& JFactory::getApplication();
     $document =& JFactory::getDocument();
     $elsettings =& ELHelper::config();
     $rows =& $this->get('Data');
     $total =& $this->get('Total');
     $pageNav =& $this->get('Pagination');
     //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]-->');
     //get menu information
     $menu =& JSite::getMenu();
     $item = $menu->getActive();
     $params =& $app->getParams('com_eventlist');
     // Request variables
     $limitstart = JRequest::getInt('limitstart');
     $limit = JRequest::getInt('limit', $params->get('cat_num'));
     $task = JRequest::getWord('task');
     $params->def('page_title', $item->name);
     //pathway
     $pathway =& $app->getPathWay();
     $pathway->setItemName(1, $item->name);
     if ($task == 'archive') {
         $pathway->addItem(JText::_('ARCHIVE'), JRoute::_('index.php?view=categories&task=archive'));
         $pagetitle = $params->get('page_title') . ' - ' . JText::_('ARCHIVE');
     } else {
         $pagetitle = $params->get('page_title');
     }
     //Set Page title
     $app->setPageTitle($pagetitle);
     $app->addMetaTag('title', $pagetitle);
     //get icon settings
     $params->def('icons', $app->getCfg('icons'));
     //add alternate feed link
     $link = 'index.php?option=com_eventlist&view=eventlist&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);
     //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
     jimport('joomla.html.pagination');
     $pageNav = new JPagination($total, $limitstart, $limit);
     $this->assignRef('rows', $rows);
     $this->assignRef('task', $task);
     $this->assignRef('params', $params);
     $this->assignRef('dellink', $dellink);
     $this->assignRef('pageNav', $pageNav);
     $this->assignRef('item', $item);
     $this->assignRef('elsettings', $elsettings);
     $this->assignRef('pagetitle', $pagetitle);
     parent::display($tpl);
 }
Ejemplo n.º 2
0
 /**
  * Method to store the venue
  *
  * @access	public
  * @return	id
  * @since	0.9
  */
 function store($data, $file)
 {
     $app =& JFactory::getApplication();
     $user =& JFactory::getUser();
     $elsettings =& ELHelper::config();
     $tzoffset = $app->getCfg('offset');
     $row =& JTable::getInstance('eventlist_venues', '');
     //bind it to the table
     if (!$row->bind($data)) {
         JError::raiseError(500, $this->_db->stderr());
         return false;
     }
     //Are we saving from an item edit?
     if ($row->id) {
         //check if user is allowed to edit venues
         $allowedtoeditvenue = ELUser::editaccess($elsettings->venueowner, $row->created_by, $elsettings->venueeditrec, $elsettings->venueedit);
         if ($allowedtoeditvenue == 0) {
             $row->checkin();
             $app->enqueueMessage(JText::_('NO ACCESS'));
             return false;
         }
         $row->modified = gmdate('Y-m-d H:i:s');
         $row->modified_by = $user->get('id');
         //Is editor the owner of the venue
         //This extra Check is needed to make it possible
         //that the venue is published after an edit from an owner
         if ($elsettings->venueowner == 1 && $row->created_by == $user->get('id')) {
             $owneredit = 1;
         } else {
             $owneredit = 0;
         }
     } else {
         //check if user is allowed to submit new venues
         $delloclink = ELUser::validate_user($elsettings->locdelrec, $elsettings->deliverlocsyes);
         if ($delloclink == 0) {
             $app->enqueueMessage(JText::_('NO ACCESS'));
             return false;
         }
         //get IP, time and userid
         $row->created = gmdate('Y-m-d H:i:s');
         $row->author_ip = $elsettings->storeip ? getenv('REMOTE_ADDR') : 'DISABLED';
         $row->created_by = $user->get('id');
         //set owneredit to false
         $owneredit = 0;
     }
     //Image upload
     //If image upload is required we will stop here if no file was attached
     if (empty($file['name']) && $elsettings->imageenabled == 2) {
         $this->setError(JText::_('IMAGE EMPTY'));
         return false;
     }
     if (($elsettings->imageenabled == 2 || $elsettings->imageenabled == 1) && !empty($file['name'])) {
         jimport('joomla.filesystem.file');
         $base_Dir = JPATH_SITE . '/images/eventlist/venues/';
         //check the image
         $check = ELImage::check($file, $elsettings);
         if ($check === false) {
             $app->redirect($_SERVER['HTTP_REFERER']);
         }
         //sanitize the image filename
         $filename = ELImage::sanitize($base_Dir, $file['name']);
         $filepath = $base_Dir . $filename;
         if (!JFile::upload($file['tmp_name'], $filepath)) {
             $this->setError(JText::_('UPLOAD FAILED'));
             return false;
         } else {
             $row->locimage = $filename;
         }
     } else {
         //keep image if edited and left blank
         $row->locimage = $row->curimage;
     }
     //end image upload if
     //Check description
     $editoruser = ELUser::editoruser();
     if (!$editoruser) {
         //check description --> wipe out code
         $row->locdescription = strip_tags($row->locdescription, '<br><br/>');
         //convert the linux \n (Mac \r, Win \r\n) to <br /> linebreaks
         $row->locdescription = str_replace(array("\r\n", "\r", "\n"), "<br />", $row->locdescription);
         //cut too long words
         $row->locdescription = wordwrap($row->locdescription, 75, " ", 1);
         //check length
         $length = JString::strlen($row->locdescription);
         if ($length > $elsettings->datdesclimit) {
             // if required shorten it
             $row->locdescription = JString::substr($row->locdescription, 0, $elsettings->datdesclimit);
             //if shortened add ...
             $row->locdescription = $row->locdescription . '...';
         }
     }
     //Autopublish
     //check if the user has the required rank for autopublish
     $autopublloc = ELUser::validate_user($elsettings->locpubrec, $elsettings->autopublocate);
     //Check if user is the owner of the venue
     //If yes enable autopublish
     if ($autopublloc || $owneredit) {
         $row->published = 1;
     } else {
         $row->published = 0;
     }
     $row->version++;
     //Make sure the data is valid
     if (!$row->check($elsettings)) {
         $this->setError($row->getError());
         return false;
     }
     //store it in the db
     if (!$row->store()) {
         $this->setError($this->_db->getErrorMsg());
         return false;
     }
     //update item order
     $row->reorder();
     return $row->id;
 }
Ejemplo n.º 3
0
 /**
  * Creates the Categoryevents View
  *
  * @since 0.9
  */
 function display($tpl = null)
 {
     $mainframe =& JFactory::getApplication();
     $option = JRequest::getCmd('option');
     //initialize variables
     $document =& JFactory::getDocument();
     $menu =& JSite::getMenu();
     $elsettings =& redEVENTHelper::config();
     $item = $menu->getActive();
     $params =& $mainframe->getParams();
     $uri =& JFactory::getURI();
     $pathway =& $mainframe->getPathWay();
     if (!$this->getLayout()) {
         $this->setLayout($params->get('default_list_layout'));
     }
     /* Check if the item is an object */
     if (!is_object($item)) {
         $item = new StdClass();
         $item->title = '';
     }
     //add css file
     if (!$params->get('custom_css')) {
         $document->addStyleSheet($this->baseurl . '/components/com_redevent/assets/css/redevent.css');
     } else {
         $document->addStyleSheet($params->get('custom_css'));
     }
     $document->addCustomTag('<!--[if IE]><style type="text/css">.floattext{zoom:1;}, * html #eventlist dd { height: 1%; }</style><![endif]-->');
     // add js
     JHTML::_('behavior.mootools');
     // for filter hint
     $document->addScript($this->baseurl . '/components/com_redevent/assets/js/eventslist.js');
     // Request variables
     $limitstart = JRequest::getInt('limitstart');
     $limit = $mainframe->getUserStateFromRequest('com_redevent.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');
     $customs =& $this->get('ListCustomFields');
     $customsfilters =& $this->get('CustomFilters');
     $category =& $this->get('Category');
     $total =& $this->get('Total');
     //are events available?
     if (!$rows) {
         $noevents = 1;
     } else {
         $noevents = 0;
     }
     //does the category exist
     if ($category->id == 0) {
         return JError::raiseError(404, JText::sprintf('COM_REDEVENT_Category_d_not_found', $category->id));
     }
     //Set Meta data
     if (!$item->title) {
         $document->setTitle($category->catname);
     } else {
         $document->setTitle($item->title . ' - ' . $category->catname);
     }
     $document->setMetadata('keywords', $category->meta_keywords);
     $document->setDescription(strip_tags($category->meta_description));
     //Print function
     $params->def('print', !$mainframe->getCfg('hidePrint'));
     $params->def('icons', $mainframe->getCfg('icons'));
     if ($pop) {
         $params->set('popup', 1);
     }
     //add alternate feed link
     $link = RedeventHelperRoute::getCategoryEventsRoute($category->slug) . '&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);
     if ($task == 'archive') {
         $link = RedeventHelperRoute::getCategoryEventsRoute($category->slug, 'archive');
         $pathway->addItem(JText::_('COM_REDEVENT_ARCHIVE') . ' - ' . $category->catname, JRoute::_($link));
         $print_link = JRoute::_($link . '&pop=1&tmpl=component');
     } else {
         $link = RedeventHelperRoute::getCategoryEventsRoute($category->slug);
         $pathway->addItem($category->catname, JRoute::_($link));
         $print_link = JRoute::_($link . '&pop=1&tmpl=component');
     }
     $thumb_link = RedeventHelperRoute::getCategoryEventsRoute($category->slug, null, 'thumb');
     $list_link = RedeventHelperRoute::getCategoryEventsRoute($category->slug, null, 'default');
     //Check if the user has access to the form
     $maintainer = ELUser::ismaintainer();
     $genaccess = ELUser::validate_user($elsettings->get('evdelrec'), $elsettings->get('delivereventsyes'));
     if ($maintainer || $genaccess) {
         $dellink = 1;
     }
     // Create the pagination object
     jimport('joomla.html.pagination');
     $pageNav = new JPagination($total, $limitstart, $limit);
     //Generate Categorydescription
     if (empty($category->catdescription)) {
         $catdescription = JText::_('COM_REDEVENT_NO_DESCRIPTION');
     } else {
         //execute plugins
         $catdescription = JHTML::_('content.prepare', $category->catdescription);
     }
     //create select lists
     $lists = $this->_buildSortLists($elsettings);
     $state =& $this->get('state');
     $filter_customs = $state->get('filter_customs');
     $this->assign('lists', $lists);
     $this->assign('action', JRoute::_('index.php?option=com_redevent&view=categoryevents&id=' . $category->id));
     $this->assignRef('rows', $rows);
     $this->assignRef('customs', $customs);
     $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('config', $elsettings);
     $this->assignRef('thumb_link', $thumb_link);
     $this->assignRef('list_link', $list_link);
     $this->assignRef('customsfilters', $customsfilters);
     $this->assign('filter_customs', $filter_customs);
     $cols = explode(',', $params->get('lists_columns', 'date, title, venue, city, category'));
     $cols = redEVENTHelper::validateColumns($cols);
     $this->assign('columns', $cols);
     parent::display($tpl);
 }
Ejemplo n.º 4
0
 /**
  * Creates the Day View
  *
  * @since 0.9
  */
 function display($tpl = null)
 {
     $mainframe =& JFactory::getApplication();
     //initialize variables
     $document =& JFactory::getDocument();
     $elsettings =& redEVENTHelper::config();
     $menu =& JSite::getMenu();
     $item = $menu->getActive();
     $params =& $mainframe->getParams();
     $uri =& JFactory::getURI();
     //add css file
     if (!$params->get('custom_css')) {
         $document->addStyleSheet($this->baseurl . '/components/com_redevent/assets/css/redevent.css');
     } else {
         $document->addStyleSheet($params->get('custom_css'));
     }
     $document->addCustomTag('<!--[if IE]><style type="text/css">.floattext{zoom:1;}, * html #eventlist dd { height: 1%; }</style><![endif]-->');
     // add js
     JHTML::_('behavior.mootools');
     // for filter hint
     $document->addScript($this->baseurl . '/components/com_redevent/assets/js/eventslist.js');
     // get variables
     $limitstart = JRequest::getVar('limitstart', 0, '', 'int');
     $limit = JRequest::getVar('limit', $params->get('display_num'), '', 'int');
     $pop = JRequest::getBool('pop');
     $pathway =& $mainframe->getPathWay();
     //get data from model
     $rows =& $this->get('Data');
     $customs =& $this->get('ListCustomFields');
     $total =& $this->get('Total');
     $day =& $this->get('Day');
     $daydate = strftime($elsettings->get('formatdate', '%d.%m.%Y'), strtotime($day));
     //are events available?
     if (!$rows) {
         $noevents = 1;
     } else {
         $noevents = 0;
     }
     //params
     if ($item) {
         $params->def('page_title', $item->title);
     }
     if ($pop) {
         //If printpopup set true
         $params->set('popup', 1);
     }
     $print_link = JRoute::_('index.php?view=day&tmpl=component&pop=1');
     //pathway
     $pathway->addItem($daydate, '');
     //Set Page title
     if ($item && !$item->title) {
         $document->setTitle($params->get('page_title'));
         $document->setMetadata('keywords', $params->get('page_title'));
     }
     //Check if the user has access to the form
     $maintainer = ELUser::ismaintainer();
     $genaccess = ELUser::validate_user($elsettings->get('evdelrec'), $elsettings->get('delivereventsyes'));
     if ($maintainer || $genaccess) {
         $dellink = 1;
     }
     //add alternate feed link
     $link = 'index.php?option=com_redevent&view=simplelist&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);
     // Create the pagination object
     $page = $total - $limit;
     jimport('joomla.html.pagination');
     $pageNav = new JPagination($total, $limitstart, $limit);
     //create select lists
     $lists = $this->_buildSortLists();
     $this->assign('lists', $lists);
     $this->assignRef('rows', $rows);
     $this->assignRef('customs', $customs);
     $this->assignRef('noevents', $noevents);
     $this->assignRef('print_link', $print_link);
     $this->assignRef('params', $params);
     $this->assignRef('dellink', $dellink);
     $this->assignRef('pageNav', $pageNav);
     $this->assignRef('page', $page);
     $this->assignRef('elsettings', $elsettings);
     $this->assignRef('lists', $lists);
     $this->assignRef('daydate', $daydate);
     $this->assign('action', JRoute::_(RedeventHelperRoute::getDayRoute(JRequest::getInt('id'))));
     $cols = explode(',', $params->get('lists_columns', 'date, title, venue, city, category'));
     $cols = redEVENTHelper::validateColumns($cols);
     $this->assign('columns', $cols);
     parent::display($tpl);
 }
Ejemplo n.º 5
0
 /**
  * Creates the Day View
  *
  * @since 0.9
  */
 function display($tpl = null)
 {
     $app =& JFactory::getApplication();
     //initialize variables
     $document =& JFactory::getDocument();
     $elsettings =& ELHelper::config();
     $menu =& JSite::getMenu();
     $item = $menu->getActive();
     $params =& $app->getParams();
     //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]-->');
     // get variables
     $limitstart = JRequest::getVar('limitstart', 0, '', 'int');
     $limit = JRequest::getVar('limit', $params->get('display_num'), '', 'int');
     $pop = JRequest::getBool('pop');
     $pathway =& $app->getPathWay();
     //get data from model
     $rows =& $this->get('Data');
     $total =& $this->get('Total');
     $day =& $this->get('Day');
     $daydate = strftime($elsettings->formatdate, strtotime($day));
     //are events available?
     if (!$rows) {
         $noevents = 1;
     } else {
         $noevents = 0;
     }
     //params
     $params->def('page_title', $item->name);
     if ($pop) {
         //If printpopup set true
         $params->set('popup', 1);
     }
     $print_link = JRoute::_('index.php?view=day&tmpl=component&pop=1');
     //pathway
     $pathway->setItemName(1, $item->name);
     //Set Page title
     if (!$item->name) {
         $document->setTitle($params->get('page_title'));
         $document->setMetadata('keywords', $params->get('page_title'));
     }
     //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;
     }
     //add alternate feed link
     $link = 'index.php?option=com_eventlist&view=day&format=feed&id=' . date('Ymd', strtotime($this->get('Day')));
     $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 pagination object
     $page = $total - $limit;
     jimport('joomla.html.pagination');
     $pageNav = new JPagination($total, $limitstart, $limit);
     //create select lists
     $lists = $this->_buildSortLists();
     $this->assign('lists', $lists);
     $this->assignRef('rows', $rows);
     $this->assignRef('noevents', $noevents);
     $this->assignRef('print_link', $print_link);
     $this->assignRef('params', $params);
     $this->assignRef('dellink', $dellink);
     $this->assignRef('pageNav', $pageNav);
     $this->assignRef('page', $page);
     $this->assignRef('elsettings', $elsettings);
     $this->assignRef('lists', $lists);
     $this->assignRef('daydate', $daydate);
     parent::display($tpl);
 }
Ejemplo n.º 6
0
 /**
  * Checks if the user is allowed to edit an item
  *
  * @author Christoph Lukes
  * @since 0.9
  *
  * @param int $allowowner
  * @param int $ownerid
  * @param int $recurse
  * @param int $level
  * @return boolean True on success
  */
 function editaccess($allowowner, $ownerid, $recurse, $level)
 {
     $user =& JFactory::getUser();
     $generalaccess = ELUser::validate_user($recurse, $level);
     if ($allowowner == 1 && ($user->get('id') == $ownerid && $ownerid != 0)) {
         return true;
     } elseif ($generalaccess == 1) {
         return true;
     }
     return false;
 }
Ejemplo n.º 7
0
 /**
  * Creates the Simple List View
  *
  * @since 0.9
  */
 function display($tpl = null)
 {
     $mainframe =& JFactory::getApplication();
     //initialize variables
     $document =& JFactory::getDocument();
     $elsettings =& redEVENTHelper::config();
     $menu =& JSite::getMenu();
     $item = $menu->getActive();
     $params =& $mainframe->getParams();
     $uri =& JFactory::getURI();
     $pathway =& $mainframe->getPathWay();
     $state =& $this->get('state');
     //add css file
     if (!$params->get('custom_css')) {
         $document->addStyleSheet($this->baseurl . '/components/com_redevent/assets/css/redevent.css');
     } else {
         $document->addStyleSheet($params->get('custom_css'));
     }
     $document->addCustomTag('<!--[if IE]><style type="text/css">.floattext{zoom:1;}, * html #eventlist dd { height: 1%; }</style><![endif]-->');
     // add js
     JHTML::_('behavior.mootools');
     // for filter hint
     $document->addScript($this->baseurl . '/components/com_redevent/assets/js/eventslist.js');
     // get variables
     $task = JRequest::getWord('task');
     $pop = JRequest::getBool('pop');
     //get data from model
     $rows =& $this->get('Data');
     $customs =& $this->get('ListCustomFields');
     $customsfilters =& $this->get('CustomFilters');
     $pagination =& $this->get('Pagination');
     //are events available?
     if (!$rows) {
         $noevents = 1;
     } else {
         $noevents = 0;
     }
     //params
     $params->def('page_title', isset($item->title) ? $item->title : JText::_('COM_REDEVENT_Events'));
     if ($pop) {
         //If printpopup set true
         $params->set('popup', 1);
         $This->setLayout('print');
     }
     $print_link = JRoute::_('index.php?option=com_redevent&view=simplelist&tmpl=component&pop=1');
     $pagetitle = $params->get('page_title');
     $thumb_link = RedeventHelperRoute::getSimpleListRoute(null, 'thumb');
     $list_link = RedeventHelperRoute::getSimpleListRoute(null, 'default');
     //Set Page title
     $this->document->setTitle($pagetitle);
     //Check if the user has access to the form
     $maintainer = ELUser::ismaintainer();
     $genaccess = ELUser::validate_user($elsettings->get('evdelrec'), $elsettings->get('delivereventsyes'));
     if ($maintainer || $genaccess) {
         $dellink = 1;
     }
     //add alternate feed link
     $link = 'index.php?option=com_redevent&view=simplelist&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);
     //create select lists
     $lists = $this->_buildSortLists();
     $filter_customs = $state->get('filter_customs');
     $this->assign('lists', $lists);
     $this->assignRef('rows', $rows);
     $this->assignRef('customs', $customs);
     $this->assignRef('customsfilters', $customsfilters);
     $this->assignRef('task', $task);
     $this->assignRef('noevents', $noevents);
     $this->assignRef('print_link', $print_link);
     $this->assignRef('params', $params);
     $this->assignRef('dellink', $dellink);
     $this->assignRef('pageNav', $pagination);
     $this->assignRef('elsettings', $elsettings);
     $this->assignRef('pagetitle', $pagetitle);
     $this->assignRef('config', $elsettings);
     $this->assignRef('thumb_link', $thumb_link);
     $this->assignRef('list_link', $list_link);
     $this->assign('filter_customs', $filter_customs);
     $cols = explode(',', $params->get('lists_columns', 'date, title, venue, city, category'));
     $cols = redEVENTHelper::validateColumns($cols);
     $this->assign('columns', $cols);
     parent::display($tpl);
 }
Ejemplo n.º 8
0
 /**
  * Method to store the venue
  *
  * @access	public
  * @return	id
  * @since	0.9
  */
 function store($data, $file)
 {
     global $mainframe;
     jimport('joomla.utilities.date');
     $user =& JFactory::getUser();
     $elsettings = ELHelper::config();
     //Get mailinformation
     $SiteName = $mainframe->getCfg('sitename');
     $MailFrom = $mainframe->getCfg('mailfrom');
     $FromName = $mainframe->getCfg('fromname');
     $tzoffset = $mainframe->getCfg('offset');
     $row =& JTable::getInstance('eventlist_venues', '');
     //bind it to the table
     if (!$row->bind($data)) {
         JError::raiseError(500, $this->_db->stderr());
         return false;
     }
     //Are we saving from an item edit?
     if ($row->id) {
         $owner = ELUser::isOwner($row->id, 'venues');
         //check if user is allowed to edit venues
         $allowedtoeditvenue = ELUser::editaccess($elsettings->venueowner, $owner, $elsettings->venueeditrec, $elsettings->venueedit);
         if ($allowedtoeditvenue == 0) {
             $row->checkin();
             $mainframe->enqueueMessage(JText::_('NO ACCESS'));
             return false;
         }
         $date = new JDate($row->modified, $tzoffset);
         $row->modified = $date->toMySQL();
         $row->modified_by = $user->get('id');
         //Is editor the owner of the venue
         //This extra Check is needed to make it possible
         //that the venue is published after an edit from an owner
         if ($elsettings->venueowner == 1 && $owner == $user->get('id')) {
             $owneredit = 1;
         } else {
             $owneredit = 0;
         }
     } else {
         //check if user is allowed to submit new venues
         $delloclink = ELUser::validate_user($elsettings->locdelrec, $elsettings->deliverlocsyes);
         if ($delloclink == 0) {
             $mainframe->enqueueMessage(JText::_('NO ACCESS'));
             return false;
         }
         //get IP, time and userid
         $date = new JDate($row->created, $tzoffset);
         $row->created = $date->toMySQL();
         $row->author_ip = $elsettings->storeip ? getenv('REMOTE_ADDR') : 'DISABLED';
         $row->created_by = $user->get('id');
         //set owneredit to false
         $owneredit = 0;
     }
     //Image upload
     //If image upload is required we will stop here if no file was attached
     if (empty($file['name']) && $elsettings->imageenabled == 2) {
         $this->setError(JText::_('IMAGE EMPTY'));
         return false;
     }
     if (($elsettings->imageenabled == 2 || $elsettings->imageenabled == 1) && !empty($file['name'])) {
         jimport('joomla.filesystem.file');
         $base_Dir = JPATH_SITE . '/images/eventlist/venues/';
         //check the image
         $check = ELImage::check($file, $elsettings);
         if ($check === false) {
             $mainframe->redirect($_SERVER['HTTP_REFERER']);
         }
         //sanitize the image filename
         $filename = ELImage::sanitize($base_Dir, $file['name']);
         $filepath = $base_Dir . $filename;
         if (!JFile::upload($file['tmp_name'], $filepath)) {
             $this->setError(JText::_('UPLOAD FAILED'));
             return false;
         } else {
             $row->locimage = $filename;
         }
     } else {
         //keep image if edited and left blank
         $row->locimage = $row->curimage;
     }
     //end image upload if
     //Check description
     $editoruser = ELUser::editoruser();
     if (!$editoruser) {
         //check datdescription --> wipe out code
         $row->locdescription = strip_tags($row->locdescription, '<br />');
         //convert the linux \n (Mac \r, Win \r\n) to <br /> linebreaks
         $row->locdescription = str_replace(array("\r\n", "\r", "\n"), "<br />", $row->locdescription);
         //cut too long words
         $row->locdescription = wordwrap($row->locdescription, 75, " ", 1);
         //check length
         $length = JString::strlen($row->locdescription);
         if ($length > $elsettings->datdesclimit) {
             // if required shorten it
             $row->locdescription = JString::substr($row->locdescription, 0, $elsettings->datdesclimit);
             //if shortened add ...
             $row->locdescription = $row->locdescription . '...';
         }
     }
     $row->venue = trim(JFilterOutput::ampReplace($row->venue));
     //Autopublish
     //check if the user has the required rank for autopublish
     $autopublloc = ELUser::validate_user($elsettings->locpubrec, $elsettings->autopublocate);
     //Check if user is the owner of the venue
     //If yes enable autopublish
     if ($autopublloc || $owneredit) {
         $row->published = 1;
     } else {
         $row->published = 0;
     }
     //Make sure the data is valid
     if (!$row->check($elsettings)) {
         $this->setError($row->getError());
         return false;
     }
     //is this an edited venue or not?
     //after store we allways have an id
     $edited = $row->id ? $row->id : false;
     //store it in the db
     if (!$row->store()) {
         $this->setError($this->_db->getErrorMsg());
         return false;
     }
     jimport('joomla.utilities.mail');
     $link = JURI::base() . JRoute::_('index.php?view=details&id=' . $row->id, false);
     //create mail
     if ($elsettings->mailinform == 2 || $elsettings->mailinform == 3) {
         $mail = JFactory::getMailer();
         $state = $row->published ? JText::sprintf('MAIL VENUE PUBLISHED', $link) : JText::_('MAIL VENUE UNPUBLISHED');
         if ($edited) {
             $modified_ip = getenv('REMOTE_ADDR');
             $edited = JHTML::Date($row->modified, JText::_('DATE_FORMAT_LC2'));
             $mailbody = JText::sprintf('MAIL EDIT VENUE', $user->name, $user->username, $user->email, $modified_ip, $edited, $row->venue, $row->url, $row->street, $row->plz, $row->city, $row->country, $row->locdescription, $state);
             $mail->setSubject($SiteName . JText::_('EDIT VENUE MAIL'));
         } else {
             $created = JHTML::Date($row->modified, JText::_('DATE_FORMAT_LC2'));
             $mailbody = JText::sprintf('MAIL NEW VENUE', $user->name, $user->username, $user->email, $row->author_ip, $created, $row->venue, $row->url, $row->street, $row->plz, $row->city, $row->country, $row->locdescription, $state);
             $mail->setSubject($SiteName . JText::_('NEW VENUE MAIL'));
         }
         $receivers = explode(',', trim($elsettings->mailinformrec));
         $mail->addRecipient($receivers);
         $mail->setSender(array($MailFrom, $FromName));
         $mail->setBody($mailbody);
         $sent = $mail->Send();
     }
     //create the mail for the user
     if ($elsettings->mailinformuser == 2 || $elsettings->mailinformuser == 3) {
         $usermail = JFactory::getMailer();
         $state = $row->published ? JText::sprintf('USER MAIL VENUE PUBLISHED', $link) : JText::_('USER MAIL VENUE UNPUBLISHED');
         if ($edited) {
             $edited = JHTML::Date($row->modified, JText::_('DATE_FORMAT_LC2'));
             $mailbody = JText::sprintf('USER MAIL EDIT VENUE', $user->name, $user->username, $edited, $row->venue, $row->url, $row->street, $row->plz, $row->city, $row->country, $row->locdescription, $state);
             $usermail->setSubject($SiteName . JText::_('EDIT USER VENUE MAIL'));
         } else {
             $created = JHTML::Date($row->modified, JText::_('DATE_FORMAT_LC2'));
             $mailbody = JText::sprintf('USER MAIL NEW VENUE', $user->name, $user->username, $created, $row->venue, $row->url, $row->street, $row->plz, $row->city, $row->country, $row->locdescription, $state);
             $usermail->setSubject($SiteName . JText::_('NEW USER VENUE MAIL'));
         }
         $usermail->addRecipient($user->email);
         $usermail->setSender(array($MailFrom, $FromName));
         $usermail->setBody($mailbody);
         $sent = $usermail->Send();
     }
     //update item order
     $row->reorder();
     return $row->id;
 }
Ejemplo n.º 9
0
 /**
  * Creates the Categoryevents View
  *
  * @since 0.9
  */
 function display($tpl = null)
 {
     global $mainframe, $option;
     //initialize variables
     $document =& JFactory::getDocument();
     $menu =& JSite::getMenu();
     $elsettings = ELHelper::config();
     $item = $menu->getActive();
     $params =& $mainframe->getParams();
     //cleanup events
     ELHelper::cleanevents($elsettings->lastupdate);
     //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 = $mainframe->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');
     $total =& $this->get('Total');
     //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', !$mainframe->getCfg('hidePrint'));
     $params->def('icons', $mainframe->getCfg('icons'));
     if ($pop) {
         $params->set('popup', 1);
     }
     $print_link = JRoute::_('index.php?option=com_eventlist&view=categoryevents&id=' . $category->id . '&pop=1&tmpl=component');
     //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
     if ($task == 'catarchive') {
         $pathway =& $mainframe->getPathWay();
         $pathway->setItemName(1, $item->name);
         $pathway->addItem(JText::_('ARCHIVE') . ' - ' . $category->catname, JRoute::_('index.php?option=' . $option . '&view=categoryevents&task=catarchive&id=' . $category->id));
         $link = JRoute::_('index.php?option=com_eventlist&view=categoryevents&task=catarchive&id=' . $category->id);
     } else {
         $pathway =& $mainframe->getPathWay();
         $pathway->setItemName(1, $item->name);
         $pathway->addItem($category->catname, JRoute::_('index.php?option=' . $option . '&view=categoryevents&id=' . $category->id));
         $link = JRoute::_('index.php?option=com_eventlist&view=categoryevents&id=' . $category->id);
     }
     //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
     jimport('joomla.html.pagination');
     $pageNav = new JPagination($total, $limitstart, $limit);
     //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 = $mainframe->triggerEvent('onPrepareContent', array(&$category, &$params, 0));
         $catdescription = $category->text;
     }
     if ($category->image != '') {
         $attribs['width'] = $elsettings->imagewidth;
         $attribs['height'] = $elsettings->imagehight;
         $attribs['border'] = 0;
         $category->image = JHTML::image('images/stories/' . $category->image, $category->catname, $attribs);
     } else {
         $category->image = JHTML::image('components/com_eventlist/assets/images/noimage.png', $category->catname);
     }
     //create select lists
     $lists = $this->_buildSortLists($elsettings);
     $this->assign('lists', $lists);
     $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('link', $link);
     $this->assignRef('pageNav', $pageNav);
     $this->assignRef('elsettings', $elsettings);
     $this->assignRef('item', $item);
     parent::display($tpl);
 }
Ejemplo n.º 10
0
 /**
  * Creates the output for event submissions
  *
  * @since 0.4
  *
  */
 function display($tpl = null)
 {
     $app =& JFactory::getApplication();
     $session =& JFactory::getSession();
     $user =& JFactory::getUser();
     if (!$user->id) {
         $app->redirect(JRoute::_($_SERVER["HTTP_REFERER"]), JText::_('Please login to be able to submit events'), 'error');
     }
     if ($this->getLayout() == 'choosevenue') {
         $this->_displaychoosevenue($tpl);
         return;
     }
     // Initialize variables
     $editor =& JFactory::getEditor();
     $doc =& JFactory::getDocument();
     $elsettings =& ELHelper::config();
     //Get Data from the model
     $row = $this->get('Event');
     //Cause of group limits we can't use class here to build the categories tree
     $categories = $this->get('Categories');
     //sticky form categorie data
     if ($session->has('eventform', 'com_eventlist')) {
         $eventform = $session->get('eventform', 0, 'com_eventlist');
         $selectedcats = $eventform['cid'];
     } else {
         $selectedcats =& $this->get('Catsselected');
     }
     //build selectlists
     $categories = eventlist_cats::buildcatselect($categories, 'cid[]', $selectedcats, 0, 'multiple="multiple" size="8 class="inputbox required validate-cid"');
     //Get requests
     $id = JRequest::getInt('id');
     //Clean output
     JFilterOutput::objectHTMLSafe($row, ENT_QUOTES, 'datdescription');
     JHTML::_('behavior.formvalidation');
     JHTML::_('behavior.tooltip');
     JHTML::_('behavior.modal', 'a.modal');
     //add css file
     $doc->addStyleSheet($this->baseurl . '/components/com_eventlist/assets/css/eventlist.css');
     $doc->addCustomTag('<!--[if IE]><style type="text/css">.floattext{zoom:1;}, * html #eventlist dd { height: 1%; }</style><![endif]-->');
     //Set page title
     $id ? $title = JText::_('EDIT EVENT') : ($title = JText::_('ADD EVENT'));
     $doc->setTitle($title);
     // Get the menu object of the active menu item
     $menu =& JSite::getMenu();
     $item = $menu->getActive();
     $params =& $app->getParams('com_eventlist');
     //pathway
     $pathway =& $app->getPathWay();
     $pathway->setItemName(1, $item->name);
     $pathway->addItem($title, '');
     //Has the user access to the editor and the add venue screen
     $editoruser = ELUser::editoruser();
     $delloclink = ELUser::validate_user($elsettings->locdelrec, $elsettings->deliverlocsyes);
     //transform <br /> and <br> back to \r\n for non editorusers
     if (!$editoruser) {
         $row->datdescription = ELHelper::br2break($row->datdescription);
     }
     //Get image information
     $dimage = ELImage::flyercreator($row->datimage, 'event');
     //Set the info image
     $infoimage = JHTML::_('image', 'components/com_eventlist/assets/images/icon-16-hint.png', JText::_('NOTES'));
     //Create the stuff required for the venueselect functionality
     $url = $app->isAdmin() ? $app->getSiteURL() : JURI::base();
     $js = "\n\t\tfunction elSelectVenue(id, venue) {\n\t\t\tdocument.getElementById('a_id').value = id;\n\t\t\tdocument.getElementById('a_name').value = venue;\n\t\t\tdocument.getElementById('sbox-window').close();\n\t\t}\n\t\t\n\t\tfunction closeAdd() {\n\t\t\tdocument.getElementById('sbox-window').close();   \n    \t}\n    \t";
     $doc->addScriptDeclaration($js);
     // include the recurrence script
     $doc->addScript($url . 'components/com_eventlist/assets/js/recurrence.js');
     // include the unlimited script
     $doc->addScript($url . 'components/com_eventlist/assets/js/unlimited.js');
     $lists = array();
     // recurrence type
     $rec_type = array();
     $rec_type[] = JHTML::_('select.option', 0, JText::_('NOTHING'));
     $rec_type[] = JHTML::_('select.option', 1, JText::_('DAYLY'));
     $rec_type[] = JHTML::_('select.option', 2, JText::_('WEEKLY'));
     $rec_type[] = JHTML::_('select.option', 3, JText::_('MONTHLY'));
     $rec_type[] = JHTML::_('select.option', 4, JText::_('WEEKDAY'));
     $lists['recurrence_type'] = JHTML::_('select.genericlist', $rec_type, 'recurrence_type', '', 'value', 'text', $row->recurrence_type);
     //if only owned events are allowed
     if ($elsettings->ownedvenuesonly) {
         $venues =& $this->get('UserVenues');
         //build list
         $venuelist = array();
         $venuelist[] = JHTML::_('select.option', '0', JText::_('NO VENUE'));
         $venuelist = array_merge($venuelist, $venues);
         $lists['venueselect'] = JHTML::_('select.genericlist', $venuelist, 'locid', 'size="1" class="inputbox"', 'value', 'text', $row->locid);
     }
     $this->assignRef('row', $row);
     $this->assignRef('categories', $categories);
     $this->assignRef('editor', $editor);
     $this->assignRef('dimage', $dimage);
     $this->assignRef('infoimage', $infoimage);
     $this->assignRef('delloclink', $delloclink);
     $this->assignRef('editoruser', $editoruser);
     $this->assignRef('elsettings', $elsettings);
     $this->assignRef('item', $item);
     $this->assignRef('params', $params);
     $this->assignRef('lists', $lists);
     parent::display($tpl);
 }
Ejemplo n.º 11
0
 /**
  * Method to store the event
  *
  * @access	public
  * @return	id
  * @since	0.9
  */
 function store($data, $file)
 {
     $app =& JFactory::getApplication();
     $user =& JFactory::getUser();
     $elsettings =& ELHelper::config();
     $cats = JRequest::getVar('cid', array(), 'post', 'array');
     $row =& JTable::getInstance('eventlist_events', '');
     //Sanitize
     $data['datdescription'] = JRequest::getVar('datdescription', '', 'post', 'string', JREQUEST_ALLOWRAW);
     //include the metatags
     if (strlen($data['meta_description']) > 255) {
         $data['meta_description'] = substr($data['meta_description'], 0, 254);
     }
     if (strlen($data['meta_keywords']) > 200) {
         $data['meta_keywords'] = substr($data['meta_keywords'], 0, 199);
     }
     $curimage = JRequest::getVar('curimage', '', 'post', 'string');
     //bind it to the table
     if (!$row->bind($data)) {
         JError::raiseError(500, $this->_db->stderr());
         return false;
     }
     //get values from time selectlist and concatenate them accordingly
     $starthours = JRequest::getCmd('starthours');
     $startminutes = JRequest::getCmd('startminutes');
     $endhours = JRequest::getCmd('endhours');
     $endminutes = JRequest::getCmd('endminutes');
     $row->times = $starthours . ':' . $startminutes;
     $row->endtimes = $endhours . ':' . $endminutes;
     //Are we saving from an item edit?
     if ($row->id) {
         //check if user is allowed to edit events
         $editaccess = ELUser::editaccess($elsettings->eventowner, $row->created_by, $elsettings->eventeditrec, $elsettings->eventedit);
         $maintainer = ELUser::ismaintainer();
         if ($maintainer || $editaccess) {
             $allowedtoeditevent = 1;
         }
         if ($allowedtoeditevent == 0) {
             JError::raiseError(403, JText::_('NO ACCESS'));
         }
         $row->modified = gmdate('Y-m-d H:i:s');
         $row->modified_by = $user->get('id');
         /*
          * Is editor the owner of the event
          * This extra Check is needed to make it possible
          * that the venue is published after an edit from an owner
          */
         if ($elsettings->venueowner == 1 && $row->created_by == $user->get('id')) {
             $owneredit = 1;
         } else {
             $owneredit = 0;
         }
     } else {
         //check if user is allowed to submit new events
         $maintainer = ELUser::ismaintainer();
         $genaccess = ELUser::validate_user($elsettings->evdelrec, $elsettings->delivereventsyes);
         if (!($maintainer || $genaccess)) {
             JError::raiseError(403, JText::_('NO ACCESS'));
         }
         //get IP, time and userid
         $row->created = gmdate('Y-m-d H:i:s');
         $row->author_ip = $elsettings->storeip ? getenv('REMOTE_ADDR') : 'DISABLED';
         $row->created_by = $user->get('id');
         //Set owneredit to false
         $owneredit = 0;
     }
     /*
      * Autopublish
      * check if the user has the required rank for autopublish
      */
     $autopubev = ELUser::validate_user($elsettings->evpubrec, $elsettings->autopubl);
     if ($autopubev || $owneredit) {
         $row->published = 1;
     } else {
         $row->published = 0;
     }
     //Image upload
     //If image upload is required we will stop here if no file was attached
     if (empty($file['name']) && $elsettings->imageenabled == 2) {
         $this->setError(JText::_('IMAGE EMPTY'));
         return false;
     }
     if (($elsettings->imageenabled == 2 || $elsettings->imageenabled == 1) && !empty($file['name'])) {
         jimport('joomla.filesystem.file');
         $base_Dir = JPATH_SITE . '/images/eventlist/events/';
         //check the image
         $check = ELImage::check($file, $elsettings);
         if ($check === false) {
             $app->redirect($_SERVER['HTTP_REFERER']);
         }
         //sanitize the image filename
         $filename = ELImage::sanitize($base_Dir, $file['name']);
         $filepath = $base_Dir . $filename;
         if (!JFile::upload($file['tmp_name'], $filepath)) {
             $this->setError(JText::_('UPLOAD FAILED'));
             return false;
         } else {
             $row->datimage = $filename;
         }
     } else {
         //keep image if edited and left blank
         $row->datimage = $curimage;
     }
     //end image if
     $editoruser = ELUser::editoruser();
     if (!$editoruser) {
         //check datdescription --> wipe out code
         $row->datdescription = strip_tags($row->datdescription, '<br><br/>');
         //convert the linux \n (Mac \r, Win \r\n) to <br /> linebreaks
         $row->datdescription = str_replace(array("\r\n", "\r", "\n"), "<br />", $row->datdescription);
         // cut too long words
         $row->datdescription = wordwrap($row->datdescription, 75, ' ', 1);
         //check length
         $length = JString::strlen($row->datdescription);
         if ($length > $elsettings->datdesclimit) {
             //too long then shorten datdescription
             $row->datdescription = JString::substr($row->datdescription, 0, $elsettings->datdesclimit);
             //add ...
             $row->datdescription = $row->datdescription . '...';
         }
     }
     //set registration regarding the el settings
     switch ($elsettings->showfroregistra) {
         case 0:
             $row->registra = 0;
             break;
         case 1:
             $row->registra = 1;
             break;
         case 2:
             $row->registra = $row->registra;
             break;
     }
     switch ($elsettings->showfrounregistra) {
         case 0:
             $row->unregistra = 0;
             break;
         case 1:
             $row->unregistra = 1;
             break;
         case 2:
             if ($elsettings->showfroregistra >= 1) {
                 $row->unregistra = $row->unregistra;
             } else {
                 $row->unregistra = 0;
             }
             break;
     }
     //Make sure the table is valid
     if (!$row->check($elsettings)) {
         $this->setError($row->getError());
         return false;
     }
     $row->version++;
     //store it in the db
     if (!$row->store(true)) {
         JError::raiseError(500, $this->_db->stderr());
         return false;
     }
     //store cat relation
     $query = 'DELETE FROM #__eventlist_cats_event_relations WHERE itemid = ' . $row->id;
     $this->_db->setQuery($query);
     $this->_db->query();
     foreach ($cats as $cat) {
         $query = 'INSERT INTO #__eventlist_cats_event_relations (`catid`, `itemid`) VALUES(' . $cat . ',' . $row->id . ')';
         $this->_db->setQuery($query);
         $this->_db->query();
     }
     return $row->id;
 }
Ejemplo n.º 12
0
 /**
  * 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);
 }
Ejemplo n.º 13
0
 /**
  * Creates the Venueevents 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('com_eventlist');
     $uri =& JFactory::getURI();
     //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.venueevents.limit', 'limit', $params->def('display_num', 0), 'int');
     $pop = JRequest::getBool('pop');
     $task = JRequest::getWord('task');
     //get data from model
     $rows =& $this->get('Data');
     $venue =& $this->get('Venue');
     $total =& $this->get('Total');
     //does the venue exist?
     if ($venue->id == 0) {
         return JError::raiseError(404, JText::sprintf('Venue #%d not found', $venue->id));
     }
     //are events available?
     if (!$rows) {
         $noevents = 1;
     } else {
         $noevents = 0;
     }
     // Add needed scripts if the lightbox effect is enabled
     if ($elsettings->lightbox == 1) {
         JHTML::_('behavior.modal');
     }
     //Get image
     $limage = ELImage::flyercreator($venue->locimage);
     //add alternate feed link
     $link = 'index.php?option=com_eventlist&view=venueevents&format=feed&id=' . $venue->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);
     //pathway
     $pathway =& $app->getPathWay();
     $pathway->setItemName(1, $item->name);
     //create the pathway
     if ($task == 'archive') {
         $pathway->addItem(JText::_('ARCHIVE') . ' - ' . $venue->venue, JRoute::_('index.php?option=com_eventlist&view=venueevents&task=archive&id=' . $venue->slug));
         $link = JRoute::_('index.php?option=com_eventlist&view=venueevents&id=' . $venue->slug . '&task=archive');
         $print_link = JRoute::_('index.php?option=com_eventlist&view=venueevents&id=' . $venue->slug . '&task=archive&pop=1&tmpl=component');
         $pagetitle = $venue->venue . ' - ' . JText::_('ARCHIVE');
     } else {
         $pathway->addItem($venue->venue, JRoute::_('index.php?option=com_eventlist&view=venueevents&id=' . $venue->slug));
         $link = JRoute::_('index.php?option=com_eventlist&view=venueevents&id=' . $venue->slug);
         $print_link = JRoute::_('index.php?option=com_eventlist&view=venueevents&id=' . $venue->slug . '&pop=1&tmpl=component');
         $pagetitle = $venue->venue;
     }
     //set Page title
     $app->setPageTitle($pagetitle);
     $app->addMetaTag('title', $pagetitle);
     $document->setMetadata('keywords', $venue->meta_keywords);
     $document->setDescription(strip_tags($venue->meta_description));
     //Printfunction
     $params->def('print', !$app->getCfg('hidePrint'));
     $params->def('icons', $app->getCfg('icons'));
     if ($pop) {
         $params->set('popup', 1);
     }
     //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;
     }
     //Generate Venuedescription
     if (!$venue->locdescription == '' || !$venue->locdescription == '<br />') {
         //execute plugins
         $venue->text = $venue->locdescription;
         $venue->title = $venue->venue;
         JPluginHelper::importPlugin('content');
         $results = $app->triggerEvent('onPrepareContent', array(&$venue, &$params, 0));
         $venuedescription = $venue->text;
     }
     $allowedtoeditvenue = ELUser::editaccess($elsettings->venueowner, $venue->created, $elsettings->venueeditrec, $elsettings->venueedit);
     //build the url
     if (!empty($venue->url) && strtolower(substr($venue->url, 0, 7)) != "http://") {
         $venue->url = 'http://' . $venue->url;
     }
     //prepare the url for output
     if (strlen(htmlspecialchars($venue->url, ENT_QUOTES)) > 35) {
         $venue->urlclean = substr(htmlspecialchars($venue->url, ENT_QUOTES), 0, 35) . '...';
     } else {
         $venue->urlclean = htmlspecialchars($venue->url, ENT_QUOTES);
     }
     //create flag
     if ($venue->country) {
         $venue->countryimg = ELOutput::getFlag($venue->country);
     }
     // Create the pagination object
     jimport('joomla.html.pagination');
     $pageNav = new JPagination($total, $limitstart, $limit);
     //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('venue', $venue);
     $this->assignRef('print_link', $print_link);
     $this->assignRef('params', $params);
     $this->assignRef('dellink', $dellink);
     $this->assignRef('limage', $limage);
     $this->assignRef('venuedescription', $venuedescription);
     $this->assignRef('pageNav', $pageNav);
     $this->assignRef('elsettings', $elsettings);
     $this->assignRef('item', $item);
     $this->assignRef('pagetitle', $pagetitle);
     $this->assignRef('task', $task);
     $this->assignRef('allowedtoeditvenue', $allowedtoeditvenue);
     parent::display($tpl);
 }
Ejemplo n.º 14
0
 /**
  * Creates the Categoriesdetailed View
  *
  * @since 0.9
  */
 function display($tpl = null)
 {
     $mainframe =& JFactory::getApplication();
     //initialise variables
     $document =& JFactory::getDocument();
     $elsettings =& redEVENTHelper::config();
     $model = $this->getModel();
     $menu =& JSite::getMenu();
     $item = $menu->getActive();
     $params =& $mainframe->getParams();
     //get vars
     $pathway =& $mainframe->getPathWay();
     $pop = JRequest::getBool('pop');
     $task = JRequest::getWord('task');
     //Get data from the model
     $categories =& $this->get('Data');
     $customs =& $this->get('ListCustomFields');
     $pageNav =& $this->get('pagination');
     //add css file
     if (!$params->get('custom_css')) {
         $document->addStyleSheet($this->baseurl . '/components/com_redevent/assets/css/redevent.css');
     } else {
         $document->addStyleSheet($params->get('custom_css'));
     }
     $document->addCustomTag('<!--[if IE]><style type="text/css">.floattext{zoom:1;}, * html #eventlist dd { height: 1%; }</style><![endif]-->');
     $params->def('page_title', $item->title);
     if ($task == 'archive') {
         $pathway->addItem(JText::_('COM_REDEVENT_ARCHIVE'), JRoute::_(RedeventHelperRoute::getCategoriesDetailedRoute(null, 'archive')));
         $print_link = JRoute::_(RedeventHelperRoute::getCategoriesDetailedRoute(null, 'archive') . '&pop=1&tmpl=component');
         $pagetitle = $params->get('page_title') . ' - ' . JText::_('COM_REDEVENT_ARCHIVE');
     } else {
         $print_link = JRoute::_(RedeventHelperRoute::getCategoriesDetailedRoute() . '&pop=1&tmpl=component');
         $pagetitle = $params->get('page_title');
     }
     //set Page title
     $this->document->setTitle($pagetitle);
     $document->setMetadata('keywords', $pagetitle);
     //Print
     $params->def('print', !$mainframe->getCfg('hidePrint'));
     $params->def('icons', $mainframe->getCfg('icons'));
     if ($pop) {
         $params->set('popup', 1);
     }
     //Check if the user has access to the form
     $maintainer = ELUser::ismaintainer();
     $genaccess = ELUser::validate_user($elsettings->get('evdelrec'), $elsettings->get('delivereventsyes'));
     if ($maintainer || $genaccess) {
         $dellink = 1;
     }
     //add alternate feed link
     // 		$link    = 'index.php?option=com_redevent&view=simplelist&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);
     // Create the pagination object
     jimport('joomla.html.pagination');
     $this->assignRef('categories', $categories);
     $this->assignRef('customs', $customs);
     $this->assignRef('print_link', $print_link);
     $this->assignRef('params', $params);
     $this->assignRef('dellink', $dellink);
     $this->assignRef('item', $item);
     $this->assignRef('model', $model);
     $this->assignRef('pageNav', $pageNav);
     $this->assignRef('elsettings', $elsettings);
     $this->assignRef('task', $task);
     $this->assignRef('pagetitle', $pagetitle);
     $cols = explode(',', $params->get('lists_columns', 'date, title, venue, city, category'));
     $cols = redEVENTHelper::validateColumns($cols);
     $this->assign('columns', $cols);
     parent::display($tpl);
 }
Ejemplo n.º 15
0
 /**
  * Creates the Venueevents View
  *
  * @since 0.9
  */
 function display($tpl = null)
 {
     $mainframe =& JFactory::getApplication();
     $option = JRequest::getCmd('option');
     //initialize variables
     $document =& JFactory::getDocument();
     $menu =& JSite::getMenu();
     $elsettings =& redEVENTHelper::config();
     $item = $menu->getActive();
     $params =& $mainframe->getParams('com_redevent');
     $uri =& JFactory::getURI();
     $pop = JRequest::getBool('pop');
     $upcomingvenueevents = $this->get('UpcomingVenueEvents');
     $model_venueevents = $this->getModel('Venueevents');
     $rows =& $model_venueevents->getData();
     $venue =& $model_venueevents->getVenue();
     $total =& $model_venueevents->getTotal();
     //add css file
     if (!$params->get('custom_css')) {
         $document->addStyleSheet($this->baseurl . '/components/com_redevent/assets/css/redevent.css');
     } else {
         $document->addStyleSheet($params->get('custom_css'));
     }
     $document->addCustomTag('<!--[if IE]><style type="text/css">.floattext{zoom:1;}, * html #eventlist dd { height: 1%; }</style><![endif]-->');
     /* Add rss link */
     $link = '&format=feed';
     $attribs = array('type' => 'application/rss+xml', 'title' => 'RSS 2.0');
     $document->addHeadLink(JRoute::_($link . '&type=rss'), 'alternate', 'rel', $attribs);
     // Add needed scripts if the lightbox effect
     JHTML::_('behavior.modal');
     //add alternate feed link
     $link = 'index.php?option=com_redevent&view=venueevents&format=feed&id=' . $venue->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);
     //pathway
     $pathway =& $mainframe->getPathWay();
     $task = JRequest::getVar('task');
     //create the pathway
     if ($task == 'archive') {
         $pathway->addItem(JText::_('COM_REDEVENT_ARCHIVE') . ' - ' . $venue->venue, JRoute::_('index.php?option=' . $option . '&view=upcomingvenueevents&task=archive&id=' . $venue->slug));
         $link = JRoute::_('index.php?option=com_redevent&view=upcomingvenueevents&id=' . $venue->slug . '&task=archive');
         $print_link = JRoute::_('index.php?option=com_redevent&view=upcomingvenueevents&id=' . $venue->slug . '&task=archive&pop=1&tmpl=component');
         $pagetitle = $venue->venue . ' - ' . JText::_('COM_REDEVENT_ARCHIVE');
     } else {
         $pathway->addItem($venue->venue, JRoute::_('index.php?option=' . $option . '&view=upcomingvenueevents&id=' . $venue->slug));
         $link = JRoute::_('index.php?option=com_redevent&view=upcomingvenueevents&id=' . $venue->slug);
         $print_link = JRoute::_('index.php?option=com_redevent&view=upcomingvenueevents&id=' . $venue->slug . '&pop=1&tmpl=component');
         $pagetitle = $venue->venue . ' - ' . JText::_('COM_REDEVENT_UPCOMING_EVENTS_TITLE');
     }
     //set Page title
     $document->setTitle($pagetitle);
     $document->setMetadata('keywords', $venue->meta_keywords);
     $document->setDescription(strip_tags($venue->meta_description));
     //Check if the user has access to the form
     $maintainer = ELUser::ismaintainer();
     $genaccess = ELUser::validate_user($elsettings->get('evdelrec'), $elsettings->get('delivereventsyes'));
     if ($maintainer || $genaccess) {
         $dellink = 1;
     }
     //Printfunction
     $params->def('print', !$mainframe->getCfg('hidePrint'));
     $params->def('icons', $mainframe->getCfg('icons'));
     if ($pop) {
         $params->set('popup', 1);
     }
     //Generate Venuedescription
     if (!empty($venue->locdescription)) {
         //execute plugins
         $venuedescription = JHTML::_('content.prepare', $venue->locdescription);
     }
     //build the url
     if (!empty($venue->url) && strtolower(substr($venue->url, 0, 7)) != "http://") {
         $venue->url = 'http://' . $venue->url;
     }
     //prepare the url for output
     if (strlen(htmlspecialchars($venue->url, ENT_QUOTES)) > 35) {
         $venue->urlclean = substr(htmlspecialchars($venue->url, ENT_QUOTES), 0, 35) . '...';
     } else {
         $venue->urlclean = htmlspecialchars($venue->url, ENT_QUOTES);
     }
     //create flag
     if ($venue->country) {
         $venue->countryimg = REOutput::getFlag($venue->country);
     }
     // Create the pagination object
     $limitstart = JRequest::getInt('limitstart');
     $limit = $mainframe->getUserStateFromRequest('com_redevent.venueevents.limit', 'limit', $params->def('display_num', 0), 'int');
     jimport('joomla.html.pagination');
     $pageNav = new JPagination($total, $limitstart, $limit);
     $this->assignRef('upcomingvenueevents', $upcomingvenueevents);
     $this->assignRef('params', $params);
     $this->assignRef('rows', $rows);
     $this->assignRef('venue', $venue);
     $this->assignRef('pageNav', $pageNav);
     $this->assignRef('venuedescription', $venuedescription);
     $this->assignRef('elsettings', $elsettings);
     $this->assignRef('item', $item);
     $this->assignRef('pagetitle', $pagetitle);
     $this->assignRef('task', $task);
     $this->assignRef('print_link', $print_link);
     $this->assignRef('dellink', $dellink);
     $this->assign('action', JRoute::_(RedeventHelperRoute::getUpcomingVenueEventsRoute($venue->slug)));
     parent::display($tpl);
 }
Ejemplo n.º 16
0
 /**
  * Creates the Simple List View
  *
  * @since 0.9
  */
 function display($tpl = null)
 {
     $app =& JFactory::getApplication();
     //initialize variables
     $document =& JFactory::getDocument();
     $elsettings =& ELHelper::config();
     $menu =& JSite::getMenu();
     $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]-->');
     // get variables
     $limitstart = JRequest::getVar('limitstart', 0, '', 'int');
     $limit = $app->getUserStateFromRequest('com_eventlist.search.limit', 'limit', $params->def('display_num', 0), 'int');
     $filter_continent = $app->getUserStateFromRequest('com_eventlist.search.filter_continent', 'filter_continent', '', 'string');
     $filter_country = $app->getUserStateFromRequest('com_eventlist.search.filter_country', 'filter_country', '', 'string');
     $filter_city = $app->getUserStateFromRequest('com_eventlist.search.filter_city', 'filter_city', '', 'string');
     $filter_date_from = $app->getUserStateFromRequest('com_eventlist.search.filter_date_from', 'filter_date_from', '', 'string');
     $filter_date_to = $app->getUserStateFromRequest('com_eventlist.search.filter_date_to', 'filter_date_to', '', 'string');
     $filter_category = $app->getUserStateFromRequest('com_eventlist.search.filter_category', 'filter_category', 0, 'int');
     $task = JRequest::getWord('task');
     $pop = JRequest::getBool('pop');
     //get data from model
     $rows =& $this->get('Data');
     $total =& $this->get('Total');
     //are events available?
     if (!$rows) {
         $noevents = 1;
     } else {
         $noevents = 0;
     }
     //params
     $params->def('page_title', $item->name);
     if ($pop) {
         //If printpopup set true
         $params->set('popup', 1);
     }
     //pathway
     $pathway->setItemName(1, $item->name);
     if ($task == 'archive') {
         $pathway->addItem(JText::_('ARCHIVE'), JRoute::_('index.php?view=eventlist&task=archive'));
         $print_link = JRoute::_('index.php?view=eventlist&task=archive&tmpl=component&pop=1');
         $pagetitle = $params->get('page_title') . ' - ' . JText::_('ARCHIVE');
     } else {
         $print_link = JRoute::_('index.php?view=eventlist&tmpl=component&pop=1');
         $pagetitle = $params->get('page_title');
     }
     //Set Page title
     $app->setPageTitle($pagetitle);
     $app->addMetaTag('title', $pagetitle);
     //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;
     }
     //add alternate feed link
     $link = 'index.php?option=com_eventlist&view=eventlist&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);
     //create select lists
     $lists = $this->_buildSortLists();
     if ($lists['filter']) {
         //$uri->setVar('filter', JRequest::getString('filter'));
         //$filter		= $app->getUserStateFromRequest('com_eventlist.eventlist.filter', 'filter', '', 'string');
         $uri->setVar('filter', $lists['filter']);
         $uri->setVar('filter_type', JRequest::getString('filter_type'));
     } else {
         $uri->delVar('filter');
         $uri->delVar('filter_type');
     }
     //Cause of group limits we can't use class here to build the categories tree
     $categories = $this->get('CategoryTree');
     $catoptions = array();
     $catoptions[] = JHTML::_('select.option', '0', JText::_('Select category'));
     $catoptions = array_merge($catoptions, eventlist_cats::getcatselectoptions($categories));
     $selectedcats = $filter_category ? array($filter_category) : array();
     //build selectlists
     $lists['categories'] = JHTML::_('select.genericlist', $catoptions, 'filter_category', 'size="1" class="inputbox"', 'value', 'text', $selectedcats);
     // Create the pagination object
     $pageNav = $this->get('Pagination');
     // date filter
     $lists['date_from'] = JHTML::_('calendar', $filter_date_from, 'filter_date_from', 'filter_date_from', '%Y-%m-%d', 'class="inputbox"');
     $lists['date_to'] = JHTML::_('calendar', $filter_date_to, 'filter_date_to', 'filter_date_to', '%Y-%m-%d', 'class="inputbox"');
     // country filter
     $continents = array();
     $continents[] = JHTML::_('select.option', '', JText::_('Select continent'));
     $continents[] = JHTML::_('select.option', 'AF', JText::_('Africa'));
     $continents[] = JHTML::_('select.option', 'AS', JText::_('Asia'));
     $continents[] = JHTML::_('select.option', 'EU', JText::_('Europe'));
     $continents[] = JHTML::_('select.option', 'NA', JText::_('North America'));
     $continents[] = JHTML::_('select.option', 'SA', JText::_('South America'));
     $continents[] = JHTML::_('select.option', 'OC', JText::_('Oceania'));
     $continents[] = JHTML::_('select.option', 'AN', JText::_('Antartica'));
     $lists['continents'] = JHTML::_('select.genericlist', $continents, 'filter_continent', 'class="inputbox"', 'value', 'text', $filter_continent);
     unset($continents);
     // country filter
     $countries = array();
     $countries[] = JHTML::_('select.option', '', JText::_('Select country'));
     $countries = array_merge($countries, $this->get('CountryOptions'));
     $lists['countries'] = JHTML::_('select.genericlist', $countries, 'filter_country', 'class="inputbox"', 'value', 'text', $filter_country);
     unset($countries);
     // city filter
     if ($filter_country) {
         $cities = array();
         $cities[] = JHTML::_('select.option', '', JText::_('Select city'));
         $cities = array_merge($cities, $this->get('CityOptions'));
         $lists['cities'] = JHTML::_('select.genericlist', $cities, 'filter_city', 'class="inputbox"', 'value', 'text', $filter_city);
         unset($cities);
     }
     $this->assign('lists', $lists);
     $this->assign('total', $total);
     $this->assign('action', $uri->toString());
     $this->assignRef('rows', $rows);
     $this->assignRef('task', $task);
     $this->assignRef('noevents', $noevents);
     $this->assignRef('print_link', $print_link);
     $this->assignRef('params', $params);
     $this->assignRef('dellink', $dellink);
     $this->assignRef('pageNav', $pageNav);
     $this->assignRef('elsettings', $elsettings);
     $this->assignRef('pagetitle', $pagetitle);
     $this->assignRef('filter_continent', $filter_continent);
     $this->assignRef('filter_country', $filter_country);
     $this->assignRef('document', $document);
     parent::display($tpl);
 }
Ejemplo n.º 17
0
 /**
  * Creates the Simple List View
  *
  * @since 0.9
  */
 function display($tpl = null)
 {
     global $mainframe;
     //initialize variables
     $document =& JFactory::getDocument();
     $elsettings =& ELHelper::config();
     $menu =& JSite::getMenu();
     $item = $menu->getActive();
     $params =& $mainframe->getParams();
     $uri =& JFactory::getURI();
     $pathway =& $mainframe->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]-->');
     // get variables
     $limitstart = JRequest::getVar('limitstart', 0, '', 'int');
     $limit = $mainframe->getUserStateFromRequest('com_eventlist.eventlist.limit', 'limit', $params->def('display_num', 0), 'int');
     $task = JRequest::getWord('task');
     $pop = JRequest::getBool('pop');
     //get data from model
     $rows =& $this->get('Data');
     $total =& $this->get('Total');
     //are events available?
     if (!$rows) {
         $noevents = 1;
     } else {
         $noevents = 0;
     }
     //params
     $params->def('page_title', $item->name);
     if ($pop) {
         //If printpopup set true
         $params->set('popup', 1);
     }
     //pathway
     $pathway->setItemName(1, $item->name);
     if ($task == 'archive') {
         $pathway->addItem(JText::_('ARCHIVE'), JRoute::_('index.php?view=eventlist&task=archive'));
         $print_link = JRoute::_('index.php?view=eventlist&task=archive&tmpl=component&pop=1');
         $pagetitle = $params->get('page_title') . ' - ' . JText::_('ARCHIVE');
     } else {
         $print_link = JRoute::_('index.php?view=eventlist&tmpl=component&pop=1');
         $pagetitle = $params->get('page_title');
     }
     //Set Page title
     $mainframe->setPageTitle($pagetitle);
     $mainframe->addMetaTag('title', $pagetitle);
     //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;
     }
     //add alternate feed link
     $link = 'index.php?option=com_eventlist&view=eventlist&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);
     //create select lists
     $lists = $this->_buildSortLists();
     if ($lists['filter']) {
         //$uri->setVar('filter', JRequest::getString('filter'));
         //$filter		= $mainframe->getUserStateFromRequest('com_eventlist.eventlist.filter', 'filter', '', 'string');
         $uri->setVar('filter', $lists['filter']);
         $uri->setVar('filter_type', JRequest::getString('filter_type'));
     } else {
         $uri->delVar('filter');
         $uri->delVar('filter_type');
     }
     // Create the pagination object
     jimport('joomla.html.pagination');
     $pageNav = new JPagination($total, $limitstart, $limit);
     $this->assign('lists', $lists);
     $this->assign('total', $total);
     $this->assign('action', $uri->toString());
     $this->assignRef('rows', $rows);
     $this->assignRef('task', $task);
     $this->assignRef('noevents', $noevents);
     $this->assignRef('print_link', $print_link);
     $this->assignRef('params', $params);
     $this->assignRef('dellink', $dellink);
     $this->assignRef('pageNav', $pageNav);
     $this->assignRef('elsettings', $elsettings);
     $this->assignRef('pagetitle', $pagetitle);
     parent::display($tpl);
 }
Ejemplo n.º 18
0
 /**
  * Creates the Venuesview
  *
  * @since 0.9
  */
 function display($tpl = null)
 {
     global $mainframe;
     $document =& JFactory::getDocument();
     $elsettings = ELHelper::config();
     //get menu information
     $menu =& JSite::getMenu();
     $item = $menu->getActive();
     $params =& $mainframe->getParams();
     //cleanup events
     ELHelper::cleanevents($elsettings->lastupdate);
     //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 = JRequest::getVar('limit', $params->get('display_num'), '', 'int');
     $pop = JRequest::getBool('pop', 0, '', 'int');
     $rows =& $this->get('Data');
     $total =& $this->get('Total');
     //Add needed scripts if the lightbox effect is enabled
     if ($elsettings->lightbox == 1) {
         JHTML::_('behavior.modal');
     }
     //add alternate feed link
     $link = 'index.php?option=com_eventlist&view=venues&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);
     $params->def('page_title', $item->name);
     //set Page title
     $document->setTitle($params->get('page_title'));
     $document->setMetadata('keywords', $params->get('page_title'));
     //pathway
     $pathway =& $mainframe->getPathWay();
     $pathway->setItemName(1, $item->name);
     //Printfunction
     $params->def('print', !$mainframe->getCfg('hidePrint'));
     $params->def('icons', $mainframe->getCfg('icons'));
     if ($params->def('page_title', 1)) {
         $params->def('header', $item->name);
     }
     if ($pop) {
         $params->set('popup', 1);
     }
     $print_link = JRoute::_('index.php?view=venues&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
     jimport('joomla.html.pagination');
     $pageNav = new JPagination($total, $limitstart, $limit);
     $link = 'index.php?option=com_eventlist&view=venues';
     $this->assignRef('rows', $rows);
     $this->assignRef('print_link', $print_link);
     $this->assignRef('params', $params);
     $this->assignRef('dellink', $dellink);
     $this->assignRef('link', $link);
     $this->assignRef('pageNav', $pageNav);
     $this->assignRef('limit', $limit);
     $this->assignRef('total', $total);
     $this->assignRef('item', $item);
     $this->assignRef('elsettings', $elsettings);
     parent::display($tpl);
 }
Ejemplo n.º 19
0
 /**
  * Creates the output for event submissions
  *
  * @since 0.4
  *
  */
 function display($tpl = null)
 {
     global $mainframe;
     if ($this->getLayout() == 'selectvenue') {
         $this->_displayselectvenue($tpl);
         return;
     }
     // Initialize variables
     $editor =& JFactory::getEditor();
     $doc =& JFactory::getDocument();
     $elsettings =& ELHelper::config();
     //Get Data from the model
     $row = $this->Get('Event');
     $categories = $this->Get('Categories');
     //Get requests
     $id = JRequest::getInt('id');
     //Clean output
     JFilterOutput::objectHTMLSafe($row, ENT_QUOTES, 'datdescription');
     JHTML::_('behavior.formvalidation');
     JHTML::_('behavior.tooltip');
     JHTML::_('behavior.modal', 'a.modal');
     //add css file
     $doc->addStyleSheet($this->baseurl . '/components/com_eventlist/assets/css/eventlist.css');
     $doc->addCustomTag('<!--[if IE]><style type="text/css">.floattext{zoom:1;}, * html #eventlist dd { height: 1%; }</style><![endif]-->');
     //Set page title
     $id ? $title = JText::_('EDIT EVENT') : ($title = JText::_('ADD EVENT'));
     $doc->setTitle($title);
     // Get the menu object of the active menu item
     $menu =& JSite::getMenu();
     $item = $menu->getActive();
     $params =& $mainframe->getParams('com_eventlist');
     //pathway
     $pathway =& $mainframe->getPathWay();
     $pathway->setItemName(1, $item->name);
     $pathway->addItem($title, '');
     //Has the user access to the editor and the add venue screen
     $editoruser = ELUser::editoruser();
     $delloclink = ELUser::validate_user($elsettings->locdelrec, $elsettings->deliverlocsyes);
     //transform <br /> and <br> back to \r\n for non editorusers
     if (!$editoruser) {
         $row->datdescription = ELHelper::br2break($row->datdescription);
     }
     //Get image information
     $dimage = ELImage::flyercreator($row->datimage, 'event');
     //Set the info image
     $infoimage = JHTML::_('image', 'components/com_eventlist/assets/images/icon-16-hint.png', JText::_('NOTES'));
     //Create the stuff required for the venueselect functionality
     $url = $mainframe->isAdmin() ? $mainframe->getSiteURL() : JURI::base();
     $js = "\r\n\t\tfunction elSelectVenue(id, venue) {\r\n\t\t\tdocument.getElementById('a_id').value = id;\r\n\t\t\tdocument.getElementById('a_name').value = venue;\r\n\t\t\tdocument.getElementById('sbox-window').close();\r\n\t\t}";
     $doc->addScriptDeclaration($js);
     // include the recurrence script
     $doc->addScript($url . 'components/com_eventlist/assets/js/recurrence.js');
     // include the unlimited script
     $doc->addScript($url . 'components/com_eventlist/assets/js/unlimited.js');
     $this->assignRef('row', $row);
     $this->assignRef('categories', $categories);
     $this->assignRef('editor', $editor);
     $this->assignRef('dimage', $dimage);
     $this->assignRef('infoimage', $infoimage);
     $this->assignRef('delloclink', $delloclink);
     $this->assignRef('editoruser', $editoruser);
     $this->assignRef('elsettings', $elsettings);
     $this->assignRef('item', $item);
     $this->assignRef('params', $params);
     parent::display($tpl);
 }
Ejemplo n.º 20
0
 /**
  * Method to store the event
  *
  * @access	public
  * @return	id
  * @since	0.9
  */
 function store($data, $file)
 {
     global $mainframe;
     $user =& JFactory::getUser();
     $elsettings =& ELHelper::config();
     //Get mailinformation
     $SiteName = $mainframe->getCfg('sitename');
     $MailFrom = $mainframe->getCfg('mailfrom');
     $FromName = $mainframe->getCfg('fromname');
     $tzoffset = $mainframe->getCfg('offset');
     $row =& JTable::getInstance('eventlist_events', '');
     //Sanitize
     $data['datdescription'] = JRequest::getVar('datdescription', '', 'post', 'string', JREQUEST_ALLOWRAW);
     //include the metatags
     $data['meta_description'] = addslashes(htmlspecialchars(trim($elsettings->meta_description)));
     if (strlen($data['meta_description']) > 255) {
         $data['meta_description'] = substr($data['meta_description'], 0, 254);
     }
     $data['meta_keywords'] = addslashes(htmlspecialchars(trim($elsettings->meta_keywords)));
     if (strlen($data['meta_keywords']) > 200) {
         $data['meta_keywords'] = substr($data['meta_keywords'], 0, 199);
     }
     $curimage = JRequest::getVar('curimage', '', 'post', 'string');
     //bind it to the table
     if (!$row->bind($data)) {
         JError::raiseError(500, $this->_db->stderr());
         return false;
     }
     //Are we saving from an item edit?
     if ($row->id) {
         //check if user is allowed to edit events
         $editaccess = ELUser::editaccess($elsettings->eventowner, $row->created_by, $elsettings->eventeditrec, $elsettings->eventedit);
         $maintainer = ELUser::ismaintainer();
         if ($maintainer || $editaccess) {
             $allowedtoeditevent = 1;
         }
         if ($allowedtoeditevent == 0) {
             JError::raiseError(403, JText::_('NO ACCESS'));
         }
         $row->modified = gmdate('Y-m-d H:i:s');
         $row->modified_by = $user->get('id');
         /*
          * Is editor the owner of the event
          * This extra Check is needed to make it possible
          * that the venue is published after an edit from an owner
          */
         if ($elsettings->venueowner == 1 && $row->created_by == $user->get('id')) {
             $owneredit = 1;
         } else {
             $owneredit = 0;
         }
     } else {
         //check if user is allowed to submit new events
         $maintainer = ELUser::ismaintainer();
         $genaccess = ELUser::validate_user($elsettings->evdelrec, $elsettings->delivereventsyes);
         if ($maintainer || $genaccess) {
             $dellink = 1;
         }
         if ($dellink == 0) {
             JError::raiseError(403, JText::_('NO ACCESS'));
         }
         //get IP, time and userid
         $row->created = gmdate('Y-m-d H:i:s');
         $row->author_ip = $elsettings->storeip ? getenv('REMOTE_ADDR') : 'DISABLED';
         $row->created_by = $user->get('id');
         //Set owneredit to false
         $owneredit = 0;
     }
     /*
      * Autopublish
      * check if the user has the required rank for autopublish
      */
     $autopubev = ELUser::validate_user($elsettings->evpubrec, $elsettings->autopubl);
     if ($autopubev || $owneredit) {
         $row->published = 1;
     } else {
         $row->published = 0;
     }
     //Image upload
     //If image upload is required we will stop here if no file was attached
     if (empty($file['name']) && $elsettings->imageenabled == 2) {
         $this->setError(JText::_('IMAGE EMPTY'));
         return false;
     }
     if (($elsettings->imageenabled == 2 || $elsettings->imageenabled == 1) && !empty($file['name'])) {
         jimport('joomla.filesystem.file');
         $base_Dir = JPATH_SITE . '/images/eventlist/events/';
         //check the image
         $check = ELImage::check($file, $elsettings);
         if ($check === false) {
             $mainframe->redirect($_SERVER['HTTP_REFERER']);
         }
         //sanitize the image filename
         $filename = ELImage::sanitize($base_Dir, $file['name']);
         $filepath = $base_Dir . $filename;
         if (!JFile::upload($file['tmp_name'], $filepath)) {
             $this->setError(JText::_('UPLOAD FAILED'));
             return false;
         } else {
             $row->datimage = $filename;
         }
     } else {
         //keep image if edited and left blank
         $row->datimage = $curimage;
     }
     //end image if
     $editoruser = ELUser::editoruser();
     if (!$editoruser) {
         //check datdescription --> wipe out code
         $row->datdescription = strip_tags($row->datdescription, '<br><br/>');
         //convert the linux \n (Mac \r, Win \r\n) to <br /> linebreaks
         $row->datdescription = str_replace(array("\r\n", "\r", "\n"), "<br />", $row->datdescription);
         // cut too long words
         $row->datdescription = wordwrap($row->datdescription, 75, ' ', 1);
         //check length
         $length = JString::strlen($row->datdescription);
         if ($length > $elsettings->datdesclimit) {
             //too long then shorten datdescription
             $row->datdescription = JString::substr($row->datdescription, 0, $elsettings->datdesclimit);
             //add ...
             $row->datdescription = $row->datdescription . '...';
         }
     }
     $row->title = trim(JFilterOutput::ampReplace($row->title));
     //set registration regarding the el settings
     switch ($elsettings->showfroregistra) {
         case 0:
             $row->registra = 0;
             break;
         case 1:
             $row->registra = 1;
             break;
         case 2:
             $row->registra = $row->registra;
             break;
     }
     switch ($elsettings->showfrounregistra) {
         case 0:
             $row->unregistra = 0;
             break;
         case 1:
             $row->unregistra = 1;
             break;
         case 2:
             if ($elsettings->showfroregistra >= 1) {
                 $row->unregistra = $row->unregistra;
             } else {
                 $row->unregistra = 0;
             }
             break;
     }
     //Make sure the table is valid
     if (!$row->check($elsettings)) {
         $this->setError($row->getError());
         return false;
     }
     //is this an edited event or not?
     //after store we allways have an id
     $edited = $row->id ? $row->id : false;
     //store it in the db
     if (!$row->store(true)) {
         JError::raiseError(500, $this->_db->stderr());
         return false;
     }
     $this->_db->setQuery('SELECT * FROM #__eventlist_venues WHERE id = ' . (int) $row->locid);
     $rowloc = $this->_db->loadObject();
     jimport('joomla.utilities.mail');
     $link = JURI::base() . JRoute::_('index.php?view=details&id=' . $row->id, false);
     //create the mail for the site owner
     if ($elsettings->mailinform == 1 || $elsettings->mailinform == 3) {
         $mail = JFactory::getMailer();
         $state = $row->published ? JText::sprintf('MAIL EVENT PUBLISHED', $link) : JText::_('MAIL EVENT UNPUBLISHED');
         if ($edited) {
             $modified_ip = getenv('REMOTE_ADDR');
             $edited = JHTML::Date($row->modified, JText::_('DATE_FORMAT_LC2'));
             $mailbody = JText::sprintf('MAIL EDIT EVENT', $user->name, $user->username, $user->email, $modified_ip, $edited, $row->title, $row->dates, $row->times, $rowloc->venue, $rowloc->city, $row->datdescription, $state);
             $mail->setSubject($SiteName . JText::_('EDIT EVENT MAIL'));
         } else {
             $created = JHTML::Date($row->created, JText::_('DATE_FORMAT_LC2'));
             $mailbody = JText::sprintf('MAIL NEW EVENT', $user->name, $user->username, $user->email, $row->author_ip, $created, $row->title, $row->dates, $row->times, $rowloc->venue, $rowloc->city, $row->datdescription, $state);
             $mail->setSubject($SiteName . JText::_('NEW EVENT MAIL'));
         }
         $receivers = explode(',', trim($elsettings->mailinformrec));
         $mail->addRecipient($receivers);
         $mail->setSender(array($MailFrom, $FromName));
         $mail->setBody($mailbody);
         $sent = $mail->Send();
     }
     //mail end
     //create the mail for the user
     if ($elsettings->mailinformuser == 1 || $elsettings->mailinformuser == 3) {
         $usermail = JFactory::getMailer();
         $state = $row->published ? JText::sprintf('USER MAIL EVENT PUBLISHED', $link) : JText::_('USER MAIL EVENT UNPUBLISHED');
         if ($edited) {
             $edited = JHTML::Date($row->modified, JText::_('DATE_FORMAT_LC2'));
             $mailbody = JText::sprintf('USER MAIL EDIT EVENT', $user->name, $user->username, $edited, $row->title, $row->dates, $row->times, $rowloc->venue, $rowloc->city, $row->datdescription, $state);
             $usermail->setSubject($SiteName . JText::_('EDIT USER EVENT MAIL'));
         } else {
             $created = JHTML::Date($row->created, JText::_('DATE_FORMAT_LC2'));
             $mailbody = JText::sprintf('USER MAIL NEW EVENT', $user->name, $user->username, $created, $row->title, $row->dates, $row->times, $rowloc->venue, $rowloc->city, $row->datdescription, $state);
             $usermail->setSubject($SiteName . JText::_('NEW USER EVENT MAIL'));
         }
         $usermail->addRecipient($user->email);
         $usermail->setSender(array($MailFrom, $FromName));
         $usermail->setBody($mailbody);
         $sent = $usermail->Send();
     }
     return $row->id;
 }