Пример #1
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();
     $upcomingevents = $this->get('UpcomingEvents');
     //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
     $params->def('page_title', JText::_('COM_REDEVENT_UPCOMING_EVENTS_TITLE'));
     /* 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);
     $this->assignRef('upcomingevents', $upcomingevents);
     $this->assignRef('params', $params);
     $this->assign('action', JRoute::_('index.php?option=com_redevent&view=upcomingevents'));
     parent::display($tpl);
 }
Пример #2
0
 /**
  * Method to get the Venues
  *
  * @access public
  * @return array
  */
 function &getData()
 {
     $mainframe =& JFactory::getApplication();
     $menu =& JSite::getMenu();
     $item = $menu->getActive();
     $params =& $menu->getParams($item->id);
     $elsettings =& redEVENTHelper::config();
     // Lets load the content if it doesn't already exist
     if (empty($this->_data)) {
         $query = $this->_buildQuery();
         // Get a reference to the global cache object.
         $cache =& JFactory::getCache('redevent');
         $this->_data = $cache->call(array('RedeventModelCountriesmap', '_getResultList'), $query);
         $countrycoords = redEVENTHelperCountries::getCountrycoordArray();
         $k = 0;
         for ($i = 0; $i < count($this->_data); $i++) {
             $country =& $this->_data[$i];
             $country->flag = REOutput::getFlag($country->iso2);
             $country->flagurl = REOutput::getFlagUrl($country->iso2);
             $country->latitude = $countrycoords[$country->iso2][0];
             $country->longitude = $countrycoords[$country->iso2][1];
             //create target link
             $country->targetlink = JRoute::_(JURI::base() . 'index.php?option=com_redevent&view=countryevents&filter_country=' . $country->iso2);
             $k = 1 - $k;
         }
     }
     return $this->_data;
 }
Пример #3
0
 /**
  * Creates the week View
  *
  * @since 2.0
  */
 function display($tpl = null)
 {
     $application = JFactory::getApplication();
     //initialize variables
     $document = JFactory::getDocument();
     $settings = redEVENTHelper::config();
     $menu = JSite::getMenu();
     $item = $menu->getActive();
     $params = $application->getParams();
     $uri = JFactory::getURI();
     //add css file
     if (!$params->get('custom_css')) {
         $document->addStyleSheet($this->baseurl . '/components/com_redevent/assets/css/redevent.css');
         $document->addStyleSheet($this->baseurl . '/components/com_redevent/assets/css/week.css');
     } else {
         $document->addStyleSheet($params->get('custom_css'));
     }
     // add js
     JHTML::_('behavior.mootools');
     $pop = JRequest::getBool('pop');
     $pathway = $application->getPathWay();
     //get data from model
     $rows =& $this->get('Data');
     $week =& $this->get('Day');
     //params
     if ($item) {
         $title = $item->title;
     } else {
         $title = JText::sprintf('COM_REDEVENT_WEEK_HEADER', $this->get('weeknumber'), $this->get('year'));
     }
     $params->def('page_title', $title);
     //pathway
     $pathway->addItem(JText::sprintf('COM_REDEVENT_WEEK_HEADER', $this->get('weeknumber'), $this->get('year')));
     //Set Page title
     if ($item && !$item->title) {
         $document->setTitle($params->get('page_title'));
         $document->setMetadata('keywords', $params->get('page_title'));
     }
     $this->assignRef('data', $rows);
     $this->assignRef('title', $title);
     $this->assignRef('params', $params);
     $this->assign('week', $this->get('week'));
     $this->assign('weeknumber', $this->get('weeknumber'));
     $this->assign('year', $this->get('year'));
     $this->assign('weekdays', $this->get('weekdays'));
     $this->assign('next', $this->get('nextweek'));
     $this->assign('previous', $this->get('previousweek'));
     $cols = explode(',', $params->get('lists_columns', 'date, title, venue, city, category'));
     array_unshift($cols, 'time');
     array_unique($cols);
     $exclude = array('date');
     $cols = array_diff($cols, $exclude);
     $cols = redEVENTHelper::validateColumns($cols);
     $this->assign('columns', $cols);
     $start = JComponentHelper::getParams('com_redevent')->get('week_start') == 'MO' ? 1 : 0;
     $this->assign('start', $start);
     parent::display($tpl);
 }
Пример #4
0
 /**
  * Creates the output for the details view
  *
  * @since 2.0
  */
 function display($tpl = null)
 {
     $mainframe =& JFactory::getApplication();
     $id = JRequest::getInt('id');
     $settings = redEVENTHelper::config();
     // Get data from the model
     $row = $this->get('Details');
     // initiate new CALENDAR
     $vcal = redEVENTHelper::getCalendarTool();
     $vcal->setProperty('unique_id', 'session' . $row->xref . '@' . $mainframe->getCfg('sitename'));
     $vcal->setConfig("filename", "event" . $row->xref . ".ics");
     redEVENTHelper::icalAddEvent($vcal, $row);
     $vcal->returnCalendar();
     // generate and redirect output to user browser
     //		echo $vcal->createCalendar(); // debug
     $mainframe->close();
 }
