/** * first step in unreg process by email * */ function cancelreg() { $xref = JRequest::getInt('xref'); if (!redEVENTHelper::canUnregister($xref)) { echo JText::_('COM_REDEVENT_UNREGISTRATION_NOT_ALLOWED'); return; } // display the unreg form confirmation JRequest::setVar('view', 'registration'); JRequest::setVar('layout', 'cancel'); parent::display(); }
/** * Creates the output for the details view * * @since 0.9 */ function display($tpl = null) { if ($this->getLayout() == 'manageattendees') { return $this->_displayManageAttendees($tpl); } $mainframe =& JFactory::getApplication(); $document = JFactory::getDocument(); $user = JFactory::getUser(); $elsettings = redEVENTHelper::config(); $acl = UserAcl::getInstance(); $uri =& JFactory::getURI(); $model =& $this->getModel(); //manages attendees $manage_attendees = $this->get('ManageAttendees'); $view_full_attendees = $this->get('ViewAttendees'); $row = $this->get('Session'); $registers = $model->getRegisters(); $register_fields = $model->getFormFields(); $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 id exists if (!$row) { return JError::raiseError(404, JText::sprintf('COM_REDEVENT_Session_not_found')); } //Print $pop = JRequest::getBool('pop'); $params->def('page_title', $row->full_title . ' - ' . JText::_('COM_REDEVENT_ATTENDEES')); if ($pop) { $params->set('popup', 1); } $print_link = JRoute::_('index.php?option=com_redevent&view=attendees&xref=' . $row->slug . '&pop=1&tmpl=component'); //pathway $pathway =& $mainframe->getPathWay(); $pathway->addItem(JText::_('COM_REDEVENT_ATTENDEES'), JRoute::_('index.php?option=com_redevent&view=attendees&xref=' . $row->slug)); //set page title and meta stuff $document->setTitle($item->title . ' - ' . $row->full_title); $unreg_check = redEVENTHelper::canUnregister($row->xref); // 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('manage_attendees', $manage_attendees); $this->assignRef('view_full_attendees', $view_full_attendees); $this->assignRef('print_link', $print_link); $this->assignRef('registers', $registers); $this->assignRef('registersfields', $register_fields); $this->assignRef('roles', $roles); $this->assignRef('elsettings', $elsettings); $this->assignRef('item', $item); $this->assignRef('unreg_check', $unreg_check); $this->assignRef('action', JRoute::_('index.php?option=com_redevent&view=attendees&xref=' . $row->slug)); $this->assignRef('lists', $lists); $tpl = JRequest::getVar('tpl', $tpl); parent::display($tpl); }
/** * 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); }
/** * Cancel a registration * * @access public * @param int $register_id * @return boolean true on success * @since 2.0 */ function cancelregistration($register_id, $xref) { $user =& JFactory::getUser(); $userid = $user->get('id'); $acl = UserAcl::getInstance(); if ($userid < 1) { JError::raiseError(403, JText::_('COM_REDEVENT_ALERTNOTAUTH')); return; } // first, check if the user is allowed to unregister from this // he must be the one that submitted the form, plus the unregistration must be allowed $q = ' SELECT s.*, r.uid, e.unregistra, x.dates, x.times, x.registrationend ' . ' FROM #__rwf_submitters AS s ' . ' INNER JOIN #__redevent_register AS r ON r.sid = s.id ' . ' INNER JOIN #__redevent_event_venue_xref AS x ON x.id = r.xref ' . ' INNER JOIN #__redevent_events AS e ON x.eventid = e.id ' . ' WHERE r.id = ' . $this->_db->Quote($register_id); $this->_db->setQuery($q); $submitterinfo = $this->_db->loadObject(); // or be allowed to manage attendees $manager = $acl->canManageAttendees($xref); if (!redEVENTHelper::canUnregister($xref) && !$manager) { $this->setError(JText::_('COM_REDEVENT_UNREGISTRATION_NOT_ALLOWED')); return false; } if (($submitterinfo->uid != $userid || $submitterinfo->unregistra == 0) && !$manager) { $this->setError(JText::_('COM_REDEVENT_UNREGISTRATION_NOT_ALLOWED')); return false; } // Now that we made sure, we can delete the submitter and corresponding form values /* Delete the redFORM entry first */ /* Submitter answers first*/ $q = ' UPDATE #__redevent_register AS r ' . ' SET r.cancelled = 1 ' . ' WHERE r.id = ' . $this->_db->Quote($register_id); $this->_db->setQuery($q); if (!$this->_db->query()) { $this->setError(JText::_('COM_REDEVENT_ERROR_CANNOT_DELETE_REGISTRATION')); return false; } return true; }