$db = JFactory::getDBO(); $groups = implode(',', JFactory::getUser()->getAuthorisedViewLevels()); $query = 'SELECT a.*, r.*, cat.title AS category, cat.alias as catalias FROM #__matukio_recurring AS r LEFT JOIN #__matukio AS a ON r.event_id = a.id LEFT JOIN #__categories AS cat ON cat.id = a.catid WHERE r.begin > ' . $db->Quote($start) . ' AND r.begin < ' . $db->Quote($end) . ' AND r.published = 1 AND cat.access in (' . $groups . ') ORDER BY r.begin ASC'; $db->setQuery($query); $rows = $db->loadObjectList(); $events = array(); foreach ($rows as $row) { $begin = JHTML::_('date', $row->begin, 'Y-m-d\\TH:i:s') . "Z"; $end = JHTML::_('date', $row->end, 'Y-m-d\\TH:i:s') . "Z"; // Link $eventid_l = $row->id . ':' . JFilterOutput::stringURLSafe($row->title); $catid_l = $row->catid . ':' . JFilterOutput::stringURLSafe(MatukioHelperCategories::getCategoryAlias($row->catid)); $link = JRoute::_(MatukioHelperRoute::getEventRoute($eventid_l, $catid_l), false); // $title = '<a href="' . $link . '">' . $row->title . '</a>'; $allday = $row->showend == 1 ? false : true; $events[] = array('id' => $row->id, 'title' => $row->title, 'start' => $begin, 'end' => $end, 'location' => $row->place, 'url' => $link, 'allDay' => $allday); } JResponse::setHeader('Content-Disposition', 'attachment;filename=element.json"'); echo json_encode($events); } elseif ($task == 'getnewfeerow') { $db = JFactory::getDBO(); $event_id = $input->getInt("event_id", 0); $backend = $input->getInt("backend", 0); // Load event (use model function) $emodel = JModelLegacy::getInstance('Event', 'MatukioModel'); $event = $emodel->getItem($event_id); $num = $input->getInt("num", 0); if (empty($num)) {
/** * OLD Booking method for old form * * @todo move into a nice function for both backend / Frontend / old and new form * @return mixed */ public function bookevent() { $database = JFactory::getDBO(); $my = JFactory::getUser(); $id = JFactory::getApplication()->input->getInt('cid', 0); $uid = JFactory::getApplication()->input->getInt('uid', 0); $catid = JFactory::getApplication()->input->getInt('catid', 0); $nrbooked = JFactory::getApplication()->input->getInt('nrbooked', 0); $name = JFactory::getApplication()->input->get('name', '', 'string'); $email = JFactory::getApplication()->input->get('email', '', 'string'); $dispatcher = JDispatcher::getInstance(); // Edit own booking $booking_id = JFactory::getApplication()->input->getInt('booking_id', 0); // AGBs $veragb = JFactory::getApplication()->input->get('veragb', 0, 'string'); $isWaitlist = false; $reason = ""; // Load event (use model function) $emodel = JModelLegacy::getInstance('Event', 'MatukioModel'); $row = $emodel->getItem($id); $usrid = $my->id; $art = 2; if ($uid > 0) { $usrid = $uid; $art = 4; } $sqlid = $usrid; if ($name != "" and $email != "" or $usrid == 0) { $usrid = 0; $sqlid = -1; } // Pruefung ob Buchung erfolgreich durchfuehrbar $database->setQuery("SELECT * FROM #__matukio_bookings WHERE semid='{$id}' AND userid='{$sqlid}'"); $temp = $database->loadObjectList(); if (!empty($booking_id)) { $temp = null; } $gebucht = MatukioHelperUtilsEvents::calculateBookedPlaces($row); $gebucht = $gebucht->booked; $allesok = 1; $ueber1 = JTEXT::_('COM_MATUKIO_BOOKING_WAS_SUCCESSFULL'); $pflichtfeld = false; $fields = MatukioHelperUtilsEvents::getAdditionalFieldsFrontend($row); for ($i = 0; $i < 20; $i++) { $test = $fields[0][$i]; if (!empty($test)) { $res = explode("|", $test); if (trim($res[1]) == "1") { $value = JFactory::getApplication()->input->get("zusatz" . ($i + 1), '', 'string'); if (empty($value)) { $pflichtfeld = true; } } } } if ($my->id > 0) { $name = $my->name; $email = $my->email; } // } if (empty($name) || empty($email)) { $allesok = 0; $ueber1 = JTEXT::_('COM_MATUKIO_BOOKING_WAS_NOT_SUCCESSFULL'); $reason = JTEXT::_('COM_MATUKIO_NO_NAME_OR_EMAIL'); } elseif ($pflichtfeld) { $allesok = 0; $ueber1 = JTEXT::_('COM_MATUKIO_BOOKING_WAS_NOT_SUCCESSFULL'); $reason = JTEXT::_('COM_MATUKIO_REQUIRED_ADDITIONAL_FIELD_EMPTY'); } elseif (count($temp) > 0) { $allesok = 0; $ueber1 = JTEXT::_('COM_MATUKIO_BOOKING_WAS_NOT_SUCCESSFULL'); $reason = JTEXT::_('COM_MATUKIO_REGISTERED_FOR_THIS_EVENT'); } elseif (MatukioHelperUtilsDate::getCurrentDate() > $row->booked) { $allesok = 0; $ueber1 = JTEXT::_('COM_MATUKIO_BOOKING_WAS_NOT_SUCCESSFULL'); $reason = JTEXT::_('COM_MATUKIO_EXCEEDED'); } elseif ($row->maxpupil - $gebucht - $nrbooked < 0 && $row->stopbooking == 1) { $allesok = 0; $ueber1 = JTEXT::_('COM_MATUKIO_BOOKING_WAS_NOT_SUCCESSFULL'); $reason = JTEXT::_('COM_MATUKIO_MAX_PARTICIPANT_NUMBER_REACHED'); } elseif ($row->maxpupil - $gebucht - $nrbooked < 0 && $row->stopbooking == 0) { $allesok = 2; $ueber1 = JTEXT::_('COM_MATUKIO_ADDED_WAITLIST'); $reason = JTEXT::_('COM_MATUKIO_YOU_ARE_BOOKED_ON_THE_WAITING_LIST'); $isWaitlist = true; } elseif (MatukioHelperSettings::getSettings('agb_text', '') != "" && $veragb != "1") { $allesok = 0; $ueber1 = JTEXT::_('COM_MATUKIO_BOOKING_WAS_NOT_SUCCESSFULL'); $reason = JTEXT::_('COM_MATUKIO_AGB_NOT_ACCEPTED'); } if ($art == 4) { $allesok = 1; $ueber1 = JTEXT::_('COM_MATUKIO_BOOKING_WAS_SUCCESSFULL'); } $link = JRoute::_(MatukioHelperRoute::getEventRoute($row->id, $catid), false); $msg = ""; $neu = ""; // Alles in Ordnung if ($allesok > 0) { // Buchung eintragen $neu = JTable::getInstance('bookings', 'Table'); if (!$neu->bind(JRequest::get('post'))) { return JError::raiseError(500, $database->stderr()); } if (!empty($booking_id)) { $neu->id = $booking_id; } $neu->semid = $id; $neu->userid = $usrid; // Hmm really do that? $neu->name = $name; $neu->email = $email; $neu->bookingdate = MatukioHelperUtilsDate::getCurrentDate(); $neu->name = MatukioHelperUtilsBasic::cleanHTMLfromText($neu->name); $neu->email = MatukioHelperUtilsBasic::cleanHTMLfromText($neu->email); $neu->zusatz1 = MatukioHelperUtilsBasic::cleanHTMLfromText($neu->zusatz1); $neu->zusatz2 = MatukioHelperUtilsBasic::cleanHTMLfromText($neu->zusatz2); $neu->zusatz3 = MatukioHelperUtilsBasic::cleanHTMLfromText($neu->zusatz3); $neu->zusatz4 = MatukioHelperUtilsBasic::cleanHTMLfromText($neu->zusatz4); $neu->zusatz5 = MatukioHelperUtilsBasic::cleanHTMLfromText($neu->zusatz5); $neu->zusatz6 = MatukioHelperUtilsBasic::cleanHTMLfromText($neu->zusatz6); $neu->zusatz7 = MatukioHelperUtilsBasic::cleanHTMLfromText($neu->zusatz7); $neu->zusatz8 = MatukioHelperUtilsBasic::cleanHTMLfromText($neu->zusatz8); $neu->zusatz9 = MatukioHelperUtilsBasic::cleanHTMLfromText($neu->zusatz9); $neu->zusatz10 = MatukioHelperUtilsBasic::cleanHTMLfromText($neu->zusatz10); $neu->zusatz11 = MatukioHelperUtilsBasic::cleanHTMLfromText($neu->zusatz11); $neu->zusatz12 = MatukioHelperUtilsBasic::cleanHTMLfromText($neu->zusatz12); $neu->zusatz13 = MatukioHelperUtilsBasic::cleanHTMLfromText($neu->zusatz13); $neu->zusatz14 = MatukioHelperUtilsBasic::cleanHTMLfromText($neu->zusatz14); $neu->zusatz15 = MatukioHelperUtilsBasic::cleanHTMLfromText($neu->zusatz15); $neu->zusatz16 = MatukioHelperUtilsBasic::cleanHTMLfromText($neu->zusatz16); $neu->zusatz17 = MatukioHelperUtilsBasic::cleanHTMLfromText($neu->zusatz17); $neu->zusatz18 = MatukioHelperUtilsBasic::cleanHTMLfromText($neu->zusatz18); $neu->zusatz19 = MatukioHelperUtilsBasic::cleanHTMLfromText($neu->zusatz19); $neu->zusatz20 = MatukioHelperUtilsBasic::cleanHTMLfromText($neu->zusatz20); // Set booking status to active @since 3.1 $neu->status = MatukioHelperUtilsBooking::$ACTIVE; if (!empty($row->fees)) { $neu->payment_method = "cash"; $payment_brutto = $row->fees * $neu->nrbooked; $coupon_code = $neu->coupon_code; if (!empty($coupon_code)) { $cdate = new DateTime(); $db = JFactory::getDBO(); $query = $db->getQuery(true); $query->select('*')->from('#__matukio_booking_coupons')->where('code = ' . $db->quote($coupon_code) . ' AND published = 1 AND published_up < ' . $db->quote($cdate->format('Y-m-d H:i:s')) . " AND published_down > " . $db->quote($cdate->format('Y-m-d H:i:s'))); $db->setQuery($query); $coupon = $db->loadObject(); if (!empty($coupon)) { if ($coupon->procent == 1) { // Get a procent value $payment_brutto = round($payment_brutto * ((100 - $coupon->value) / 100), 2); } else { $payment_brutto = $payment_brutto - $coupon->value; } } else { // Perhaps delete this invalid field, or display an error?! TODO } } $neu->payment_brutto = $payment_brutto; } $results = $dispatcher->trigger('onBeforeSaveBooking', $neu, $row); // Set status since @3.1 if ($isWaitlist) { // We book to the waitlist, let's set the booking like that then $neu->status = MatukioHelperUtilsBooking::$WAITLIST; } elseif (empty($row->fees)) { // We set the status to active because no payment is done.. so no reason to not confirm them $neu->status = MatukioHelperUtilsBooking::$ACTIVE; } elseif (MatukioHelperSettings::_("booking_always_active", 0)) { // We check if the booking always active setting is set - if yes the booking is always!! active (except waitlist delete etc.) $neu->status = MatukioHelperUtilsBooking::$ACTIVE; } else { // We set the status to pending - this is going to be overwritten by the payment API (if paid etc.) $neu->status = MatukioHelperUtilsBooking::$PENDING; } if (!$neu->check()) { JError::raiseError(500, $database->stderr()); exit; } if (!$neu->store()) { JError::raiseError(500, $database->stderr()); exit; } $neu->checkin(); $ueber1 = JText::_("COM_MATUKIO_BOOKING_WAS_SUCCESSFULL"); if ($usrid == 0) { $usrid = $neu->id * -1; } if (MatukioHelperSettings::getSettings("oldbooking_redirect_after", "bookingpage") == "bookingpage") { $link = JRoute::_(MatukioHelperRoute::getEventRoute($row->id, $catid, 1, $neu->id), false); } elseif (MatukioHelperSettings::getSettings("oldbooking_redirect_after", "bookingpage") == "eventpage") { $link = JRoute::_(MatukioHelperRoute::getEventRoute($row->id, $catid, 0, $neu->id), false); } else { // Eventlist overview $link = JRoute::_("index.php?option=com_matukio&view=eventlist"); } if ($art == 4) { MatukioHelperUtilsEvents::sendBookingConfirmationMail($row, $neu->id, 8); } else { MatukioHelperUtilsEvents::sendBookingConfirmationMail($row, $neu->id, 1); } } else { $link = JRoute::_(MatukioHelperRoute::getEventRoute($row->id, $catid), false); } $this->setRedirect($link, $ueber1 . " " . $reason); }
$vars->orderid = $this->booking->id; $vars->order_id = $this->booking->id; $vars->user_firstname = $this->booking->name; $vars->user_id = $this->booking->userid; $vars->user_email = $this->booking->email; if (empty($this->booking->email) && $this->booking->userid > 0) { $user = JFactory::getUser($this->booking->userid); $vars->user_email = $user->email; $vars->user_firstname = $user->name; } $vars->item_name = $this->event->title; // Link back to the form if (MatukioHelperSettings::getSettings("oldbooking_redirect_after", "bookingpage") == "bookingpage") { $vars->return = JURI::base() . substr(JRoute::_(MatukioHelperRoute::getEventRoute($this->event->id, $this->event->catid, 1, $this->booking->id, $this->uuid), false), strlen(JURI::base(true)) + 1); } elseif (MatukioHelperSettings::getSettings("oldbooking_redirect_after", "bookingpage") == "eventpage") { $vars->return = JURI::base() . substr(JRoute::_(MatukioHelperRoute::getEventRoute($this->event->id, $this->event->catid, 0, $this->booking->id, $this->uuid), false), strlen(JURI::base(true)) + 1); } else { // Eventlist overview $vars->return = JURI::base() . substr(JRoute::_("index.php?option=com_matukio&view=eventlist"), strlen(JURI::base(true)) + 1); } $vars->cancel_return = JRoute::_(JURI::root() . "index.php?option=com_matukio&view=ppayment&task=cancelPayment&pg_plugin=" . $pg_plugin . "&uuid=" . $this->uuid); $vars->notify_url = JRoute::_(JURI::root() . "index.php?option=com_matukio&view=ppayment&task=status&pg_plugin=" . $pg_plugin . "&uuid=" . $this->uuid); $vars->submiturl = JRoute::_("index.php?option=com_matukio&controller=ppayment&task=confirmpayment&processor={$pg_plugin}"); // Not documented in payment api $vars->url = JRoute::_(JURI::root() . "index.php?option=com_matukio&view=ppayment&task=status&pg_plugin=" . $pg_plugin . "&uid=" . $this->booking->id . "&uuid=" . $this->uuid); $vars->currency_code = MatukioHelperSettings::getSettings("paypal_currency", 'EUR'); $vars->amount = $this->booking->payment_brutto; // Import the right plugin here! JPluginHelper::importPlugin('payment', $pg_plugin); if ($pg_plugin == 'paypal') { $vars->cmd = '_xclick';
/** * Gets the upcoming events * * @param object $events - The events * @param object $user - The user * * @return string - The html code */ public static function getUpcomingEventsHTML($events, $user) { JHTML::_('stylesheet', 'media/com_matukio/css/upcoming.css'); $html = ""; if (count($events)) { $dispatcher = JDispatcher::getInstance(); JPluginHelper::importPlugin('content'); $params = JComponentHelper::getParams('com_matukio'); foreach ($events as $event) { $buchopt = MatukioHelperUtilsEvents::getEventBookableArray(0, $event, $user->id); // Link $eventid_l = $event->id . ':' . JFilterOutput::stringURLSafe($event->title); $catid_l = $event->catid . ':' . JFilterOutput::stringURLSafe(MatukioHelperCategories::getCategoryAlias($event->catid)); $link = JRoute::_(MatukioHelperRoute::getEventRoute($eventid_l, $catid_l), false); // Event image -- TODO Add / Check for category image $linksbild = MatukioHelperUtilsBasic::getComponentImagePath() . "2601.png"; if ($event->image != "" and MatukioHelperSettings::getSettings('event_image', 1) == 1) { $linksbild = MatukioHelperUtilsBasic::getEventImagePath(1) . $event->image; } $hot = $event->hot_event ? " " : ""; $top = $event->top_event ? " mat_top_event" : ""; // Starting Row $html .= '<div class="mat_single_event' . $hot . $top . '">'; $html .= ' <div class="mat_event_header">'; $html .= ' <div class="mat_event_header_inner">'; $html .= ' <div class="mat_event_header_line">'; $html .= ' <div class="mat_event_image">'; $html .= ' <img src="' . $linksbild . '" alt="' . $event->title . '" align="absmiddle" />'; $html .= ' </div>'; $html .= ' <div class="mat_event_title">'; $html .= ' <h2><a href="' . $link . '" title="' . $event->title . '">' . $event->title . '</a></h2>'; $html .= ' </div>'; $html .= ' </div>'; $html .= ' <div class="mat_event_location">'; $begin = JHTML::_('date', $event->begin, MatukioHelperSettings::getSettings('date_format', 'd-m-Y, H:i')); $location = $event->place; $locobj = null; if ($event->place_id > 0) { $locobj = MatukioHelperUtilsEvents::getLocation($event->place_id); $placelink = JRoute::_("index.php?option=com_matukio&view=location&id=" . $locobj->id . ":" . JFilterOutput::stringURLSafe($locobj->title)); $location = '<a href="' . $placelink . '">' . $locobj->location . '</a>'; } if (MatukioHelperSettings::getSettings('show_timezone', '1')) { $begin .= " (GMT " . JHTML::_('date', $event->booked, 'P') . ")"; } if ($event->webinar == 1) { $locimg = MatukioHelperUtilsBasic::getComponentImagePath() . "webinar.png"; $html .= '<h4><img src="' . $locimg . '" title="' . JText::_("COM_MATUKIO_WEBINAR") . '" style="width: 22px; vertical-align:middle" /> ' . $location . " " . JText::_("COM_MATUKIO_AT") . " " . $begin . '</h4>'; } else { // TODO add map link $locimg = MatukioHelperUtilsBasic::getComponentImagePath() . "home.png"; $html .= '<h4><img src="' . $locimg . '" title="' . JText::_("COM_MATUKIO_FIELDS_CITY") . '" style="width: 22px; vertical-align:middle" /> ' . $location . " " . JText::_("COM_MATUKIO_AT") . " " . $begin . '</h4>'; } $html .= ' </div>'; $html .= ' </div>'; $html .= ' </div>'; $html .= ' <div class="mat_event_description">'; $html .= $event->shortdesc; $html .= '</div>'; $html .= ' <div class="mat_event_footer">'; $html .= ' <div class="mat_event_footer_inner">'; $html .= ' <div class="mat_event_infoline">'; $catlink = JRoute::_("index.php?option=com_matukio&view=eventlist&art=0&catid=" . $event->catid . ":" . JFilterOutput::stringURLSafe($event->category)); $html .= '<a href="' . $catlink . '">' . JTEXT::_($event->category) . '</a>'; // Infoline $gebucht = MatukioHelperUtilsEvents::calculateBookedPlaces($event); if (MatukioHelperSettings::getSettings('event_showinfoline', 1) == 1) { $html .= " | "; // Veranstaltungsnummer anzeigen if ($event->semnum != "") { $html .= JTEXT::_('COM_MATUKIO_NUMBER') . ": " . $event->semnum . " | "; } $html .= JTEXT::_('COM_MATUKIO_BOOKABLE') . ": " . $buchopt[4]; } // Seminarleiter anzeigen if ($event->teacher != "") { $html .= " | " . $event->teacher; } // Fees if ($event->fees > 0) { $html .= " | "; $gebuehr = MatukioHelperUtilsEvents::getFormatedCurrency($event->fees); $currency = MatukioHelperSettings::getSettings('currency_symbol', '$'); if ($currency == '€') { $html .= JTEXT::_('COM_MATUKIO_FEES') . ': ' . $gebuehr . " " . $currency; } else { $html .= JTEXT::_('COM_MATUKIO_FEES') . ': ' . $currency . " " . $gebuehr; } } $html .= '</div>'; $html .= ' <div class="mat_event_footer_buttons" align="right">'; // Detail Link $html .= " <a title=\"" . $event->title . "\" href=\"" . $link . "\">" . "<span class=\"mat_button\"><img src=\"" . MatukioHelperUtilsBasic::getComponentImagePath() . "0012.png\" border=\"0\" align=\"absmiddle\"> " . JTEXT::_('COM_MATUKIO_EVENT_DETAILS') . "</span></a> "; // Booking Link if (($user->id != 0 || MatukioHelperSettings::getSettings('booking_unregistered', 1) == 1) && MatukioHelperSettings::getSettings('oldbookingform', 0) != 1) { if ($event->nrbooked > 0) { $bookinglink = JRoute::_("index.php?option=com_matukio&view=bookevent&cid=" . $event->id . ":" . JFilterOutput::stringURLSafe($event->title)); $html .= " <a title=\"" . JTEXT::_('COM_MATUKIO_BOOK') . "\" href=\"" . $bookinglink . "\"><span class=\"mat_button mat_book\" type=\"button\"><img src=\"" . MatukioHelperUtilsBasic::getComponentImagePath() . "1116.png\" border=\"0\" align=\"absmiddle\"> " . JTEXT::_('COM_MATUKIO_BOOK') . "</span></a>"; } } $html .= ' <br />'; $results = $dispatcher->trigger('onContentAfterButton', array('com_matukio.upcomingevent', &$event, &$params, 0)); $html .= trim(implode("\n", $results)); $html .= ' </div>'; $html .= ' </div>'; $html .= ' </div>'; $html .= ' </div>'; } } return $html; }
// Link $eventid_l = $row->id . ':' . JFilterOutput::stringURLSafe($row->title); $catid_l = $row->catid . ':' . JFilterOutput::stringURLSafe($row->category); $link = JRoute::_(MatukioHelperRoute::getEventRoute($eventid_l, $catid_l), false); $events .= "<a class=\"editlinktip hasTip\" title=\"" . htmlspecialchars($row->title) . "::" . sem_m003($row, $params) . "\" style=\"text-decoration: none;\" href='" . $link . "'><img src=\"modules/mod_matukio/images/" . $grafik . ".png\" border=\"0\"></a>"; } } if ($events != "") { $stil = "style=\"" . $params->get('sem_m086', '') . $heutestil . "\""; } $html .= "<td " . $stil . ">" . $i . "<br />" . $events . "</td>"; $spalten++; } if ($spalten < 7) { $leertage = 7 - $spalten; for ($i = 1; $i <= $leertage; $i++) { $html .= "<td style=\"" . $params->get('sem_m085', '') . "\"> </td>"; } } $html .= "</tr></table></center>"; break; } if ($params->get('sem_m074', 0) > 0) { $html .= "</marquee>"; } if ($params->get('sem_m075', 0) > 0 and $params->get('sem_m039', 0) > 0) { $needles = array('event' => (int) 1, 'category' => (int) 0); $item = MatukioHelperRoute::_findItem($needles); $html .= "<hr style='height:1px;color:#808080;background-color:#808080;border:0px;'><a href='" . JROUTE::_('index.php?option=com_matukio&view=eventlist' . $index . '&Itemid=' . $item->id, 1, 0) . "'><b>" . JText::_('MOD_MATUKIO_MORE') . "</b></a>"; } echo $html;
/** * NEW Booking method for old and new form * * @throws Exception - if db query fails * @return mixed */ public function book() { $payment_brutto = 0; $database = JFactory::getDBO(); $post = JRequest::get('post'); $my = JFactory::getUser(); $input = JFactory::getApplication()->input; $event_id = $input->getInt('event_id', 0); $uid = $input->getInt('uid', 0); $steps = $input->getInt('steps', 3); $uuid = $input->get('uuid', 0, 'string'); $id = $input->getInt('id', 0); $booking = null; if (!empty($id)) { // check if there is really such a booking $model = JModelLegacy::getInstance('Booking', 'MatukioModel'); $booking = $model->getBooking($uuid); if (empty($booking)) { throw new Exception(JText::_("COM_MATUKIO_NO_BOOKING_FOUND"), 404); } if ($booking->id != $id) { throw new Exception(JText::_("COM_MATUKIO_NO_BOOKING_FOUND"), 404); } } $nrbooked = $input->getInt('nrbooked', 1); $catid = $input->getInt('catid', 0); $payment_method = $input->get('payment', '', 'string'); $agb = $input->get('agb', '', 'string'); $isWaitlist = false; $dispatcher = JDispatcher::getInstance(); if (empty($event_id)) { throw new Exception(JText::_("COM_MATUKIO_NO_ID"), 404); } // Load event (use model function) $emodel = JModelLegacy::getInstance('Event', 'MatukioModel'); $event = $emodel->getItem($event_id); $userid = $my->id; // Different fees @since 3.0 $different_fees = $event->different_fees; $reason = ""; $art = 2; $temp = null; $gebucht = MatukioHelperUtilsEvents::calculateBookedPlaces($event); $gebucht = $gebucht->booked; $allesok = 1; $ueber1 = JTEXT::_('COM_MATUKIO_BOOKING_WAS_SUCCESSFULL'); $pflichtfeld = false; $fields = MatukioHelperUtilsEvents::getAdditionalFieldsFrontend($event); // Checking old required fields - backward compatibilty for ($i = 0; $i < 20; $i++) { $test = $fields[0][$i]; if (!empty($test)) { $res = explode("|", $test); if (trim($res[1]) == "1") { $value = $input->get("zusatz" . ($i + 1), '', 'string'); if (empty($value)) { $pflichtfeld = true; } } } } if (MatukioHelperSettings::getSettings("captcha", 0) == 1) { $ccval = $input->get("ccval", '', 'string'); $captcha = $input->get("captcha", '', 'string'); if (empty($captcha)) { $allesok = 0; $ueber1 = JTEXT::_('COM_MATUKIO_BOOKING_WAS_NOT_SUCCESSFULL'); $reason = JTEXT::_('COM_MATUKIO_CAPTCHA_WRONG'); } elseif (md5($captcha) != $ccval) { $allesok = 0; $ueber1 = JTEXT::_('COM_MATUKIO_BOOKING_WAS_NOT_SUCCESSFULL'); $reason = JTEXT::_('COM_MATUKIO_CAPTCHA_WRONG'); } } if (MatukioHelperSettings::getSettings("recaptcha", 0) == 1) { require_once JPATH_COMPONENT_ADMINISTRATOR . '/include/recaptcha/recaptchalib.php'; $key = MatukioHelperSettings::getSettings("recaptcha_private_key", ""); if (empty($key)) { throw new Exception("COM_MATUKIO_YOU_HAVE_TO_SET_A_RECAPTCHA_KEY", 500); } $resp = recaptcha_check_answer($key, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); if (!$resp->is_valid) { // What happens when the CAPTCHA was entered incorrectly $allesok = 0; $ueber1 = JTEXT::_('COM_MATUKIO_BOOKING_WAS_NOT_SUCCESSFULL'); $reason = JTEXT::_('COM_MATUKIO_CAPTCHA_WRONG') . $resp->error; } } $agbtext = MatukioHelperSettings::getSettings("agb_text", ""); if ($pflichtfeld) { $allesok = 0; $ueber1 = JTEXT::_('COM_MATUKIO_BOOKING_WAS_NOT_SUCCESSFULL'); $reason = JTEXT::_('COM_MATUKIO_REQUIRED_ADDITIONAL_FIELD_EMPTY'); } elseif (count($temp) > 0) { $allesok = 0; $ueber1 = JTEXT::_('COM_MATUKIO_BOOKING_WAS_NOT_SUCCESSFULL'); $reason = JTEXT::_('COM_MATUKIO_REGISTERED_FOR_THIS_EVENT'); } elseif (MatukioHelperUtilsDate::getCurrentDate() > $event->booked) { echo "current: " . MatukioHelperUtilsDate::getCurrentDate(); echo " booking: " . $event->booked; $allesok = 0; $ueber1 = JTEXT::_('COM_MATUKIO_BOOKING_WAS_NOT_SUCCESSFULL'); $reason = JTEXT::_('COM_MATUKIO_EXCEEDED'); } elseif ($event->maxpupil - $gebucht - $nrbooked < 0 && $event->stopbooking == 1) { $allesok = 0; $ueber1 = JTEXT::_('COM_MATUKIO_BOOKING_WAS_NOT_SUCCESSFULL'); $reason = JTEXT::_('COM_MATUKIO_MAX_PARTICIPANT_NUMBER_REACHED'); } elseif (!empty($agbtext)) { // Has to be on the end if (empty($agb)) { $allesok = 0; $ueber1 = JTEXT::_('COM_MATUKIO_BOOKING_WAS_NOT_SUCCESSFULL'); $reason = JTEXT::_('COM_MATUKIO_AGB_NOT_ACCEPTED'); } } if ($event->maxpupil - $gebucht - $nrbooked < 0 && $event->stopbooking == 0) { $allesok = 2; $ueber1 = JTEXT::_('COM_MATUKIO_ADDED_WAITLIST'); $reason = JTEXT::_('COM_MATUKIO_YOU_ARE_BOOKED_ON_THE_WAITING_LIST'); if (empty($booking)) { $isWaitlist = true; } else { // Prevent switching old booking to waitlist if ($booking->status == MatukioHelperUtilsBooking::$WAITLIST) { $isWaitlist = true; } else { $isWaitlist = false; } } } if ($art == 4) { $allesok = 1; $ueber1 = JTEXT::_('COM_MATUKIO_BOOKING_WAS_SUCCESSFULL'); } $results = $dispatcher->trigger('onValidateBooking', $post, $event, $allesok); // Alles in Ordnung if ($allesok > 0) { // Buchung eintragen $neu = JTable::getInstance('bookings', 'Table'); if (!$neu->bind($post)) { return JError::raiseError(500, $database->stderr()); } $neu->semid = $event->id; $neu->userid = $userid; $firstname = $input->get('firstname', '', 'string'); $lastname = $input->get('lastname', '', 'string'); $neu->bookingdate = MatukioHelperUtilsDate::getCurrentDate(); $neu->name = MatukioHelperUtilsBasic::cleanHTMLfromText($firstname . " " . $lastname); $neu->email = MatukioHelperUtilsBasic::cleanHTMLfromText($neu->email); $neu->zusatz1 = MatukioHelperUtilsBasic::cleanHTMLfromText($neu->zusatz1); $neu->zusatz2 = MatukioHelperUtilsBasic::cleanHTMLfromText($neu->zusatz2); $neu->zusatz3 = MatukioHelperUtilsBasic::cleanHTMLfromText($neu->zusatz3); $neu->zusatz4 = MatukioHelperUtilsBasic::cleanHTMLfromText($neu->zusatz4); $neu->zusatz5 = MatukioHelperUtilsBasic::cleanHTMLfromText($neu->zusatz5); $neu->zusatz6 = MatukioHelperUtilsBasic::cleanHTMLfromText($neu->zusatz6); $neu->zusatz7 = MatukioHelperUtilsBasic::cleanHTMLfromText($neu->zusatz7); $neu->zusatz8 = MatukioHelperUtilsBasic::cleanHTMLfromText($neu->zusatz8); $neu->zusatz9 = MatukioHelperUtilsBasic::cleanHTMLfromText($neu->zusatz9); $neu->zusatz10 = MatukioHelperUtilsBasic::cleanHTMLfromText($neu->zusatz10); $neu->zusatz11 = MatukioHelperUtilsBasic::cleanHTMLfromText($neu->zusatz11); $neu->zusatz12 = MatukioHelperUtilsBasic::cleanHTMLfromText($neu->zusatz12); $neu->zusatz13 = MatukioHelperUtilsBasic::cleanHTMLfromText($neu->zusatz13); $neu->zusatz14 = MatukioHelperUtilsBasic::cleanHTMLfromText($neu->zusatz14); $neu->zusatz15 = MatukioHelperUtilsBasic::cleanHTMLfromText($neu->zusatz15); $neu->zusatz16 = MatukioHelperUtilsBasic::cleanHTMLfromText($neu->zusatz16); $neu->zusatz17 = MatukioHelperUtilsBasic::cleanHTMLfromText($neu->zusatz17); $neu->zusatz18 = MatukioHelperUtilsBasic::cleanHTMLfromText($neu->zusatz18); $neu->zusatz19 = MatukioHelperUtilsBasic::cleanHTMLfromText($neu->zusatz19); $neu->zusatz20 = MatukioHelperUtilsBasic::cleanHTMLfromText($neu->zusatz20); $fields = MatukioHelperUtilsBooking::getBookingFields(); if (!empty($fields)) { $newfields = ""; for ($i = 0; $i < count($fields); $i++) { $field = $fields[$i]; $name = $field->field_name; $newfields .= $field->id; $newfields .= "::"; $newfields .= $input->get($name, '', 'string'); $newfields .= ";"; } $neu->newfields = $newfields; if (!empty($event->fees) && $steps > 2) { $neu->payment_method = $payment_method; if ($different_fees == 0) { $payment_brutto = $event->fees * $neu->nrbooked; $coupon_code = $neu->coupon_code; if (!empty($coupon_code)) { $cdate = new DateTime(); $db = JFactory::getDBO(); $query = $db->getQuery(true); $query->select('*')->from('#__matukio_booking_coupons')->where('code = ' . $db->quote($coupon_code) . ' AND published = 1 AND (published_up < ' . $db->quote($cdate->format('Y-m-d H:i:s')) . ' OR published_up = ' . $db->quote("0000-00-00 00:00:00") . ') ' . 'AND (published_down > ' . $db->quote($cdate->format('Y-m-d H:i:s')) . ' OR published_down = ' . $db->quote("0000-00-00 00:00:00") . ')'); $db->setQuery($query); $coupon = $db->loadObject(); if (!empty($coupon)) { if ($coupon->procent == 1) { // Get a procent value $payment_brutto = round($payment_brutto * ((100 - $coupon->value) / 100), 2); } else { // Get a real value $payment_brutto = $payment_brutto - $coupon->value; } // Check how often the coupon is used and if used to often set published to 0 (since 3.0.0) $coupon->hits++; // Check if coupon has to be disabled now if (!empty($coupon->max_hits) && $coupon->hits >= $coupon->max_hits) { $coupon->published = 0; } $coupontable = JTable::getInstance('coupons', 'Table'); if (!$coupontable->bind($coupon)) { throw new Exception(42, $database->stderr()); } if (!$coupontable->check()) { throw new Exception(42, $database->stderr()); } if (!$coupontable->store()) { throw new Exception(42, $database->stderr()); } $coupontable->checkin(); } else { // Perhaps delete this invalid field, or display an error?! Should be validated through js normally throw new Exception(JText::_("COM_MATUKIO_INVALID_COUPON_CODE"), 42); } } $neu->payment_brutto = $payment_brutto; } else { // Different fees $payment_brutto = MatukioHelperFees::getPaymentTotal($event); $neu->payment_brutto = $payment_brutto; $difarray = array("places" => $input->get("places", array(), 'Array'), "types" => $input->get("ticket_fees", array(), 'Array')); $neu->different_fees = json_encode($difarray); } } elseif (!empty($event->fees)) { if ($different_fees == 0) { // We have disabled payment plugins but a fee // Only calculate total amount $payment_brutto = $event->fees * $neu->nrbooked; $neu->payment_brutto = $payment_brutto; } else { // Different fees $payment_brutto = MatukioHelperFees::getPaymentTotal($event); $neu->payment_brutto = $payment_brutto; $difarray = array("places" => $input->get("places", array(), 'Array'), "types" => $input->get("ticket_fees", array(), 'Array')); $neu->different_fees = json_encode($difarray); } } } else { // Only calculate total amount $payment_brutto = $event->fees * $neu->nrbooked; $neu->payment_brutto = $event->fees * $neu->nrbooked; } // Taxes if ($neu->payment_brutto > 0) { // Lets check if there are any if ($event->tax_id == 0) { // No taxes $neu->payment_netto = $neu->payment_brutto; $neu->payment_tax = 0.0; } else { $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select("*")->from("#__matukio_taxes")->where("id = " . $db->quote($event->tax_id) . " AND published = 1"); $db->setQuery($query); $tax = $db->loadObject(); if (empty($tax)) { // Houston we have a problem throw new Exception("Invalid tax value! Please select the correct tax in the event edit form."); } else { // Calculate netto $minfac = 100 / (100 + $tax->value); $neu->payment_netto = $neu->payment_brutto * $minfac; $neu->payment_tax = $neu->payment_brutto - $neu->payment_netto; } } } $results = $dispatcher->trigger('onBeforeSaveBooking', $neu, $event); // Set status since @3.1 if (!empty($booking)) { // We don't update the status for old bookings $neu->status = $booking->status; } elseif ($isWaitlist) { // We book to the waitlist, let's set the booking like that then $neu->status = MatukioHelperUtilsBooking::$WAITLIST; } elseif (MatukioHelperSettings::_("booking_always_inactive", 0)) { // We set the status to pending $neu->status = MatukioHelperUtilsBooking::$PENDING; } elseif (empty($event->fees)) { // We set the status to active because no payment is done.. so no reason to not confirm them $neu->status = MatukioHelperUtilsBooking::$ACTIVE; } elseif ($steps == 2) { // We set the status to active because no payment can be done.. so no reason to not confirm them $neu->status = MatukioHelperUtilsBooking::$ACTIVE; } elseif ($payment_method == "cash") { // We check if the booking always active setting is set - if yes the booking is always!! active (except waitlist delete etc.) $neu->status = MatukioHelperUtilsBooking::$ACTIVE; } elseif (MatukioHelperSettings::_("booking_always_active", 0)) { // We check if the booking always active setting is set - if yes the booking is always!! active (except waitlist delete etc.) $neu->status = MatukioHelperUtilsBooking::$ACTIVE; } else { // We set the status to pending - this is going to be overwritten by the payment API (if paid etc.) $neu->status = MatukioHelperUtilsBooking::$PENDING; } if (!$neu->check()) { JError::raiseError(500, $database->stderr()); } if (!$neu->store()) { JError::raiseError(500, $database->stderr()); } $neu->checkin(); $results = $dispatcher->trigger('onAfterBookingSave', $neu, $event); $ueber1 = JText::_("COM_MATUKIO_BOOKING_WAS_SUCCESSFULL"); $booking_id = $neu->id; } if ($payment_brutto > 0 && $steps > 2) { // Link to the payment form $link = JRoute::_("index.php?option=com_matukio&view=paymentform&uuid=" . $uuid); $this->setRedirect($link, $reason); } else { if ($allesok > 0) { // We need to send the confirmation here.. we don't send it yet if the event has payment processing MatukioHelperUtilsEvents::sendBookingConfirmationMail($event, $neu->id, 1); } // Link to the bookingpage if (MatukioHelperSettings::getSettings("oldbooking_redirect_after", "bookingpage") == "bookingpage") { $link = JRoute::_("index.php?option=com_matukio&view=booking&uuid=" . $neu->uuid); } elseif (MatukioHelperSettings::getSettings("oldbooking_redirect_after", "bookingpage") == "eventpage") { $link = JRoute::_(MatukioHelperRoute::getEventRoute($event->id, $catid, 0, $booking_id), false); } else { // Eventlist overview $link = JRoute::_("index.php?option=com_matukio&view=eventlist"); } $this->setRedirect($link, $ueber1 . " " . $reason); } }
/** * Set booking to canceled? * * @throws Exception if booking not found * @return void */ public function cancelPayment() { $uuid = JFactory::getApplication()->input->get('uuid', ''); $pg_plugin = JFactory::getApplication()->input->get('pg_plugin', ''); $model = $this->getModel('PPayment', 'MatukioModel'); $booking = $model->getBooking($uuid); if (empty($booking)) { throw new Exception(JText::_("COM_MATUKIO_BOOKING_NOT_FOUND"), 404); } $event = $model->getEvent($booking->semid); // Update status $db = JFactory::getDbo(); $query = $db->getQuery(true); // Set status to deleted $query->update("#__matukio_bookings")->where("uuid = " . $db->quote($uuid))->set("payment_status = " . $db->quote("P"))->set("status = 4"); $db->setQuery($query); $db->execute(); // Link to event art = 1 $eventid_l = $event->id . ':' . JFilterOutput::stringURLSafe($event->title); $catid_l = $event->catid . ':' . JFilterOutput::stringURLSafe(MatukioHelperCategories::getCategoryAlias($event->catid)); $link = JRoute::_(MatukioHelperRoute::getEventRoute($eventid_l, $catid_l, 1), false); $msg = JText::_("COM_MATUKIO_YOUR_BOOKING_HAS_BEEN_DELETED"); $this->setRedirect($link, $msg); }
// Ticket if (MatukioHelperSettings::getSettings("download_ticket", 1) && ($this->booking->status == 0 || $this->booking->status == 1)) { $href = JURI::ROOT() . "index.php?option=com_matukio&view=printeventlist&format=raw&todo=ticket&cid=" . $this->booking->semid . "&uuid=" . $this->booking->uuid; echo " <a border=\"0\" href=\"" . $href . "\" ><span class=\"btn\" type=\"button\">" . JTEXT::_('COM_MATUKIO_DOWNLOAD_TICKET_BUTTON') . "</span></a>"; } // Certification if (MatukioHelperSettings::getSettings('frontend_certificatesystem', 0) > 0) { if ($this->booking->certificated == 1 and $this->event->nrbooked > 0) { echo MatukioHelperUtilsEvents::getPrintWindow(1, $this->event->sid, $this->booking->id, 'CERT', 'btn'); } } // Edit booking if (strtotime($this->event->booked) - time() >= MatukioHelperSettings::getSettings('booking_stornotage', 1) * 24 * 60 * 60 && MatukioHelperSettings::getSettings('booking_edit', 1) == 1 && $this->booking->paid == 0 && ($this->booking->status == 0 || $this->booking->status == 1)) { $editbookinglink = JRoute::_("index.php?option=com_matukio&view=bookevent&cid=" . $this->booking->semid . "&uuid=" . $this->booking->uuid); if (MatukioHelperSettings::getSettings('oldbookingform', 0) == 1) { $editbookinglink = JRoute::_(MatukioHelperRoute::getEventRoute($this->event->id, $this->event->catid, 1, $this->booking->id, $this->booking->uuid), false); } echo " <a border=\"0\" href=\"" . $editbookinglink . "\" ><span class=\"btn btn-success\" type=\"button\">" . JTEXT::_('COM_MATUKIO_EDIT_YOUR_BOOKING') . "</span></a>"; } // Cancel booking if (strtotime($this->event->booked) - time() >= MatukioHelperSettings::getSettings('booking_stornotage', 1) * 24 * 60 * 60 && $this->booking->paid == 0 && MatukioHelperSettings::getSettings('booking_stornotage', 1) != -1 && ($this->booking->status == 0 || $this->booking->status == 1)) { $unbookinglink = JRoute::_("index.php?option=com_matukio&view=bookevent&task=cancelBooking&cid=" . $this->booking->semid . "&uuid=" . $this->booking->uuid); echo " <a border=\"0\" href=\"" . $unbookinglink . "\" ><span class=\"btn btn-danger\" type=\"button\">" . JTEXT::_('COM_MATUKIO_BOOKING_CANCELLED') . "</span></a>"; } ?> </div> <?php // Footer echo MatukioHelperUtilsBasic::getCopyright(); ?>
/** * Gets the replacements for the event & (booking) * * @param object $event - The event data * @param object $booking - The booking data * @param int $nr - the number * * @return mixed */ public static function getReplaces($event, $booking = null, $nr = null) { $needles = array('event' => (int) $event->id, 'category' => 0); $itemId = MatukioHelperRoute::_findItem($needles)->id; if ($nr != null) { $replaces["MAT_NR"] = $nr; } // Current date $replaces["MAT_DATE"] = JHTML::_('date', '', MatukioHelperSettings::getSettings('date_format_without_time', 'd-m-Y')); // Signature $replaces["MAT_SIGNATURE"] = MatukioHelperSettings::getSettings('mat_signature', 'Please do not answer this E-Mail.'); // Event data $replaces["MAT_EVENT_SEMNUM"] = $event->semnum; // Alias $replaces["MAT_EVENT_NUMBER"] = $event->semnum; $replaces["MAT_EVENT_CATID"] = $event->catid; $replaces["MAT_EVENT_CATEGORY"] = JText::_($event->category); $replaces["MAT_EVENT_TITLE"] = JText::_($event->title); $replaces["MAT_EVENT_TARGET"] = JText::_($event->target); $replaces["MAT_EVENT_SHORTDESC"] = JText::_($event->shortdesc); // TODO change image path $replaces["MAT_EVENT_DESCRIPTION"] = JHTML::_('content.prepare', $event->description); $location = $event->place; // Locations if ($event->place_id > 0) { $locobj = MatukioHelperUtilsEvents::getLocation($event->place_id); $location = $locobj->location; } $replaces["MAT_EVENT_PLACE"] = $location; $replaces["MAT_EVENT_LOCATION"] = $location; $replaces["MAT_EVENT_TEACHER"] = $event->teacher; // Alias $replaces["MAT_EVENT_TUTOR"] = $event->teacher; if ($event->fees > 0) { $replaces["MAT_EVENT_FEES"] = MatukioHelperUtilsEvents::getFormatedCurrency($event->fees, MatukioHelperSettings::_('currency_symbol', '$')); } else { $replaces["MAT_EVENT_FEES"] = JText::_("COM_MATUKIO_FREE"); } $replaces["MAT_EVENT_ORGANIZER_ID"] = $event->publisher; $replaces["MAT_EVENT_ORGANIZER"] = JFactory::getUser($event->publisher)->name; $replaces["MAT_EVENT_MAXPUPIL"] = $event->maxpupil; $replaces["MAT_EVENT_BOOKEDPUPIL"] = $event->bookedpupil; $replaces["MAT_EVENT_BEGIN"] = JHTML::_('date', $event->begin, MatukioHelperSettings::getSettings('date_format', 'd-m-Y, H:i')); $replaces["MAT_EVENT_END"] = JHTML::_('date', $event->end, MatukioHelperSettings::getSettings('date_format', 'd-m-Y, H:i')); $replaces["MAT_EVENT_BOOKED"] = JHTML::_('date', $event->booked, MatukioHelperSettings::getSettings('date_format', 'd-m-Y, H:i')); $replaces["MAT_EVENT_GMAPLOC"] = $event->gmaploc; $replaces["MAT_EVENT_NRBOOKED"] = $event->nrbooked; /* Alias */ $custom10 = explode("|", $event->zusatz10); $custom11 = explode("|", $event->zusatz11); $custom12 = explode("|", $event->zusatz12); $custom13 = explode("|", $event->zusatz13); $custom14 = explode("|", $event->zusatz14); $custom15 = explode("|", $event->zusatz15); $custom16 = explode("|", $event->zusatz16); $custom17 = explode("|", $event->zusatz17); $custom18 = explode("|", $event->zusatz18); $custom19 = explode("|", $event->zusatz19); $custom20 = explode("|", $event->zusatz20); $custom1 = explode("|", $event->zusatz1); $custom2 = explode("|", $event->zusatz2); $custom3 = explode("|", $event->zusatz3); $custom4 = explode("|", $event->zusatz4); $custom5 = explode("|", $event->zusatz5); $custom6 = explode("|", $event->zusatz6); $custom7 = explode("|", $event->zusatz7); $custom8 = explode("|", $event->zusatz8); $custom9 = explode("|", $event->zusatz9); $replaces["MAT_EVENT_CUSTOM10"] = $custom10[0]; $replaces["MAT_EVENT_CUSTOM11"] = $custom11[0]; $replaces["MAT_EVENT_CUSTOM12"] = $custom12[0]; $replaces["MAT_EVENT_CUSTOM13"] = $custom13[0]; $replaces["MAT_EVENT_CUSTOM14"] = $custom14[0]; $replaces["MAT_EVENT_CUSTOM15"] = $custom15[0]; $replaces["MAT_EVENT_CUSTOM16"] = $custom16[0]; $replaces["MAT_EVENT_CUSTOM17"] = $custom17[0]; $replaces["MAT_EVENT_CUSTOM18"] = $custom18[0]; $replaces["MAT_EVENT_CUSTOM19"] = $custom19[0]; $replaces["MAT_EVENT_CUSTOM20"] = $custom20[0]; $replaces["MAT_EVENT_CUSTOM1"] = $custom1[0]; $replaces["MAT_EVENT_CUSTOM2"] = $custom2[0]; $replaces["MAT_EVENT_CUSTOM3"] = $custom3[0]; $replaces["MAT_EVENT_CUSTOM4"] = $custom4[0]; $replaces["MAT_EVENT_CUSTOM5"] = $custom5[0]; $replaces["MAT_EVENT_CUSTOM6"] = $custom6[0]; $replaces["MAT_EVENT_CUSTOM7"] = $custom7[0]; $replaces["MAT_EVENT_CUSTOM8"] = $custom8[0]; $replaces["MAT_EVENT_CUSTOM9"] = $custom9[0]; $replaces["MAT_EVENT_ZUSATZ10"] = $replaces["MAT_EVENT_CUSTOM10"]; $replaces["MAT_EVENT_ZUSATZ11"] = $replaces["MAT_EVENT_CUSTOM11"]; $replaces["MAT_EVENT_ZUSATZ12"] = $replaces["MAT_EVENT_CUSTOM12"]; $replaces["MAT_EVENT_ZUSATZ13"] = $replaces["MAT_EVENT_CUSTOM13"]; $replaces["MAT_EVENT_ZUSATZ14"] = $replaces["MAT_EVENT_CUSTOM14"]; $replaces["MAT_EVENT_ZUSATZ15"] = $replaces["MAT_EVENT_CUSTOM15"]; $replaces["MAT_EVENT_ZUSATZ16"] = $replaces["MAT_EVENT_CUSTOM16"]; $replaces["MAT_EVENT_ZUSATZ17"] = $replaces["MAT_EVENT_CUSTOM17"]; $replaces["MAT_EVENT_ZUSATZ18"] = $replaces["MAT_EVENT_CUSTOM18"]; $replaces["MAT_EVENT_ZUSATZ19"] = $replaces["MAT_EVENT_CUSTOM19"]; $replaces["MAT_EVENT_ZUSATZ20"] = $replaces["MAT_EVENT_CUSTOM20"]; $replaces["MAT_EVENT_ZUSATZ1"] = $replaces["MAT_EVENT_CUSTOM1"]; $replaces["MAT_EVENT_ZUSATZ2"] = $replaces["MAT_EVENT_CUSTOM2"]; $replaces["MAT_EVENT_ZUSATZ3"] = $replaces["MAT_EVENT_CUSTOM3"]; $replaces["MAT_EVENT_ZUSATZ4"] = $replaces["MAT_EVENT_CUSTOM4"]; $replaces["MAT_EVENT_ZUSATZ5"] = $replaces["MAT_EVENT_CUSTOM5"]; $replaces["MAT_EVENT_ZUSATZ6"] = $replaces["MAT_EVENT_CUSTOM6"]; $replaces["MAT_EVENT_ZUSATZ7"] = $replaces["MAT_EVENT_CUSTOM7"]; $replaces["MAT_EVENT_ZUSATZ8"] = $replaces["MAT_EVENT_CUSTOM8"]; $replaces["MAT_EVENT_ZUSATZ9"] = $replaces["MAT_EVENT_CUSTOM9"]; $replaces["MAT_EVENT_ZUSATZ10HINT"] = $event->zusatz10hint; $replaces["MAT_EVENT_ZUSATZ11HINT"] = $event->zusatz11hint; $replaces["MAT_EVENT_ZUSATZ12HINT"] = $event->zusatz12hint; $replaces["MAT_EVENT_ZUSATZ13HINT"] = $event->zusatz13hint; $replaces["MAT_EVENT_ZUSATZ14HINT"] = $event->zusatz14hint; $replaces["MAT_EVENT_ZUSATZ15HINT"] = $event->zusatz15hint; $replaces["MAT_EVENT_ZUSATZ16HINT"] = $event->zusatz16hint; $replaces["MAT_EVENT_ZUSATZ17HINT"] = $event->zusatz17hint; $replaces["MAT_EVENT_ZUSATZ18HINT"] = $event->zusatz18hint; $replaces["MAT_EVENT_ZUSATZ19HINT"] = $event->zusatz19hint; $replaces["MAT_EVENT_ZUSATZ20HINT"] = $event->zusatz20hint; $replaces["MAT_EVENT_ZUSATZ1HINT"] = $event->zusatz1hint; $replaces["MAT_EVENT_ZUSATZ2HINT"] = $event->zusatz2hint; $replaces["MAT_EVENT_ZUSATZ3HINT"] = $event->zusatz3hint; $replaces["MAT_EVENT_ZUSATZ4HINT"] = $event->zusatz4hint; $replaces["MAT_EVENT_ZUSATZ5HINT"] = $event->zusatz5hint; $replaces["MAT_EVENT_ZUSATZ6HINT"] = $event->zusatz6hint; $replaces["MAT_EVENT_ZUSATZ7HINT"] = $event->zusatz7hint; $replaces["MAT_EVENT_ZUSATZ8HINT"] = $event->zusatz8hint; $replaces["MAT_EVENT_ZUSATZ9HINT"] = $event->zusatz9hint; /* ALIAS */ $replaces["MAT_EVENT_CUSTOM10HINT"] = $event->zusatz10hint; $replaces["MAT_EVENT_CUSTOM11HINT"] = $event->zusatz11hint; $replaces["MAT_EVENT_CUSTOM12HINT"] = $event->zusatz12hint; $replaces["MAT_EVENT_CUSTOM13HINT"] = $event->zusatz13hint; $replaces["MAT_EVENT_CUSTOM14HINT"] = $event->zusatz14hint; $replaces["MAT_EVENT_CUSTOM15HINT"] = $event->zusatz15hint; $replaces["MAT_EVENT_CUSTOM16HINT"] = $event->zusatz16hint; $replaces["MAT_EVENT_CUSTOM17HINT"] = $event->zusatz17hint; $replaces["MAT_EVENT_CUSTOM18HINT"] = $event->zusatz18hint; $replaces["MAT_EVENT_CUSTOM19HINT"] = $event->zusatz19hint; $replaces["MAT_EVENT_CUSTOM20HINT"] = $event->zusatz20hint; $replaces["MAT_EVENT_CUSTOM1HINT"] = $event->zusatz1hint; $replaces["MAT_EVENT_CUSTOM2HINT"] = $event->zusatz2hint; $replaces["MAT_EVENT_CUSTOM3HINT"] = $event->zusatz3hint; $replaces["MAT_EVENT_CUSTOM4HINT"] = $event->zusatz4hint; $replaces["MAT_EVENT_CUSTOM5HINT"] = $event->zusatz5hint; $replaces["MAT_EVENT_CUSTOM6HINT"] = $event->zusatz6hint; $replaces["MAT_EVENT_CUSTOM7HINT"] = $event->zusatz7hint; $replaces["MAT_EVENT_CUSTOM8HINT"] = $event->zusatz8hint; $replaces["MAT_EVENT_CUSTOM9HINT"] = $event->zusatz9hint; $replaces["MAT_EVENT_CREATED_BY"] = $event->created_by; $replaces["MAT_EVENT_MODIFIED_BY"] = $event->modified_by; $replaces["MAT_EVENT_CREATED"] = JHTML::_('date', $event->created, MatukioHelperSettings::getSettings('date_format', 'd-m-Y, H:i')); $replaces["MAT_EVENT_WEBINAR"] = $event->webinar; if ($booking != null) { if (empty($booking->sid)) { $booking->sid = $booking->id; } // Booking data $replaces["MAT_BOOKING_ID"] = $booking->sid; $replaces["MAT_BOOKING_NUMBER"] = MatukioHelperUtilsBooking::getBookingId($booking->sid); $replaces["MAT_SIGN"] = "<span> </span>"; $user = JFactory::getUser($booking->userid); $replaces["MAT_BOOKING_USERNAME"] = ""; if ($booking->userid > 0) { $replaces["MAT_BOOKING_USERNAME"] = $user->username; } if (isset($booking->aname)) { $booking->aname = trim($booking->aname); } if (isset($booking->name)) { $booking->name = trim($booking->name); } // Old form if (isset($booking->aname) && !empty($booking->aname)) { $replaces["MAT_BOOKING_NAME"] = $booking->aname; } elseif (isset($booking->name) && !empty($booking->name)) { $replaces["MAT_BOOKING_NAME"] = $booking->name; } if (isset($booking->aemail) && !empty($booking->aemail)) { $replaces["MAT_BOOKING_EMAIL"] = $booking->aemail; } elseif (isset($booking->email) && !empty($booking->email)) { $replaces["MAT_BOOKING_EMAIL"] = $booking->email; } // Fix for empty E-Mail if (empty($replaces["MAT_BOOKING_EMAIL"])) { $replaces["MAT_BOOKING_EMAIL"] = $booking->email; } $replaces["MAT_BOOKING_SID"] = $booking->sid; $replaces["MAT_BOOKING_SEMID"] = $booking->semid; $replaces["MAT_BOOKING_USERID"] = $booking->userid; $replaces["MAT_BOOKING_CERTIFICATED"] = $booking->certificated; $replaces["MAT_EVENT_BOOKINGDATE"] = JHTML::_('date', $booking->bookingdate, MatukioHelperSettings::getSettings('date_format', 'd-m-Y, H:i')); $replaces["MAT_EVENT_UPDATED"] = JHTML::_('date', $booking->updated, MatukioHelperSettings::getSettings('date_format', 'd-m-Y, H:i')); $replaces["MAT_INVOICE_DATE"] = JHTML::_('date', $booking->bookingdate, MatukioHelperSettings::getSettings('date_format_without_time', 'd-m-Y')); if ($booking->payment_brutto > 0) { $replaces["MAT_INVOICE_NUMBER"] = MatukioHelperInvoice::getInvoiceNumber($booking->id, JHTML::_('date', $booking->bookingdate, 'Y')); } else { $replaces["MAT_INVOICE_NUMBER"] = ""; } $replaces["MAT_BOOKING_PAID"] = MatukioHelperUtilsBooking::getBookingPaidName($booking->paid); $replaces["MAT_BOOKING_PAID_NUM"] = $booking->paid; $replaces["MAT_BOOKING_PAYMENT_STATUS"] = $booking->payment_status; $replaces["MAT_BOOKING_PAYMENT_PLUGIN_DATA"] = $booking->payment_plugin_data; $replaces["MAT_BOOKING_NRBOOKED"] = $booking->nrbooked; // Alias $replaces["MAT_BOOKING_BOOKEDNR"] = $booking->nrbooked; $replaces["MAT_BOOKING_ZUSATZ10"] = $booking->zusatz10; $replaces["MAT_BOOKING_ZUSATZ11"] = $booking->zusatz11; $replaces["MAT_BOOKING_ZUSATZ12"] = $booking->zusatz12; $replaces["MAT_BOOKING_ZUSATZ13"] = $booking->zusatz13; $replaces["MAT_BOOKING_ZUSATZ14"] = $booking->zusatz14; $replaces["MAT_BOOKING_ZUSATZ15"] = $booking->zusatz15; $replaces["MAT_BOOKING_ZUSATZ16"] = $booking->zusatz16; $replaces["MAT_BOOKING_ZUSATZ17"] = $booking->zusatz17; $replaces["MAT_BOOKING_ZUSATZ18"] = $booking->zusatz18; $replaces["MAT_BOOKING_ZUSATZ19"] = $booking->zusatz19; $replaces["MAT_BOOKING_ZUSATZ20"] = $booking->zusatz20; $replaces["MAT_BOOKING_ZUSATZ1"] = $booking->zusatz1; $replaces["MAT_BOOKING_ZUSATZ2"] = $booking->zusatz2; $replaces["MAT_BOOKING_ZUSATZ3"] = $booking->zusatz3; $replaces["MAT_BOOKING_ZUSATZ4"] = $booking->zusatz4; $replaces["MAT_BOOKING_ZUSATZ5"] = $booking->zusatz5; $replaces["MAT_BOOKING_ZUSATZ6"] = $booking->zusatz6; $replaces["MAT_BOOKING_ZUSATZ7"] = $booking->zusatz7; $replaces["MAT_BOOKING_ZUSATZ8"] = $booking->zusatz8; $replaces["MAT_BOOKING_ZUSATZ9"] = $booking->zusatz9; /* Alias */ $replaces["MAT_BOOKING_CUSTOM10"] = $booking->zusatz10; $replaces["MAT_BOOKING_CUSTOM11"] = $booking->zusatz11; $replaces["MAT_BOOKING_CUSTOM12"] = $booking->zusatz12; $replaces["MAT_BOOKING_CUSTOM13"] = $booking->zusatz13; $replaces["MAT_BOOKING_CUSTOM14"] = $booking->zusatz14; $replaces["MAT_BOOKING_CUSTOM15"] = $booking->zusatz15; $replaces["MAT_BOOKING_CUSTOM16"] = $booking->zusatz16; $replaces["MAT_BOOKING_CUSTOM17"] = $booking->zusatz17; $replaces["MAT_BOOKING_CUSTOM18"] = $booking->zusatz18; $replaces["MAT_BOOKING_CUSTOM19"] = $booking->zusatz19; $replaces["MAT_BOOKING_CUSTOM20"] = $booking->zusatz20; $replaces["MAT_BOOKING_CUSTOM1"] = $booking->zusatz1; $replaces["MAT_BOOKING_CUSTOM2"] = $booking->zusatz2; $replaces["MAT_BOOKING_CUSTOM3"] = $booking->zusatz3; $replaces["MAT_BOOKING_CUSTOM4"] = $booking->zusatz4; $replaces["MAT_BOOKING_CUSTOM5"] = $booking->zusatz5; $replaces["MAT_BOOKING_CUSTOM6"] = $booking->zusatz6; $replaces["MAT_BOOKING_CUSTOM7"] = $booking->zusatz7; $replaces["MAT_BOOKING_CUSTOM8"] = $booking->zusatz8; $replaces["MAT_BOOKING_CUSTOM9"] = $booking->zusatz9; $replaces["MAT_BOOKING_UUID"] = $booking->uuid; if (!empty($booking->payment_method)) { $replaces["MAT_BOOKING_PAYMENT_METHOD"] = self::getPaymentMethodTitle($booking->payment_method); } else { $replaces["MAT_BOOKING_PAYMENT_METHOD"] = ""; } $replaces["MAT_BOOKING_PAYMENT_METHOD_RAW"] = $booking->payment_method; $replaces["MAT_BOOKING_PAYMENT_NUMBER"] = $booking->payment_number; $replaces["MAT_BOOKING_PAYMENT_NETTO"] = MatukioHelperUtilsEvents::getFormatedCurrency($booking->payment_netto, MatukioHelperSettings::_('currency_symbol', '$')); $replaces["MAT_BOOKING_PAYMENT_NET"] = $replaces["MAT_BOOKING_PAYMENT_NETTO"]; $replaces["MAT_BOOKING_PAYMENT_TAX"] = MatukioHelperUtilsEvents::getFormatedCurrency($booking->payment_tax, MatukioHelperSettings::_('currency_symbol', '$')); $replaces["MAT_BOOKING_PAYMENT_BRUTTO"] = MatukioHelperUtilsEvents::getFormatedCurrency($booking->payment_brutto, MatukioHelperSettings::_('currency_symbol', '$')); $replaces["MAT_BOOKING_PAYMENT_GROSS"] = $replaces["MAT_BOOKING_PAYMENT_BRUTTO"]; $replaces["MAT_BOOKING_COUPON_CODE"] = $booking->coupon_code; $replaces["MAT_BOOKING_STATUS"] = MatukioHelperUtilsBooking::getBookingStatusName($booking->status); /* Mark since 4.5 */ $replaces["MAT_BOOKING_MARK"] = $booking->mark; /* QR Codes */ $replaces["MAT_BOOKING_QRCODE_ID"] = MatukioHelperUtilsBooking::getBookingIdQRCode($booking->sid); $replaces["MAT_BOOKING_QRCODE"] = $replaces["MAT_BOOKING_QRCODE_ID"]; $replaces["MAT_BOOKING_BARCODE"] = MatukioHelperUtilsBooking::getBookingIdBarcode($booking->sid); // Checkin URLs and QR-Codes since 4.5 $checkinurl = JRoute::_("index.php?option=com_matukio&view=booking&task=checkin&uuid=" . $booking->uuid . "&Itemid=" . $itemId, true, -1); $replaces["MAT_BOOKING_CHECKIN_URL"] = $checkinurl; $replaces["MAT_BOOKING_CHECKIN_LINK"] = '<a href="' . $checkinurl . '">' . JText::_("COM_MATUKIO_CHECKIN_BOOKING") . "</a>"; $replaces["MAT_BOOKING_CHECKIN_QRCODE"] = MatukioHelperUtilsBooking::getBookingCheckinQRCode($checkinurl, $booking->sid); if ($event->fees > 0) { $replaces["MAT_BOOKING_FEES_STATUS"] = MatukioHelperUtilsEvents::getFormatedCurrency($booking->payment_brutto, MatukioHelperSettings::_('currency_symbol', '$')) . " (" . MatukioHelperUtilsBooking::getBookingPaidName($booking->paid) . ")"; } else { $replaces["MAT_BOOKING_FEES_STATUS"] = JText::_("COM_MATUKIO_FREE_EVENT"); } // Booking detail page @since 4.1.1 $replaces["MAT_BOOKING_DETAILPAGE_URL"] = JRoute::_("index.php?option=com_matukio&view=booking&uuid=" . $booking->uuid . "&Itemid=" . $itemId, true, -1); $replaces["MAT_BOOKING_DETAILPAGE"] = '<a href="' . JRoute::_("index.php?option=com_matukio&view=booking&uuid=" . $booking->uuid . "&Itemid=" . $itemId, true, -1) . '">' . JText::_("COM_MATUKIO_BOOKING_DETAILS") . "</a>"; $editbookinglink = JRoute::_("index.php?option=com_matukio&view=bookevent&cid=" . $booking->semid . "&uuid=" . $booking->uuid . "&Itemid=" . $itemId, true, -1); if (MatukioHelperSettings::getSettings('oldbookingform', 0) == 1) { $editbookinglink = JRoute::_(MatukioHelperRoute::getEventRoute($event->id, $event->catid, 1, $booking->id, $booking->uuid), true, -1); } $replaces["MAT_BOOKING_EDIT_URL"] = $editbookinglink; $replaces["MAT_BOOKING_EDIT"] = '<a href="' . $editbookinglink . '">' . JText::_("COM_MATUKIO_EDIT_YOUR_BOOKING") . "</a>"; // TODO Different fees } // Event info complete no booking here $replaces["MAT_EVENT_ALL_DETAILS_HTML"] = self::getEmailEventInfoHTML($event); $replaces["MAT_EVENT_ALL_DETAILS_TEXT"] = self::getEmailEventInfoTEXT($event); /* Other things */ $replaces["MAT_BANK_TRANSFER_INFORMATIONS"] = MatukioHelperPayment::getBanktransferInfo(MatukioHelperSettings::getSettings("banktransfer_account", ''), MatukioHelperSettings::getSettings("banktransfer_blz", ''), MatukioHelperSettings::getSettings("banktransfer_bank", ''), MatukioHelperSettings::getSettings("banktransfer_accountholder", ''), MatukioHelperSettings::getSettings("banktransfer_iban", ''), MatukioHelperSettings::getSettings("banktransfer_bic", '')); // CSV $bookingnewname = ""; if ($booking != null) { $replaces["MAT_CSV_BOOKING_DETAILS"] = self::getExportCSVBookingDetails($booking, $event, MatukioHelperSettings::getSettings('export_csv_separator', ';')); if (MatukioHelperSettings::getSettings('oldbookingform', 0) == 1) { // Old booking form if ($booking->userid > 0) { $user = JFactory::getUser($booking->userid); $replaces["MAT_BOOKING_NAME"] = $user->name; $replaces["MAT_BOOKING_EMAIL"] = $user->email; } } else { // New booking form fields $fields = MatukioHelperUtilsBooking::getBookingFields(); $fieldvals = explode(";", $booking->newfields); $value = array(); foreach ($fieldvals as $val) { $tmp = explode("::", $val); if (count($tmp) > 1) { $value[$tmp[0]] = $tmp[1]; } else { $value[$tmp[0]] = ""; } } foreach ($fields as $field) { if (!empty($value[$field->id])) { // Not use the Spacer fields if ($field->type != "spacer" && $field->type != "spacertext") { $replaces["MAT_BOOKING_" . strtoupper($field->field_name)] = $value[$field->id]; } if ($field->field_name == "firstname") { $bookingnewname .= $value[$field->id]; } if ($field->field_name == "lastname") { $bookingnewname .= " " . $value[$field->id]; } } else { // Not use the Spacer fields if ($field->type != "spacer" && $field->type != "spacertext") { $replaces["MAT_BOOKING_" . strtoupper($field->field_name)] = ""; } } } $bookingnewname = trim($bookingnewname); $replaces["MAT_BOOKING_COMMENT"] = $booking->comment; if (empty($replaces["MAT_BOOKING_NAME"])) { if (!empty($bookingnewname)) { $replaces["MAT_BOOKING_NAME"] = $bookingnewname; } else { if ($booking->userid > 0) { $user = JFactory::getUser($booking->userid); $replaces["MAT_BOOKING_NAME"] = $user->name; } } } } if (empty($replaces["MAT_BOOKING_EMAIL"])) { if ($booking->userid > 0) { $user = JFactory::getUser($booking->userid); $replaces["MAT_BOOKING_EMAIL"] = $user->email; } } // Booking complete $replaces["MAT_BOOKING_ALL_DETAILS_HTML"] = self::getEmailBookingInfoHTML($event, $booking, $bookingnewname); $replaces["MAT_BOOKING_ALL_DETAILS_TEXT"] = self::getEmailBookingInfoTEXT($event, $booking, $bookingnewname); } return $replaces; }
$html .= "\n<title>" . $mainconfig->get('config.sitename') . " - " . JTEXT::_('COM_MATUKIO_EVENTS') . "</title>"; $html .= "\n<link>" . JURI::root() . "index.php?tmpl=component&option=" . JFactory::getApplication()->input->get('option') . "&view=eventlist</link>"; $html .= "\n<description>" . $mainconfig->get('config.sitename') . " - Events" . "</description>"; $html .= "\n<language>" . $sprache->getTag() . "</language>"; $html .= "\n<copyright>" . $mainconfig->get('config.fromname') . "</copyright>"; $html .= "\n<ttl>60</ttl>"; $html .= "\n<pubDate>" . date("r") . "</pubDate>"; foreach ($this->rows as $row) { $user = JFactory::getuser($row->publisher); $cancelled = ""; if ($row->cancelled == 1) { $cancelled = " - " . JTEXT::_('COM_MATUKIO_CANCELLED'); } $html .= "\n<item>"; $html .= "\n<title>" . $row->title . $cancelled . "</title>"; $html .= "\n<description>" . JTEXT::_('COM_MATUKIO_BEGIN') . ": " . JHTML::_('date', $row->begin, MatukioHelperSettings::getSettings('date_format_small', 'd-m-Y, H:i')) . " - " . $row->shortdesc . "</description>"; $eventid_l = $row->id . ':' . JFilterOutput::stringURLSafe($row->title); $catid_l = $row->catid . ':' . JFilterOutput::stringURLSafe(MatukioHelperCategories::getCategoryAlias($row->catid)); $link = JRoute::_(MatukioHelperRoute::getEventRoute($eventid_l, $catid_l), true, 2); $html .= "\n<link>" . $link . "</link>"; if (MatukioHelperSettings::getSettings('frontend_showownerdetails', 1) > 0) { $html .= "\n<author>" . $user->name . ", " . $user->email . "</author>"; } $html .= "\n<guid>" . MatukioHelperUtilsBooking::getBookingId($row->id) . "</guid>"; $html .= "\n<category>" . $row->category . "</category>"; $html .= "\n<pubDate>" . date("r", strtotime($row->publishdate)) . "</pubDate>"; $html .= "\n</item>"; } $html .= "\n</channel>"; $html .= "\n</rss>"; echo $html;