Пример #5
0
 /**
  * Method to get the Venues
  *
  * @access public
  * @return array
  */
 function &getData()
 {
     $mainframe =& JFactory::getApplication();
     $menu =& JSite::getMenu();
     $item = $menu->getActive();
     $params =& $menu->getParams($item->id);
     $elsettings =& redEVENTHelper::config();
     // Lets load the content if it doesn't already exist
     if (empty($this->_data)) {
         $query = $this->_buildQuery();
         // Get a reference to the global cache object.
         $cache =& JFactory::getCache('redevent');
         $this->_data = $cache->call(array('RedeventModelVenuesmap', '_getResultList'), $query);
         $k = 0;
         for ($i = 0; $i < count($this->_data); $i++) {
             $venue =& $this->_data[$i];
             //Create image information
             $venue->limage = redEVENTImage::flyercreator($venue->locimage);
             //Generate Venuedescription
             if (!empty($venue->locdescription)) {
                 //execute plugins
                 $venue->locdescription = 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 target link
             $venue->targetlink = JRoute::_(RedeventHelperRoute::getVenueEventsRoute($venue->slug));
             $k = 1 - $k;
         }
     }
     return $this->_data;
 }
Пример #6
0
 /**
  * Creates the Calendar View
  *
  * @since 1.1
  */
 function display($tpl = null)
 {
     $app =& JFactory::getApplication();
     // Load tooltips behavior
     JHTML::_('behavior.tooltip');
     //initialize variables
     $document =& JFactory::getDocument();
     $menu =& JSite::getMenu();
     $settings =& redEVENTHelper::config();
     $item = $menu->getActive();
     $params =& $app->getParams();
     $uri =& JFactory::getURI();
     $pathway =& $app->getPathWay();
     //add css file
     $document->addStyleSheet($this->baseurl . '/components/com_redevent/assets/css/redevent.css');
     $document->addCustomTag('<!--[if IE]><style type="text/css">.floattext{zoom:1;}, * html #redevent dd { height: 1%; }</style><![endif]-->');
     $document->addStyleSheet($this->baseurl . '/components/com_redevent/assets/css/redeventcalendar.css');
     // add javascript
     $document->addScript($this->baseurl . '/components/com_redevent/assets/js/calendar.js');
     $year = (int) JRequest::getVar('yearID', strftime("%Y"));
     $month = (int) JRequest::getVar('monthID', strftime("%m"));
     //get data from model and set the month
     $model =& $this->getModel();
     $model->setDate(mktime(0, 0, 1, $month, 1, $year));
     $rows =& $this->get('Data');
     //Set Meta data
     $document->setTitle($item->title);
     //Set Page title
     $pagetitle = $params->def('page_title', $item->title);
     $this->document->setTitle($pagetitle);
     //init calendar
     $cal = new RECalendar($year, $month, 0, $app->getCfg('offset'));
     $cal->enableMonthNav('index.php?option=com_redevent&view=calendar');
     $cal->setFirstWeekDay($params->get('week_start', "SU") == 'SU' ? 0 : 1);
     $cal->enableDayLinks(false);
     $this->assignRef('rows', $rows);
     $this->assignRef('params', $params);
     $this->assignRef('settings', $settings);
     $this->assignRef('cal', $cal);
     parent::display($tpl);
 }
Пример #7
0
 /**
  * Creates the raw output for the simplelist view
  *
  * @since 2.0
  */
 function display($tpl = null)
 {
     $mainframe =& JFactory::getApplication();
     $settings = redEVENTHelper::config();
     // Get data from the model
     $model = $this->getModel();
     $model->setLimit($settings->get('ical_max_items', 100));
     $model->setLimitstart(0);
     $rows =& $model->getData();
     // initiate new CALENDAR
     $vcal = redEVENTHelper::getCalendarTool();
     $vcal->setProperty('unique_id', 'allevents@' . $mainframe->getCfg('sitename'));
     $vcal->setConfig("filename", "events.ics");
     foreach ($rows as $row) {
         redEVENTHelper::icalAddEvent($vcal, $row);
     }
     $vcal->returnCalendar();
     // generate and redirect output to user browser
     //		echo $vcal->createCalendar(); // debug
     $mainframe->close();
 }
Пример #8
0
 /**
  * Creates the output for the registration view
  *
  * @since 1.5
  */
 function display($tpl = null)
 {
     $mainframe =& Jfactory::getApplication();
     $document =& JFactory::getDocument();
     $user =& JFactory::getUser();
     $dispatcher =& JDispatcher::getInstance();
     $config = redEVENTHelper::config();
     $acl = UserAcl::getInstance();
     $event = $this->get('SessionDetails');
     if ($this->getLayout() == 'confirmed') {
         $message = $event->confirmation_message;
         $document->setTitle($event->title . ' - ' . JText::_('COM_REDEVENT_REGISTRATION_CONFIRMED_PAGE_TITLE'));
     } else {
         if ($this->getLayout() == 'review') {
             $message = $event->review_message;
             $document->setTitle($event->title . ' - ' . JText::_('COM_REDEVENT_REGISTRATION_REVIEW_PAGE_TITLE'));
         } else {
             if ($this->getLayout() == 'edit') {
                 return $this->_displayEdit($tpl);
             } else {
                 if ($this->getLayout() == 'cancel') {
                     return $this->_displayCancel($tpl);
                 } else {
                     echo 'layout not defined';
                     return;
                 }
             }
         }
     }
     /* This loads the tags replacer */
     JView::loadHelper('tags');
     /* Start the tag replacer */
     $tags = new redEVENT_tags();
     $tags->setXref(JRequest::getInt('xref'));
     $message = $tags->ReplaceTags($message);
     $this->assignRef('tags', $tags);
     $this->assignRef('message', $message);
     $this->assignRef('event', $event);
     parent::display($tpl);
 }
Пример #9
0
 /**
  * Method to build the sortlists
  *
  * @access private
  * @return array
  * @since 0.9
  */
 function _buildSortLists()
 {
     $elsettings =& redEVENTHelper::config();
     $filter_order = JRequest::getCmd('filter_order', 'x.dates');
     $filter_order_Dir = JRequest::getWord('filter_order_Dir', 'ASC');
     $filter = $this->escape(JRequest::getString('filter'));
     $filter_type = JRequest::getString('filter_type');
     $sortselects = array();
     $sortselects[] = JHTML::_('select.option', 'title', JText::_('COM_REDEVENT_FILTER_SELECT_EVENT'));
     $sortselects[] = JHTML::_('select.option', 'venue', JText::_('COM_REDEVENT_FILTER_SELECT_VENUE'));
     $sortselects[] = JHTML::_('select.option', 'city', JText::_('COM_REDEVENT_FILTER_SELECT_CITY'));
     $sortselects[] = JHTML::_('select.option', 'type', JText::_('COM_REDEVENT_FILTER_SELECT_CATEGORY'));
     $sortselect = JHTML::_('select.genericlist', $sortselects, 'filter_type', 'size="1" class="inputbox"', 'value', 'text', $filter_type);
     $lists['order_Dir'] = $filter_order_Dir;
     $lists['order'] = $filter_order;
     $lists['filter'] = $filter;
     $lists['filter_types'] = $sortselect;
     return $lists;
 }
Пример #10
0
?>
</th>
		<th></th>
		<th><?php 
echo JText::_('COM_REDEVENT_EVENT_VENUE');
?>
</th>
		<th><?php 
echo JText::_('COM_REDEVENT_EVENT_PRICE');
?>
</th>  
	</tr>
</thead>
<tbody>
<?php 
$elsettings = redEVENTHelper::config();
$imagepath = JURI::root() . 'administrator/components/com_redevent/assets/images/';
foreach ($this->upcomingvenueevents as $key => $event) {
    $event_url = JRoute::_('index.php?option=com_redevent&view=details&xref=' . $event->xref . '&id=' . $event->slug);
    $venue_url = JRoute::_('index.php?option=com_redevent&view=venueevents&id=' . $event->venueslug);
    ?>
	<tr>
		<td><?php 
    echo JHTML::_('link', $event_url, $event->full_title);
    ?>
</td>
		<td><?php 
    echo $event->location;
    ?>
</td>
		<td><?php 
Пример #11
0
 /**
  * Creates the output for the details view
  *
  * @since 0.9
  */
 function display($tpl = null)
 {
     $mainframe =& JFactory::getApplication();
     $uri =& JFactory::getUri();
     /* Set which page to show */
     $tpl = JRequest::getVar('page', null);
     $params =& $mainframe->getParams('com_redevent');
     $document = JFactory::getDocument();
     $user = JFactory::getUser();
     $dispatcher = JDispatcher::getInstance();
     $elsettings = redEVENTHelper::config();
     $acl = UserAcl::getInstance();
     if ($params->get('gplusone', 1)) {
         $document->addScript('https://apis.google.com/js/plusone.js');
     }
     if ($params->get('tweet', 1)) {
         $document->addScript('http://platform.twitter.com/widgets.js');
     }
     $row = $this->get('Details');
     $registers = $this->get('Registers');
     $roles = $this->get('Roles');
     $prices = $this->get('Prices');
     $register_fields = $this->get('FormFields');
     $regcheck = $this->get('Usercheck');
     /* Get the venues information */
     $this->_venues = $this->get('Venues');
     /* This loads the tags replacer */
     JView::loadHelper('tags');
     $tags = new redEVENT_tags();
     $tags->setEventId(JRequest::getInt('id'));
     $tags->setXref(JRequest::getInt('xref'));
     $this->assignRef('tags', $tags);
     //get menu information
     $menu =& JSite::getMenu();
     $item = $menu->getActive();
     if (!$item) {
         $item = $menu->getDefault();
     }
     //Check if the id exists
     if ($row->did == 0) {
         return JError::raiseError(404, JText::sprintf('COM_REDEVENT_Event_d_not_found', $row->did));
     }
     //Check if user has access to the details
     if ($params->get('showdetails', 1) == 0) {
         $mainframe->redirect('index.php', JText::_('COM_REDEVENT_EVENT_DETAILS_NOT_AVAILABLE'), 'error');
     }
     //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]-->');
     //Print
     $pop = JRequest::getBool('pop');
     $params->def('page_title', $row->full_title);
     if ($pop) {
         $params->set('popup', 1);
     }
     $print_link = JRoute::_('index.php?option=com_redevent&view=details&id=' . $row->slug . '&xref=' . JRequest::getInt('xref') . '&pop=1&tmpl=component');
     //pathway
     $pathway =& $mainframe->getPathWay();
     $pathway->addItem($row->full_title, JRoute::_('index.php?option=com_redevent&view=details&id=' . $row->slug));
     //Check user if he can edit
     $allowedtoeditevent = $acl->canEditEvent($row->did);
     //Timecheck for registration
     $jetzt = date("Y-m-d");
     $now = strtotime($jetzt);
     $date = strtotime($row->dates);
     $timecheck = $now - $date;
     //is the user allready registered at the event
     if ($regcheck) {
         // add javascript code for cancel button on attendees layout.
         JHTML::_('behavior.mootools');
         $js = " window.addEvent('domready', function(){\n\t\t            \$\$('.unreglink').addEvent('click', function(event){\n\t\t                  if (confirm('" . JText::_('COM_REDEVENT_CONFIRM_CANCEL_REGISTRATION') . "')) {\n                      \treturn true;\n\t                    }\n\t                    else {\n\t                    \tif (event.preventDefault) {\n\t                    \t\tevent.preventDefault();\n\t\t\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t\t\tevent.returnValue = false;\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\treturn false;\n                    \t}\n\t\t            });\t\t            \n\t\t        }); ";
         $document->addScriptDeclaration($js);
     }
     //Generate Eventdescription
     if ($row->datdescription == '' || $row->datdescription == '<br />') {
         $row->datdescription = JText::_('COM_REDEVENT_NO_DESCRIPTION');
     } else {
         //Execute Plugins
         $row->datdescription = JHTML::_('content.prepare', $row->datdescription);
     }
     // generate Metatags
     $meta_keywords_content = "";
     if (!empty($row->meta_keywords)) {
         $keywords = explode(",", $row->meta_keywords);
         foreach ($keywords as $keyword) {
             if ($meta_keywords_content != "") {
                 $meta_keywords_content .= ", ";
             }
             if (preg_match("/[\\/[\\/]/", $keyword)) {
                 $keyword = trim(str_replace("[", "", str_replace("]", "", $keyword)));
                 $buffer = $this->keyword_switcher($keyword, $row, $elsettings->get('formattime', '%H:%M'), $elsettings->get('formatdate', '%d.%m.%Y'));
                 if ($buffer != "") {
                     $meta_keywords_content .= $buffer;
                 } else {
                     $meta_keywords_content = substr($meta_keywords_content, 0, strlen($meta_keywords_content) - 2);
                     // remove the comma and the white space
                 }
             } else {
                 $meta_keywords_content .= $keyword;
             }
         }
     }
     if (!empty($row->meta_description)) {
         $description = explode("[", $row->meta_description);
         $description_content = "";
         foreach ($description as $desc) {
             $keyword = substr($desc, 0, strpos($desc, "]", 0));
             if ($keyword != "") {
                 $description_content .= $this->keyword_switcher($keyword, $row, $elsettings->get('formattime', '%H:%M'), $elsettings->get('formatdate', '%d.%m.%Y'));
                 $description_content .= substr($desc, strpos($desc, "]", 0) + 1);
             } else {
                 $description_content .= $desc;
             }
         }
     } else {
         $description_content = "";
     }
     //set page title and meta stuff
     $document->setTitle($row->full_title);
     $document->setMetadata('keywords', $meta_keywords_content);
     $document->setDescription(strip_tags($description_content));
     // more metadata
     $document->addCustomTag('<meta property="og:title" content="' . $row->full_title . '"/>');
     $document->addCustomTag('<meta property="og:type" content="event"/>');
     $document->addCustomTag('<meta property="og:url" content="' . htmlspecialchars($uri->toString()) . '"/>');
     if ($row->datimage) {
         $document->addCustomTag('<meta property="og:image" content="' . JURI::base() . 'images/redevent/events/' . $row->datimage . '"/>');
     }
     $document->addCustomTag('<meta property="og:site_name" content="' . $mainframe->getCfg('sitename') . '"/>');
     $document->addCustomTag('<meta property="og:description" content="' . JFilterOutput::cleanText($row->summary) . '"/>');
     //build the url
     if (!empty($row->url) && strtolower(substr($row->url, 0, 7)) != "http://") {
         $row->url = 'http://' . $row->url;
     }
     /* Get the Venue Dates */
     $venuedates = $this->get('VenueDates');
     //add alternate feed link
     $link = 'index.php?option=com_redevent&view=details&format=feed';
     if (!empty($row->slug)) {
         $link .= '&id=' . $row->slug;
     }
     $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 unregistration rights
     $unreg_check = redEVENTHelper::canUnregister($row->xref);
     //manages attendees
     $manage_attendees = $this->get('ManageAttendees') || $this->get('ViewFullAttendees');
     $candeleteattendees = $this->get('ManageAttendees');
     $view_attendees_list = $row->show_names && in_array($params->get('frontend_view_attendees_access'), JFactory::getUser()->getAuthorisedViewLevels());
     //assign vars to jview
     $this->assignRef('row', $row);
     $this->assignRef('params', $params);
     $this->assignRef('user', $user);
     $this->assignRef('allowedtoeditevent', $allowedtoeditevent);
     $this->assignRef('manage_attendees', $manage_attendees);
     $this->assignRef('view_attendees_list', $view_attendees_list);
     $this->assignRef('candeleteattendees', $candeleteattendees);
     $this->assignRef('print_link', $print_link);
     $this->assignRef('registers', $registers);
     $this->assignRef('registersfields', $register_fields);
     $this->assignRef('elsettings', $elsettings);
     $this->assignRef('item', $item);
     $this->assignRef('messages', $messages);
     $this->assignRef('venuedates', $venuedates);
     $this->assignRef('unreg_check', $unreg_check);
     $this->assignRef('roles', $roles);
     $this->assignRef('prices', $prices);
     $this->assignRef('uri', $uri);
     $this->assignRef('lang', JFactory::getLanguage());
     if ($params->get('fbopengraph', 1)) {
         $this->_opengraph();
     }
     $tpl = JRequest::getVar('tpl', $tpl);
     if ($tpl == '') {
         switch ($row->details_layout) {
             case 2:
                 $this->setLayout('fixed');
                 break;
             case 1:
                 $this->setLayout('default');
                 break;
             case 0:
                 $this->setLayout($params->get('details_layout', 'fixed'));
                 break;
         }
     }
     parent::display($tpl);
 }
Пример #12
0
 /**
  * Method to get the Categories
  *
  * @access public
  * @return array
  */
 function &getData()
 {
     $elsettings =& redEVENTHelper::config();
     // Lets load the content if it doesn't already exist
     if (empty($this->_data)) {
         $query = $this->_buildQuery();
         $this->_data = $this->_getList($query, $this->getState('limitstart'), $this->getState('limit'));
         $k = 0;
         $count = count($this->_data);
         for ($i = 0; $i < $count; $i++) {
             $category =& $this->_data[$i];
             //create target link
             $task = JRequest::getWord('task');
             $category->linktext = JText::_('COM_REDEVENT_SHOW_EVENTS');
             $category->linktarget = RedeventHelperRoute::getCategoryEventsRoute($category->slug);
             $k = 1 - $k;
         }
     }
     return $this->_data;
 }
Пример #13
0
 /**
  * Formats time
  *
  * @param string $date
  * @param string $time
  * 
  * @return string $formattime
  *
  * @since 0.9
  */
 function formatprice($price, $currency = null)
 {
     $settings =& redEVENTHelper::config();
     if (!$price) {
         return JText::_('COM_REDEVENT_EVENT_PRICE_FREE');
     }
     switch ($settings->get('currency_decimals', 'decimals')) {
         case 'decimals':
             //Format price
             $formatprice = number_format($price, 2, $settings->get('currency_decimal_separator', ','), $settings->get('currency_thousand_separator', '.'));
             break;
         case 'comma':
             //Format price
             $formatprice = number_format($price, 0, $settings->get('currency_decimal_separator', ','), $settings->get('currency_thousand_separator', '.')) . ',-';
             break;
         case 'none':
             //Format price
             $formatprice = number_format($price, 0, $settings->get('currency_decimal_separator', ','), $settings->get('currency_thousand_separator', '.'));
             break;
     }
     if ($currency) {
         return $currency . ' ' . $formatprice;
     } else {
         return $formatprice;
     }
 }
Пример #14
0
 /**
  * Method to build the sortlists
  *
  * @access private
  * @return array
  * @since 0.9
  */
 function _buildSortLists()
 {
     $app =& JFactory::getApplication();
     $elsettings =& redEVENTHelper::config();
     $filter_order = JRequest::getCmd('filter_order', 'x.dates');
     $filter_order_Dir = JRequest::getWord('filter_order_Dir', 'ASC');
     $filter = $app->getUserState('com_redevent.day.filter');
     $filter_type = $app->getUserState('com_redevent.day.filter_type');
     $sortselects = array();
     $sortselects[] = JHTML::_('select.option', 'title', JText::_('COM_REDEVENT_FILTER_SELECT_EVENT'));
     $sortselects[] = JHTML::_('select.option', 'venue', JText::_('COM_REDEVENT_FILTER_SELECT_VENUE'));
     $sortselects[] = JHTML::_('select.option', 'city', JText::_('COM_REDEVENT_FILTER_SELECT_CITY'));
     $sortselects[] = JHTML::_('select.option', 'type', JText::_('COM_REDEVENT_FILTER_SELECT_CATEGORY'));
     $sortselect = JHTML::_('select.genericlist', $sortselects, 'filter_type', 'size="1" class="inputbox"', 'value', 'text', $filter_type);
     $lists['order_Dir'] = $filter_order_Dir;
     $lists['order'] = $filter_order;
     $lists['filter'] = $filter;
     $lists['filter_types'] = $sortselect;
     return $lists;
 }
Пример #15
0
    /**
     * Creates the Venueevents View
     *
     * @since 0.9
     */
    function display()
    {
        $document =& JFactory::getDocument();
        $document->link = JRoute::_('index.php?option=com_redevent&view=upcomingvenueevents');
        $upcomingevents = $this->get('UpcomingVenueEvents');
        $elsettings = redEVENTHelper::config();
        $imagepath = JURI::root() . 'administrator/components/com_redevent/assets/images/';
        foreach ((array) $upcomingevents as $key => $event) {
            $event_url = RedeventHelperRoute::getDetailsRoute($event->slug, $event->xslug);
            $venue_url = RedeventHelperRoute::getVenueEventsRoute($event->venueslug);
            $description = '<table>
			<tbody>
			<tr>
				<td width="100">Course:</td><td>' . JHTML::_('link', $event_url, $event->full_title, 'target="_blank"') . '</td>
			</tr><tr>
				<td>Where:</td><td>' . $event->location . ' &nbsp; ' . REOutput::getFlag($event->country) . '</td>
			</tr><tr>				
				<td>Date:</td><td>' . REOutput::formatdate($event->dates, $event->times) . '</td>
			</tr><tr>				
				<td>Duration:</td><td>' . $event->duration;
            if ($event->duration == 1) {
                $description .= JText::_('COM_REDEVENT_DAY');
            } else {
                if ($event->duration > 1) {
                    $description .= JText::_('COM_REDEVENT_DAYS');
                }
            }
            $description .= '</td>
			</tr><tr>			
				<td>Venue:</td><td>' . JHTML::_('link', $venue_url, $event->venue, 'target="_blank"') . '</td>
			</tr><tr>				
				<td>Price:</td><td class="re-price">' . REOutput::formatListPrices($event->prices) . '</td>
			</tr><tr>
				<td>Credits:</td><td>' . $event->course_credit . '</td>
			</tr><tr>			
				<td>Signup:</td><td>';
            /* Get the different submission types */
            $submissiontypes = explode(',', $event->submission_types);
            $venues_html = '';
            foreach ($submissiontypes as $key => $subtype) {
                switch ($subtype) {
                    case 'email':
                        $venues_html .= '&nbsp;' . JHTML::_('link', JRoute::_('index.php?option=com_redevent&view=signup&task=signup&subtype=email&xref=' . $event->xref . '&id=' . $event->id), JHTML::_('image', $imagepath . $elsettings->get('signup_email_img'), JText::_($elsettings->get('signup_email_text')), 'width="24px" height="24px" border="0"'), 'target="_blank"') . '&nbsp; ';
                        break;
                    case 'phone':
                        $venues_html .= '&nbsp;' . JHTML::_('link', JRoute::_('index.php?option=com_redevent&view=signup&task=signup&subtype=phone&xref=' . $event->xref . '&id=' . $event->id), JHTML::_('image', $imagepath . $elsettings->get('signup_phone_img'), JText::_($elsettings->get('signup_phone_text')), 'width="24px" height="24px" border="0"'), 'target="_blank"') . '&nbsp; ';
                        break;
                    case 'external':
                        $venues_html .= '&nbsp;' . JHTML::_('link', $event->submission_type_external, JHTML::_('image', $imagepath . $elsettings->get('signup_external_img'), $elsettings->get('signup_external_text'), 'width="24px" height="24px" border="0"'), 'target="_blank"') . '&nbsp; ';
                        break;
                    case 'webform':
                        if ($event->prices && count($event->prices)) {
                            foreach ($event->prices as $p) {
                                $img = empty($p->image) ? JHTML::_('image', $imagepath . $elsettings->get('signup_webform_img'), JText::_($elsettings->get('signup_webform_text'))) : JHTML::_('image', $imagepath . $p->image, JText::_($p->name));
                                $link = JRoute::_(RedeventHelperRoute::getSignupRoute('webform', $event->slug, $event->xslug, $p->slug));
                                $venues_html .= '&nbsp;' . JHTML::_('link', $link, $img) . '&nbsp; ';
                            }
                        } else {
                            $venues_html .= '&nbsp;' . JHTML::_('link', JRoute::_(RedeventHelperRoute::getSignupRoute('webform', $event->slug, $event->xslug)), JHTML::_('image', $imagepath . $elsettings->get('signup_webform_img'), JText::_($elsettings->get('signup_webform_text')))) . '&nbsp; ';
                        }
                        break;
                    case 'formaloffer':
                        $venues_html .= '&nbsp;' . JHTML::_('link', JRoute::_('index.php?option=com_redevent&view=signup&subtype=formaloffer&task=signup&xref=' . $event->xslug . '&id=' . $event->slug), JHTML::_('image', $imagepath . $elsettings->get('signup_formal_offer_img'), JText::_($elsettings->get('signup_formal_offer_text')), 'width="24px" height="24px" border="0"'), 'target="_blank"') . '&nbsp; ';
                        break;
                }
            }
            $description .= $venues_html;
            $description .= '</td></tr></tbody></table>';
            $item = new JFeedItem();
            $item->title = $event->full_title;
            $item->link = $event_url;
            $item->description = $description;
            $item->date = '';
            $item->category = $event->venue;
            // loads item info into rss array
            $document->addItem($item);
        }
    }
Пример #16
0
 /**
  * Creates the Event Feed of the Venue Category
  *
  * @since 0.9
  */
 function display()
 {
     $mainframe =& JFactory::getApplication();
     $doc =& JFactory::getDocument();
     $elsettings =& redEVENTHelper::config();
     // Get some data from the model
     JRequest::setVar('limit', $mainframe->getCfg('feed_limit'));
     $rows =& $this->get('Data');
     foreach ($rows as $row) {
         // strip html from feed item title
         $title = $this->escape($row->full_title);
         $title = html_entity_decode($title);
         // strip html from feed item category
         if (!empty($row->categories)) {
             $category = array();
             foreach ($row->categories as $cat) {
                 $category[] = $cat->catname;
             }
             $category = $this->escape(implode(', ', $category));
             $category = html_entity_decode($category);
         } else {
             $category = '';
         }
         //Format date
         if (redEVENTHelper::isValidDate($row->dates)) {
             $date = strftime($elsettings->get('formatdate', '%d.%m.%Y'), strtotime($row->dates));
             if (!redEVENTHelper::isValidDate($row->enddates) || $row->enddates == $row->dates) {
                 $displaydate = $date;
             } else {
                 $enddate = strftime($elsettings->get('formatdate', '%d.%m.%Y'), strtotime($row->enddates));
                 $displaydate = $date . ' - ' . $enddate;
             }
         } else {
             $displaydate = JText::_('COM_REDEVENT_OPEN_DATE');
         }
         //Format time
         if ($row->times) {
             $time = strftime($elsettings->get('formattime', '%H:%M'), strtotime($row->times));
             $displaytime = $time;
         }
         if ($row->endtimes) {
             $endtime = strftime($elsettings->get('formattime', '%H:%M'), strtotime($row->endtimes));
             $displaytime = $time . ' - ' . $endtime;
         }
         // url link to article
         // & used instead of &amp; as this is converted by feed creator
         $link = RedeventHelperRoute::getDetailsRoute($row->slug, $row->xslug);
         $link = JRoute::_($link);
         // feed item description text
         $description = JText::_('COM_REDEVENT_TITLE') . ': ' . $title . '<br />';
         $description .= JText::_('COM_REDEVENT_VENUE') . ': ' . $row->venue . ' / ' . $row->city . '<br />';
         $description .= JText::_('COM_REDEVENT_CATEGORY') . ': ' . $category . '<br />';
         $description .= JText::_('COM_REDEVENT_DATE') . ': ' . $displaydate . '<br />';
         $description .= JText::_('COM_REDEVENT_TIME') . ': ' . $displaytime . '<br />';
         //$description .= JText::_('COM_REDEVENT_DESCRIPTION' ).': '.$row->datdescription;
         @($created = $row->created ? date('r', strtotime($row->created)) : '');
         // load individual item creator class
         $item = new JFeedItem();
         $item->title = $title;
         $item->link = $link;
         $item->description = $description;
         $item->date = $created;
         $item->category = $category;
         // loads item info into rss array
         $doc->addItem($item);
     }
 }
Пример #17
0
 function _displayRssCal()
 {
     define('CACHE', './cache');
     $mainframe =& JFactory::getApplication();
     $elsettings = redEVENTHelper::config();
     $id = JRequest::getInt('id');
     $offset = (double) $mainframe->getCfg('offset');
     $hours = $offset >= 0 ? floor($offset) : ceil($offset);
     $mins = abs($offset - $hours) * 60;
     $utcoffset = sprintf('%+03d:%02d', $hours, $mins);
     $feed = new rsscalCreator('redEVENT feed', JURI::base(), '');
     $feed->setFilename(CACHE, 'venue' . $id . '.rss');
     $model = $this->getModel();
     $model->setLimit($elsettings->get('ical_max_items', 100));
     $model->setLimitstart(0);
     $rows =& $this->get('Data');
     foreach ($rows as $row) {
         // strip html from feed item title
         $title = $this->escape($row->full_title);
         $title = html_entity_decode($title);
         // strip html from feed item category
         if (!empty($row->categories)) {
             $category = array();
             foreach ($row->categories as $cat) {
                 $category[] = $cat->catname;
             }
             $category = $this->escape(implode(', ', $category));
             $category = html_entity_decode($category);
         } else {
             $category = '';
         }
         //Format date
         $date = strftime($elsettings->get('formatdate', '%d.%m.%Y'), strtotime($row->dates));
         $rssstartdate = $row->dates;
         if (!$row->enddates) {
             $displaydate = $date;
             $rssenddate = $row->dates;
         } else {
             $enddate = strftime($elsettings->get('formatdate', '%d.%m.%Y'), strtotime($row->enddates));
             $rssenddate = $row->enddates;
             $displaydate = $date . ' - ' . $enddate;
         }
         //Format time
         if ($row->times) {
             $time = strftime($elsettings->get('formattime', '%H:%M'), strtotime($row->times));
             $displaytime = $time;
             $rssstartdate .= 'T' . $row->times . $utcoffset;
         }
         if ($row->endtimes) {
             $endtime = strftime($elsettings->get('formattime', '%H:%M'), strtotime($row->endtimes));
             $displaytime = $time . ' - ' . $endtime;
             $rssenddate .= 'T' . $row->endtimes . $utcoffset;
         }
         // url link to event
         $link = JURI::base() . RedeventHelperRoute::getDetailsRoute($row->id);
         $link = JRoute::_($link);
         $item = new rsscalItem($row->full_title, $link);
         $item->addElement('ev:type', $category);
         //			$item->addElement( 'ev:organizer', "" );
         $item->addElement('ev:location', $row->venue);
         $item->addElement('ev:startdate', $rssstartdate);
         $item->addElement('ev:enddate', $rssenddate);
         $item->addElement('dc:subject', $row->full_title);
         $feed->addItem($item);
     }
     $feed->returnRSS(CACHE);
 }
Пример #18
0
 /**
  * Creates the output for the manage attendees layout
  *
  * @since 2.0
  */
 function _displayManageAttendees($tpl = null)
 {
     $mainframe =& JFactory::getApplication();
     $document = JFactory::getDocument();
     $user = JFactory::getUser();
     $elsettings = redEVENTHelper::config();
     $uri =& JFactory::getURI();
     $row = $this->get('Session');
     $registers = $this->get('Registers');
     $regcheck = $this->get('ManageAttendees');
     $roles = $this->get('Roles');
     //get menu information
     $menu =& JSite::getMenu();
     $item = $menu->getActive();
     if (!$item) {
         $item = $menu->getDefault();
     }
     $params =& $mainframe->getParams('com_redevent');
     //Check if the session exists
     if (!$row) {
         return JError::raiseError(404, JText::sprintf('COM_REDEVENT_Session_not_found'));
     }
     //Check if user has access to the attendees management
     if (!$regcheck) {
         $mainframe->redirect('index.php', JText::_('COM_REDEVENT_Only_logged_users_can_access_this_page'), 'error');
     }
     //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', JText::_('COM_REDEVENT_Manage_attendees'));
     //pathway
     $pathway =& $mainframe->getPathWay();
     $pathway->addItem(JText::_('COM_REDEVENT_Manage_attendees') . ' - ' . $row->full_title, JRoute::_('index.php?option=com_redevent&view=attendees&layout=manageattendees&id=' . $row->slug));
     //Check user if he can edit
     $manage_attendees = $this->get('ManageAttendees');
     $view_full_attendees = $this->get('ViewAttendees');
     // add javascript code for cancel button on attendees layout.
     JHTML::_('behavior.mootools');
     $js = " window.addEvent('domready', function(){\n\t\t            \$\$('.unreglink').addEvent('click', function(event){\n\t\t                  if (confirm('" . JText::_('COM_REDEVENT_CONFIRM_CANCEL_REGISTRATION') . "')) {\n                      \treturn true;\n\t                    }\n\t                    else {\n\t                    \tif (event.preventDefault) {\n\t                    \t\tevent.preventDefault();\n\t\t\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t\t\tevent.returnValue = false;\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\treturn false;\n                    \t}\n\t\t            });\t\t            \n\t\t        }); ";
     $document->addScriptDeclaration($js);
     //set page title and meta stuff
     $document->setTitle(JText::_('COM_REDEVENT_Manage_attendees') . ' - ' . $row->full_title);
     // lists
     $lists = array();
     /* Call the state object */
     $state =& $this->get('state');
     /* Get the values from the state object that were inserted in the model's construct function */
     $lists['order_Dir'] = $state->get('filter_order_Dir');
     $lists['order'] = $state->get('filter_order');
     //assign vars to jview
     $this->assignRef('row', $row);
     $this->assignRef('params', $params);
     $this->assignRef('user', $user);
     $this->assignRef('registers', $registers);
     $this->assignRef('roles', $roles);
     $this->assignRef('elsettings', $elsettings);
     $this->assignRef('item', $item);
     $this->assignRef('manage_attendees', $manage_attendees);
     $this->assignRef('view_full_attendees', $view_full_attendees);
     $this->assignRef('action', JROute::_('index.php?option=com_redevent&view=attendees&layout=manageattendees&id=' . $row->slug));
     $this->assignRef('lists', $lists);
     parent::display($tpl);
 }
Пример #19
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);
 }
