<?php /** * @package Matukio * @author Yves Hoppe <*****@*****.**> * @date 10.11.13 * * @copyright Copyright (C) 2008 - 2013 Yves Hoppe - compojoom.com . All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ defined('_JEXEC') or die('Restricted access'); $input = JFactory::getApplication()->input; $task = $input->get('task', null); // Checking if task is set if (!$task) { echo "No task specified"; return; } // URL index.php?option=com_matukio&format=raw&view=requests&task=get_override_fee_edit_row if ($task == 'get_override_fee_edit_row') { MatukioHelperFees::printDifferentFeesRow(); } elseif ($task == 'generate_recurring') { MatukioHelperRecurring::printGenerateRecurring(); } jexit();
<td class="key" width="80px"> <?php echo JTEXT::_('COM_MATUKIO_FEES'); ?> </td> <td> <?php $tmp = MatukioHelperUtilsEvents::getFormatedCurrency($this->event->fees, MatukioHelperSettings::getSettings('currency_symbol', '$')); if ($buchopt[0] == 2) { if ($buchopt[2][0]->paid == 1) { $tmp .= " - " . JTEXT::_('COM_MATUKIO_PAID'); } } echo $tmp . " " . JTEXT::_('COM_MATUKIO_PRO_PERSON'); if (MatukioHelperSettings::getSettings('show_different_fees', 1) && $this->event->different_fees) { echo MatukioHelperFees::getFeesShow($this->event); } ?> </td> </tr> <?php } ?> <?php // Files: $datfeld = MatukioHelperUtilsEvents::getEventFileArray($this->event); $htxt = array(); for ($i = 0; $i < count($datfeld[0]); $i++) { if ($datfeld[0][$i] != "" and ($datfeld[2][$i] == 0 or $my->id > 0 and $datfeld[2][$i] == 1 or $buchopt[0] == 2 and $datfeld[2][$i] == 2 or $buchopt[2][0]->paid == 1 and $datfeld[2][$i] == 3)) { // Still a joke $filelink = JRoute::_("index.php?option=com_matukio&view=matukio&task=downloadfile&a6d5dgdee4cu7eho8e7fc6ed4e76z=" . sha1(md5($datfeld[0][$i])) . $this->event->id);
/** * Returns the html event edit fields * sem_f008 * * @param object $row - The event * @param int $art - The art (no idea) * @param bool $frontend - Is this form shown in the frontend or backend?! * * @return string */ public static function getEventEdit($row, $art, $frontend = false) { jimport('joomla.database.table'); // We need Bootstrap since 3.0 if ($frontend) { CompojoomHtmlBehavior::bootstrap31(true, false, true, false); JHTML::_('script', 'media/lib_compojoom/js/jquery.radiobtns.js'); } MatukioHelperUtilsBasic::loadValidation(); JHTML::_('script', 'media/com_matukio/js/select2.min.js'); JHTML::_('script', 'media/com_matukio/js/recurring.jquery.js'); JHTML::_('stylesheet', 'media/com_matukio/css/select2.css'); JHTML::_('stylesheet', 'media/com_matukio/css/select2-bootstrap.css'); $doc = JFactory::getDocument(); // Small css fixes $doc->addStyleDeclaration(' .table td { vertical-align: middle !important; } '); // Add JS for different fees $doc->addScriptDeclaration(' (function ($) { $( document ).ready(function( $ ) { $("#adminForm").validationEngine(); var numfees = $("#numfees").val(); $("#add_fee").click(function() { $.get( "index.php?option=com_matukio&format=raw&view=requests&task=get_override_fee_edit_row", { num: numfees } ) .done(function( data ) { $( "#feecont" ).append( data ); $("input .btn").button(); numfees++; $("#numfees").val(numfees); // Turn radios into btn-group $.getScript( "' . JUri::root() . 'media/com_matukio/js/radiobtns.js" ); }); }); $(".compojoom-bootstrap").mat_recurring({ }); // Turn checkboxes into btn-group $(\'.checkbox.btn-group label\').addClass(\'btn\'); // Isis template and others may already have done this so remove these! $(".checkbox.btn-group label").unbind(\'click\'); $(".checkbox.btn-group label input[type=\'checkbox\']").unbind(\'click\'); $(".checkbox.btn-group label").click(function(event) { event || (event = window.event); // stop the event being triggered twice is click on input AND label outside it! if (event.target.tagName.toUpperCase()=="INPUT"){ //event.preventDefault(); return; } var label = $(this); var input = $(\'#\' + label.attr(\'for\')); if (input.prop(\'disabled\')) { label.removeClass(\'active btn-success btn-danger btn-primary\'); input.prop(\'checked\', false); event.stopImmediatePropagation(); return; } if (!input.prop(\'checked\')) { label.addClass(\'active btn-success\'); } else { label.removeClass(\'active btn-success btn-danger btn-primary\'); } // bootstrap takes care of the checkboxes themselves! }); $(".btn-group input[type=checkbox]").each(function() { var input = $(this); input.css(\'display\',\'none\'); }); $("#place_id").change(function(){ var pval = $(this).val(); if (pval == "0") { $("#custom_place").show(); $("#gmaps").show(); } else { $("#custom_place").hide(); $("#gmaps").hide(); } }); }) })(jQuery); '); $editor = JFactory::getEditor(); $catlist = self::getCategoryListArray($row->catid); $reqfield = " <span class=\"sem_reqfield\">*</span>"; // Vorlage $html = ""; if ($art == 1 or $art == 2) { $html = "<input type=\"hidden\" name=\"pattern\" value=\"\" />"; $html .= "<input type=\"hidden\" name=\"vorlage\" value=\"0\" />"; } if ($row->id == 0 and ($art == 1 or $art == 2)) { // $html = self::getTemplateListSelect($row->vorlage, $art); } // Surrounding div // $html .= '<div class="compojoom-bootstrap">'; $html .= '<div id="mat_event_edit">'; $html .= '<!-- List of tabs --> <ul class="nav nav-tabs nav-justified"> <li class="active"> <a href="#basic" data-toggle="tab">' . JText::_('COM_MATUKIO_BASIC_SETTINGS') . '</a> </li> <li> <a href="#advanced" data-toggle="tab">' . JText::_('COM_MATUKIO_ADDITIONAL_SETTINGS') . '</a> </li> <li> <a href="#eventfields" data-toggle="tab">' . JText::_('COM_MATUKIO_GENERAL_INPUT_FIELDS') . '</a> </li> <li> <a href="#files" data-toggle="tab">' . JText::_('COM_MATUKIO_FILES') . '</a> </li> <li> <a href="#overrides" data-toggle="tab">' . JText::_('COM_MATUKIO_OVERRIDES') . '</a> </li> </ul>'; // Basics $html .= '<div class="tab-content">'; $html .= '<div id="basic" class="tab-pane active">'; $html .= '<div class="form-group">'; $html .= '<div class="col-sm-offset-2 col-sm-10">'; $html .= JTEXT::_('COM_MATUKIO_SETTINGS_NEEDED'); $html .= '</div>'; $html .= '</div>'; // Vorlagenname und Besitzer if ($art == 3) { $html .= "<tr>" . self::getTableCell(JTEXT::_('COM_MATUKIO_TEMPLATE') . ':', 'd', 'r', '20%', 'sem_edit') . self::getTableCell("<input class=\"sem_inputbox\" type=\"text\" name=\"pattern\" size=\"50\" maxlength=\"100\"\n\t\t\tvalue=\"" . $row->pattern . "\" />" . $reqfield, 'd', 'l', '80%', 'sem_edit') . "</tr>"; $html .= "<tr>" . self::getTableCell(JTEXT::_('COM_MATUKIO_OWNER') . ':', 'd', 'r', '20%', 'sem_edit') . self::getTableCell(self::getOranizerList($row->publisher) . $reqfield, 'd', 'l', '80%', 'sem_edit') . "</tr>"; $reqfield = ""; } // ID der Veranstaltung if ($row->id < 1) { $htxt = JTEXT::_('COM_MATUKIO_ID_NOT_CREATED'); $htx2 = JTEXT::_('COM_MATUKIO_SHOULD_REGISTERED_USERS_RECEIVE_MAIL'); $htx3 = JTEXT::_('COM_MATUKIO_NEW_EVENT_PUBLISHED_INTERESTED_SEE_HOMEPAGE'); $htx4 = ""; $htx5 = " checked=\"checked\""; } else { $htxt = $row->id; $htx2 = JTEXT::_('COM_MATUKIO_INFORM_PER_EMAIL'); $htx3 = JTEXT::_('COM_MATUKIO_EVENTS_DATAS_CHANGED'); if ($row->cancelled == 0) { $htx4 = ""; $htx5 = " checked=\"checked\""; if ($art != 3) { $htx4 = " onClick=\"infotext.value='" . JTEXT::_('COM_MATUKIO_ORGANISER_CANCELLED') . "'\""; $htx5 = " onClick=\"infotext.value='" . JTEXT::_('COM_MATUKIO_EVENTS_DATAS_CHANGED') . "'\"" . $htx5; } } else { $htx4 = " checked=\"checked\""; $htx5 = ""; if ($art != 3) { $htx4 = " onClick=\"infotext.value='" . JTEXT::_('COM_MATUKIO_EVENTS_DATAS_CHANGED') . "'\"" . $htx4; $htx5 = " onClick=\"infotext.value='" . JTEXT::_('COM_MATUKIO_ORGANISER_HAS_REPUBLISHED_EVENT') . "'\""; } } } if ($row->id > 0 && false) { $html .= "<tr>" . self::getTableCell(JTEXT::_('COM_MATUKIO_ID') . MatukioHelperUtilsBasic::createToolTip(JTEXT::_('COM_MATUKIO_AUTO_ID')), 'd', 'l', '20%', 'sem_edit'); $html .= self::getTableCell($htxt, 'd', 'l', '80%', 'sem_edit') . "</tr>"; } // Titel $html .= '<div class="form-group">'; $html .= '<label for="title" class="col-sm-2 control-label">' . JTEXT::_('COM_MATUKIO_TITLE') . $reqfield . '</label>'; $html .= '<div class="col-sm-10">'; $html .= "<input class=\"form-control validate[required]\" type=\"text\" name=\"title\" id=\"title\"\n maxlength=\"250\" value=\"" . $row->title . "\" />"; $html .= '</div>'; $html .= '</div>'; // Category $htxt = $catlist[0]; if (MatukioHelperSettings::getSettings('event_image', 1) == 1) { foreach ($catlist[1] as $el) { $htxt .= "<input type=\"hidden\" id=\"im" . $el->id . "\" value=\"" . $el->image . "\" />"; } } $html .= '<div class="form-group">'; $html .= '<label for="category" class="col-sm-2 control-label">' . JTEXT::_('COM_MATUKIO_CATEGORY') . MatukioHelperUtilsBasic::createToolTip(JTEXT::_('COM_MATUKIO_EVENT_ASSIGNED_CATEGORY')) . $reqfield . '</label>'; $html .= '<div class="col-sm-10">'; $html .= $htxt; $html .= '</div>'; $html .= '</div>'; // Event number $html .= '<div class="form-group">'; $html .= '<label for="semnum" class="col-sm-2 control-label">' . JTEXT::_('COM_MATUKIO_NUMBER') . MatukioHelperUtilsBasic::createToolTip(JTEXT::_('COM_MATUKIO_UNIQUE_NUMBER')) . $reqfield . '</label>'; $html .= '<div class="col-sm-10">'; $html .= "<input class=\"form-control validate[required]\"\n\t\t\t\ttype=\"text\" id=\"semnum\" name=\"semnum\" maxlength=\"100\" value=\"" . $row->semnum . "\" />"; $html .= '</div>'; $html .= '</div>'; $radios = array(); $radios[] = JHTML::_('select.option', 1, JTEXT::_('COM_MATUKIO_YES')); $radios[] = JHTML::_('select.option', 0, JTEXT::_('COM_MATUKIO_NO')); if ($row->showbegin == "") { $row->showbegin = 1; } if ($row->showend == "") { $row->showend = 1; } if ($row->showbooked == "") { $row->showbooked = 1; } // Event begin $htxt = "<div class=\"col-sm-4\">" . JHTML::_('calendar', JHtml::_('date', $row->begin, 'Y-m-d H:i:s'), '_begin_date', '_begin_date', '%Y-%m-%d %H:%M:%S', array('class' => 'form-control validate[required]')); $radio_showbegin = MatukioHelperInput::getRadioButtonBool("showbegin", "showbegin", $row->showbegin); $htxt .= "</div> <div class=\"col-sm-4\">" . JTEXT::_('COM_MATUKIO_DISPLAY') . " " . $radio_showbegin . "</div>"; $html .= '<div class="form-group">'; $html .= '<label for="_begin_date" class="col-sm-2 control-label">' . JTEXT::_('COM_MATUKIO_BEGIN') . MatukioHelperUtilsBasic::createToolTip(JTEXT::_('COM_MATUKIO_DATE_TIME_FORMAT')) . $reqfield . '</label>'; $html .= $htxt; $html .= '</div>'; // Event end $htxt = "<div class=\"col-sm-4\">" . JHTML::_('calendar', JHtml::_('date', $row->end, 'Y-m-d H:i:s'), '_end_date', '_end_date', '%Y-%m-%d %H:%M:%S', array('class' => 'form-control validate[required]')); $radio_showend = MatukioHelperInput::getRadioButtonBool("showend", "showend", $row->showend); $htxt .= "</div> <div class=\"col-sm-4\">" . JTEXT::_('COM_MATUKIO_DISPLAY') . " " . $radio_showend . "</div>"; $html .= '<div class="form-group">'; $html .= '<label for="_end_date" class="col-sm-2 control-label">' . JTEXT::_('COM_MATUKIO_END') . MatukioHelperUtilsBasic::createToolTip(JTEXT::_('COM_MATUKIO_DATE_TIME_FORMAT')) . $reqfield . '</label>'; $html .= $htxt; $html .= '</div>'; // Anmeldeschluss // Closing end $htxt = "<div class=\"col-sm-4\">" . JHTML::_('calendar', JHtml::_('date', $row->booked, 'Y-m-d H:i:s'), '_booked_date', '_booked_date', '%Y-%m-%d %H:%M:%S', array('class' => 'form-control validate[required]')); $radio_showbooked = MatukioHelperInput::getRadioButtonBool("showbooked", "showbooked", $row->showbooked); $htxt .= "</div> <div class=\"col-sm-4\">" . JTEXT::_('COM_MATUKIO_DISPLAY') . " " . $radio_showbooked . "</div>"; $html .= '<div class="form-group">'; $html .= '<label for="_booked_date" class="col-sm-2 control-label">' . JTEXT::_('COM_MATUKIO_CLOSING_DATE') . MatukioHelperUtilsBasic::createToolTip(JTEXT::_('COM_MATUKIO_DATE_TIME_FORMAT')) . $reqfield . '</label>'; $html .= $htxt; $html .= '</div>'; // RECURRING $html .= '<div class="form-group">'; $html .= '<label for="recurring" class="col-sm-2 control-label">' . JTEXT::_('COM_MATUKIO_IS_RECURRING') . $reqfield . '</label>'; $html .= '<div class="col-sm-10">'; $html .= MatukioHelperInput::getRadioButtonBool("recurring", "recurring", $row->recurring); $html .= '</div>'; $html .= '</div>'; // Recurring events $rstyle = ""; if (!$row->recurring) { $rstyle = ' style="display: none;"'; } $html .= '<div id="reccuring-gen"' . $rstyle . '>'; $html .= '<div class="form-group">'; $html .= '<div class="col-sm-offset-2 col-sm-10">'; $html .= JTEXT::_('COM_MATUKIOR_RECURRING_INTRO'); $html .= '</div>'; $html .= '</div>'; // Check for old events if (empty($row->recurring_type)) { $row->recurring_type = "daily"; } $repeat_type = array(); $repeat_type["daily"] = JText::_("COM_MATUKIO_REPEAT_DAILY"); $repeat_type["weekly"] = JText::_("COM_MATUKIO_REPEAT_WEEKLY"); $repeat_type["monthly"] = JText::_("COM_MATUKIO_REPEAT_MONTHLY"); $repeat_type["yearly"] = JText::_("COM_MATUKIO_REPEAT_YEARLY"); $recurring = MatukioHelperInput::getRadioButton("recurring_type", "recurring_type", $repeat_type, $row->recurring_type); $html .= '<div class="form-group">'; $html .= '<label for="recurring_type" class="col-sm-2 control-label">' . JTEXT::_('COM_MATUKIO_REPEAT_TYPE') . '</label>'; $html .= '<div class="col-sm-10">'; $html .= $recurring; $html .= '</div>'; $html .= '</div>'; $html .= '<div class="form-group">'; $html .= '<div class="col-sm-offset-2 col-sm-10">'; $html .= '<div id="recurring_daily">'; $html .= '</div>'; $html .= '<div id="recurring_monthly">'; $repeat_week = array(); $repeat_week[1] = JText::_("COM_MATUKIO_RECURRING_WEEK1"); $repeat_week[2] = JText::_("COM_MATUKIO_RECURRING_WEEK2"); $repeat_week[3] = JText::_("COM_MATUKIO_RECURRING_WEEK3"); $repeat_week[4] = JText::_("COM_MATUKIO_RECURRING_WEEK4"); $repeat_week[5] = JText::_("COM_MATUKIO_RECURRING_WEEK5"); $recurring_month_week = MatukioHelperInput::getCheckboxButton("recurring_month_week", "recurring_month_week", $repeat_week, $row->recurring_month_week); $html .= $recurring_month_week . "<br />"; $html .= "<br />"; $html .= '</div>'; $html .= '<div id="recurring_weekly">'; $repeat_week_day = array(); $repeat_week_day["Monday"] = JText::_("COM_MATUKIO_MONDAY"); $repeat_week_day["Tuesday"] = JText::_("COM_MATUKIO_TUESDAY"); $repeat_week_day["Wednesday"] = JText::_("COM_MATUKIO_WEDNESDAY"); $repeat_week_day["Thursday"] = JText::_("COM_MATUKIO_THURSDAY"); $repeat_week_day["Friday"] = JText::_("COM_MATUKIO_FRIDAY"); $repeat_week_day["Saturday"] = JText::_("COM_MATUKIO_SATURDAY"); $repeat_week_day["Sunday"] = JText::_("COM_MATUKIO_SUNDAY"); $recurring_week_day = MatukioHelperInput::getCheckboxButton("recurring_week_day", "recurring_week_day", $repeat_week_day, $row->recurring_week_day); $html .= $recurring_week_day; $html .= "<br />"; $html .= '</div>'; $html .= '</div>'; $html .= '</div>'; $html .= '<div class="form-group">'; $html .= '<label for="recurring_count" class="col-sm-2 control-label">' . JTEXT::_('COM_MATUKIO_RECURRING_REPEAT_COUNT') . '</label>'; $html .= '<div class="col-sm-10">'; $html .= '<input type="text" name="recurring_count" id="recurring_count" value="' . $row->recurring_count . '" class="form-control" />'; $html .= '</div>'; $html .= '</div>'; $html .= '<div class="form-group">'; $html .= '<label for="recurring_count" class="col-sm-2 control-label">' . JTEXT::_('COM_MATUKIO_RECURRING_REPEAT_UNTIL') . '</label>'; $html .= '<div class="col-sm-10">'; $html .= '<input type="text" name="recurring_until" id="recurring_until" value="' . $row->recurring_until . '" class="form-control" />'; $html .= '</div>'; $html .= '</div>'; $html .= '<div class="form-group">'; $html .= '<div class="col-sm-offset-2 col-sm-10">'; $html .= '<button id="generateRecurring" class="btn btn-success">' . JText::_("COM_MATUKIO_RECURRING_BUTTON_GENERATE") . '</button>'; $html .= '</div>'; $html .= '</div>'; $html .= '<div class="form-group">'; $html .= '<div class="col-sm-offset-2 col-sm-10">'; $html .= '<div id="generated_events">' . '</div>'; $html .= '</div>'; $html .= '</div>'; $html .= '<input type="hidden" name="recurring_edited" id="recurring_edited" value="0" />'; $html .= '</div>'; // Short description $html .= '<div class="form-group">'; $html .= '<label for="shortdesc" class="col-sm-2 control-label">' . JTEXT::_('COM_MATUKIO_BRIEF_DESCRIPTION') . MatukioHelperUtilsBasic::createToolTip(JTEXT::_('COM_MATUKIO_BRIEF_DESCRIPTION_DESC')) . $reqfield . '</label>'; $html .= '<div class="col-sm-10">'; $html .= "<textarea class=\"form-control validate[required]\" rows=\"3\" name=\"shortdesc\" placeholder=\"" . JText::_("COM_MATUKIO_BRIEF_DESCRIPTION_DESC") . "\">" . $row->shortdesc . "</textarea>"; $html .= '</div>'; $html .= '</div>'; // Locations $locations = array(JHTML::_('select.option', '0', JText::_('COM_MATUKIO_CUSTOM_LOCATION'))); $dblocs = self::getLocations(); if ($dblocs) { foreach ($dblocs as $l) { $locations[] = JHTML::_('select.option', $l->id, JText::_($l->title)); } } $select_locations = JHTML::_('select.genericlist', $locations, 'place_id', 'class="form-control chzn-single"', 'value', 'text', $row->place_id); $html .= '<div class="form-group">'; $html .= '<label for="place_id" class="col-sm-2 control-label">' . JTEXT::_('COM_MATUKIO_CITY') . $reqfield . '</label>'; $html .= '<div class="col-sm-10">'; $html .= $select_locations; $html .= '</div>'; $html .= '</div>'; $pstyle = ""; if ($row->place_id > 0) { $pstyle = ' style="display:none"'; } $html .= '<div id="custom_place" class="form-group"' . $pstyle . '>'; $html .= '<label for="place" class="col-sm-2 control-label">' . JTEXT::_('COM_MATUKIO_CUSTOM_LOCATION') . '</label>'; $html .= '<div class="col-sm-10">'; $html .= "<textarea class=\"form-control\" rows=\"3\" name=\"place\">" . $row->place . "</textarea>"; $html .= '</div>'; $html .= '</div>'; // Organiser if ($art != 3 && (!$frontend || MatukioHelperSettings::_("frontend_organizer_allevent", 1))) { $html .= '<div class="form-group">'; $html .= '<label for="publisher" class="col-sm-2 control-label">' . JTEXT::_('COM_MATUKIO_ORGANISER') . MatukioHelperUtilsBasic::createToolTip(JTEXT::_('COM_MATUKIO_ORGANISER_MANAGE_FRONTEND')) . $reqfield . '</label>'; $html .= '<div class="col-sm-10">'; $html .= self::getOranizerList($row->publisher); $html .= '</div>'; $html .= '</div>'; } else { $html .= '<input type="hidden" name="publisher" value="' . JFactory::getUser()->id . '" />'; } $webinar = MatukioHelperInput::getRadioButtonBool("webinar", "webinar", $row->webinar); $html .= '<div class="form-group">'; $html .= '<label for="webinar" class="col-sm-2 control-label">' . JTEXT::_('COM_MATUKIO_WEBINAR') . $reqfield . '</label>'; $html .= '<div class="col-sm-10">'; $html .= $webinar; $html .= '</div>'; $html .= '</div>'; // Available seats $htxt = "<div class=\"col-sm-6\"><input class=\"form-control validate[required, custom[integer]]\" type=\"text\" name=\"maxpupil\" value=\"" . $row->maxpupil . "\" /></div><div class=\"col-sm-4\"> - " . JTEXT::_('COM_MATUKIO_IF_FULLY_BOOKED') . ": "; $radios = array(); $radios[] = JHTML::_('select.option', 0, JTEXT::_('COM_MATUKIO_WAITLIST')); $radios[] = JHTML::_('select.option', 1, JTEXT::_('COM_MATUKIO_END_BOOKING')); $radios[] = JHTML::_('select.option', 2, JTEXT::_('COM_MATUKIO_HIDE_EVENT')); $htxt .= JHTML::_('select.genericlist', $radios, 'stopbooking', 'class="inputbox"', 'value', 'text', $row->stopbooking) . "</div>"; $html .= '<div class="form-group">'; $html .= '<label for="webinar" class="col-sm-2 control-label">' . JTEXT::_('COM_MATUKIO_MAX_PARTICIPANT') . $reqfield . '</label>'; $html .= $htxt; $html .= '</div>'; // Min. participants (since 4.3.0 for cronjob) $html .= '<div class="form-group">'; $html .= '<label for="hot_event" class="col-sm-2 control-label">' . JTEXT::_('COM_MATUKIO_MIN_PARTICIPANTS') . '</label>'; $html .= '<div class="col-sm-10">'; $html .= "<input class=\"form-control\" type=\"text\" name=\"minpupil\" id=\"minpupil\" value=\"" . $row->minpupil . "\" />"; $html .= '</div>'; $html .= '</div>'; // Max. bookable places $bookableplaces = $row->nrbooked; if ($bookableplaces == "") { $bookableplaces = 1; } if (MatukioHelperSettings::getSettings('frontend_usermehrereplaetze', 2) > 0) { $htxt = "<input class=\"inputbox form-control validate[required, custom[integer]]\" type=\"text\" name=\"nrbooked\" value=\"" . $bookableplaces . "\" />"; } else { $radios = array(); $radios[] = JHTML::_('select.option', 0, "0"); $radios[] = JHTML::_('select.option', 1, "1"); $htxt = JHTML::_('select.genericlist', $radios, 'nrbooked', 'class="form-control validate[required, custom[integer]]" ', 'value', 'text', $row->nrbooked); } $html .= '<div class="form-group">'; $html .= '<label for="webinar" class="col-sm-2 control-label">' . JTEXT::_('COM_MATUKIO_MAX_BOOKABLE_PLACES') . MatukioHelperUtilsBasic::createToolTip(JTEXT::_('COM_MATUKIO_CANNOT_BOOK_ONLINE')) . $reqfield . '</label>'; $html .= '<div class="col-sm-10">'; $html .= $htxt; $html .= '</div>'; $html .= '</div>'; $html .= "</div>"; // ### Panel 2 ### $html .= '<div class="tab-pane" id="advanced">'; $html .= '<div class="form-group">'; $html .= '<div class="col-sm-12">' . JTEXT::_('COM_MATUKIO_ADDITIONAL_SETTINGS_DESC') . '</div>'; $html .= '</div>'; // Description $htxt = $editor->display("description", $row->description, "600", "300", "50", "5"); $html .= '<div class="form-group">'; $html .= '<div class="col-sm-12">'; $html .= '<label for="description" class="control-label">' . JTEXT::_('COM_MATUKIO_DESCRIPTION') . '</label><br /><br />'; $html .= JTEXT::_('COM_MATUKIO_USE_FOLLOWING_TAGS') . $htxt; $html .= '</div>'; $html .= '</div>'; // Veranstaltungsbild if (MatukioHelperSettings::getSettings('event_image', 1) == 1) { jimport('joomla.filesystem.folder'); $htxt = ""; if (MatukioHelperSettings::getSettings('image_path', '') != "") { $htxt = trim(MatukioHelperSettings::getSettings('image_path', ''), "/") . "/"; } $htxt = JPATH_SITE . "/images/" . $htxt; if (!is_dir($htxt)) { mkdir($htxt, 0755); } $imageFiles = JFolder::files($htxt); $images = array(JHTML::_('select.option', '', '- ' . JText::_('COM_MATUKIO_STANDARD_IMAGE') . ' -')); foreach ($imageFiles as $file) { if (preg_match("/jpg|png|gif/i", $file)) { $images[] = JHTML::_('select.option', $file); } } $imagelist = JHTML::_('select.genericlist', $images, 'image', 'class="sem_inputbox form-control" size="1" ', 'value', 'text', $row->image); $htxt = "<span style=\"position:absolute;display:none;border:3px solid #FF9900;background-color:#FFFFFF;\" id=\"1\"><img id=\"toolbild\"\n src=\"images/stories/" . $row->image . "\" /></span><span style=\"position:absolute;display:none;border:3px solid #FF9900;background-color:#FFFFFF;\"\n id=\"2\"><img src=\"" . MatukioHelperUtilsBasic::getComponentImagePath() . "2601.png\" /></span>"; $htxt .= $imagelist . " "; $html .= '<div class="form-group">'; $html .= '<label for="image" class="col-sm-2 control-label">' . JTEXT::_('COM_MATUKIO_IMAGE_FOR_OVERVIEW') . '</label>'; $html .= '<div class="col-sm-10">'; $html .= $htxt; $html .= '</div>'; $html .= '</div>'; } // Google-Maps $htxt = "<input class=\"sem_inputbox form-control\" type=\"text\" name=\"gmaploc\" id=\"gmaploc\" value=\"" . $row->gmaploc . "\" /> "; $html .= '<div id="gmaps" class="form-group">'; $html .= '<label for="gmaploc" class="col-sm-2 control-label">' . JTEXT::_('COM_MATUKIO_GMAPS_LOCATION') . '</label>'; $html .= '<div class="col-sm-10">'; $html .= $htxt; $html .= '</div>'; $html .= '</div>'; // Tutor $html .= '<div class="form-group">'; $html .= '<label for="teacher" class="col-sm-2 control-label">' . JTEXT::_('COM_MATUKIO_TUTOR') . '</label>'; $html .= '<div class="col-sm-10">'; $html .= "<input class=\"form-control\" type=\"text\" name=\"teacher\" id=\"teacher\" value=\"" . $row->teacher . "\" />"; $html .= '</div>'; $html .= '</div>'; // Target $html .= '<div class="form-group">'; $html .= '<label for="target" class="col-sm-2 control-label">' . JTEXT::_('COM_MATUKIO_TARGET_GROUP') . '</label>'; $html .= '<div class="col-sm-10">'; $html .= "<input class=\"form-control\" type=\"text\" name=\"target\" id=\"target\" value=\"" . $row->target . "\" />"; $html .= '</div>'; $html .= '</div>'; // Fees // Yeah i know this also is true if fees is 0, but we need to check if it is "" or null if (empty($row->fees)) { $row->fees = 0; } // Gebuehr $html .= '<div class="form-group">'; $html .= '<label for="fees" class="col-sm-2 control-label">' . JTEXT::_('COM_MATUKIO_FEES') . " (" . MatukioHelperSettings::getSettings('currency_symbol', '$') . ')' . " " . JTEXT::_('COM_MATUKIO_PRO_PERSON') . " " . JText::_("COM_MATUKIO_BRUTTO") . '</label>'; $html .= '<div class="col-sm-10">'; $html .= "<input class=\"form-control validate[required]\" type=\"text\" name=\"fees\" id=\"fees\" value=\"" . $row->fees . "\" />"; $html .= '</div>'; $html .= '</div>'; // Taxes $taxes = array(JHTML::_('select.option', '0', '- ' . JText::_('COM_MATUKIO_NO_TAX') . ' -')); $taxes_list = MatukioHelperTaxes::getTaxes(); foreach ($taxes_list as $t) { $taxes[] = JHTML::_('select.option', $t->id, '- ' . JText::_($t->title) . ' -'); } $taxlist = JHTML::_('select.genericlist', $taxes, 'tax_id', 'class="form-control chzn-single"', 'value', 'text', $row->tax_id); $html .= '<div class="form-group">'; $html .= '<label for="tax_id" class="col-sm-2 control-label">' . JTEXT::_('COM_MATUKIO_EVENT_TAX') . '</label>'; $html .= '<div class="col-sm-10">'; $html .= $taxlist; $html .= '</div>'; $html .= '</div>'; // Different fees $different_fees = MatukioHelperInput::getRadioButtonBool("different_fees", "different_fees", $row->different_fees); $html .= '<div class="form-group">'; $html .= '<label for="different_fees" class="col-sm-2 control-label">' . JTEXT::_('COM_MATUKIO_DIFFERENT_FEES') . '</label>'; $html .= '<div class="col-sm-10">'; $html .= $different_fees; $html .= '</div>'; $html .= '</div>'; // Top event $top_event = MatukioHelperInput::getRadioButtonBool("top_event", "top_event", $row->top_event); $html .= '<div class="form-group">'; $html .= '<label for="top_event" class="col-sm-2 control-label">' . JTEXT::_('COM_MATUKIO_TOP_EVENT') . '</label>'; $html .= '<div class="col-sm-10">'; $html .= $top_event; $html .= '</div>'; $html .= '</div>'; // Hot event $hot_event = MatukioHelperInput::getRadioButtonBool("hot_event", "hot_event", $row->hot_event); $html .= '<div class="form-group">'; $html .= '<label for="hot_event" class="col-sm-2 control-label">' . JTEXT::_('COM_MATUKIO_HOT_EVENT') . '</label>'; $html .= '<div class="col-sm-10">'; $html .= $hot_event; $html .= '</div>'; $html .= '</div>'; // Abgesagt /* $htxt = MatukioHelperInput::getRadioButtonBool( "cancel", "cancel", $row->cancelled, "inputbox required", "required=\"required\" aria-required=\"true\"" ); $html .= '<div class="form-group">'; $html .= '<label for="cancel" class="col-sm-2 control-label">' . JTEXT::_('COM_MATUKIO_CANCELLED') . MatukioHelperUtilsBasic::createToolTip(JTEXT::_('COM_MATUKIO_CANCELLED_EVENT_NO_BOOKINGS')) . '</label>' ; $html .= '<div class="col-sm-10">'; $html .= $htxt . "<input type=\"hidden\" name=\"cancelled\" value=\"" . $row->cancelled . "\">"; $html .= '</div>'; $html .= '</div>'; */ $html .= "<input type=\"hidden\" name=\"cancel\" value=\"" . $row->cancelled . "\">"; $html .= "<input type=\"hidden\" name=\"cancelled\" value=\"" . $row->cancelled . "\">"; $html .= "</div>"; // ### Panel 3 ### $html .= '<div class="tab-pane" id="eventfields">'; $html .= "<table class=\"table\">"; $html .= "<tr>" . self::getTableCell(JTEXT::_('COM_MATUKIO_FILLED_IN_ONCE') . "<br /> <br />" . JTEXT::_('COM_MATUKIO_FIELD_INPUT_SPECIFIED') . "<br /> <br />" . JTEXT::_('COM_MATUKIO_FIELD_TIPS_SPECIFIED') . "<br /> <br />", 'd', 'l', '100%', 'sem_edit', 2) . "</tr>"; // Zusatzfelder $zusfeld = self::getAdditionalFieldsFrontend($row); if (!empty($zusfeld)) { for ($i = 0; $i < count($zusfeld[0]); $i++) { $html .= "<tr>" . self::getTableCell(JTEXT::_('COM_MATUKIO_INPUT') . " " . ($i + 1) . ":", 'd', 'l', '20%', 'sem_edit'); $htxt = "<input class=\"input sem_inputbox\" type=\"text\" name=\"zusatz" . ($i + 1) . "\" size=\"50\" value=\"" . $zusfeld[0][$i] . "\" />"; $html .= self::getTableCell($htxt, 'd', 'l', '80%', 'sem_edit') . "</tr>"; if (empty($zusfeld[1][$i])) { $zusfeld[1][$i] = ""; } $html .= "<tr>" . self::getTableCell(JTEXT::_('COM_MATUKIO_FIELD_TIP') . ":", 'd', 'l', '20%', 'sem_edit'); $htxt = "<input class=\"input sem_inputbox\" type=\"text\" name=\"zusatz" . ($i + 1) . "hint\" size=\"50\" maxlength=\"250\" value=\"" . $zusfeld[1][$i] . "\" />"; $html .= self::getTableCell($htxt, 'd', 'l', '80%', 'sem_edit') . "</tr>"; $radios = array(); $radios[] = JHTML::_('select.option', 1, JTEXT::_('COM_MATUKIO_YES')); $radios[] = JHTML::_('select.option', 0, JTEXT::_('COM_MATUKIO_NO')); $htxt = ""; if (empty($zusfeld[1][$i])) { // Set radio button to 0 $zusfeld[2][$i] = 0; } $html .= "<tr>" . self::getTableCell(str_replace("SEM_FNUM", $i + 1, JTEXT::_('COM_MATUKIO_DISPLAY_SEM_FNUM')) . ":", 'd', 'l', '20%', 'sem_edit'); $showoverview = MatukioHelperInput::getRadioButtonBool('zusatz' . ($i + 1) . 'show', 'zusatz' . ($i + 1) . 'show', $zusfeld[2][$i]); $html .= self::getTableCell($htxt . " " . $showoverview, 'd', 'l', '80%', 'sem_edit') . "</tr>"; } } $html .= "</table>"; $html .= "</div>"; // ### Panel 4 ### if (MatukioHelperSettings::_('file_maxsize', 500) > 0) { $html .= '<div class="tab-pane" id="files">'; $htxt = str_replace("SEM_FILESIZE", MatukioHelperSettings::getSettings('file_maxsize', 500), JTEXT::_('COM_MATUKIO_FILE_SIZE_UP_TO')); $htxt = str_replace("SEM_FILETYPES", strtoupper(MatukioHelperSettings::getSettings('file_endings', 'txt pdf zip jpg')), $htxt); $html .= "<table class=\"table\">"; $html .= "<tr>" . self::getTableCell($htxt, 'd', 'l', '100%', 'sem_edit', 2) . "</tr>"; $datfeld = self::getEventFileArray($row); $select = array(); $select[] = JHTML::_('select.option', 0, JTEXT::_('COM_MATUKIO_EVERYONE')); $select[] = JHTML::_('select.option', 1, JTEXT::_('COM_MATUKIO_REGISTERED_USERS')); $select[] = JHTML::_('select.option', 2, JTEXT::_('COM_MATUKIO_USERS_BOOKED_EVENT')); $select[] = JHTML::_('select.option', 3, JTEXT::_('COM_MATUKIO_USERS_PAID_FOR_EVENT')); for ($i = 0; $i < count($datfeld[0]); $i++) { $html .= "<tr>" . self::getTableCell(JTEXT::_('COM_MATUKIO_FILE') . " " . ($i + 1) . ":", 'd', 'l', '20%', 'sem_edit'); if ($datfeld[0][$i] != "") { $htxt = "<b>" . $datfeld[0][$i] . "</b> - <input class=\"sem_inputbox\" type=\"checkbox\" name=\"deldatei" . ($i + 1) . "\"\n value=\"1\" onClick=\"if(this.checked==true) {datei" . ($i + 1) . ".disabled=true;} else {datei" . ($i + 1) . ".disabled=false;}\"> " . JTEXT::_('COM_MATUKIO_DELETE_FILE'); $html .= self::getTableCell($htxt, 'd', 'l', '80%', 'sem_edit') . "</tr>"; $html .= "<tr>" . self::getTableCell(" ", 'd', 'l', '20%', 'sem_edit'); } $htxt = "<input class=\"sem_inputbox btn-success\" name=\"datei" . ($i + 1) . "\" type=\"file\">"; $html .= self::getTableCell($htxt, 'd', 'l', '80%', 'sem_edit') . "</tr>"; $html .= "<tr>" . self::getTableCell(" ", 'd', 'l', '20%', 'sem_edit'); $htxt = JTEXT::_('COM_MATUKIO_DESCRIPTION') . ": <input class=\"sem_inputbox form-control\" type=\"text\" name=\"file" . ($i + 1) . "desc\" size=\"50\" maxlength=\"255\" value=\"" . $datfeld[1][$i] . "\" />"; $html .= self::getTableCell($htxt, 'd', 'l', '80%', 'sem_edit') . "</tr>"; $html .= "<tr>" . self::getTableCell(" ", 'd', 'l', '20%', 'sem_edit'); $htxt = JHTML::_('select.genericlist', $select, 'file' . ($i + 1) . 'down', 'class="sem_inputbox" ', 'value', 'text', $datfeld[2][$i]); $html .= self::getTableCell(JTEXT::_('COM_MATUKIO_WHO_MAY_DOWNLOAD') . " " . $htxt, 'd', 'l', '80%', 'sem_edit') . "</tr>"; } $html .= "</table>"; $html .= "</div>"; } // ### Panel 5 ### $html .= '<div class="tab-pane" id="overrides">'; $editor = JFactory::getEditor(); $html .= '<div class="form-group">'; $html .= '<div class="col-sm-12">'; $html .= JText::_("COM_MATUKIO_OVERRIDES_INTRO"); $html .= '</div>'; $html .= '</div>'; // Custom different fees @since 3.0 $html .= '<div class="form-group">'; $html .= '<div class="col-sm-12">'; $html .= '<label>' . JText::_("COM_MATUKIO_DIFFERENT_FEES_OVERRIDE") . '</label>'; $html .= '</div>'; $html .= '</div>'; $html .= '<div class="form-group">'; $html .= '<div class="col-sm-12">'; $html .= JText::_("COM_MATUKIO_DIFFERENT_FEES_OVERRIDE_TEXT"); $html .= '</div>'; $html .= '</div>'; $html .= '<div class="form-group">'; $html .= '<div class="col-sm-12">'; $html .= '<div id="feecont">'; if (empty($row->different_fees_override)) { $html .= MatukioHelperFees::getDifferentFeeEdit(0); $count = 1; } else { $json = str_replace('"', '"', $row->different_fees_override); $fees = json_decode($json, true); $count = 1; foreach ($fees as $f) { $html .= MatukioHelperFees::getDifferentFeeEdit($f["num"], $f); $count++; } } $html .= '</div>'; $html .= '</div>'; $html .= '<input type="hidden" name="numfees" id="numfees" value="' . $count . '" />'; $html .= "</div>"; $html .= '<br /><br /><div class="form-group">'; $html .= '<div class="col-sm-12">'; $html .= '<label for="booking_mail">' . JText::_("COM_MATUKIO_CUSTOM_BOOKING_MAIL_TEXT") . '</label>'; $html .= '</div>'; $html .= '</div>'; $html .= '<div class="form-group">'; $html .= '<div class="col-sm-12">'; $html .= $editor->display("booking_mail", $row->booking_mail, 600, 300, 40, 20, 1); $html .= '</div>'; $html .= '</div>'; $html .= '<div class="form-group">'; $html .= '<div class="col-sm-12">'; $html .= '<label for="certificate_code">' . JText::_("COM_MATUKIO_CUSTOM_CERTIFICATE_CODE") . '</label>'; $html .= '</div>'; $html .= '</div>'; $html .= '<div class="form-group">'; $html .= '<div class="col-sm-12">'; $html .= $editor->display("certificate_code", $row->certificate_code, 600, 300, 40, 20, 1); $html .= '</div>'; $html .= '</div>'; $html .= "</div>"; // End intern row fluid div $html .= "</div>"; $html .= '<div class="clr clear"></div>'; return $html; }
echo " <a id=\"addticket\" class=\"mat_addticket\" border=\"0\" href=\"#\"><span class=\"mat_add\" type=\"button\">\r\n\t\t\t\t\t<img src=\"" . MatukioHelperUtilsBasic::getComponentImagePath() . "1832.png\" border=\"0\" align=\"absmiddle\" style=\"width: 16px; height: 16px;\"> " . JTEXT::_('COM_MATUKIO_ADD') . "</span></a>"; echo '</td>'; echo '</tr>'; echo "</table>"; echo "</div>"; } } else { // Just one single ticket! echo "<input type=\"hidden\" name=\"nrbooked\" id=\"nrbooked\" value=\"1\" />"; // Different Fees @since 3.0.0 if ($this->event->different_fees) { $fees_list = MatukioHelperFees::getFees(); echo "<input type=\"hidden\" name=\"places[0]\" id=\"places0\" value=\"1\" class=\"ticket_places\" />"; if (!empty($this->event->different_fees_override)) { // We have an override for this event $fees_list = MatukioHelperFees::getOverrideFees($this->event->different_fees_override); } // We have just a single ticket so we just show a drop down list and set ticket_fee to array obj 0 echo "<table class=\"mat_table table\">\n"; echo '<tr>'; echo '<td class="key" width="150px">'; echo JText::_("COM_MATUKIO_TICKET_TYPE"); echo " <span class=\"mat_req\">*</span>"; echo '</td>'; echo '<td>'; echo '<select id="ticket_fees0" name="ticket_fees[0]" class="sem_inputbox chzn-single ticket_fees" size="1">'; echo '<option value="0" selected="selected" discvalue="0" discount="1" percent="1">- ' . JText::_("COM_MATUKIO_NORMAL") . ' -</option>'; foreach ($fees_list as $f) { $disc_text = $f->discount ? '-' : '+'; if (!$f->percent) { $fval = MatukioHelperUtilsEvents::getFormatedCurrency($f->value, MatukioHelperSettings::getSettings('currency_symbol', '$'));
echo " <span class=\"mat_req\">*</span>"; echo '</td>'; echo '<td>'; echo $htx2; echo '</td>'; echo '</tr>'; echo "</table>"; } else { // Different Fees with multiple tickets @since 3.0.0 echo "<input type=\"hidden\" name=\"nrbooked\" id=\"nrbooked\" value=\"" . $this->booking->nrbooked . "\" />"; // Show different fees for empty and new bookings if (!empty($this->booking->different_fees) || empty($this->booking->id)) { echo MatukioHelperFees::getEditBookingFeesList($this->booking->different_fees, $event, $buchopt); } else { echo JText::_("COM_MATUKIO_NO_TICKETS_BOOKED_WITH_DIFFERENT_FEES"); echo MatukioHelperFees::getEditBookingFeesList($this->booking->different_fees, $event, $buchopt); } } } else { echo '<input type="hidden" name="nrbooked" value="1" />'; } if (MatukioHelperSettings::getSettings('participant_grading_system', 0)) { echo "<table class=\"mat_table table\">\n"; echo '<tr>'; echo '<td class="key" width="150px">'; echo JTEXT::_('COM_MATUKIO_PARTICIPANT_MARK'); echo '</td>'; echo '<td>'; echo $this->mark_select; echo '</td>'; echo '</tr>';
/** * 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); } }
/** * Saves the form * * @throws Exception * @return object */ public function save() { $input = JFactory::getApplication()->input; if ($input->getInt("oldform", 0) == 1) { $this->saveOld(); return; } $database = JFactory::getDBO(); $dispatcher = JDispatcher::getInstance(); // Backend $art = 4; $event_id = $input->getInt('event_id', 0); $uid = $input->getInt('uid', 0); $userid = $input->getInt('userid', 0); $id = $input->getInt("id", 0); $notify_participant = $input->getInt("notify_participant", 0); $notify_participant_invoice = $input->getInt("notify_participant_invoice", 0); $payment_method = $input->get('payment', '', 'string'); if (empty($event_id)) { JError::raiseError(404, 'COM_MATUKIO_NO_ID'); } // Load event (use events helper function) $event = MatukioHelperUtilsEvents::getEventRecurring($event_id); // Different fees @since 3.0 $different_fees = $event->different_fees; $reason = ""; if (!empty($uid)) { if ($uid < 0) { // Setting booking to changed booking $userid = $uid; // uid = Negativ } } // Checking old required fields - backward compatibilty - only frontend - we allow everything here.. if ($art == 4) { $allesok = 1; $ueber1 = JTEXT::_('COM_MATUKIO_BOOKING_WAS_SUCCESSFULL'); } // Buchung eintragen $neu = JTable::getInstance('bookings', 'Table'); if (!$neu->bind(JRequest::get('post'))) { return JError::raiseError(500, $database->stderr()); } $neu->semid = $event->id; $neu->userid = $userid; $firstname = $input->get('firstname', '', 'string'); $lastname = $input->get('lastname', '', 'string'); if (empty($id)) { $neu->bookingdate = MatukioHelperUtilsDate::getCurrentDate(); } $neu->name = trim($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)) { $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)); $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 { // Raise an error JError::raise(E_ERROR, 500, JText::_("COM_MATUKIO_INVALID_COUPON_CODE")); } } $neu->payment_brutto = $payment_brutto; } else { // Different fees @since 3.0 $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); } // 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); if (!$neu->check()) { return JError::raiseError(500, $database->stderr()); } if (!$neu->store()) { return JError::raiseError(500, $database->stderr()); } $neu->checkin(); $results = $dispatcher->trigger('onAfterBooking', $neu, $event); $ueber1 = JText::_("COM_MATUKIO_BOOKING_WAS_SUCCESSFULL"); if ($userid == 0) { $userid = $neu->id * -1; } // Send new confirmation mail if ($notify_participant) { MatukioHelperUtilsEvents::sendBookingConfirmationMail($event, $neu->id, 11, false, $neu, $notify_participant_invoice); } switch ($this->task) { case 'apply': $msg = JText::_('COM_MATUKIO_BOOKING_APPLY'); $link = 'index.php?option=com_matukio&controller=editbooking&task=editBooking&booking_id=' . $neu->id; break; case 'save': default: $msg = JText::_('COM_MATUKIO_BOOKING_SAVE'); $link = 'index.php?option=com_matukio&view=bookings'; break; } $this->setRedirect($link, $msg); }
$htxt = MatukioHelperSettings::getSettings('currency_symbol', '$') . " " . MatukioHelperUtilsEvents::getFormatedCurrency($this->event->fees); if (MatukioHelperSettings::getSettings('frontend_usermehrereplaetze', 1) > 0) { if ($buchopt[0] != 2) { $htxt .= " " . JTEXT::_('COM_MATUKIO_PRO_PERSON'); } if ($buchopt[0] == 2 and $buchopt[2][0]->nrbooked > 1) { $htxt = MatukioHelperUtilsEvents::getFormatedCurrency($buchopt[2][0]->payment_brutto, MatukioHelperSettings::getSettings('currency_symbol', '$')) . " (" . $htxt . " " . JTEXT::_('COM_MATUKIO_PRO_PERSON') . ")"; } } if ($buchopt[0] == 2) { if ($buchopt[2][0]->paid == 1) { $htxt .= " - " . JTEXT::_('COM_MATUKIO_PAID'); } } if (MatukioHelperSettings::getSettings('show_different_fees', 1) && $this->event->different_fees) { $htxt .= MatukioHelperFees::getFeesShow($this->event); } $html .= MatukioHelperUtilsEvents::getTableCell($htxt, 'd', 'l', '80%', 'sem_rowd') . "</tr>"; } // Dateien herunterladen $datfeld = MatukioHelperUtilsEvents::getEventFileArray($this->event); $htxt = array(); for ($i = 0; $i < count($datfeld[0]); $i++) { if ($datfeld[0][$i] != "" and ($datfeld[2][$i] == 0 or $my->id > 0 and $datfeld[2][$i] == 1 or $buchopt[0] == 2 and $datfeld[2][$i] == 2 or $buchopt[2][0]->paid == 1 and $datfeld[2][$i] == 3)) { // TODO improve security.. dirks way is a joke.. security by obscurity in opensource!!1 // index.php?s=" . MatukioHelperUtilsBasic::getRandomChar() . "&option=" . JFactory::getApplication()->input->get('option') . "&task=34&a6d5dgdee4cu7eho8e7fc6ed4e76z=" // . sha1(md5($datfeld[0][$i])) . $this->event->id . $filelink = JRoute::_("index.php?option=com_matukio&view=matukio&task=downloadfile&a6d5dgdee4cu7eho8e7fc6ed4e76z=" . sha1(md5($datfeld[0][$i])) . $this->event->id); $htxt[] = "<tr><td style=\"white-space:nowrap;vertical-align:top;\"><span style=\"background-image:url(" . MatukioHelperUtilsBasic::getComponentImagePath() . "0002.png);background-repeat:no-repeat;background-position:2px;padding-left:18px;vertical-align:middle;\" >\n <a href=\"" . $filelink . "\" target=\"_blank\">" . $datfeld[0][$i] . "</a></span></td><td width=\"80%\" style=\"vertical-align:top;\">" . $datfeld[1][$i] . "</td></tr>"; } }