/** * Checks a user in * * @throws Exception * @return void */ public function checkin() { if (MatukioHelperSettings::_("checkin_only_organizer", 1) && !JFactory::getUser()->authorise('core.edit.own', 'com_matukio')) { // Access check for editing this event throw new Exception(JText::_("JERROR_ALERTNOAUTHOR"), 403); } $uuid = JFactory::getApplication()->input->get('uuid', 0); if (empty($uuid)) { throw new Exception(JText::_("COM_MATUKIO_NO_ID"), 404); } $db = JFactory::getDbo(); // First load booking $query = $db->getQuery(true); $query->select("*")->from("#__matukio_bookings")->where("uuid = " . $db->quote($uuid))->where("status = " . MatukioHelperUtilsBooking::$ACTIVE); $db->setQuery($query); $booking = $db->loadObject(); if (empty($booking)) { throw new Exception(JText::_("COM_MATUKIO_CHECKIN_NO_ACTIVE_BOOKING_FOUND"), 404); } // Let's check if the user is checked in already if ($booking->checked_in == 1) { throw new Exception(JText::_("COM_MATUKIO_CHECKIN_BOOKING_ALREADY_CHECKED_IN"), 42); } // Let's checkin the user $query = $db->getQuery(true); $query->update("#__matukio_bookings")->set("checked_in = 1")->where("uuid = " . $db->quote($uuid)); $db->setQuery($query); $db->execute(); // Let's redirect to the booking details page $link = JRoute::_("index.php?option=com_matukio&view=booking&uuid=" . $uuid); $msg = JText::_("COM_MATUKIO_CHECKIN_SUCCESSFULL"); $this->setRedirect($link, $msg); }
/** * Shows the form * * @param string $tpl - The tmpl * * @return bool|mixed|object */ public function display($tpl = null) { $booking_id = JFactory::getApplication()->input->get('booking_id', 0); $user = JFactory::getUser(); $model = $this->getModel(); if (empty($booking_id)) { JError::raiseError('404', "COM_MATUKIO_NO_ID"); } $booking = $model->getBooking($booking_id); $event = $model->getEvent($booking->semid); MatukioHelperUtilsBasic::expandPathway(JTEXT::_('COM_MATUKIO_EVENTS'), JRoute::_("index.php?option=com_matukio&view=eventlist")); MatukioHelperUtilsBasic::expandPathway(JTEXT::_('COM_MATUKIO_EVENT_PAYPAL_PAYMENT'), ""); $net_amount = $booking->payment_brutto; $tax_amount = 0; $successurl = JURI::base() . substr(JRoute::_("index.php?option=com_matukio&view=callback&booking_id=" . $booking_id), strlen(JURI::base(true)) + 1); $cancelreturn = JURI::base() . substr(JRoute::_("index.php?option=com_matukio&view=callback&task=cancel&booking_id=" . $booking_id . "&return=1"), strlen(JURI::base(true)) + 1); $item_number = $booking->nrbooked; $this->event = $event; $this->user = $user; $this->booking = $booking; $this->merchant_address = MatukioHelperSettings::getSettings("paypal_address", '*****@*****.**'); $this->currency = MatukioHelperSettings::getSettings("paypal_currency", 'EUR'); $this->success_url = $successurl; $this->cancel_url = $cancelreturn; $this->item_number = $item_number; $this->net_amount = $net_amount; $this->tax_amount = $tax_amount; parent::display($tpl); }
/** * Gets a setting with the given title, returns default if not available * * @param string $title - The key / title of the setting * @param string $default - The default value (if setting not found) * * @return mixed */ public static function getSettings($title = '', $default = '') { if (!isset(self::$instance)) { self::$instance = self::_loadSettings(); } return self::$instance->get($title, $default); }
/** * Displays the form * * @param bool $cachable - Is it cachable * @param bool $urlparams - The url params * * @return JControllerLegacy|void */ public function display($cachable = false, $urlparams = false) { MatukioHelperUtilsBasic::loginUser(); $document = JFactory::getDocument(); $viewName = JFactory::getApplication()->input->get('view', 'eventlist'); $viewType = $document->getType(); $view = $this->getView($viewName, $viewType); $model = $this->getModel('Eventlist', 'MatukioModel'); $view->setModel($model, true); $tmpl = MatukioHelperSettings::getSettings("event_template", "default"); $params = JComponentHelper::getParams('com_matukio'); $menuitemid = JFactory::getApplication()->input->getInt('Itemid'); if ($menuitemid) { $site = new JSite(); $menu = $site->getMenu(); $menuparams = $menu->getParams($menuitemid); $params->merge($menuparams); } $ptmpl = $params->get('template', ''); if (!empty($ptmpl)) { $tmpl = $ptmpl; } $view->setLayout($tmpl); $view->display(); }
/** * Gets the timezone * * @param Date $date The date Obj * * @return string */ public static function getTimezone($date) { $cltimezone = ""; if (MatukioHelperSettings::getSettings('show_timezone', '1')) { $cltimezone = " (GMT " . JHTML::_('date', $date, 'P') . ")"; } return $cltimezone; }
/** * Displays the form * * @param string $tpl - The templates * * @return mixed|void */ public function display($tpl = null) { $orga_id = JFactory::getApplication()->input->get('id', 0); $model = $this->getModel(); $params = JComponentHelper::getParams('com_matukio'); $menuitemid = JFactory::getApplication()->input->get('Itemid'); if ($menuitemid) { $site = new JSite(); $menu = $site->getMenu(); $menuparams = $menu->getParams($menuitemid); $params->merge($menuparams); } if (empty($orga_id)) { $orga_id = $params->get('organizerId', 0); } // Raise error if (empty($orga_id)) { JError::raise(E_ERROR, 403, JText::_("COM_MATUKIO_NO_ID")); } $organizer = $model->getOrganizer($orga_id); if (!empty($organizer)) { // Get the Joomla user obj $organizer_user = JFactory::getUser($organizer->userId); } else { $organizer_user = null; } $ue_title = $params->get('title', ''); if (empty($ue_title)) { // Set the title to the name $ue_title = $organizer->name; } $title = JFactory::getDocument()->getTitle(); JFactory::getDocument()->setTitle($title . " - " . JText::_($organizer->name)); // Plugin support $dispatcher = JDispatcher::getInstance(); JPluginHelper::importPlugin('content'); $this->jevent = new stdClass(); $results = $dispatcher->trigger('onContentAfterDisplay', array('com_matukio.organizer', &$organizer, &$params, 0)); $this->jevent->afterDisplayContent = trim(implode("\n", $results)); $this->organizer = $organizer; $this->organizer_user = $organizer_user; $this->title = $ue_title; $this->user = JFactory::getUser(); // Upcoming events since 3.1 if (MatukioHelperSettings::getSettings("organizer_show_upcoming", 1) && !empty($organizer_user)) { $this->upcoming_events = $model->getUpcomingEvents($organizer_user->id); } parent::display($tpl); }
/** * Displays the raw calendar file * * @param string $tpl - The template * * @return mixed|void */ public function display($tpl = null) { if (MatukioHelperSettings::getSettings('frontend_usericsdownload', 1) == 0) { JError::raiseError(403, JText::_("ALERTNOTAUTH")); return; } $cid = JFactory::getApplication()->input->getInt('cid', 0); $events = array(); if (!empty($cid)) { // Just one event $model = JModelLegacy::getInstance('Event', 'MatukioModel'); $event = $model->getItem($cid); $events[] = $event; } else { $database = JFactory::getDBO(); $neudatum = MatukioHelperUtilsDate::getCurrentDate(); // ICS File with all Events $where = array(); $database->setQuery("SELECT id, access FROM #__categories WHERE extension = '" . JFactory::getApplication()->input->get('option') . "'"); $cats = $database->loadObjectList(); $allowedcat = array(); foreach ($cats as $cat) { if ($cat->access < 1) { $allowedcat[] = $cat->id; } } if (count($allowedcat) > 0) { $allowedcat = implode(',', $allowedcat); $where[] = "a.catid IN (" . $allowedcat . ")"; } $where[] = "a.published = '1'"; $where[] = "a.end > '{$neudatum}'"; $where[] = "a.booked > '{$neudatum}'"; $database->setQuery("SELECT a.*, r.*, cat.title AS category FROM #__matukio_recurring AS r\r\n\t\t\t LEFT JOIN #__matukio AS a ON r.event_id = a.id\r\n\t\t\t LEFT JOIN #__categories AS cat ON cat.id = a.catid" . (count($where) ? "\nWHERE " . implode(' AND ', $where) : "") . "\nORDER BY r.begin DESC" . "\nLIMIT 0, 1000"); $events = $database->loadObjectList(); } $this->events = $events; parent::display($tpl); }
/** * Shows the form * * @param string $tpl - The tmpl * * @return bool|mixed|object */ public function display($tpl = NULL) { $database = JFactory::getDBO(); $my = JFactory::getuser(); $dateid = JFactory::getApplication()->input->getInt('dateid', 1); $catid = JFactory::getApplication()->input->getInt('catid', 0); $search = JFactory::getApplication()->input->get('search', '', 'string'); $limit = JFactory::getApplication()->input->getInt('limit', 5); $limitstart = JFactory::getApplication()->input->getInt('limitstart', 0); $cid = JFactory::getApplication()->input->getInt('cid', 0); $uid = JFactory::getApplication()->input->getInt('uid', 0); $todo = JFactory::getApplication()->input->get('todo', 'print_eventlist'); // print_eventlist, print_booking, print_myevents, print $rows = null; $status = null; $headertext = null; $neudatum = MatukioHelperUtilsDate::getCurrentDate(); if ($limitstart < 0) { $limitstart = 0; } $ttlimit = ""; if ($limit > 0) { $ttlimit = "\nLIMIT {$limitstart}, {$limit}"; } /** * 65O9805443904 = public ?! * 653O875032490 = Meine Angebote * 6530387504345 = Meine Buchungen / Buchungsbestätigung ?! * * 3728763872762 = * csv */ $where = array(); $where[] = "a.pattern = ''"; $where[] = "a.published = '1'"; switch ($todo) { case "print_eventlist": $navioben = explode(" ", MatukioHelperSettings::getSettings('frontend_topnavshowmodules', 'SEM_NUMBER SEM_SEARCH SEM_CATEGORIES SEM_RESET')); break; case "print_booking": $navioben = explode(" ", MatukioHelperSettings::getSettings('frontend_topnavbookingmodules', 'SEM_NUMBER SEM_SEARCH SEM_CATEGORIES SEM_RESET')); break; case "print_myevents": $navioben = explode(" ", MatukioHelperSettings::getSettings('frontend_topnavoffermodules', 'SEM_NUMBER SEM_SEARCH SEM_CATEGORIES SEM_RESET')); break; case "print_teilnehmerliste": $navioben = ""; break; } if ($todo != "print_teilnehmerliste" && $todo != "csvlist" && $todo != "certificate" && $todo != "invoice") { if (in_array('SEM_TYPES', $navioben)) { switch ($dateid) { case "1": $where[] = "a.end > '{$neudatum}'"; break; case "2": $where[] = "a.end <= '{$neudatum}'"; break; } } } switch ($todo) { default: case "print_eventlist": if (!in_array('SEM_TYPES', $navioben)) { $where[] = "r.end > '{$neudatum}'"; } if ((isset($_GET["catid"]) or in_array('SEM_CATEGORIES', $navioben)) and $catid > 0) { $where[] = "a.catid ='{$catid}'"; } $headertext = JTEXT::_('COM_MATUKIO_EVENTS'); if ($cid) { $where[] = "r.id= '{$cid}'"; $headertext = JTEXT::_('COM_MATUKIO_EVENT'); } $database->setQuery("SELECT a.*, r.*, cc.title AS category FROM #__matukio_recurring AS r" . "\nLEFT JOIN #__matukio AS a ON r.event_id = a.id" . "\nLEFT JOIN #__categories AS cc ON cc.id = a.catid" . (count($where) ? "\nWHERE " . implode(' AND ', $where) : "") . "\nAND (r.semnum LIKE'%{$search}%' OR a.teacher LIKE '%{$search}%' OR a.title LIKE '%{$search}%'" . " OR a.shortdesc LIKE '%{$search}%' OR a.description LIKE '%{$search}%')"); $rows = $database->loadObjectList(); // Abzug der Kurse, die wegen Ausbuchung nicht angezeigt werden sollen if (!$cid) { $abid = array(); foreach ($rows as $row) { if ($row->stopbooking == 2) { $gebucht = MatukioHelperUtilsEvents::calculateBookedPlaces($row); if ($row->maxpupil - $gebucht->booked < 1) { $abid[] = $row->id; } } } if (count($abid) > 0) { $abid = implode(',', $abid); $where[] = "r.id NOT IN ({$abid})"; } } $database->setQuery("SELECT a.*, r.*, cc.title AS category FROM #__matukio_recurring AS r" . "\nLEFT JOIN #__matukio AS a ON r.event_id = a.id" . "\nLEFT JOIN #__categories AS cc" . "\nON cc.id = a.catid" . (count($where) ? "\nWHERE " . implode(' AND ', $where) : "") . "\nAND (a.semnum LIKE'%{$search}%' OR a.teacher LIKE '%{$search}%' OR a.title LIKE '%{$search}%' OR a.shortdesc LIKE '%{$search}%' OR a.description LIKE '%{$search}%')" . "\nORDER BY r.begin" . $ttlimit); $rows = $database->loadObjectList(); $status = array(); $paid = array(); $abid = array(); for ($i = 0, $n = count($rows); $i < $n; $i++) { $row =& $rows[$i]; $gebucht = MatukioHelperUtilsEvents::calculateBookedPlaces($row); $gebucht = $gebucht->booked; if (MatukioHelperUtilsDate::getCurrentDate() > $row->booked or $row->maxpupil - $gebucht < 1 and $row->stopbooking == 1 or $my->id == $row->publisher and MatukioHelperSettings::getSettings('booking_ownevents', 1) == 0) { $status[$i] = JTEXT::_('COM_MATUKIO_UNBOOKABLE'); } elseif ($row->maxpupil - $gebucht < 1 && $row->stopbooking == 0) { $status[$i] = JTEXT::_('COM_MATUKIO_BOOKING_ON_WAITLIST'); } elseif ($row->maxpupil - $gebucht < 1 && $row->stopbooking == 2) { $abid[] = $row->id; } else { $status[$i] = JTEXT::_('COM_MATUKIO_NOT_EXCEEDED'); } $database->setQuery("SELECT * FROM #__matukio_bookings WHERE semid='{$row->id}' AND userid='{$my->id}'"); $temp = $database->loadObjectList(); if (count($temp) > 0) { $status[$i] = JTEXT::_('COM_MATUKIO_ALREADY_BOOKED'); if ($temp[0]->paid == 1) { $rows[$i]->fees = $rows[$i]->fees . " - " . JTEXT::_('COM_MATUKIO_PAID'); } } $rows[$i]->codepic = ""; } break; // My bookings ?! // My bookings ?! case "print_booking": $headertext = JTEXT::_('COM_MATUKIO_MY_BOOKINGS') . " - " . $my->name; if (in_array('SEM_CATEGORIES', $navioben) and $catid > 0) { $where[] = "a.catid ='{$catid}'"; } $where[] = "cc.userid = '" . $my->id . "'"; if ($cid) { $where[] = "cc.semid = '" . $cid . "'"; $headertext = JTEXT::_('COM_MATUKIO_BOOKING_CONFIRMATION') . " - " . $my->name; } $database->setQuery("SELECT a.*, r.*, cat.title AS category, cc.bookingdate AS bookingdate, cc.id AS bookid, cc.status AS bookingstatus\r\n\t\t\t\t\tFROM #__matukio_recurring AS r\r\n\t\t\t\t\tLEFT JOIN #__matukio AS a ON r.event_id = a.id\r\n\t\t\t\t\tLEFT JOIN #__matukio_bookings AS cc ON cc.semid = r.id\r\n\t\t\t\t\tLEFT JOIN #__categories AS cat ON cat.id = a.catid" . (count($where) ? "\nWHERE " . implode(' AND ', $where) : "") . "\nAND (r.semnum LIKE'%{$search}%' OR a.teacher LIKE '%{$search}%' OR a.title LIKE '%{$search}%' OR a.shortdesc LIKE '%{$search}%'\r\n OR a.description LIKE '%{$search}%')" . "\nORDER BY r.begin" . $ttlimit); $rows = $database->loadObjectList(); $status = array(); for ($i = 0, $n = count($rows); $i < $n; $i++) { $row =& $rows[$i]; $database->setQuery("SELECT * FROM #__matukio_bookings WHERE semid = '{$row->id}' ORDER BY id"); $temps = $database->loadObjectList(); $status[$i] = MatukioHelperUtilsBooking::getBookingStatusName($row->bookingstatus); $rows[$i]->codepic = $row->bookid; if ($temps[0]->paid == 1) { $rows[$i]->fees = $rows[$i]->fees . " - " . JTEXT::_('COM_MATUKIO_PAID'); } } break; // My events ?! // My events ?! case "print_myevents": if (in_array('SEM_CATEGORIES', $navioben) and $catid > 0) { $where[] = "a.catid ='{$catid}'"; } $where[] = "a.publisher = '" . $my->id . "'"; $database->setQuery("SELECT a.*, r.* cat.title AS category FROM #__matukio_recurring AS r\r\n\t\t\t \t LEFT JOIN #__matukio AS a ON r.eventid = a.id\r\n\t\t\t\t\tLEFT JOIN #__categories AS cat ON cat.id = a.catid" . (count($where) ? "\nWHERE " . implode(' AND ', $where) : "") . "\nAND (r.semnum LIKE'%{$search}%' OR a.teacher LIKE '%{$search}%' OR a.title LIKE '%{$search}%' OR a.shortdesc LIKE '%{$search}%' OR a.description LIKE '%{$search}%')" . "\nORDER BY r.begin" . $ttlimit); $rows = $database->loadObjectList(); $status = array(); $headertext = JTEXT::_('COM_MATUKIO_MY_OFFERS') . " - " . $my->name; for ($i = 0, $n = count($rows); $i < $n; $i++) { $row =& $rows[$i]; $status[$i] = MatukioHelperUtilsBooking::getBookingStatusName($row->bookingstatus); $rows[$i]->codepic = ""; } break; case "print_teilnehmerliste": // TODO implement userchecking $art = JFactory::getApplication()->input->getInt('art', 0); $this->art = $art; if ($art == 1) { $this->setLayout("signaturelist"); } else { $this->setLayout("participants"); } break; case "csvlist": // TODO implement userchecking $art = JFactory::getApplication()->input->getInt('art', 0); $this->art = $art; $this->cid = $cid; $this->setLayout("csv"); break; case "certificate": // TODO implement userchecking $art = JFactory::getApplication()->input->getInt('art', 0); $uid = JFactory::getApplication()->input->getInt('uid', 0); $this->art = $art; $this->uid = $uid; $this->setLayout("certificate"); break; case "invoice": // TODO implement userchecking $art = JFactory::getApplication()->input->getInt('art', 0); $uid = JFactory::getApplication()->input->getInt('uid', 0); $this->art = $art; $this->uid = $uid; $this->setLayout("invoice"); break; } $this->rows = $rows; $this->status = $status; $this->headertext = $headertext; parent::display($tpl); }
$single_fee = $single_fee + $single_fee * ($value[$i] / 100); } } } $total += $places[$i] * $single_fee; } // Substract coupon code (if any) if (!empty($coupon_code)) { // Get coupon value $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 $total = round($total * ((100 - $coupon->value) / 100), 2); } else { $total = $total - $coupon->value; } } } echo MatukioHelperUtilsEvents::getFormatedCurrency($total, MatukioHelperSettings::getSettings('currency_symbol', '$')); } elseif ($task == 'generate_recurring') { MatukioHelperRecurring::printGenerateRecurring(); } elseif ($task == 'get_override_fee_edit_row') { MatukioHelperFees::printDifferentFeesRow(); } jexit();
} $kurs = null; // Load event only if we are not in the backend / or got an whole event to print if (!$backend) { $kurs = MatukioHelperUtilsEvents::getEventRecurring($this->cid); } if (!isset($this->cid)) { $this->cid = 0; } if (!isset($this->bookings)) { $this->bookings = null; } $konvert = MatukioHelperSettings::getSettings('csv_export_charset', 'UTF-8'); header("Content-Encoding: " . $konvert); header("Content-Type: text/csv; charset=" . $konvert); if (!empty($kurs)) { header("Content-Disposition: attachment; filename=\"" . $kurs->title . ".csv\""); } else { $filename = "bookings-" . JHTML::_('date', 'now', MatukioHelperSettings::getSettings('date_format_without_time', 'd-m-Y')) . ".csv"; header("Content-Disposition: attachment; filename=\"" . $filename . "\""); } header('Pragma: no-cache'); if ($konvert == "UTF-8") { // It does not help, as far as we know // $csvdata = chr(239) . chr(187) . chr(191); } $csvdata .= MatukioHelperUtilsEvents::generateCSVFile($backend, $this->cid, $this->bookings, $kurs); $konvert = MatukioHelperSettings::getSettings('csv_export_charset', 'UTF-8'); $csvdata = iconv("UTF-8", $konvert, $csvdata); echo $csvdata; exit;
?> "/> <?php } ?> <?php if ($cpp_headerback_color = MatukioHelperSettings::getSettings('cpp_headerback_color', '')) { ?> <input type="hidden" name="cpp_headerback_color" value="<?php echo $cpp_headerback_color; ?> "/> <?php } ?> <?php if ($cpp_headerborder_color = MatukioHelperSettings::getSettings('cpp_headerborder_color', '')) { ?> <input type="hidden" name="cpp_headerborder_color" value="<?php echo $cpp_headerborder_color; ?> "/> <?php } ?> <input type="image" src="https://www.paypalobjects.com/WEBSCR-640-20110306-1/en_US/i/btn/btn_paynowCC_LG.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!" id="paypalsubmit"/> <img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1"/> </form> </p>
echo '<table id="mat_payment_table" class="mat_table table" border="0" cellpadding="8" cellspacing="8">'; echo "<tr>"; echo '<td class="key" width="150px">'; echo '<label for="conf_payment_total" width="100" title="' . JText::_("COM_MATUKIO_TOTAL_AMOUNT") . '">'; echo JText::_("COM_MATUKIO_TOTAL_AMOUNT"); echo '</label>'; echo '</td>'; echo "<td>"; echo "<div id=\"conf_payment_total\"></div>"; echo "</tr>"; echo "</td>"; echo "</table>"; } // AGB echo "<br />"; $agb = MatukioHelperSettings::getSettings("agb_text", ""); if (!empty($agb)) { $link = JURI::ROOT() . "index.php?tmpl=component&s=" . MatukioHelperUtilsBasic::getRandomChar() . "&option=" . JFactory::getApplication()->input->get('option') . "&view=agb"; echo MatukioHelperUtilsBooking::getCheckbox("agb", " ", false); echo "<a href=\"" . $link . "\" class=\"modal cjmodal\" rel=\"{handler: 'iframe', size: {x:700, y:500}}\">"; echo JTEXT::_('COM_MATUKIO_TERMS_AND_CONDITIONS'); echo "</a>"; } ?> </div> <div id="mat_control"> <div id="mat_control_inner"> <button id="btn_back" class="mat_button"><?php echo JTEXT::_("COM_MATUKIO_BACK"); ?> </button>
/** * 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); }
} ?> <tr> <td colspan="2"> <div align="right"> <input type="submit" value="<?php echo JText::_("COM_MATUKIO_BOOK"); ?> " class="mmat_button"/> </div> </td> </tr> </table> <input type="hidden" name="nrbooked" value="1"/> <?php if (MatukioHelperSettings::getSettings('oldbookingform', 0) == 0) { ?> <input type="hidden" name="oldform" value="0"/> <input type="hidden" name="uuid" value="<?php echo MatukioHelperPayment::getUuid(true); ?> "/> <input type="hidden" name="option" value="com_matukio"/> <input type="hidden" name="view" value="bookings"/> <input type="hidden" name="controller" value="bookings"/> <input type="hidden" name="task" value="editBooking"/> <?php } else { ?> <input type="hidden" name="option" value="com_matukio"/> <input type="hidden" name="uuid" value="<?php
echo $href; ?> ');"><img src="<?php echo MatukioHelperUtilsBasic::getComponentImagePath(); ?> 3116.png" border="0" align="absmiddle"> <?php echo JTEXT::_('COM_MATUKIO_RSS_FEED'); ?> </span> <?php } ?> <?php if (MatukioHelperSettings::getSettings('frontend_usericsdownload', 1) == 1) { // ICS Download $href = JURI::ROOT() . "index.php?tmpl=component&option=" . JFactory::getApplication()->input->get('option') . "&view=ics&format=raw"; ?> <span class="mat_button" style="cursor:pointer;" type="button" onClick="window.open('<?php echo $href; ?> ');"><img src="<?php echo MatukioHelperUtilsBasic::getComponentImagePath(); ?> 3316.png" border="0" align="absmiddle"> <?php echo JTEXT::_('COM_MATUKIO_DOWNLOAD_CALENDER_FILE'); ?> </span>
/** * Displays the form * * @param string $tpl - The tmpl * * @return mixed|object */ public function display($tpl = null) { $params = JComponentHelper::getParams('com_matukio'); $menuitemid = JFactory::getApplication()->input->get('Itemid'); if ($menuitemid) { $site = new JSite(); $menu = $site->getMenu(); $menuparams = $menu->getParams($menuitemid); $params->merge($menuparams); } // Hardcode in Dirk's matukio-mvc.php task $art = JFactory::getApplication()->input->getInt('art', 0); $order_by = $params->get("orderby", "a.begin"); $database = JFactory::getDBO(); $dateid = JFactory::getApplication()->input->getInt('dateid', 1); $catid = JFactory::getApplication()->input->getInt('catid', 0); $uuid = JFactory::getApplication()->input->get('uuid', '', 'string'); if (empty($catid)) { $catid = $params->get('startcat', 0); } $search = JFactory::getApplication()->input->get('search', '', 'string'); $search = str_replace("'", "", $search); $search = str_replace("\"", "", $search); $limit = JFactory::getApplication()->input->getInt('limit', MatukioHelperSettings::getSettings('event_showanzahl', 10)); $limitstart = JFactory::getApplication()->input->getInt('limitstart', 0); $my = JFactory::getuser(); $groups = implode(',', $my->getAuthorisedViewLevels()); if ($art == 1) { if ($my->id == 0 && empty($uuid)) { JError::raiseError("403", JTEXT::_('COM_MATUKIO_NOT_LOGGED_IN')); } } // Check if user is logged in and allowed to edit his OWN events if ($art == 2) { if (!JFactory::getUser()->authorise('core.edit.own', 'com_matukio')) { return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); } } switch ($art) { default: case "0": $navioben = explode(" ", MatukioHelperSettings::getSettings('frontend_topnavshowmodules', 'SEM_NUMBER SEM_SEARCH SEM_CATEGORIES SEM_RESET')); break; case "1": $navioben = explode(" ", MatukioHelperSettings::getSettings('frontend_topnavbookingmodules', 'SEM_NUMBER SEM_SEARCH SEM_TYPES SEM_RESET')); break; case "2": $navioben = explode(" ", MatukioHelperSettings::getSettings('frontend_topnavoffermodules', 'SEM_NUMBER SEM_SEARCH SEM_TYPES SEM_RESET')); break; } // Old event form if ($this->getLayout() != "modern" || $my->id == 0) { $ret = MatukioHelperUtilsEvents::getEventList($art, $search, $dateid, $catid, $order_by, $my, $navioben, $limitstart, $limit, "old"); $events = $ret[0]; $total = $ret[1]; switch ($art) { case "0": $anztyp = array(JTEXT::_('COM_MATUKIO_EVENTS'), 0); break; case "1": // Show booked events $anztyp = array(JTEXT::_('COM_MATUKIO_MY_BOOKINGS'), 1); break; case "2": // Show offered events $anztyp = array(JTEXT::_('COM_MATUKIO_MY_OFFERS'), 2); break; } $pageNav = MatukioHelperUtilsEvents::cleanSiteNavigation($total, $limit, $limitstart); $this->rows = $events; $this->pageNav = $pageNav; } // Modern Layout - merge that someday :/ if ($this->getLayout() == "modern") { // Tabs if ($my->id > 0) { // Just set it to the default $anztyp = array(JTEXT::_('COM_MATUKIO_EVENTS'), 0); // Normal events view $ret = MatukioHelperUtilsEvents::getEventList(0, $search, $dateid, $catid, $order_by, $my, $navioben, $limitstart, $limit, "modern"); $allEvents = $ret[0]; $total = $ret[1]; $this->pageNavAllEvents = MatukioHelperUtilsEvents::cleanSiteNavigation($total, $limit, $limitstart); $this->allEvents = $allEvents; // My Bookings $bookedEvents = MatukioHelperUtilsEvents::getEventList(1, $search, $dateid, $catid, $order_by, $my, $navioben, 0, 1000, "modern"); $this->mybookedEvents = $bookedEvents[0]; // My offers if (JFactory::getUser()->authorise('core.edit.own', 'com_matukio')) { $editEvents = MatukioHelperUtilsEvents::getEventList(2, $search, $dateid, $catid, $order_by, $my, $navioben, 0, 1000, "modern"); $this->myofferEvents = $editEvents[0]; } } else { // Not logged in user - we can take rows from above $this->allEvents = $events; $this->pageNavAllEvents = $pageNav; } } // Kursauswahl erstellen $allekurse = array(); $allekurse[] = JHTML::_('select.option', '0', JTEXT::_('COM_MATUKIO_ALL_EVENTS')); $allekurse[] = JHTML::_('select.option', '1', JTEXT::_('COM_MATUKIO_CURRENT_EVENTS')); $allekurse[] = JHTML::_('select.option', '2', JTEXT::_('COM_MATUKIO_OLD_EVENTS')); $selectclass = $this->getLayout() == "modern" ? "mat_inputbox" : "sem_inputbox22"; $datelist = JHTML::_('select.genericlist', $allekurse, "dateid", "class=\"" . $selectclass . " chzn-single\" size=\"1\"\r\n onchange=\"changeStatus();\"", "value", "text", $dateid); $categories[] = JHTML::_('select.option', '0', JTEXT::_('COM_MATUKIO_ALL_CATS')); $database->setQuery("SELECT id AS value, title AS text FROM #__categories WHERE extension='" . JFactory::getApplication()->input->get('option') . "' AND access in (" . $groups . ") AND published = 1 ORDER BY lft"); $categs = array_merge($categories, (array) $database->loadObjectList()); $clist = JHTML::_('select.genericlist', $categs, "catid", "class=\"" . $selectclass . " chzn-single\" size=\"1\"\r\n onchange=\"changeCategoryEventlist();\" style=\"width: 180px;\"", "value", "text", $catid); $listen = array($datelist, $dateid, $clist, $catid); // Navigationspfad erweitern MatukioHelperUtilsBasic::expandPathway($anztyp[0], JRoute::_("index.php?option=com_matukio&view=eventlist")); $ue_title = $params->get('title', 'COM_MATUKIO_EVENTS_OVERVIEW'); $this->art = $art; $this->search = $search; $this->limit = $limit; $this->limitstart = $limitstart; $this->total = $total; $this->datelist = $datelist; $this->dateid = $dateid; $this->clist = $clist; $this->catid = $catid; $this->title = $ue_title; $this->order_by = $order_by; parent::display($tpl); }
/** * Confirms (notfies organizer + participants) an event * * @param object $event - An recurring event * * @return bool * @throws Exception on Error */ public static function confirmRecurringEvent($event) { // First update event $db = JFactory::getDbo(); if (MatukioHelperSettings::_("booking_confirmation", 1)) { // Notify participants and organizer over the event is taking place $db->setQuery("SELECT * FROM #__matukio_bookings WHERE semid = " . $event->id); $rows = $db->loadObjectList(); if ($db->getErrorNum()) { throw new Exception($db->getErrorMsg(), 42); } foreach ($rows as $row) { MatukioHelperUtilsEvents::sendBookingConfirmationMail($event, $row->id, 12); } } return true; }
/** * Gets the powered by * * @param bool $frontend - Are we in the frontend? * * @return string */ public static function getCopyright($frontend = true) { $html = ""; // Always show in the backend if (MatukioHelperSettings::getSettings('frontend_showfooter', 1) == 1 || $frontend == false) { $html = "<div id=\"copyright_box\" align=\"center\" style=\"margin-top: 20px;\">\r\n <a href=\"https://compojoom.com/joomla-extensions/matukio-events-management-made-easy\" target=\"_new\">Matukio</a> - Events for <a href=\"http://joomla.org\">Joomla!â„¢</a>\r\n by <a href=\"https://compojoom.com\" target=\"_new\">compojoom.com</a>\r\n </div>"; } return $html; }
/** * Integrates into the Joomla search * * @param string $text - The search text * @param string $phrase - The search phrase * @param string $ordering - The ordering of the results * @param object $areas - The Areas * * @return array */ public function onContentSearch($text, $phrase = '', $ordering = '', $areas = null) { if (is_array($areas)) { if (!array_intersect($areas, array_keys($this->onContentSearchAreas()))) { return array(); } } // No search text $text = trim($text); if ($text == "") { return array(); } // Vorbereitungen $database = JFactory::getDBO(); $my = JFactory::getuser(); $app = JFactory::getApplication(); $offset = $app->getCfg('offset'); if (MatukioHelperSettings::getSettings('date_format_summertime', 1) > 0) { $jahr = date("Y"); $sombeginn = mktime(2, 0, 0, 3, 31 - date('w', mktime(2, 0, 0, 3, 31, $jahr)), $jahr); $somende = mktime(2, 0, 0, 10, 31 - date('w', mktime(2, 0, 0, 10, 31, $jahr)), $jahr); $aktuell = time(); if ($aktuell > $sombeginn and $aktuell < $somende) { $offset++; } } $date = JFactory::getDate(); // Offset? $date->setOffset($offset); $neudatum = $date->toSql(); // Find corresponding Matukio joomla entry $database->setQuery("SELECT id FROM #__menu WHERE link='index.php?option=com_matukio&view=eventlist'"); $tempitemid = $database->loadResult(); $slimit = $this->params->get('search_limit', 50); $sname = $this->params->get('search_name', 'Matukio'); // Check category ACL rights $groups = implode(',', $my->getAuthorisedViewLevels()); // TODO Cleanup .. $query = $database->getQuery(true); $query->select("id, access")->from("#__categories")->where(array("extension = " . $database->quote("com_matukio"), "published = 1", "access in (" . $groups . ")")); $database->setQuery($query); $cats = $database->loadObjectList(); // Filter search for allowed categories $allowedcat = array(); foreach ((array) $cats as $cat) { $allowedcat[] = $cat->id; } if (!empty($allowedcat)) { $where[] = "a.catid IN (" . implode(',', $allowedcat) . ")"; } $where[] = "r.published = '1'"; $where[] = "a.pattern = ''"; switch (MatukioHelperSettings::getSettings('event_stopshowing', 2)) { case "0": $showend = "r.begin"; break; case "1": $showend = "r.booked"; break; case "3": $showend = ""; break; default: $showend = "r.end"; break; } $where[] = "{$showend} > '{$neudatum}'"; // Sortierung festlegen $order = ''; switch ($ordering) { case 'newest': $order = ' ORDER BY r.id DESC'; break; case 'oldest': $order = ' ORDER BY r.id'; break; case 'popular': $order = ' ORDER BY r.hits'; break; case 'alpha': $order = ' ORDER BY title'; break; case 'category': $order = ' ORDER BY category'; break; } switch ($phrase) { case 'exact': $text = preg_replace('/\\s/', ' ', trim($text)); $suche = "\nAND (r.semnum LIKE '%" . $text . "%' OR a.gmaploc LIKE '%" . $text . "%' OR a.target LIKE '%" . $text . "%' OR a.place LIKE '%" . $text . "%' OR a.teacher LIKE '%" . $text . "%' OR a.title LIKE '%" . $text . "%' OR a.shortdesc LIKE '%" . $text . "%' OR a.description LIKE '%" . $text . "%')"; break; case 'all': case 'any': default: $text = preg_replace('/\\s\\s+/', ' ', trim($text)); $words = explode(' ', $text); $suche = array(); foreach ($words as $word) { $word = $database->Quote('%' . $database->getEscaped($word, true) . '%', false); $suche2 = array(); $suche2[] = "a.semnum LIKE {$word}"; $suche2[] = "a.gmaploc LIKE {$word}"; $suche2[] = "a.target LIKE {$word}"; $suche2[] = "a.place LIKE {$word}"; $suche2[] = "a.teacher LIKE {$word}"; $suche2[] = "a.title LIKE {$word}"; $suche2[] = "a.shortdesc LIKE {$word}"; $suche2[] = "a.description LIKE {$word}"; $suche3[] = implode(' OR ', $suche2); } $suche = "\nAND (" . implode($phrase == 'all' ? ') AND (' : ') OR (', $suche3) . ")"; break; } // Rueckgabe des Suchergebnisses $database->setQuery("SELECT a.*, r.*," . " a.title AS title," . " r.begin AS begin," . " a.publishdate AS created," . " a.shortdesc AS text," . " CONCAT('index.php?option=com_matukio&Itemid=" . $tempitemid . "&view=event&id=', r.id) AS href," . " '2' AS browsernav," . " '" . $sname . "' AS section," . " cat.title AS category" . " FROM #__matukio_recurring AS r" . " LEFT JOIN #__matukio AS a ON r.event_id = a.id" . " LEFT JOIN #__categories AS cat ON a.catid = cat.id" . (count($where) ? "\nWHERE " . implode(' AND ', $where) : "") . $suche . $order . " LIMIT 0, " . $slimit); $rows = $database->loadObjectList(); for ($i = 0; $i < count($rows); $i++) { $date = JFactory::getDate($rows[$i]->begin); $rows[$i]->section = $rows[$i]->section . " - " . JHTML::_('date', $date, MatukioHelperSettings::getSettings('date_format', 'd-m-Y, H:i')); $rows[$i]->Itemid = $tempitemid; } return $rows; }
?> </th> <th width="5%" nowrap="nowrap" style="text-align: center"> <?php echo JText::_('COM_MATUKIO_BOOK'); ?> </th> </tr> </thead> <tbody> <?php foreach ($this->items as $i => $item) { $link = JRoute::_('index.php?option=com_matukio&controller=recurring&task=edit&id=' . $item->id); $link_event = JRoute::_('index.php?option=com_matukio&controller=eventlist&task=editEvent&id=' . $item->eventid); $begin = JHTML::_('date', $item->begin, MatukioHelperSettings::getSettings('date_format_without_time', 'd-m-Y')) . ", " . JHTML::_('date', $item->begin, MatukioHelperSettings::getSettings('time_format', 'H:i')); $end = JHTML::_('date', $item->end, MatukioHelperSettings::getSettings('date_format_without_time', 'd-m-Y')) . ", " . JHTML::_('date', $item->end, MatukioHelperSettings::getSettings('time_format', 'H:i')); // Triggers publish / unpublish $published_image = MatukioHelperUtilsBasic::getPublishedImageRecurring($item, $i); // Triggers canceld / active $cancel_image = MatukioHelperUtilsBasic::getCancelImageRecurring($item, $i); // Booked places link $booked = MatukioHelperUtilsEvents::calculateBookedPlacesRecurring($item)->booked; $status_img = MatukioHelperUtilsBasic::getStatusImage($item); $available_img = MatukioHelperUtilsBasic::getAvailableImage($item, $booked); $bookable_image = MatukioHelperUtilsBasic::getBookableImage($item); $rating_image = MatukioHelperUtilsBasic::getRatingImage($item); $bplaces = '<a href="index.php?option=com_matukio&view=bookings&event_id=' . $item->id . '" value="' . $booked . '">' . $booked . "</a>"; ?> <tr class="row<?php echo $i % 2; ?>
} } // Book if (($this->user->id or MatukioHelperSettings::getSettings('booking_unregistered', 1) == 1) and $this->event->cancelled == 0 and $this->event->nrbooked > 0 and (count($buchopt[2]) == 0 or count($buchopt[2]) > 0 && MatukioHelperSettings::getSettings('frontend_usermehrereplaetze', 1) != 0)) { $bookinglink = JRoute::_("index.php?option=com_matukio&view=bookevent&cid=" . $this->event->id . ":" . JFilterOutput::stringURLSafe($this->event->title)); echo " <a title=\"" . JTEXT::_('COM_MATUKIO_BOOK') . "\" href=\"" . $bookinglink . "\"><span class=\"mat_book\" type=\"button\"><img src=\"" . MatukioHelperUtilsBasic::getComponentImagePath() . "1116.png\" border=\"0\" align=\"absmiddle\"> " . JTEXT::_('COM_MATUKIO_BOOK') . "</span></a>"; } // Aenderungen speichern Veranstalter , not really implemented here if ($this->art == 3 and $usrid != 0 and ($this->event->nrbooked > 1 or $zfleer == 0)) { echo ' <input type="submit" class="button" value="' . JTEXT::_('COM_MATUKIO_SAVE_CHANGES') . '">'; } // Aenderungen speichern Benutzer falls noch nicht gezahlt if ($this->art == 1 and strtotime($this->event->booked) - time() >= MatukioHelperSettings::getSettings('booking_stornotage', 1) * 24 * 60 * 60 and $bezahlt == 0) { if ($this->user->id > 0) { $unbookinglink = JRoute::_("index.php?option=com_matukio&view=bookevent&task=cancelBooking&cid=" . $this->event->id); if (MatukioHelperSettings::getSettings('booking_stornotage', 1) > -1) { echo " <a border=\"0\" href=\"" . $unbookinglink . "\" ><span class=\"mat_book\" type=\"button\"><img src=\"" . MatukioHelperUtilsBasic::getComponentImagePath() . "1532.png\" border=\"0\" align=\"absmiddle\" style=\"width: 16px; height: 16px;\"> " . JTEXT::_('COM_MATUKIO_BOOKING_CANCELLED') . "</span></a>"; } } } // Booking details to first booking if (count($buchopt[2]) > 0) { $blink = JRoute::_("index.php?option=com_matukio&view=booking&uuid=" . $buchopt[2][0]->uuid); echo " <a href=\"" . $blink . "\"><span class=\"mat_button\" style=\"cursor:pointer;\"\n title=\"" . JTEXT::_('COM_MATUKIO_BOOKING_DETAILS') . "\">" . "<img src=\"" . MatukioHelperUtilsBasic::getComponentImagePath() . "0004.png\" border=\"0\" align=\"absmiddle\"> " . JTEXT::_('COM_MATUKIO_BOOKING_DETAILS') . "</span></a>"; } ?> </div> </div> <?php echo $this->jevent->afterDisplayContent; ?>
</a> </div> <?php } ?> </td> </tr> </table> </div> <?php // Description echo JHtml::_('content.prepare', $this->location->description); // CComment and co echo $this->jevent->afterDisplayContent; // Since 3.1.0 - Show upcoming events with that location if (MatukioHelperSettings::getSettings("locations_show_upcoming", 1)) { ?> <div id="upcoming_events"> <?php if (count($this->upcoming_events)) { echo "<h3>" . JText::_("COM_MATUKIO_UPCOMING_EVENTS_AT_THIS_LOCATION") . "</h3>"; echo MatukioHelperUpcoming::getUpcomingEventsHTML($this->upcoming_events, $this->user); } ?> </div> <?php } // Footer echo MatukioHelperUtilsBasic::getCopyright();
/**  * @package Social Ads  * @copyright Copyright (C) 2009 -2010 Techjoomla, Tekdi Web Solutions . All rights reserved.  * @license GNU GPLv2 <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>  * @link     http://www.techjoomla.com  */ defined('_JEXEC') or die('Restricted access'); require_once JPATH_ADMINISTRATOR . '/components/com_matukio/helpers/defines.php'; JLoader::register('MatukioHelperSettings', JPATH_ADMINISTRATOR . '/components/com_matukio/helpers/settings.php'); // Load banktransfer data $account = MatukioHelperSettings::getSettings('banktransfer_account', ''); $blz = MatukioHelperSettings::getSettings('banktransfer_blz', ''); $bank = MatukioHelperSettings::getSettings('banktransfer_bank', ''); $account_holder = MatukioHelperSettings::getSettings('banktransfer_accountholder', ''); $iban = MatukioHelperSettings::getSettings('banktransfer_iban', ''); $bic = MatukioHelperSettings::getSettings('banktransfer_bic', ''); // no direct access JHTML::_('behavior.formvalidation'); $document = JFactory::getDocument(); if ($vars->custom_email == "") { $email = JText::_('NO_ADDRS'); } else { $email = $vars->custom_email; } ?> <div class="akeeba-bootstrap"> <form action="<?php echo $vars->url; ?> " name="adminForm" id="adminForm" onSubmit="return myValidate(this);" class="form-validate form-horizontal" method="post">
/** * Removes an or multiple events * * @throws Exception - If db queries fail * @return void */ public function remove() { $cid = JFactory::getApplication()->input->get('cid', array(), 'array'); $db = JFactory::getDBO(); if (count($cid)) { $cids = implode(',', $cid); // Notify users if (MatukioHelperSettings::_("notify_participants_delete", 1)) { $db->setQuery("SELECT * FROM #__matukio_bookings WHERE id IN (" . $cids . ")"); $bookings = $db->loadObjectList(); if ($db->getErrorNum()) { throw new Exception($db->getErrorMsg(), 42); } foreach ($bookings as $b) { $event = MatukioHelperUtilsEvents::getEventRecurring($b->semid); MatukioHelperUtilsEvents::sendBookingConfirmationMail($event, $b->id, 4); } } // Delete events $query = "DELETE FROM #__matukio_recurring where id IN (" . $cids . ")"; $db->setQuery($query); if (!$db->execute()) { throw new Exception($db->getErrorMsg(), 42); } // Delete old bookings $db->setQuery("DELETE FROM #__matukio_bookings WHERE semid IN (" . $cids . ")"); if (!$db->execute()) { throw new Exception($db->getErrorMsg(), 42); } } $msg = JText::_("COM_MATUKIO_DELETE_SUCCESS"); $this->setRedirect('index.php?option=com_matukio&view=recurring', $msg); }
public static function saveEvent($frontend = false) { $database = JFactory::getDBO(); $input = JFactory::getApplication()->input; $caid = $input->getInt('caid', 0); $cancel = $input->getInt('cancel', 0); $deldatei1 = $input->get('deldatei1', 0); $deldatei2 = $input->get('deldatei2', 0); $deldatei3 = $input->get('deldatei3', 0); $deldatei4 = $input->get('deldatei4', 0); $deldatei5 = $input->get('deldatei5', 0); $vorlage = $input->getInt('vorlage', 0, 'string'); $id = $input->getInt('id', 0); $art = $input->getInt('art', 2); $neudatum = MatukioHelperUtilsDate::getCurrentDate(); $recurring = $input->getInt("recurring", 0); $isNew = true; JPluginHelper::importPlugin('content'); $dispatcher = JDispatcher::getInstance(); // Zeit formatieren $_begin_date = $input->get('_begin_date', '0000-00-00', 'string'); $_end_date = $input->get('_end_date', '0000-00-00', 'string'); $_booked_date = $input->get('_booked_date', '0000-00-00', 'string'); if ($id > 0) { $kurs = JTable::getInstance('Matukio', 'Table'); $kurs->load($id); $isNew = false; } if ($vorlage > 0) { $kurs = JTable::getInstance('Matukio', 'Table'); $kurs->load($vorlage); } $post = JRequest::get('post'); // Allow HTML for certain fields $post['description'] = JRequest::getVar('description', '', 'post', 'html', JREQUEST_ALLOWHTML); $post['booking_mail'] = JRequest::getVar('booking_mail', '', 'post', 'html', JREQUEST_ALLOWHTML); $post['certificate_code'] = JRequest::getVar('certificate_code', '', 'post', 'html', JREQUEST_ALLOWHTML); $post['shortdesc'] = JRequest::getVar('shortdesc', '', 'post', 'html', JREQUEST_ALLOWHTML); $post['place'] = JRequest::getVar('place', '', 'post', 'html', JREQUEST_ALLOWHTML); $row = JTable::getInstance('Matukio', 'Table'); $row->load($id); if (!$row->bind($post)) { throw new Exception($row->getError(), 42); } // Zuweisung der aktuellen Zeit if ($id == 0) { $row->publishdate = $neudatum; } $row->updated = $neudatum; if ($cancel != $row->cancelled && MatukioHelperSettings::_("notify_participants_cancel", 1)) { $tempmail = 9 + $cancel; $events = MatukioHelperUtilsEvents::getEventsRecurringOnEventId($row->id); foreach ($events as $e) { $database->setQuery("SELECT * FROM #__matukio_bookings WHERE semid='{$e->id}'"); $rows = $database->loadObjectList(); for ($i = 0, $n = count($rows); $i < $n; $i++) { MatukioHelperUtilsEvents::sendBookingConfirmationMail($e, $rows[$i]->id, $tempmail); } } } $row->cancelled = $cancel; $row->catid = $caid; // Zuweisung der Startzeit $row->begin = JFactory::getDate($_begin_date, MatukioHelperUtilsBasic::getTimeZone())->format('Y-m-d H:i:s', false, false); // Zuweisung der Endzeit $row->end = JFactory::getDate($_end_date, MatukioHelperUtilsBasic::getTimeZone())->format('Y-m-d H:i:s', false, false); // Zuweisung der Buchungszeit $row->booked = JFactory::getDate($_booked_date, MatukioHelperUtilsBasic::getTimeZone())->format('Y-m-d H:i:s', false, false); // Neue Daten eintragen $row->description = str_replace('<br>', '<br />', $row->description); $row->description = str_replace('\\"', '"', $row->description); $row->description = str_replace("'", "'", $row->description); $row->fees = str_replace(",", ".", $row->fees); $row->different_fees_override = ""; $different_fees_override = $input->get("different_fees_override", array(), 'Array'); if (count($different_fees_override)) { // Check if element 0 is not empty if (!empty($different_fees_override[0]["title"])) { $row->different_fees_override = json_encode($different_fees_override); } } if ($row->id > 0 or $vorlage > 0) { if ($deldatei1 != 1) { $row->file1 = $kurs->file1; $row->file1code = $kurs->file1code; } if ($deldatei2 != 1) { $row->file2 = $kurs->file2; $row->file2code = $kurs->file2code; } if ($deldatei3 != 1) { $row->file3 = $kurs->file3; $row->file3code = $kurs->file3code; } if ($deldatei4 != 1) { $row->file4 = $kurs->file4; $row->file4code = $kurs->file4code; } if ($deldatei5 != 1) { $row->file5 = $kurs->file5; $row->file5code = $kurs->file5code; } } if ($row->id > 0) { $row->hits = $kurs->hits; } $fileext = explode(' ', strtolower(MatukioHelperSettings::getSettings('file_endings', 'txt zip pdf'))); $filesize = MatukioHelperSettings::getSettings('file_maxsize', 500) * 1024; $fehler = array('', '', '', '', '', '', '', '', '', ''); if (!empty($_FILES['datei1'])) { if (is_file($_FILES['datei1']['tmp_name']) and $_FILES['datei1']['size'] > 0) { if ($_FILES['datei1']['size'] > $filesize) { $fehler[0] = str_replace("SEM_FILE", $_FILES['datei1']['name'], JTEXT::_('COM_MATUKIO_UPLOAD_FAILED_MAX_SIZE')); } $datei1ext = array_pop(explode(".", strtolower($_FILES['datei1']['name']))); if (!in_array($datei1ext, $fileext)) { $fehler[1] = str_replace("SEM_FILE", $_FILES['datei1']['name'], JTEXT::_('COM_MATUKIO_UPLOAD_FAILED_FILE_TYPE')); } if ($fehler[0] == "" and $fehler[1] == "") { if ($deldatei1 != 1) { $row->file1 = $_FILES['datei1']['name']; $row->file1code = base64_encode(file_get_contents($_FILES['datei1']['tmp_name'])); } else { $row->file1 = ""; $row->file1code = ""; } } } } else { // Delete file if ($deldatei1 == 1) { $row->file1 = ""; $row->file1code = ""; } } if (!empty($_FILES['datei2'])) { if (is_file($_FILES['datei2']['tmp_name']) and $_FILES['datei2']['size'] > 0) { if ($_FILES['datei2']['size'] > $filesize) { $fehler[2] = str_replace("SEM_FILE", $_FILES['datei2']['name'], JTEXT::_('COM_MATUKIO_UPLOAD_FAILED_MAX_SIZE')); } $datei2ext = array_pop(explode(".", strtolower($_FILES['datei2']['name']))); if (!in_array($datei2ext, $fileext)) { $fehler[3] = str_replace("SEM_FILE", $_FILES['datei2']['name'], JTEXT::_('COM_MATUKIO_UPLOAD_FAILED_FILE_TYPE')); } if ($fehler[2] == "" and $fehler[3] == "") { $row->file2 = $_FILES['datei2']['name']; $row->file2code = base64_encode(file_get_contents($_FILES['datei2']['tmp_name'])); } } } else { // Delete file if ($deldatei2 == 1) { $row->file2 = ""; $row->file2code = ""; } } if (!empty($_FILES['datei3'])) { if (is_file($_FILES['datei3']['tmp_name']) and $_FILES['datei3']['size'] > 0) { if ($_FILES['datei3']['size'] > $filesize) { $fehler[4] = str_replace("SEM_FILE", $_FILES['datei3']['name'], JTEXT::_('COM_MATUKIO_UPLOAD_FAILED_MAX_SIZE')); } $datei3ext = array_pop(explode(".", strtolower($_FILES['datei3']['name']))); if (!in_array($datei3ext, $fileext)) { $fehler[5] = str_replace("SEM_FILE", $_FILES['datei3']['name'], JTEXT::_('COM_MATUKIO_UPLOAD_FAILED_FILE_TYPE')); } if ($fehler[4] == "" and $fehler[5] == "") { $row->file3 = $_FILES['datei3']['name']; $row->file3code = base64_encode(file_get_contents($_FILES['datei3']['tmp_name'])); } } } else { // Delete file if ($deldatei3 == 1) { $row->file3 = ""; $row->file3code = ""; } } if (!empty($_FILES['datei4'])) { if (is_file($_FILES['datei4']['tmp_name']) and $_FILES['datei4']['size'] > 0) { if ($_FILES['datei4']['size'] > $filesize) { $fehler[6] = str_replace("SEM_FILE", $_FILES['datei4']['name'], JTEXT::_('COM_MATUKIO_UPLOAD_FAILED_MAX_SIZE')); } $datei4ext = array_pop(explode(".", strtolower($_FILES['datei4']['name']))); if (!in_array($datei4ext, $fileext)) { $fehler[7] = str_replace("SEM_FILE", $_FILES['datei4']['name'], JTEXT::_('COM_MATUKIO_UPLOAD_FAILED_FILE_TYPE')); } if ($fehler[6] == "" and $fehler[7] == "") { $row->file4 = $_FILES['datei4']['name']; $row->file4code = base64_encode(file_get_contents($_FILES['datei4']['tmp_name'])); } } } else { // Delete file if ($deldatei4 == 1) { $row->file4 = ""; $row->file4code = ""; } } if (!empty($_FILES['datei5'])) { if (is_file($_FILES['datei5']['tmp_name']) and $_FILES['datei5']['size'] > 0) { if ($_FILES['datei5']['size'] > $filesize) { $fehler[8] = str_replace("SEM_FILE", $_FILES['datei5']['name'], JTEXT::_('COM_MATUKIO_UPLOAD_FAILED_MAX_SIZE')); } $datei5ext = array_pop(explode(".", strtolower($_FILES['datei5']['name']))); if (!in_array($datei5ext, $fileext)) { $fehler[9] = str_replace("SEM_FILE", $_FILES['datei5']['name'], JTEXT::_('COM_MATUKIO_UPLOAD_FAILED_FILE_TYPE')); } if ($fehler[8] == "" and $fehler[9] == "") { $row->file5 = $_FILES['datei5']['name']; $row->file5code = base64_encode(file_get_contents($_FILES['datei5']['tmp_name'])); } } } else { // Delete file if ($deldatei5 == 1) { $row->file5 = ""; $row->file5code = ""; } } // Eingaben ueberpruefen $speichern = true; // Template?? Deprecated if ($art == 3) { if (!MatukioHelperUtilsEvents::checkRequiredFieldValues($row->pattern, 'leer')) { $speichern = false; $fehler[] = JTEXT::_('COM_MATUKIO_YOU_HAVENT_FILLED_OUT_ALL_REQUIRED_FIELDS'); } } else { if (!MatukioHelperUtilsEvents::checkRequiredFieldValues($row->semnum, 'leer') or !MatukioHelperUtilsEvents::checkRequiredFieldValues($row->title, 'leer') or $row->catid == 0 or !MatukioHelperUtilsEvents::checkRequiredFieldValues($row->shortdesc, 'leer')) { $speichern = false; $fehler[] = JTEXT::_('COM_MATUKIO_YOU_HAVENT_FILLED_OUT_ALL_REQUIRED_FIELDS'); } elseif (!MatukioHelperUtilsEvents::checkRequiredFieldValues($row->maxpupil, 'nummer') or !MatukioHelperUtilsEvents::checkRequiredFieldValues($row->nrbooked, 'nummer')) { $speichern = false; $fehler[] = JTEXT::_('COM_MATUKIO_YOU_HAVENT_TYPED_A_NUMBER'); } else { $database->setQuery("SELECT id FROM #__matukio WHERE semnum='{$row->semnum}' AND id!='{$row->id}'"); $rows = $database->loadObjectList(); if (count($rows) > 0) { $speichern = false; $htxt = JTEXT::_('COM_MATUKIO_NOT_UNIQUE_NUMBERS'); if ($id < 1) { $htxt .= " " . JTEXT::_('COM_MATUKIO_EVENT_NOT_STORED'); } $fehler[] = $htxt; } } } // Kurs speichern if ($speichern == true) { // Trigger plugin event $results = $dispatcher->trigger('onBeforeSaveEvent', $row); // Check if we already created recurring events if ($recurring == 1) { $edited = $input->getInt("recurring_edited", 0); if ($row->recurring_created && $edited && $row->id > 0) { // Delete old recurring events $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->delete("#__matukio_recurring")->where("event_id = " . $row->id); $db->setQuery($query); $db->execute(); // Maybe set booking status to deleted too? } else { // Set it to 1 $row->recurring_created = 1; } } if (!$row->check()) { throw new Exception($database->stderr(), 42); } if (!$row->store()) { throw new Exception($database->stderr(), 42); } $row->checkin(); // Trigger plugin event $results = $dispatcher->trigger('onAfterSaveEvent', array('com_matukio.event', &$row, $isNew)); // Create recurring events if ($recurring == 1) { $dates_string = $input->get("recurring_dates", '', 'string'); if (!empty($dates_string)) { $bdate = explode(" ", $row->begin); $bdate = $bdate[0]; // Add begin date (if not already in there) if (strpos($dates_string, $bdate) === false) { $dates_string = $bdate . "," . "{$dates_string}"; } $dates = explode(",", $dates_string); $begin_date = new DateTime($row->begin); $end_date = new DateTime($row->end); $closing_date = new DateTime($row->booked); $diff = $begin_date->diff($end_date); $diff2 = $begin_date->diff($closing_date); $start_time = $begin_date->format("H:i:s"); $year = date('Y'); foreach ($dates as $d) { $rec_start = new DateTime($d . " " . $start_time); $rec_end = clone $rec_start; $rec_end->add($diff); $rec_close = clone $rec_start; $rec_close->add($diff2); $robj = new stdClass(); $robj->event_id = $row->id; $robj->semnum = MatukioHelperUtilsEvents::createNewEventNumber($year); $robj->begin = $rec_start->format("Y-m-d H:i:s"); $robj->end = $rec_end->format("Y-m-d H:i:s"); $robj->booked = $rec_close->format("Y-m-d H:i:s"); $robj->published = 1; $rect = JTable::getInstance('Recurring', 'MatukioTable'); if (!$rect->bind($robj)) { throw new Exception($rect->getError(), 42); } if (!$rect->check()) { throw new Exception($rect->getError(), 42); } if (!$rect->store()) { throw new Exception($rect->getError(), 42); } } } } else { // Delete the current date from recurring table and insert the new one // Delete old recurring events $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select("*")->from("#__matukio_recurring")->where("event_id = " . $row->id); $db->setQuery($query); $recd = $db->loadObjectList(); // Switch from recurring events to none recurring if (count($recd) > 1) { $query = $db->getQuery(true); $query->delete("#__matukio_recurring")->where("event_id = " . $row->id); $db->setQuery($query); $db->execute(); // Insert it ones MatukioHelperRecurring::saveRecurringDateForEvent($row); } elseif (count($recd) == 1) { // Ugly hack $recd = $recd[0]; $rect = JTable::getInstance('Recurring', 'MatukioTable'); $recd->semnum = $row->semnum; $recd->begin = $row->begin; $recd->end = $row->end; $recd->booked = $row->booked; $recd->published = $row->published; // We just update the date if (!$rect->bind($recd)) { throw new Exception($rect->getError(), 42); } if (!$rect->check()) { throw new Exception($rect->getError(), 42); } if (!$rect->store()) { throw new Exception($rect->getError(), 42); } } else { // Insert date into recurring table // Add recurring date MatukioHelperRecurring::saveRecurringDateForEvent($row); } } // Trigger plugin event $results = $dispatcher->trigger('onAfterSaveRecurring', $row); } // Ausgabe der Kurse $fehlerzahl = array_unique($fehler); if (count($fehlerzahl) > 1) { $fehler = array_unique($fehler); if ($fehler[0] == "") { $fehler = array_slice($fehler, 1); } $fehler = implode("<br />", $fehler); JFactory::getApplication()->enqueueMessage($fehler, 'Warning'); } // Notify Admin BCC of event creation if (MatukioHelperSettings::getSettings('sendmail_operator', '') != '' && $isNew && $speichern) { $mailer = JFactory::getMailer(); $mainframe = JFactory::getApplication(); $sender = $mainframe->getCfg('fromname'); $from = $mainframe->getCfg('mailfrom'); $user = JFactory::getUser($row->publisher); $replyname = $user->name; $replyto = $user->email; $subject = JText::_("COM_MATUKIO_NEW_EVENT_CREATED"); $body = JText::_("COM_MATUKIO_NEW_EVENT_CREATED") . "\n\n"; $body .= JText::_("COM_MATUKIO_EVENT_DETAILS") . ":\n\n"; $body .= JText::_("COM_MATUKIO_TITLE") . ":\t\t" . $row->title . "\n"; $body .= JText::_("COM_MATUKIO_RECURRING_SEMNUM") . ":\t\t" . $row->semnum . "\n"; $body .= JText::_("COM_MATUKIO_BEGIN") . ":\t\t" . $row->begin . "\n"; $body .= JText::_("COM_MATUKIO_END") . ":\t\t" . $row->end . "\n"; $body .= JText::_("COM_MATUKIO_EVENT_DEFAULT_PLACE") . ":\t\t" . $row->place . "\n"; $body .= JText::_("COM_MATUKIO_EVENT_DEFAULT_SHORT_DESCRIPTION") . ":\t\t" . $row->shortdesc . "\n"; $body .= JText::_("COM_MATUKIO_PUBLISHER") . ":\t\t" . $user->name . "\n"; $success = $mailer->sendMail($from, $sender, explode(",", MatukioHelperSettings::getSettings('sendmail_operator', '')), $subject, $body, MatukioHelperSettings::getSettings('email_html', 1), null, null, null, $replyto, $replyname); } // Send an notification email to all users with new event details @since 4.3.0 if (MatukioHelperSettings::getSettings('sendmail_newevent', 1) && $isNew && $speichern) { // We send an notification of the new event to all users / user group if (MatukioHelperSettings::_("sendmail_newevent_group", 0)) { // Filter users to the given group if not 0 (all) given jimport('joomla.access.access'); $ids = JAccess::getUsersByGroup(MatukioHelperSettings::_("sendmail_newevent_group", 0)); $query = "SELECT * FROM #__users WHERE block = 0 AND id IN (" . implode(",", $ids) . ")"; $db->setQuery($query); $users = $db->loadObjectList(); } else { // Get all users $query = "SELECT * FROM #__users WHERE block = 0"; $db->setQuery($query); $users = $db->loadObjectList(); } $mailer = JFactory::getMailer(); // Set an empty category here - TODO query it from #__category table $row->category = ""; $tmpl = MatukioHelperTemplates::getEmailBody("mail_newevent", $row, null); // Use HTML or text E-Mail if (MatukioHelperSettings::getSettings('email_html', 1)) { // Start html output $body = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' . "\n"; $body .= '<html xmlns="http://www.w3.org/1999/xhtml">' . "\n"; $body .= "<head>\n"; $body .= "</head>\n"; $body .= "<body>\n"; $body .= $tmpl->value; $body .= "</body>\n</html>"; } else { $body = $tmpl->value_text; } $subject = $tmpl->subject; $mainframe = JFactory::getApplication(); $sender = $mainframe->getCfg('fromname'); $from = $mainframe->getCfg('mailfrom'); // Loop and sent mail foreach ($users as $u) { $success = $mailer->sendMail($from, $sender, $u->email, $subject, $body, MatukioHelperSettings::getSettings('email_html', 1), null, null, null); $mailer->ClearAllRecipients(); } // E-Mail to Admin / Operator etc. if (MatukioHelperSettings::getSettings('sendmail_operator', '') != "") { $success = $mailer->sendMail($from, $sender, explode(",", MatukioHelperSettings::getSettings('sendmail_operator', '')), $subject, $body, MatukioHelperSettings::getSettings('email_html', 1), null, null, null); $mailer->ClearAllRecipients(); } } $obj = new StdClass(); $obj->id = $row->id; $obj->error = $row->fehler; $obj->error_count = count($fehlerzahl); $obj->saved = $speichern; $obj->event = $row; return $obj; }
/** * Rates an event * * @throws Exception if user is not logged in * @return void / redirect */ public function rate() { // Check if user is logged in if (JFactory::getUser()->id == 0) { throw new Exception("COM_MATUKIO_NO_ACCESS"); } $msg = JText::_("COM_MATUKIO_RATING_SUCCESSFULL"); $mainframe = JFactory::getApplication(); jimport('joomla.mail.helper'); $my = JFactory::getuser(); $database = JFactory::getDBO(); $cid = JFactory::getApplication()->input->getInt('cid', 0); $grade = JFactory::getApplication()->input->getInt('grade', 0); $text = JFactory::getApplication()->input->get('text', ''); $text = str_replace(array("\"", "\\'"), "", $text); $text = JMailHelper::cleanBody($text); $database->setQuery("UPDATE #__matukio_bookings SET grade='" . $grade . "', comment='" . $text . "' WHERE semid='" . $cid . "' AND userid='" . $my->id . "'"); if (!$database->execute()) { JError::raiseError(500, $database->getError()); exit; } $database->setQuery("SELECT * FROM #__matukio_bookings WHERE semid='" . $cid . "'"); $rows = $database->loadObjectList(); $zaehler = 0; $wertung = 0; foreach ($rows as $row) { if ($row->grade > 0) { $wertung = $wertung + $row->grade; $zaehler++; } } if ($zaehler > 0) { $geswert = round($wertung / $zaehler); } else { $geswert = 0; } $database->setQuery("UPDATE #__matukio SET grade='{$geswert}' WHERE id='{$cid}'"); if (!$database->execute()) { JError::raiseError(500, $database->getError()); $msg = "COM_MATUKIO_RATING_FAILED " . $database->getError(); } if (MatukioHelperSettings::getSettings('sendmail_owner', 1) > 0) { $database->setQuery("SELECT * FROM #__matukio_bookings WHERE semid='{$cid}' AND userid='{$my->id}'"); $buchung = $database->loadObject(); // Load event (use model function) $emodel = JModelLegacy::getInstance('Event', 'MatukioModel'); $row = $emodel->getItem($cid); $publisher = JFactory::getuser($row->publisher); $body = "\n<head>\n<style type=\"text/css\">\n<!--\nbody {\nfont-family: Verdana, Tahoma, Arial;\nfont-size:12pt;\n}\n-->\n</style></head><body>"; $body .= "<p><div style=\"font-size: 10pt\">" . JTEXT::_('COM_MATUKIO_RECEIVED_RATING') . "</div>"; $body .= "<p><div style=\"font-size: 10pt\">" . JTEXT::_('COM_MATUKIO_RATING') . ":</div>"; $htxt = str_replace('SEM_POINTS', $grade, JTEXT::_('COM_MATUKIO_SEM_POINTS_6')); $body .= "<div style=\"border: 1px solid #A0A0A0; width: 100%; padding: 5px;\">" . $htxt . "</div>"; $body .= "<p><div style=\"font-size: 10pt\">" . JTEXT::_('COM_MATUKIO_COMMENT') . ":</div>"; $body .= "<div style=\"border: 1px solid #A0A0A0; width: 100%; padding: 5px;\">" . htmlspecialchars($text) . "</div>"; $body .= "<p><div style=\"font-size: 10pt\">" . JTEXT::_('COM_MATUKIO_AVARAGE_SCORE') . ":</div>"; $htxt = str_replace('SEM_POINTS', $geswert, JTEXT::_('COM_MATUKIO_SEM_POINTS_6')); $body .= "<div style=\"border: 1px solid #A0A0A0; width: 100%; padding: 5px;\">" . $htxt . "</div>"; $body .= "<p>" . MatukioHelperUtilsEvents::getEmailBody($row, $buchung, $my); $sender = $mainframe->getCfg('fromname'); $from = $mainframe->getCfg('mailfrom'); $replyname = $my->name; $replyto = $my->email; $email = $publisher->email; $subject = JTEXT::_('COM_MATUKIO_EVENT'); if ($row->semnum != "") { $subject .= " " . $row->semnum; } $subject .= ": " . $row->title; $subject = JMailHelper::cleanSubject($subject); $mailer = JFactory::getMailer(); $mailer->sendMail($from, $sender, $email, $subject, $body, 1, null, null, null, $replyto, $replyname); } $link = "index.php?option=com_matukio&tmpl=component&s=" . MatukioHelperUtilsBasic::getRandomChar() . "&view=rateevent&cid=" . $cid; $this->setRedirect($link, $msg); }
} ?> <?php if (!$user->id > 0) { // User is not logged in, only show eventlist require dirname(__FILE__) . "/modern_eventlist.php"; } else { $params['useCookie'] = true; $params['startOffset'] = 0; $group = 'tabs'; echo JHtml::_('tabs.start', $group, $params); // Panel Eventlist echo JHtml::_('tabs.panel', JText::_('COM_MATUKIO_EVENTLIST'), 'eventlist'); require dirname(__FILE__) . "/modern_eventlist.php"; echo JHtml::_('tabs.panel', JText::_('COM_MATUKIO_MY_BOOKINGS'), 'mybookings'); require dirname(__FILE__) . "/modern_bookings.php"; if (JFactory::getUser()->authorise('core.edit.own', 'com_matukio') && MatukioHelperSettings::getSettings('frontend_ownereditevent', 1)) { echo JHtml::_('tabs.panel', JText::_('COM_MATUKIO_MY_OFFERS'), 'myoffers'); require dirname(__FILE__) . "/modern_offers.php"; } echo JHtml::_('tabs.end'); } ?> </form> <?php echo MatukioHelperUtilsBasic::getCopyright(); ?> </div> <!-- End Matukio by compojoom.com -->
$dots = array(JTEXT::_('COM_MATUKIO_NOT_EXCEEDED'), JTEXT::_('COM_MATUKIO_BOOKING_ON_WAITLIST'), JTEXT::_('COM_MATUKIO_UNBOOKABLE')); } elseif ($this->art == 1) { $dots = array(JTEXT::_('COM_MATUKIO_PARTICIPANT_ASSURED'), JTEXT::_('COM_MATUKIO_WAITLIST'), JTEXT::_('COM_MATUKIO_NO_SPACE_AVAILABLE')); } elseif ($this->art == 2) { $dots = array(JTEXT::_('COM_MATUKIO_EVENT_HAS_NOT_STARTED_YET'), JTEXT::_('COM_MATUKIO_EVENT_IS_RUNNING'), JTEXT::_('COM_MATUKIO_EVENT_HAS_ENDED')); } // --------------------------------------- // Farbbeschreibungen anzeigen // --------------------------------------- if (count($this->rows) > 0 and MatukioHelperSettings::getSettings('sem_hide_ampel', '') == 0 and MatukioHelperSettings::getSettings('event_statusgraphic', 2) > 0) { $html .= MatukioHelperUtilsEvents::getColorDescriptions($dots[0], $dots[1], $dots[2], $this->art); } // --------------------------------- // Anzeige Funktionsknoepfe unten // --------------------------------- if (MatukioHelperSettings::getSettings('event_buttonposition', 2) > 0) { $html .= MatukioHelperUtilsEvents::getTableHeader(4) . "<tr>" . MatukioHelperUtilsEvents::getTableCell($knopfunten, 'd', 'c', '100%', 'sem_nav_d') . "</tr>" . MatukioHelperUtilsEvents::getTableHeader('e'); } // --------------------------------------- // Ausgabe der unsichtbaren Formularfelder // --------------------------------------- foreach ($navioben1 as $el) { switch ($el) { case "SEM_NUMBER": $html .= "<input type=\"hidden\" name=\"limit\" value=\"" . $this->limit . "\">"; break; case "SEM_SEARCH": $html .= "<input type=\"hidden\" name=\"search\" value=\"" . $this->search . "\">"; break; case "SEM_CATEGORIES": $html .= "<input type=\"hidden\" name=\"catid\" value=\"" . $this->catid . "\">";
$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'; } $html = $dispatcher->trigger('onTP_GetHTML', array($vars)); if ($pg_plugin == 'paypal') { ?> <?php $t1 = JText::_('COM_MATUKIO_LEVEL_REDIRECTING_HEADER'); $t2 = JText::_('COM_MATUKIO_LEVEL_REDIRECTING_BODY'); ?> <h3><?php echo JText::_('COM_MATUKIO_LEVEL_REDIRECTING_HEADER');
/** * Displays the form * * @param string $tpl - The tmpl * * @return mixed|void */ public function display($tpl = null) { if (MatukioHelperSettings::getSettings('rss_feed', 1) == 0) { JError::raiseError(403, JText::_("ALERTNOTAUTH")); } $database = JFactory::getDBO(); $neudatum = MatukioHelperUtilsDate::getCurrentDate(); $where = array(); $database->setQuery("SELECT id, access FROM #__categories WHERE extension='" . JFactory::getApplication()->input->get('option') . "'"); $cats = $database->loadObjectList(); $allowedcat = array(); foreach ($cats as $cat) { if ($cat->access < 1) { $allowedcat[] = $cat->id; } } if (count($allowedcat) > 0) { $allowedcat = implode(',', $allowedcat); $where[] = "a.catid IN ({$allowedcat})"; } $where[] = "a.published = '1'"; $where[] = "a.end > '{$neudatum}'"; $where[] = "a.booked > '{$neudatum}'"; $database->setQuery("SELECT a.*, r.*, cat.title AS category FROM #__matukio_recurring AS r\r\n\t\t LEFT JOIN #__matukio AS a ON r.event_id = a.id\r\n\t\t LEFT JOIN #__categories AS cat ON cat.id = a.catid" . (count($where) ? "\nWHERE " . implode(' AND ', $where) : "") . "\nORDER BY r.begin ASC" . "\nLIMIT 0, 1000"); $rows = $database->loadObjectList(); $this->rows = $rows; parent::display($tpl); }