Пример #20
0
 /**
  * Saves xref data
  * @param array
  * @return boolean true on success
  */
 function storeXref($data)
 {
     $user =& JFactory::getUser();
     $settings =& redEVENTHelper::config();
     // TODO : check user group access ?
     $row =& JTable::getInstance('RedEvent_eventvenuexref', '');
     if ($data['id']) {
         if (!$this->canManageXref($data['id'])) {
             $this->setError('YOU ARE NOT ALLOWED TO EDIT THIS DATE');
             return false;
         }
         $row->load($data['id']);
     } else {
         if (!$this->getCanAddXref()) {
             $this->setError('YOU ARE NOT ALLOWED TO ADD EVENT DATE');
             return false;
         }
     }
     if (!$row->bind($data)) {
         $this->setError('SUBMIT XREF ERROR BINDING DATA');
         RedeventHelperLog::simplelog('SUBMIT XREF ERROR BINDING DATA');
         return false;
     }
     if (!$row->check()) {
         $this->setError('SUBMIT XREF ERROR CHECK DATA');
         RedeventHelperLog::simplelog('SUBMIT XREF ERROR CHECK DATA');
         return false;
     }
     if (!$row->store(true)) {
         $this->setError('SUBMIT XREF ERROR STORE DATA');
         RedeventHelperLog::simplelog('SUBMIT XREF ERROR STORE DATA');
         return false;
     }
     /** roles **/
     // first remove current rows
     $query = ' DELETE FROM #__redevent_sessions_roles ' . ' WHERE xref = ' . $this->_db->Quote($row->id);
     $this->_db->setQuery($query);
     if (!$this->_db->query()) {
         $this->setError($this->_db->getErrorMsg());
         return false;
     }
     // then recreate them if any
     foreach ((array) $data['rrole'] as $k => $r) {
         if (!($data['rrole'][$k] && $data['urole'][$k])) {
             continue;
         }
         $new =& JTable::getInstance('RedEvent_sessions_roles', '');
         $new->set('xref', $row->id);
         $new->set('role_id', $r);
         $new->set('user_id', $data['urole'][$k]);
         if (!($new->check() && $new->store())) {
             $this->setError($new->getError());
             return false;
         }
     }
     /** roles END **/
     /** prices **/
     // first remove current rows
     $query = ' DELETE FROM #__redevent_sessions_pricegroups ' . ' WHERE xref = ' . $this->_db->Quote($row->id);
     $this->_db->setQuery($query);
     if (!$this->_db->query()) {
         $this->setError($this->_db->getErrorMsg());
         return false;
     }
     // then recreate them if any
     foreach ((array) $data['pricegroup'] as $k => $r) {
         if (!$data['pricegroup'][$k]) {
             continue;
         }
         $new =& JTable::getInstance('RedEvent_sessions_pricegroups', '');
         $new->set('xref', $row->id);
         $new->set('pricegroup_id', $r);
         $new->set('price', $data['price'][$k]);
         if (!($new->check() && $new->store())) {
             $this->setError($new->getError());
             return false;
         }
     }
     /** prices END **/
     // we need to save the recurrence too
     $recurrence =& JTable::getInstance('RedEvent_recurrences', '');
     if (!isset($data['recurrenceid']) || !$data['recurrenceid']) {
         $rrule = RedeventHelperRecurrence::parsePost($data);
         if (!empty($rrule)) {
             // new recurrence
             $recurrence->rrule = $rrule;
             if (!$recurrence->store()) {
                 $this->setError($recurrence->getError());
                 return false;
             }
             // add repeat record
             $repeat =& JTable::getInstance('RedEvent_repeats', '');
             $repeat->set('xref_id', $row->id);
             $repeat->set('recurrence_id', $recurrence->id);
             $repeat->set('count', 0);
             if (!$repeat->store()) {
                 $this->setError($repeat->getError());
                 return false;
             }
         }
     } else {
         if ($data['repeat'] == 0) {
             $recurrence->load($data['recurrenceid']);
             // reset the status
             $recurrence->ended = 0;
             // TODO: maybe add a check to have a choice between updating rrule or not...
             $rrule = RedeventHelperRecurrence::parsePost($data);
             $recurrence->rrule = $rrule;
             if (!$recurrence->store()) {
                 $this->setError($recurrence->getError());
                 return false;
             }
         }
     }
     if ($recurrence->id) {
         redEVENTHelper::generaterecurrences($recurrence->id);
     }
     return true;
 }
Пример #21
0
 /**
  * Method to get the Categories
  *
  * @access public
  * @return array
  */
 function &getData()
 {
     $mainframe =& JFactory::getApplication();
     $params =& $mainframe->getParams();
     $elsettings =& redEVENTHelper::config();
     // Lets load the content if it doesn't already exist
     if (empty($this->_categories)) {
         $query = $this->_buildQuery();
         $this->_categories = $this->_getList($query, $this->getState('limitstart'), $this->getState('limit'));
         $count = count($this->_categories);
         for ($i = 0; $i < $count; $i++) {
             $category =& $this->_categories[$i];
             $category->events = $this->_getEvents($category);
             $category->assignedevents = $this->_getEventsTotal($category);
             //Generate description
             if (empty($category->catdescription)) {
                 $category->catdescription = JText::_('COM_REDEVENT_NO_DESCRIPTION');
             } else {
                 //execute plugins
                 $category->catdescription = JHTML::_('content.prepare', $category->catdescription);
             }
             //create target link
             $task = JRequest::getWord('task');
             $category->linktext = JText::_('COM_REDEVENT_SHOW_EVENTS');
             $category->linktarget = JRoute::_(RedeventHelperRoute::getCategoryEventsRoute($category->slug));
         }
     }
     return $this->_categories;
 }
Пример #22
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);
 }
Пример #23
0
 /**
  * Creates the output for the details view
  *
  * @since 0.9
  */
 function display($tpl = null)
 {
     $mainframe =& JFactory::getApplication();
     /* Set which page to show */
     $state = JRequest::getVar('state', '');
     $submit_key = JRequest::getVar('submit_key', '');
     $document = JFactory::getDocument();
     $dispatcher = JDispatcher::getInstance();
     $elsettings = redEVENTHelper::config();
     $uri =& JFactory::getURI();
     $row = $this->get('Event');
     /* This loads the tags replacer */
     JView::loadHelper('tags');
     JRequest::setVar('xref', $row->xref);
     // neede for tag constructor
     $tags = new redEVENT_tags();
     $tags->setXref($row->xref);
     $tags->setSubmitkey($submit_key);
     //get menu information
     $menu =& JSite::getMenu();
     $item = $menu->getActive();
     if (!$item) {
         $item = $menu->getDefault();
     }
     $params =& $mainframe->getParams('com_redevent');
     //Check if the id exists
     if ($row->eventid == 0) {
         return JError::raiseError(404, JText::sprintf('COM_REDEVENT_Event_d_not_found', $row->eventid));
     }
     //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]-->');
     //Print
     $pop = JRequest::getBool('pop');
     $params->def('page_title', JText::_('COM_REDEVENT_DETAILS'));
     if ($pop) {
         $params->set('popup', 1);
     }
     $print_link = JRoute::_(htmlspecialchars($uri->toString()) . '&pop=1&tmpl=component');
     //set page title and meta stuff
     $document->setTitle($row->title . ' - ' . JText::_('COM_REDEVENT_Payment'));
     $text = '';
     switch ($state) {
         case 'processing':
             $text = $tags->ReplaceTags($row->paymentprocessing);
             break;
         case 'accepted':
             $text = $tags->ReplaceTags($row->paymentaccepted);
             break;
         case 'refused':
             $text = JText::_('COM_REDEVENT_PAYMENT_PAYMENT_REFUSED');
             break;
         default:
             $text = JText::_('COM_REDEVENT_PAYMENT_UNKNOWN_PAYMENT_STATUS');
             break;
     }
     //assign vars to jview
     $this->assignRef('row', $row);
     $this->assign('text', $text);
     $this->assignRef('params', $params);
     $this->assignRef('print_link', $print_link);
     $this->assignRef('elsettings', $elsettings);
     $this->assignRef('item', $item);
     $this->assignRef('tags', $tags);
     $tpl = JRequest::getVar('tpl', $tpl);
     parent::display($tpl);
 }
Пример #24
0
 /**
  * Performs dayly scheduled cleanups
  *
  * Currently it archives and removes outdated events
  * and takes care of the recurrence of events
  *
  * @since 0.9
  */
 function cleanup($forced = 0)
 {
     $db =& JFactory::getDBO();
     $elsettings =& redEVENTHelper::config();
     $params =& JComponentHelper::getParams('com_redevent');
     $now = time();
     $query = ' SELECT lastupdate ' . ' FROM #__redevent_settings ';
     $db->setQuery($query);
     $lastupdate = $db->loadResult();
     //last update later then 24h?
     //$difference = $now - $lastupdate;
     //if ( $difference > 86400 ) {
     //better: new day since last update?
     $nrdaysnow = floor($now / 86400);
     $nrdaysupdate = floor($lastupdate / 86400);
     if ($nrdaysnow > $nrdaysupdate || $forced) {
         $nulldate = '0000-00-00';
         $limit_date = strftime('%Y-%m-%d', time() - $params->get('pastevents_delay', 3) * 3600 * 24);
         redEVENTHelper::generaterecurrences();
         // date filtering
         $where = array('x.dates IS NOT NULL');
         switch ($params->get('pastevents_reference_date', 'end')) {
             case 'start':
                 $where[] = ' DATEDIFF(' . $db->Quote($limit_date) . ', x.dates) >= 0 ';
                 break;
             case 'registration':
                 $where[] = ' DATEDIFF(' . $db->Quote($limit_date) . ', (IF (x.registrationend <> ' . $db->Quote($nulldate) . ', x.registrationend, x.dates))) >= 0 ';
                 break;
             case 'end':
                 $where[] = ' DATEDIFF(' . $db->Quote($limit_date) . ', (IF (x.enddates <> ' . $db->Quote($nulldate) . ', x.enddates, x.dates))) >= 0 ';
                 break;
         }
         $where_date = implode(' AND ', $where);
         //delete outdated events
         if ($params->get('pastevents_action', 0) == 1) {
             // lists event_id for which we are going to delete xrefs
             $query = ' SELECT x.eventid FROM #__redevent_event_venue_xref AS x ';
             $query .= ' WHERE ' . $where_date;
             $db->SetQuery($query);
             $event_ids = $db->loadResultArray();
             if (!count($event_ids)) {
                 return true;
             }
             $query = ' DELETE x FROM #__redevent_event_venue_xref AS x ' . ' WHERE ' . $where_date;
             $db->SetQuery($query);
             if (!$db->Query()) {
                 RedeventHelperLog::simpleLog('CLEANUP Error while deleting old xrefs: ' . $db->getErrorMsg());
             }
             if ($params->get('pastevents_events_action', 1)) {
                 // now delete the events with no more xref
                 $query = ' DELETE e FROM #__redevent_events AS e ' . ' LEFT JOIN #__redevent_event_venue_xref AS x ON x.eventid = e.id ' . ' WHERE x.id IS NULL ' . '   AND e.id IN (' . implode(', ', $event_ids) . ')';
                 $db->SetQuery($query);
                 if (!$db->Query()) {
                     RedeventHelperLog::simpleLog('CLEANUP Error while deleting old events with no more xrefs: ' . $db->getErrorMsg());
                 }
             }
         }
         //Set state archived of outdated events
         if ($params->get('pastevents_action', 0) == 2) {
             // lists xref_id and associated event_id for which we are going to be archived
             $query = ' SELECT x.id, x.eventid ' . ' FROM #__redevent_event_venue_xref AS x ' . ' WHERE ' . $where_date . ' AND x.published = 1 ';
             $db->SetQuery($query);
             $xrefs = $db->loadObjectList();
             if (empty($xrefs)) {
                 return true;
             }
             // build list of xref and corresponding events
             $event_ids = array();
             $xref_ids = array();
             foreach ($xrefs as $xref) {
                 $event_ids[] = $db->Quote($xref->eventid);
                 $xref_ids[] = $db->Quote($xref->id);
             }
             // filter duplicates
             $event_ids = array_unique($event_ids);
             // update xref to archive
             $query = ' UPDATE #__redevent_event_venue_xref AS x ' . ' SET x.published = -1 ' . ' WHERE x.id IN (' . implode(', ', $xref_ids) . ')';
             $db->SetQuery($query);
             if (!$db->Query()) {
                 RedeventHelperLog::simpleLog('CLEANUP Error while archiving old xrefs: ' . $db->getErrorMsg());
             }
             if ($params->get('pastevents_events_action', 1)) {
                 // update events to archive (if no more published xref)
                 $query = ' UPDATE #__redevent_events AS e ' . ' LEFT JOIN #__redevent_event_venue_xref AS x ON x.eventid = e.id AND x.published <> -1 ' . ' SET e.published = -1 ' . ' WHERE x.id IS NULL ' . '   AND e.id IN (' . implode(', ', $event_ids) . ')';
                 $db->SetQuery($query);
                 if (!$db->Query()) {
                     RedeventHelperLog::simpleLog('CLEANUP Error while archiving events with only archived xrefs: ' . $db->getErrorMsg());
                 }
             }
         }
         //Set timestamp of last cleanup
         $query = 'UPDATE #__redevent_settings SET lastupdate = ' . time() . ' WHERE id = 1';
         $db->SetQuery($query);
         $db->Query();
     }
 }
Пример #25
0
 function _getTag_phonesignup()
 {
     $registration_status = $this->_canRegister();
     if (!$registration_status->canregister) {
         $img = JHTML::_('image', JURI::root() . 'components/com_redevent/assets/images/agt_action_fail.png', $registration_status->status, array('class' => 'hasTip', 'title' => $registration_status->status));
         return $img;
     }
     $mainframe =& JFactory::getApplication();
     $base_url = JURI::root();
     $iconspath = $base_url . 'administrator/components/com_redevent/assets/images/';
     $elsettings = redEVENTHelper::config();
     $text = '<span class="vlink phone">' . JHTML::_('link', $this->absoluteUrls(RedeventHelperRoute::getSignupRoute('phone', $this->getEvent()->getData()->slug, $this->getEvent()->getData()->xslug)), JHTML::_('image', $iconspath . $elsettings->get('signup_phone_img'), JText::_($elsettings->get('signup_phone_text')), 'width="24px" height="24px"')) . '</span> ';
     return $text;
 }
Пример #26
0
 /**
  * Method to build the sortlists
  *
  * @access private
  * @return array
  * @since 0.9
  */
 function _buildSortLists()
 {
     $app =& JFactory::getApplication();
     $uri =& JFactory::getURI();
     // remove previously set filter in get
     $uri->delVar('filter');
     $uri->delVar('filter_type');
     $uri->delVar('filter_category');
     $uri->delVar('filter_venuecategory');
     $uri->delVar('filter_venue');
     $uri->delVar('filter_event');
     $uri->delVar('filtercustom');
     $elsettings =& redEVENTHelper::config();
     $params = $app->getParams();
     $filter_order = JRequest::getCmd('filter_order', 'x.dates');
     $filter_order_Dir = JRequest::getWord('filter_order_Dir', 'ASC');
     $state = $this->get('state');
     $filter = $state->get('filter');
     $filter_type = $state->get('filter_type');
     $filter_category = $state->get('filter_category');
     $filter_venue = $state->get('filter_venue');
     $filter_event = $state->get('filter_event');
     $this->assign('action', JRoute::_(RedeventHelperRoute::getFeaturedRoute()));
     $sortselects = array();
     if ($params->get('filter_type_event', 1)) {
         $sortselects[] = JHTML::_('select.option', 'title', JText::_('COM_REDEVENT_FILTER_SELECT_EVENT'));
     }
     if ($params->get('filter_type_venue', 1)) {
         $sortselects[] = JHTML::_('select.option', 'venue', JText::_('COM_REDEVENT_FILTER_SELECT_VENUE'));
     }
     if ($params->get('filter_type_city', 1)) {
         $sortselects[] = JHTML::_('select.option', 'city', JText::_('COM_REDEVENT_FILTER_SELECT_CITY'));
     }
     if ($params->get('filter_type_category', 1)) {
         $sortselects[] = JHTML::_('select.option', 'type', JText::_('COM_REDEVENT_FILTER_SELECT_CATEGORY'));
     }
     if (count($sortselects) == 0) {
         $sortselect = false;
     } else {
         if (count($sortselects) == 1) {
             $sortselect = '<input type="hidden" name="filter_type" value="' . $sortselects[0]->value . '" />';
         } else {
             $sortselect = JHTML::_('select.genericlist', $sortselects, 'filter_type', 'size="1" class="inputbox"', 'value', 'text', $filter_type);
         }
     }
     // category filter
     $options = array(JHTML::_('select.option', '', JText::_('COM_REDEVENT_FILTER_SELECT_CATEGORY')));
     $options = array_merge($options, $this->get('CategoriesOptions'));
     $lists['categoryfilter'] = JHTML::_('select.genericlist', $options, 'filter_category', 'size="1" class="inputbox dynfilter"', 'value', 'text', $filter_category);
     // venue filter
     $options = array(JHTML::_('select.option', '', JText::_('COM_REDEVENT_FILTER_SELECT_VENUE')));
     $options = array_merge($options, $this->get('VenuesOptions'));
     $lists['venuefilter'] = JHTML::_('select.genericlist', $options, 'filter_venue', 'size="1" class="inputbox dynfilter"', 'value', 'text', $filter_venue);
     // events filter
     if ($params->get('lists_filter_event', 0)) {
         $options = array(JHTML::_('select.option', '', JText::_('COM_REDEVENT_FILTER_SELECT_EVENT')));
         $options = array_merge($options, $this->get('EventsOptions'));
         $lists['eventfilter'] = JHTML::_('select.genericlist', $options, 'filter_event', 'size="1" class="inputbox dynfilter"', 'value', 'text', $filter_event);
     }
     $lists['order_Dir'] = $filter_order_Dir;
     $lists['order'] = $filter_order;
     $lists['filter'] = $filter;
     $lists['filter_type'] = $sortselect;
     return $lists;
 }
Пример #27
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();
     $acl = UserAcl::getInstance();
     //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.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');
     $customs =& $this->get('ListCustomFields');
     $customsfilters =& $this->get('CustomFilters');
     //does the venue exist?
     if ($venue->id == 0) {
         return JError::raiseError(404, JText::sprintf('COM_REDEVENT_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
     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();
     //create the pathway
     if ($task == 'archive') {
         $link = JRoute::_(RedeventHelperRoute::getVenueEventsRoute($venue->slug, 'archive'));
         $pathway->addItem(JText::_('COM_REDEVENT_ARCHIVE') . ' - ' . $venue->venue, $link);
         $print_link = JRoute::_('index.php?option=com_redevent&view=venueevents&id=' . $venue->slug . '&task=archive&pop=1&tmpl=component');
         $pagetitle = $venue->venue . ' - ' . JText::_('COM_REDEVENT_ARCHIVE');
     } else {
         $link = JRoute::_(RedeventHelperRoute::getVenueEventsRoute($venue->slug));
         $pathway->addItem($venue->venue, $link);
         $print_link = JRoute::_('index.php?option=com_redevent&view=venueevents&id=' . $venue->slug . '&pop=1&tmpl=component');
         $pagetitle = $venue->venue;
     }
     $thumb_link = RedeventHelperRoute::getVenueEventsRoute($venue->slug, null, 'thumb');
     $list_link = RedeventHelperRoute::getVenueEventsRoute($venue->slug, null, 'default');
     //set Page title
     $this->document->setTitle($pagetitle);
     $document->setMetadata('keywords', $venue->meta_keywords);
     $document->setDescription(strip_tags($venue->meta_description));
     //Printfunction
     $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 = $acl->canEditVenue($venue->id);
     //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
     jimport('joomla.html.pagination');
     $pageNav = new JPagination($total, $limitstart, $limit);
     //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::_(RedeventHelperRoute::getVenueEventsRoute($venue->slug)));
     $this->assignRef('rows', $rows);
     $this->assignRef('customs', $customs);
     $this->assignRef('noevents', $noevents);
     $this->assignRef('venue', $venue);
     $this->assignRef('print_link', $print_link);
     $this->assignRef('params', $params);
     $this->assignRef('editlink', $maintainer);
     $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('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);
 }
Пример #28
0
 /**
  * Method to store the venue
  *
  * @access	public
  * @return	id
  * @since	0.9
  */
 function store($data, $file)
 {
     $mainframe =& JFactory::getApplication();
     $user =& JFactory::getUser();
     $elsettings =& redEVENTHelper::config();
     //Get mailinformation
     $SiteName = $mainframe->getCfg('sitename');
     $MailFrom = $mainframe->getCfg('mailfrom');
     $FromName = $mainframe->getCfg('fromname');
     $tzoffset = $mainframe->getCfg('offset');
     $params = $mainframe->getParams('com_redevent');
     $row =& JTable::getInstance('redevent_venues', '');
     //bind it to the table
     if (!$row->bind($data)) {
         RedeventError::raiseError(500, $this->_db->stderr());
         return false;
     }
     //Are we saving from an item edit?
     if ($row->id) {
         $row->modified = gmdate('Y-m-d H:i:s');
         $row->modified_by = $user->get('id');
     } else {
         //get IP, time and userid
         $row->created = gmdate('Y-m-d H:i:s');
         $row->author_ip = $elsettings->get('storeip', '1') ? getenv('REMOTE_ADDR') : 'DISABLED';
         $row->created_by = $user->get('id');
     }
     //Image upload
     //If image upload is required we will stop here if no file was attached
     if (empty($file['name']) && $params->get('edit_image', 1) == 2) {
         $this->setError(JText::_('COM_REDEVENT_IMAGE_EMPTY'));
         return false;
     }
     if (($params->get('edit_image', 1) == 2 || $params->get('edit_image', 1) == 1) && !empty($file['name'])) {
         jimport('joomla.filesystem.file');
         if ($params->get('default_image_path', 'redevent')) {
             $reldirpath = $params->get('default_image_path', 'redevent') . DS . 'venues' . DS;
         } else {
             $reldirpath = '';
         }
         $base_Dir = JPATH_SITE . DS . 'images' . DS . $reldirpath;
         //check the image
         $check = redEVENTImage::check($file, $elsettings);
         if ($check === false) {
             $mainframe->redirect($_SERVER['HTTP_REFERER']);
         }
         //sanitize the image filename
         $filename = redEVENTImage::sanitize($base_Dir, $file['name']);
         $filepath = $base_Dir . $filename;
         if (!JFile::upload($file['tmp_name'], $filepath)) {
             $this->setError(JText::_('COM_REDEVENT_UPLOAD_FAILED'));
             return false;
         } else {
             $row->locimage = 'images' . DS . $reldirpath . $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 > $params->get('max_description', 1000)) {
             // if required shorten it
             $row->locdescription = JString::substr($row->locdescription, 0, $params->get('max_description', 1000));
             //if shortened add ...
             $row->locdescription = $row->locdescription . '...';
         }
     }
     $row->venue = trim(JFilterOutput::ampReplace($row->venue));
     //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;
     }
     // update the event category xref
     // first, delete current rows for this event
     $query = ' DELETE FROM #__redevent_venue_category_xref WHERE venue_id = ' . $this->_db->Quote($row->id);
     $this->_db->setQuery($query);
     if (!$this->_db->query()) {
         $this->setError($this->_db->getErrorMsg());
         return false;
     }
     // insert new ref
     foreach ((array) $data['categories'] as $cat_id) {
         $query = ' INSERT INTO #__redevent_venue_category_xref (venue_id, category_id) VALUES (' . $this->_db->Quote($row->id) . ', ' . $this->_db->Quote($cat_id) . ')';
         $this->_db->setQuery($query);
         if (!$this->_db->query()) {
             $this->setError($this->_db->getErrorMsg());
             return false;
         }
     }
     // attachments
     if ($params->get('allow_attachments', 1)) {
         REAttach::store('venue' . $row->id);
     }
     jimport('joomla.utilities.mail');
     $link = JRoute::_(JURI::base() . RedeventHelperRoute::getVenueEventsRoute($row->id), false);
     //create mail
     if ($params->get('mailinform') == 2 || $params->get('mailinform') == 3) {
         $mail = JFactory::getMailer();
         $state = $row->published ? JText::sprintf('COM_REDEVENT_MAIL_VENUE_PUBLISHED', $link) : JText::_('COM_REDEVENT_MAIL_VENUE_UNPUBLISHED');
         if ($edited) {
             $modified_ip = getenv('REMOTE_ADDR');
             $edited = JHTML::Date($row->modified, JText::_('DATE_FORMAT_LC2'));
             $mailbody = JText::sprintf('COM_REDEVENT_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::_('COM_REDEVENT_EDIT_VENUE_MAIL'));
         } else {
             $created = JHTML::Date($row->modified, JText::_('DATE_FORMAT_LC2'));
             $mailbody = JText::sprintf('COM_REDEVENT_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::_('COM_REDEVENT_NEW_VENUE_MAIL'));
         }
         $receivers = explode(',', trim($params->get('mailinformrec')));
         $mail->addRecipient($receivers);
         $mail->setSender(array($MailFrom, $FromName));
         $mail->setBody($mailbody);
         if (!$mail->Send()) {
             RedeventHelperLog::simpleLog('Error sending created/edited venue notification to site owner');
         }
     }
     //create the mail for the user
     if ($params->get('mailinformuser') == 2 || $params->get('mailinformuser') == 3) {
         $usermail = JFactory::getMailer();
         $state = $row->published ? JText::sprintf('COM_REDEVENT_USER_MAIL_VENUE_PUBLISHED', $link) : JText::_('COM_REDEVENT_USER_MAIL_VENUE_UNPUBLISHED');
         if ($edited) {
             $edited = JHTML::Date($row->modified, JText::_('DATE_FORMAT_LC2'));
             $mailbody = JText::sprintf('COM_REDEVENT_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::_('COM_REDEVENT_EDIT_USER_VENUE_MAIL'));
         } else {
             $created = JHTML::Date($row->modified, JText::_('DATE_FORMAT_LC2'));
             $mailbody = JText::sprintf('COM_REDEVENT_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::_('COM_REDEVENT_NEW_USER_VENUE_MAIL'));
         }
         $usermail->addRecipient($user->email);
         $usermail->setSender(array($MailFrom, $FromName));
         $usermail->setBody($mailbody);
         if (!$usermail->Send()) {
             RedeventHelperLog::simpleLog('Error sending created/edited venue notification to venue owner');
         }
     }
     //update item order
     $row->reorder();
     return $row->id;
 }
Пример #29
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);
 }
Пример #30
0
 /**
  * Creates the Venuesview
  *
  * @since 0.9
  */
 function display($tpl = null)
 {
     $mainframe =& JFactory::getApplication();
     $document =& JFactory::getDocument();
     $elsettings =& redEVENTHelper::config();
     //get menu information
     $menu =& JSite::getMenu();
     $item = $menu->getActive();
     $params =& $mainframe->getParams();
     //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]-->');
     // Request variables
     $limitstart = JRequest::getInt('limitstart');
     $limit = JRequest::getVar('limit', $params->get('display_num'), '', 'int');
     $pop = JRequest::getBool('pop', 0, '', 'int');
     $task = JRequest::getWord('task');
     $rows =& $this->get('Data');
     $total =& $this->get('Total');
     //Add needed scripts if the lightbox effect is enabled
     JHTML::_('behavior.modal');
     //add alternate feed link
     $link = 'index.php?option=com_redevent&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);
     //pathway
     $pathway =& $mainframe->getPathWay();
     if ($task == 'archive') {
         $pathway->addItem(JText::_('COM_REDEVENT_ARCHIVE'), JRoute::_('index.php?option=com_redevent&view=venues&task=archive'));
         $pagetitle = $params->get('page_title') . ' - ' . JText::_('COM_REDEVENT_ARCHIVE');
         $print_link = JRoute::_('index.php?option=com_redevent&view=venues&task=archive&pop=1&tmpl=component');
     } else {
         $pagetitle = $params->get('page_title');
         $print_link = JRoute::_('index.php?option=com_redevent&view=venues&pop=1&tmpl=component');
     }
     //Set Page title
     $this->document->setTitle($pagetitle);
     $document->setMetadata('keywords', $pagetitle);
     //Printfunction
     $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;
     }
     // Create the pagination object
     jimport('joomla.html.pagination');
     $pageNav = $this->get('pagination');
     $this->assignRef('rows', $rows);
     $this->assignRef('print_link', $print_link);
     $this->assignRef('params', $params);
     $this->assignRef('dellink', $dellink);
     $this->assignRef('pageNav', $pageNav);
     $this->assignRef('limit', $limit);
     $this->assignRef('total', $total);
     $this->assignRef('item', $item);
     $this->assignRef('elsettings', $elsettings);
     $this->assignRef('task', $task);
     $this->assignRef('pagetitle', $pagetitle);
     parent::display($tpl);
 }