예제 #1
0
 /**
  * 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();
 }
예제 #2
0
 /**
  * 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);
 }
예제 #3
0
 /**
  * Saves the recurring date
  *
  * @param   bool  $frontend  - Are we in the frontend?
  *
  * @throws  Exception on db error
  * @return  string    - (id of the recurring date)
  */
 public static function saveRecurring($frontend = false)
 {
     $database = JFactory::getDBO();
     $input = JFactory::getApplication()->input;
     // 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');
     $id = $input->getInt('id', 0);
     $post = JRequest::get('post');
     $row = JTable::getInstance('Recurring', 'MatukioTable');
     $row->load($id);
     if (!$row->bind($post)) {
         throw new Exception($row->getError(), 42);
     }
     // 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);
     if (!$row->check()) {
         throw new Exception($database->stderr(), 42);
     }
     if (!$row->store()) {
         throw new Exception($database->stderr(), 42);
     }
     $row->checkin();
     // Return id
     return $row->id;
 }
예제 #4
0
 /**
  * Displays the form
  *
  * @param   string  $tpl  - The template
  *
  * @throws  Exception
  * @return  mixed|void
  */
 public function display($tpl = null)
 {
     $cid = JFactory::getApplication()->input->getInt('cid', 0);
     $user = JFactory::getUser();
     // Booking id!!
     $uid = JFactory::getApplication()->input->getInt('uid', 0);
     $uuid = JFactory::getApplication()->input->get('uuid', 0);
     if (empty($cid)) {
         throw new Exception(JText::_("COM_MATUKIO_NO_ID"), 404);
     }
     // Load event (use model function)
     $emodel = JModelLegacy::getInstance('Event', 'MatukioModel');
     $event = $emodel->getItem($cid);
     $booking = null;
     if (!empty($uuid)) {
         $model = JModelLegacy::getInstance('Booking', 'MatukioModel');
         $booking = $model->getBooking($uuid);
         if (empty($booking)) {
             throw new Exception(JText::_("COM_MATUKIO_NO_BOOKING_FOUND"), 404);
         }
         $uid = $booking->id;
     }
     // With Payment Step or without?
     $steps = 3;
     if (empty($event->fees)) {
         $steps = 2;
     }
     $fields_p1 = MatukioHelperUtilsBooking::getBookingFields(1);
     $fields_p2 = MatukioHelperUtilsBooking::getBookingFields(2);
     $fields_p3 = MatukioHelperUtilsBooking::getBookingFields(3);
     // MatukioHelperUtilsBasic::expandPathway(JTEXT::_('COM_MATUKIO_EVENTS'), JRoute::_("index.php?option=com_matukio&view=eventlist"));
     // Add event to breadcrumb :)
     MatukioHelperUtilsBasic::expandPathway(JTEXT::_($event->title), JRoute::_("index.php?option=com_matukio&view=event&id=" . $cid));
     MatukioHelperUtilsBasic::expandPathway(JTEXT::_('COM_MATUKIO_EVENT_BOOKING'), "");
     $dispatcher = JDispatcher::getInstance();
     JPluginHelper::importPlugin("payment");
     $gateways = $dispatcher->trigger('onTP_GetInfo', array(MatukioHelperPayment::$matukio_payment_plugins));
     $payment = array();
     foreach ($gateways as $gway) {
         $payment[] = array("name" => $gway->id, "title" => $gway->name);
     }
     if (empty($payment)) {
         // If no payment plugins enabled then set Steps to 2 :)
         $steps = 2;
     }
     $this->gateways = $gateways;
     $this->event = $event;
     $this->uid = $uid;
     $this->uuid = $uuid;
     $this->booking = $booking;
     $this->user = $user;
     $this->steps = $steps;
     $this->payment = $payment;
     $this->fields_p1 = $fields_p1;
     $this->fields_p2 = $fields_p2;
     $this->fields_p3 = $fields_p3;
     parent::display($tpl);
 }
예제 #5
0
 /**
  * Displays the form
  *
  * @param   bool  $cachable   - Is it cachable
  * @param   bool  $urlparams  - The url params
  *
  * @deprecated  Used for old links - should be moved some time
  * @return JControllerLegacy|void
  */
 public function display($cachable = false, $urlparams = false)
 {
     $task = JFactory::getApplication()->input->get('task', '');
     if (empty($task)) {
         MatukioHelperUtilsBasic::loginUser();
         $link = JRoute::_("index.php?option=com_matukio&view=eventlist");
         $this->setRedirect($link);
     }
 }
예제 #6
0
 /**
  * Gets the backend print window (sem_f038)
  *
  * @param   int  $art  - The art
  * @param   int  $cid  - The cid
  * @param   int  $uid  - The uid
  *
  * @todo    fix and update
  * @return  string
  */
 public static function getBackendPrintWindow($art, $cid, $uid = 0)
 {
     $search = trim(strtolower(JFactory::getApplication()->input->get('search', '', 'string')));
     $limit = trim(JFactory::getApplication()->input->getInt('limit', 5));
     $limitstart = trim(JFactory::getApplication()->input->getInt('limitstart', 0));
     if (empty($uid)) {
         $uid = trim(JFactory::getApplication()->input->get('uid', 0));
     }
     $href = JURI::ROOT() . "index.php?tmpl=component&s=" . 0 . "&option=" . JFactory::getApplication()->input->get('option') . "&view=printeventlist&search=" . $search . "&limit=" . $limit . "&limitstart=" . $limitstart . "&cid=" . $cid . "&uid=" . $uid . "&todo=";
     $x = 550;
     $y = 300;
     $image = "1932";
     $title = JTEXT::_('COM_MATUKIO_PRINT');
     switch ($art) {
         case 1:
             // Art 36
             $href .= "print_eventlist";
             break;
         case 2:
             // Teilnehmerliste - 34
             $href .= "print_teilnehmerliste&art=1&cid=" . $cid;
             $image = "1932";
             $title = JTEXT::_('COM_MATUKIO_PRINT_SIGNATURE_LIST');
             break;
         case 3:
             $href .= "certificate&cid=" . $cid;
             $image = "2900";
             $title = JTEXT::_('COM_MATUKIO_PRINT_CERTIFICATE');
             break;
         case 4:
             // Unterschriftliste
             $href .= "print_teilnehmerliste&cid=" . $cid;
             $image = "2032";
             $title = JTEXT::_('COM_MATUKIO_PRINT_PARTICIPANTS_LIST');
             break;
         case 5:
             $href = JURI::ROOT() . "index.php?option=com_matukio&view=printeventlist&format=raw&todo=csvlist&cid=" . $cid;
             $image = "1632";
             $title = JTEXT::_('COM_MATUKIO_DOWNLOAD_CSV_FILE');
             break;
         case 6:
             // Invoice
             $href = JURI::ROOT() . "index.php?option=com_matukio&view=printeventlist&format=raw&todo=invoice&cid=" . $cid . "&uid=" . $uid;
             $image = "invoice";
             $title = JTEXT::_('COM_MATUKIO_PRINT_INVOICE');
             break;
     }
     if ($art != 5 && $art != 6) {
         $html = "<a title=\"" . $title . "\" class=\"modal cjmodal\" href=\"" . $href . "\" rel=\"{handler: 'iframe', size: {x: " . $x . ", y: " . $y . "}}\">";
     } else {
         $html = "<a title=\"" . $title . "\" href=\"" . $href . "\">";
     }
     $html .= "<img src=\"" . MatukioHelperUtilsBasic::getComponentImagePath() . $image . ".png\" border=\"0\" valign=\"absmiddle\" alt=\"" . $title . "\" /></a>";
     return $html;
 }
 /**
  * Displays the payment form
  *
  * @param   bool  $cachable   - Is the site cachable (we ignore that)
  * @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', 'PaymentForm');
     $viewType = $document->getType();
     $view = $this->getView($viewName, $viewType);
     $model = $this->getModel('PaymentForm', 'MatukioModel');
     $view->setModel($model, true);
     $view->display();
 }
예제 #8
0
 /**
  * Returns an barchart
  *
  * @param   int  $done  - Is the loading done
  *
  * @return  string
  */
 public static function getProcentBarchart($done)
 {
     $max = 100;
     if ($done < 0) {
         $done = 0;
     }
     if ($done > $max) {
         $done = $max;
     }
     $displayValue = $done / $max * 100;
     $displayValue = number_format($displayValue, 0, '.', '');
     return "<span style=\"white-space: nowrap;\">\n\t\t<img src=\"" . MatukioHelperUtilsBasic::getComponentImagePath() . "3000.png\" width=\"" . $displayValue . "\" style=\"height: 10px\" />\n\t\t<img src=\"" . MatukioHelperUtilsBasic::getComponentImagePath() . "3001.png\" width=\"" . (100 - $displayValue) . "\" style=\"height: 10px\" /></span>";
 }
예제 #9
0
 public function display($tpl = NULL)
 {
     $booking_id = JFactory::getApplication()->input->get('booking_id', 0);
     $user = JFactory::getUser();
     $model = $this->getModel();
     $return = JFactory::getApplication()->input->get('return', 0);
     if (empty($booking_id)) {
         JError::raiseError('404', "COM_MATUKIO_NO_ID");
         return;
     }
     $booking = $model->getBooking($booking_id);
     $event = $model->getEvent($booking->semid);
     if ($return != 1) {
         $dispatcher = JDispatcher::getInstance();
         $results = $dispatcher->trigger('onAfterPaidBooking', $booking, $event);
     }
     MatukioHelperUtilsBasic::expandPathway(JTEXT::_('COM_MATUKIO_EVENTS'), JRoute::_("index.php?option=com_matukio"));
     MatukioHelperUtilsBasic::expandPathway(JTEXT::_('COM_MATUKIO_EVENT_PAYPAL_PAYMENT'), "");
     $this->event = $event;
     $this->user = $user;
     $this->booking = $booking;
     parent::display($tpl);
 }
예제 #10
0
 /**
  * Displays the form
  *
  * @param null $tpl
  *
  * @return mixed|void
  */
 public function display($tpl = null)
 {
     $catid = JFactory::getApplication()->input->get('catid', array(), '', 'array');
     $user = JFactory::getUser();
     $ue_title = "COM_MATUKIO_UPCOMING_EVENTS";
     $dispatcher = JDispatcher::getInstance();
     $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($catid)) {
         $catid = $params->get('catid', 0);
     }
     $ue_title = $params->get('title', 'COM_MATUKIO_UPCOMING_EVENTS');
     $number = $params->get('number', 10);
     $orderby = $params->get('orderby', 'begin ASC');
     $model = $this->getModel();
     $events = $model->getEvents($catid, $number, $orderby);
     MatukioHelperUtilsBasic::expandPathway(JTEXT::_('COM_MATUKIO_UPCOMING_EVENTS'), "");
     JPluginHelper::importPlugin('content');
     foreach ($events as $key => $event) {
         $events[$key]->jevent = new stdClass();
         $results = $dispatcher->trigger('onContentAfterButton', array('com_matukio.upcomingevent', &$event, &$params, 0));
         $events[$key]->jevent->afterDisplayButton = trim(implode("\n", $results));
         $results = $dispatcher->trigger('onContentAfterDisplay', array('com_matukio.upcomingevent', &$event, &$params, 0));
         $events[$key]->jevent->afterDisplayContent = trim(implode("\n", $results));
     }
     $this->catid = $catid;
     $this->events = $events;
     $this->user = $user;
     $this->title = $ue_title;
     parent::display($tpl);
 }
 /**
  * Sends an email to the organizer
  *
  * @throws  exception
  * @return  object
  */
 public function sendEmail()
 {
     $mainframe = JFactory::getApplication();
     $msg = JText::_("COM_MATUKIO_MAIL_TO_ORGANIZER_SEND_SUCCESSFULL");
     $msg_type = "message";
     jimport('joomla.mail.helper');
     // Check if sending is allowed
     if (!MatukioHelperSettings::getSettings("sendmail_contact", 1)) {
         throw new Exception("COM_MATUKIO_CONTACTING_ORGANIZERS_IS_DISABLED");
     }
     $my = JFactory::getuser();
     $database = JFactory::getDBO();
     $cid = JFactory::getApplication()->input->getInt('event_id', 0);
     $organizer_id = JFactory::getApplication()->input->getInt('organizer_id', 0);
     $uid = JFactory::getApplication()->input->get('art', 0);
     $text = JMailHelper::cleanBody(nl2br(JFactory::getApplication()->input->get('text', '', 'string')));
     $name = JFactory::getApplication()->input->get('name', '', 'string');
     $email = JFactory::getApplication()->input->get('email', '', 'string');
     if ($text != "" && $name != "" && $email != "") {
         $reason = JTEXT::_('COM_MATUKIO_MESSAGE_SEND');
         // Load event (use model function)
         $emodel = JModelLegacy::getInstance('Event', 'MatukioModel');
         $event = $emodel->getItem($cid);
         $subject = "";
         if ($event->semnum != "") {
             $subject .= " " . $event->semnum;
         }
         $subject .= ": " . $event->title;
         $subject = JMailHelper::cleanSubject($subject);
         $sender = $mainframe->getCfg('fromname');
         $from = $mainframe->getCfg('mailfrom');
         if ($my->id == 0) {
             $replyname = $name;
             $replyto = $email;
             // Setting it hardcoded for the body function.. dirk you really give me headaches
             $my->name = $name;
             $my->email = $email;
         } else {
             $replyname = $my->name;
             $replyto = $my->email;
         }
         $body = "\n<head>\n<style type=\"text/css\">\n<!--\nbody {\nfont-family: Verdana, Tahoma, Arial;\nfont-size:12pt;\n}\n-->\n</style></head><body>";
         if ($uid == 1 and $my->id != 0) {
             $body .= "<p><div style=\"font-size: 10pt\">" . JTEXT::_('COM_MATUKIO_QUESTION_ABOUT_EVENT') . "</div><p>";
         }
         $body .= "<div style=\"border: 1px solid #A0A0A0; width: 100%; padding: 5px;\">" . $text . "</div><p>";
         $temp = array();
         // Mail to Organizer
         if ($uid == 1) {
             $body .= MatukioHelperUtilsEvents::getEmailBody($event, $temp, $my);
             $publisher = JFactory::getUser($event->publisher);
             $email = $publisher->email;
             $mailer = JFactory::getMailer();
             $mailer->sendMail($from, $sender, $email, $subject, $body, 1, null, null, null, $replyto, $replyname);
         } elseif ($uid == "organizer") {
             $organizer = MatukioHelperOrganizer::getOrganizerId($organizer_id);
             $publisher = JFactory::getuser($organizer->userId);
             $email = $publisher->email;
             $mailer = JFactory::getMailer();
             $mailer->sendMail($from, $sender, $email, $subject, $body, 1, null, null, null, $replyto, $replyname);
         } else {
             if (!JFactory::getUser()->authorise('core.create', 'com_matukio')) {
                 return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR'));
             }
             $database->setQuery("SELECT * FROM #__matukio_bookings WHERE semid='" . $event->id . "'");
             $rows = $database->loadObjectList();
             foreach ($rows as $row) {
                 if ($row->userid == 0) {
                     $user = JFactory::getUser(0);
                     $user->email = $row->email;
                     $user->name = $row->name;
                 } else {
                     $user = JFactory::getUser($row->userid);
                 }
                 $text = $body . MatukioHelperUtilsEvents::getEmailBody($event, $row, $user);
                 $mailer = JFactory::getMailer();
                 $mailer->sendMail($from, $sender, $user->email, $subject, $text, 1, null, null, null, $replyto, $replyname);
             }
         }
     } else {
         $msg = JTEXT::_('COM_MATUKIO_MESSAGE_NOT_SEND');
         $msg_type = "error";
     }
     $link = MatukioHelperUtilsBasic::getSitePath() . "index.php?tmpl=component&s=" . MatukioHelperUtilsBasic::getRandomChar() . "&option=" . JFactory::getApplication()->input->get('option') . "&view=contactorganizer&cid=" . $cid . "&art=" . $uid . "&task=19";
     $this->setRedirect($link, $msg, $msg_type);
 }
예제 #12
0
<?php

/**
 * @package    Matukio
 * @author     Yves Hoppe <*****@*****.**>
 * @date       03.04.13
 *
 * @copyright  Copyright (C) 2008 - 2014 Yves Hoppe - compojoom.com . All rights reserved.
 * @license    GNU General Public License version 2 or later; see LICENSE
 */
defined('_JEXEC') or die('Restricted access');
JHTML::_('stylesheet', 'media/mod_calendar_upcoming/tmpl/default/css/tmpl.css');
MatukioHelperUtilsBasic::bootstrap(true);
JHTML::_('stylesheet', 'media/com_matukio/css/matukio.css');
JHTML::_('stylesheet', 'media/com_matukio/css/fullcalendar.css');
JHTML::_('script', 'media/com_matukio/js/fullcalendar.min.js');
?>
<!-- Start Matukio by compojoom.com -->
<script type="text/javascript">
	jQuery( document ).ready(function( $ ) {
		$("#mmat_calendar_holder_<?php 
echo $module->id;
?>
").fullCalendar({
			header: {
				left: 'prev,next today',
				center: 'title',
				right: 'month,agendaWeek,agendaDay'
			},
			titleFormat: {
				month: '<?php 
예제 #13
0
 /**
  * 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);
     }
 }
예제 #14
0
 /**
  * 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 
// Buttons
?>
<div class="mat_buttons">
	<div class="mat_buttons_inner">
		<?php 
// Print Button
echo MatukioHelperUtilsEvents::getPrintWindow(2 + 2, '', '', 'b');
?>

		<?php 
/* New event button */
if (JFactory::getUser()->authorise('core.create', 'com_matukio')) {
    ?>
			<a href="<?php 
    echo JRoute::_("index.php?option=com_matukio&view=createevent");
    ?>
"><span class="mat_button"
			                                                                                          style="cursor:pointer;"><?php 
    echo JHTML::_('image', MatukioHelperUtilsBasic::getComponentImagePath() . '1816.png', null, array('border' => '0', 'align' => 'absmiddle'));
    ?>
					<?php 
    echo JTEXT::_('COM_MATUKIO_NEW_EVENT');
    ?>
</span></a>
		<?php 
}
?>
	</div>
</div>
예제 #16
0
            $disc_text = "";
            $fval = MatukioHelperUtilsEvents::getFormatedCurrency($fval, MatukioHelperSettings::getSettings('currency_symbol', '$'));
        } else {
            if (!$f->percent) {
                $fval = MatukioHelperUtilsEvents::getFormatedCurrency($f->value, MatukioHelperSettings::getSettings('currency_symbol', '$'));
            } else {
                $fval = $f->value . " %";
            }
        }
        echo '<option value="' . $f->id . '" discvalue="' . $f->value . '" percent="' . $f->percent . '" discount="' . $f->discount . '">' . JText::_($f->title) . ' (' . $disc_text . $fval . ")" . '</option>';
    }
    echo '</select>';
    echo '</td>';
    echo '<td style="text-align: right;">';
    // Add additional tickets in another category!
    echo " <a id=\"delticket" . $num . "\" border=\"0\" num=\"" . $num . "\" class=\"btn btn-danger\"><span type=\"button\">" . "<img src=\"" . MatukioHelperUtilsBasic::getComponentImagePath() . "1532.png\" border=\"0\" align=\"absmiddle\" style=\"width: 16px; height: 16px; margin-right: 8px;\" />" . JTEXT::_('COM_MATUKIO_REMOVE') . "</span></a>";
    echo '</td>';
    echo '</tr>';
    echo "</table>";
    if ($backend) {
        echo '<script type="text/javascript">';
        echo 'jQuery( document ).ready(function( $ ) {
				$("#delticket' . $num . '").click(function(){
					$("#tickets_' . $num . '").remove();
				});
			});';
        echo '</script>';
    }
} elseif ($task == 'get_total_different') {
    $total = 0.0;
    $nrbooked = $input->getInt('nrbooked', 1);
예제 #17
0
 /**
  * Gets the calendar button
  *
  * @param   object  $event     - THe event
  * @param   string  $template  - The template
  *
  * @return  string
  */
 public static function getCalendarButton($event, $template = "modern")
 {
     $config = JFactory::getConfig();
     $_suffix = $config->get('sef_suffix');
     if ($_suffix == 0) {
         // No .html suffix
         $icslink = JRoute::_("index.php?option=com_matukio&tmpl=component&view=ics&format=raw&cid=" . $event->id);
     } else {
         $icslink = JURI::ROOT() . "index.php?tmpl=component&option=com_matukio&view=ics&format=raw&cid=" . $event->id;
     }
     $btn_class = "mat_button";
     if ($template == "bootstrap") {
         $btn_class = "btn";
     }
     $img = "<img src=\"" . MatukioHelperUtilsBasic::getComponentImagePath() . "3316.png\" border=\"0\" align=\"absmiddle\">&nbsp;";
     if ($template == "bootstrap") {
         $img = "";
     }
     return " <a title=\"" . JTEXT::_('COM_MATUKIO_DOWNLOAD_CALENDER_FILE') . "\" href=\"" . $icslink . "\" target=\"_BLANK\">" . "<span class=\"" . $btn_class . "\">" . $img . JTEXT::_('COM_MATUKIO_DOWNLOAD_CALENDER_FILE') . "</span></a> ";
 }
            </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>
		<?php 
}
?>

		<?php 
// Print Button
echo MatukioHelperUtilsEvents::getPrintWindow(0 + 2, '', '', 'b');
?>
	</div>
예제 #19
0
 /**
  * Gets the upcoming events
  *
  * @param   object  $events  - The events
  * @param   object  $user    - The user
  *
  * @return  string - The html code
  */
 public static function getUpcomingEventsHTML($events, $user)
 {
     JHTML::_('stylesheet', 'media/com_matukio/css/upcoming.css');
     $html = "";
     if (count($events)) {
         $dispatcher = JDispatcher::getInstance();
         JPluginHelper::importPlugin('content');
         $params = JComponentHelper::getParams('com_matukio');
         foreach ($events as $event) {
             $buchopt = MatukioHelperUtilsEvents::getEventBookableArray(0, $event, $user->id);
             // Link
             $eventid_l = $event->id . ':' . JFilterOutput::stringURLSafe($event->title);
             $catid_l = $event->catid . ':' . JFilterOutput::stringURLSafe(MatukioHelperCategories::getCategoryAlias($event->catid));
             $link = JRoute::_(MatukioHelperRoute::getEventRoute($eventid_l, $catid_l), false);
             // Event image   -- TODO Add / Check for category image
             $linksbild = MatukioHelperUtilsBasic::getComponentImagePath() . "2601.png";
             if ($event->image != "" and MatukioHelperSettings::getSettings('event_image', 1) == 1) {
                 $linksbild = MatukioHelperUtilsBasic::getEventImagePath(1) . $event->image;
             }
             $hot = $event->hot_event ? " " : "";
             $top = $event->top_event ? " mat_top_event" : "";
             // Starting Row
             $html .= '<div class="mat_single_event' . $hot . $top . '">';
             $html .= '	<div class="mat_event_header">';
             $html .= '		<div class="mat_event_header_inner">';
             $html .= '			<div class="mat_event_header_line">';
             $html .= '				<div class="mat_event_image">';
             $html .= '					<img src="' . $linksbild . '" alt="' . $event->title . '" align="absmiddle" />';
             $html .= '				</div>';
             $html .= '				<div class="mat_event_title">';
             $html .= '					<h2><a href="' . $link . '" title="' . $event->title . '">' . $event->title . '</a></h2>';
             $html .= '				</div>';
             $html .= '			</div>';
             $html .= '			<div class="mat_event_location">';
             $begin = JHTML::_('date', $event->begin, MatukioHelperSettings::getSettings('date_format', 'd-m-Y, H:i'));
             $location = $event->place;
             $locobj = null;
             if ($event->place_id > 0) {
                 $locobj = MatukioHelperUtilsEvents::getLocation($event->place_id);
                 $placelink = JRoute::_("index.php?option=com_matukio&view=location&id=" . $locobj->id . ":" . JFilterOutput::stringURLSafe($locobj->title));
                 $location = '<a href="' . $placelink . '">' . $locobj->location . '</a>';
             }
             if (MatukioHelperSettings::getSettings('show_timezone', '1')) {
                 $begin .= " (GMT " . JHTML::_('date', $event->booked, 'P') . ")";
             }
             if ($event->webinar == 1) {
                 $locimg = MatukioHelperUtilsBasic::getComponentImagePath() . "webinar.png";
                 $html .= '<h4><img src="' . $locimg . '" title="' . JText::_("COM_MATUKIO_WEBINAR") . '" style="width: 22px; vertical-align:middle" /> ' . $location . " " . JText::_("COM_MATUKIO_AT") . " " . $begin . '</h4>';
             } else {
                 // TODO add map link
                 $locimg = MatukioHelperUtilsBasic::getComponentImagePath() . "home.png";
                 $html .= '<h4><img src="' . $locimg . '" title="' . JText::_("COM_MATUKIO_FIELDS_CITY") . '" style="width: 22px; vertical-align:middle" /> ' . $location . " " . JText::_("COM_MATUKIO_AT") . " " . $begin . '</h4>';
             }
             $html .= '			</div>';
             $html .= '		</div>';
             $html .= '	</div>';
             $html .= '	<div class="mat_event_description">';
             $html .= $event->shortdesc;
             $html .= '</div>';
             $html .= '	<div class="mat_event_footer">';
             $html .= '		<div class="mat_event_footer_inner">';
             $html .= '			<div class="mat_event_infoline">';
             $catlink = JRoute::_("index.php?option=com_matukio&view=eventlist&art=0&catid=" . $event->catid . ":" . JFilterOutput::stringURLSafe($event->category));
             $html .= '<a href="' . $catlink . '">' . JTEXT::_($event->category) . '</a>';
             // Infoline
             $gebucht = MatukioHelperUtilsEvents::calculateBookedPlaces($event);
             if (MatukioHelperSettings::getSettings('event_showinfoline', 1) == 1) {
                 $html .= " | ";
                 // Veranstaltungsnummer anzeigen
                 if ($event->semnum != "") {
                     $html .= JTEXT::_('COM_MATUKIO_NUMBER') . ": " . $event->semnum . " | ";
                 }
                 $html .= JTEXT::_('COM_MATUKIO_BOOKABLE') . ": " . $buchopt[4];
             }
             // Seminarleiter anzeigen
             if ($event->teacher != "") {
                 $html .= " | " . $event->teacher;
             }
             // Fees
             if ($event->fees > 0) {
                 $html .= " | ";
                 $gebuehr = MatukioHelperUtilsEvents::getFormatedCurrency($event->fees);
                 $currency = MatukioHelperSettings::getSettings('currency_symbol', '$');
                 if ($currency == '€') {
                     $html .= JTEXT::_('COM_MATUKIO_FEES') . ': ' . $gebuehr . " " . $currency;
                 } else {
                     $html .= JTEXT::_('COM_MATUKIO_FEES') . ': ' . $currency . " " . $gebuehr;
                 }
             }
             $html .= '</div>';
             $html .= '			<div class="mat_event_footer_buttons" align="right">';
             // Detail Link
             $html .= " <a title=\"" . $event->title . "\" href=\"" . $link . "\">" . "<span class=\"mat_button\"><img src=\"" . MatukioHelperUtilsBasic::getComponentImagePath() . "0012.png\" border=\"0\" align=\"absmiddle\">&nbsp;" . JTEXT::_('COM_MATUKIO_EVENT_DETAILS') . "</span></a> ";
             // Booking Link
             if (($user->id != 0 || MatukioHelperSettings::getSettings('booking_unregistered', 1) == 1) && MatukioHelperSettings::getSettings('oldbookingform', 0) != 1) {
                 if ($event->nrbooked > 0) {
                     $bookinglink = JRoute::_("index.php?option=com_matukio&view=bookevent&cid=" . $event->id . ":" . JFilterOutput::stringURLSafe($event->title));
                     $html .= " <a title=\"" . JTEXT::_('COM_MATUKIO_BOOK') . "\" href=\"" . $bookinglink . "\"><span class=\"mat_button mat_book\" type=\"button\"><img src=\"" . MatukioHelperUtilsBasic::getComponentImagePath() . "1116.png\" border=\"0\" align=\"absmiddle\">&nbsp;" . JTEXT::_('COM_MATUKIO_BOOK') . "</span></a>";
                 }
             }
             $html .= '				<br />';
             $results = $dispatcher->trigger('onContentAfterButton', array('com_matukio.upcomingevent', &$event, &$params, 0));
             $html .= trim(implode("\n", $results));
             $html .= '			</div>';
             $html .= '		</div>';
             $html .= '	</div>';
             $html .= ' </div>';
         }
     }
     return $html;
 }
예제 #20
0
 /**
  * $cattable->id = null;
  * $cattable->asset_id = 0;
  * $cattable->parent_id = 0;
  * $cattable->lft = 0;
  * $cattable->rgt = 0;
  * $cattable->level = 1;
  * $cattable->path = "test";
  * $cattable->extension = "com_matukio";
  * $cattable->title = "";
  * $cattable->alias = "";
  * $cattable->note = "";
  * $cattable->description = "";
  * $cattable->published = "";
  * $cattable->checked_out = 0;
  * $cattable->checked_out_time = "0000-00-00 00:00:00";
  * $cattable->access = "";
  * $cattable->params = "";
  *
  * $cattable->metadesc = "";
  * $cattable->metakey = "";
  * $cattable->metadata = "";
  * $cattable->created_user_id = "";
  * $cattable->created_time = "";
  * $cattable->modified_user_id = "";
  * $cattable->hits = "";
  * $cattable->language = "";
  */
 public function importseminar()
 {
     $input = JFactory::getApplication()->input;
     $db = JFactory::getDbo();
     $seminar_table = $input->get('seminar_table', '');
     $seminar_category_table = $input->get('seminar_category_table', '');
     $seminar_booking_table = $input->get('seminar_booking_table', '');
     $seminar_number_table = $input->get('seminar_number_table', '');
     // Load old categories
     $query = $db->getQuery(true);
     $query->select("*")->from($seminar_category_table)->where("section = " . $db->quote("com_seminar"));
     $db->setQuery($query);
     $cats = $db->loadObjectList();
     $insert_id = null;
     $relationsDb = array();
     $user = JFactory::getUser();
     $i = 0;
     $table = JTable::getInstance('Category', 'JTable');
     $dispatcher = JDispatcher::getInstance();
     JPluginHelper::importPlugin('content');
     foreach ($cats as $cat) {
         // Import category into Joomla 2.5 #__categories table
         $old_id = $cat->id;
         $cat->name = html_entity_decode($cat->title);
         $cat->path = $cat->name;
         $cat->alias = $cat->alias;
         $cat->parent = 1;
         $cat->author = $user->id;
         $new_id = $this->insertCategory($cat);
         if ($new_id == -1) {
             break;
         }
         $dispatcher->trigger('onContentAfterSave', array('com_content.category.' . $insert_id, &$table, true));
         $relationsDb[] = $db->quote($new_id) . ',' . $i . ',' . $old_id;
         // Get the events for the category
         $query = $db->getQuery(true);
         $query->select("*")->from($seminar_table)->where("catid = " . $old_id);
         $db->setQuery($query);
         $events = $db->loadObjectList();
         foreach ($events as $event) {
             $mattab = JTable::getInstance('Matukio', 'Table');
             $old_event_id = $event->id;
             // Reset event id
             $event->id = null;
             $event->created_by = $user->id;
             $event->catid = $new_id;
             if (!$mattab->bind($event)) {
                 JError::raiseError(500, $mattab->getError());
             }
             // Zuweisung der Startzeit
             $mattab->begin = JFactory::getDate($event->begin, MatukioHelperUtilsBasic::getTimeZone())->format('Y-m-d H:i:s', false, false);
             // Zuweisung der Endzeit
             $mattab->end = JFactory::getDate($event->end, MatukioHelperUtilsBasic::getTimeZone())->format('Y-m-d H:i:s', false, false);
             // Zuweisung der Buchungszeit
             $mattab->booked = JFactory::getDate($event->booked, MatukioHelperUtilsBasic::getTimeZone())->format('Y-m-d H:i:s', false, false);
             if (!$mattab->check()) {
                 JError::raiseError(500, $db->stderr());
             }
             if (!$mattab->store()) {
                 JError::raiseError(500, $db->stderr());
             }
             $mattab->checkin();
             // Add recurring event date
             $rid = MatukioHelperRecurring::saveRecurringDateForEvent($mattab);
             // Get the event bookings for this event
             $query = $db->getQuery(true);
             $query->select("*")->from($seminar_booking_table)->where("semid = " . $old_event_id);
             $db->setQuery($query);
             $bookings = $db->loadObjectList();
             foreach ($bookings as $booking) {
                 // Reset
                 $booking->id = null;
                 // Update 3.1 - we need the recurring id not the event id
                 $booking->semid = $rid;
                 $booking->uuid = MatukioHelperPayment::getUuid(true);
                 // Calculating payment
                 $booking->payment_brutto = $mattab->fees * $booking->nrbooked;
                 // No taxes here -> user is goign to add them later
                 $booking->payment_netto = $booking->payment_brutto;
                 $booking->payment_tax = 0.0;
                 $booktable = JTable::getInstance('Bookings', 'Table');
                 if (!$booktable->bind($booking)) {
                     JError::raiseError(500, $booktable->getError());
                 }
                 if (!$booktable->check()) {
                     JError::raiseError(500, $db->stderr());
                 }
                 if (!$booktable->store()) {
                     JError::raiseError(500, $db->stderr());
                 }
             }
         }
         $i++;
     }
     // Import Numbers
     $query = $db->getQuery(true);
     $query->select("*")->from($seminar_number_table);
     $db->setQuery($query);
     $numbers = $db->loadObjectList();
     foreach ($numbers as $number) {
         $numtable = JTable::getInstance("Number", "Table");
         if (!$numtable->bind($number)) {
             JError::raiseError(500, $numtable->getError());
         }
         if (!$numtable->check()) {
             JError::raiseError(500, $db->stderr());
         }
         if (!$numtable->store()) {
             JError::raiseError(500, $db->stderr());
         }
     }
     $msg = JText::_("COM_MATUKIO_IMPORT_SUCCESSFULLY");
     $link = 'index.php?option=com_matukio&view=import';
     $this->setRedirect($link, $msg);
 }
예제 #21
0
 /**
  * Displays the event form
  *
  * @param   string  $tpl  - The template
  *
  * @throws  Exception
  * @return  void
  */
 public function display($tpl = null)
 {
     $input = JFactory::getApplication()->input;
     $model = $this->getModel();
     $art = $input->getInt('art', 0);
     $database = JFactory::getDBO();
     $dateid = $input->getInt('dateid', 1);
     // Event id
     $cid = $input->getInt('id', 0);
     // Booking id!!
     $uid = $input->getInt('uid', 0);
     $uuid = $input->get('uuid', '');
     $dispatcher = JDispatcher::getInstance();
     $booking = "";
     $user = JFactory::getUser();
     if ($art == 1) {
         // Updated 2.2.4 to show the cancel booking button if logged in!
         $booking = MatukioHelperUtilsBooking::getBooking($uid, $cid);
     }
     // Fix if uid / booking not found or booking as not registered user
     if (empty($booking)) {
         $art = 0;
     }
     // Category id
     $catid = $input->getInt('catid', 0);
     $search = $input->get('search', '', 'string');
     $limit = $input->getInt('limit', 5);
     // TODO Pagination should be updated to Joomla Framework
     $limitstart = $input->getInt('limitstart', 0);
     $params = JComponentHelper::getParams('com_matukio');
     $menuitemid = $input->get('Itemid');
     if ($menuitemid) {
         $site = new JSite();
         $menu = $site->getMenu();
         $menuparams = $menu->getParams($menuitemid);
         $params->merge($menuparams);
     }
     $menu_cid = $params->get('eventId', 0);
     if (empty($cid)) {
         if (empty($menu_cid)) {
             JError::raiseError('404', JTEXT::_("COM_MATUKIO_NO_ID"));
         } else {
             $cid = $menu_cid;
         }
     }
     $row = $model->getItem($cid, true);
     if ($art == 3) {
         if ($uid > 0) {
             $database->setQuery("SELECT * FROM #__matukio_bookings WHERE id='" . $uid . "'");
             $temp = $database->loadObjectList();
             $userid = $temp[0]->userid;
             if ($userid == 0) {
                 $uid = $uid * -1;
             } else {
                 $uid = $userid;
             }
         }
     } else {
         if ($uid > 0) {
             $database->setQuery("SELECT * FROM #__matukio_bookings WHERE id='{$uid}'");
             $temp = $database->loadObjectList();
             if ($temp[0]->userid != 0 || $art != 1) {
                 $uid = $temp[0]->userid;
             } else {
                 $uid = $uid * -1;
             }
         }
     }
     if ($art == 0) {
         // Hits erhoehen
         $database->setQuery("UPDATE #__matukio_recurring SET hits=hits+1 WHERE id='{$cid}'");
         if (!$database->execute()) {
             throw new Exception("COM_MATUKIO_ERROR_ADDING_HIT" . ":" . $row->getError());
         }
         // Ausgabe des Kurses
         // MatukioHelperUtilsBasic::expandPathway(JTEXT::_('COM_MATUKIO_EVENTS'), JRoute::_("index.php?option=com_matukio"));
     } elseif ($art == 1 or $art == 2) {
         if ($user->id > 0) {
             MatukioHelperUtilsBasic::expandPathway(JTEXT::_('COM_MATUKIO_MY_BOOKINGS'), JRoute::_("index.php?option=com_matukio&view=eventlist&art=1"));
         }
     } else {
         MatukioHelperUtilsBasic::expandPathway(JTEXT::_('COM_MATUKIO_MY_OFFERS'), JRoute::_("index.php?option=com_matukio&view=eventlist&art=2"));
     }
     // Add category link to breadcrumb
     MatukioHelperUtilsBasic::expandPathway($row->category, JRoute::_("index.php?option=com_matukio&view=eventlist&art=" . $art . "&catid=" . $row->catid . ":" . JFilterOutput::stringURLSafe($row->category)));
     // Add event to breadcrumb
     MatukioHelperUtilsBasic::expandPathway($row->title, "");
     $ueberschrift = array(JTEXT::_('COM_MATUKIO_DESCRIPTION'), $row->shortdesc);
     if (empty($row)) {
         JError::raiseError('404', JTEXT::_("COM_MATUKIO_NO_ID"));
         return;
     }
     $locobj = null;
     if ($row->place_id > 0) {
         $locobj = MatukioHelperUtilsEvents::getLocation($row->place_id);
     }
     $title = JFactory::getDocument()->getTitle();
     JFactory::getDocument()->setTitle($title . " - " . JText::_($row->title));
     JPluginHelper::importPlugin('content');
     $this->jevent = new stdClass();
     $results = $dispatcher->trigger('onContentAfterDisplay', array('com_matukio.event', &$row, &$params, 0));
     $this->jevent->afterDisplayContent = trim(implode("\n", $results));
     $this->id = $cid;
     $this->art = $art;
     $this->event = $row;
     $this->uid = $uid;
     $this->uuid = $uuid;
     $this->search = $search;
     $this->catid = $catid;
     $this->limit = $limit;
     $this->limitstart = $limitstart;
     $this->dateid = $dateid;
     $this->ueberschrift = $ueberschrift;
     $this->booking = $booking;
     $this->user = $user;
     $this->location = $locobj;
     parent::display($tpl);
 }
예제 #22
0
 * @author     Yves Hoppe <*****@*****.**>
 * @date       03.04.13
 *
 * @copyright  Copyright (C) 2008 - 2014 Yves Hoppe - compojoom.com . All rights reserved.
 * @license    GNU General Public License version 2 or later; see LICENSE
 */
defined('_JEXEC') or die('Restricted access');
$mainconfig = JFactory::getConfig();
$filename = $this->events[0]->title;
//var_dump($this->events);
if (count($this->events) > 1) {
    $filename = $mainconfig->get('sitename') . " - Events";
}
$icsdata = "BEGIN:VCALENDAR\n";
$icsdata .= "VERSION:2.0\n";
$icsdata .= "PRODID:" . MatukioHelperUtilsBasic::getSitePath() . "\n";
$icsdata .= "METHOD:PUBLISH\n";
foreach ($this->events as $event) {
    $user = JFactory::getuser($event->publisher);
    $icsdata .= "BEGIN:VEVENT\n";
    $icsdata .= "UID:" . MatukioHelperUtilsBooking::getBookingId($event->id) . "\n";
    $icsdata .= "ORGANIZER;CN=\"" . $user->name . "\":MAILTO:" . $user->email . "\n";
    $icsdata .= "SUMMARY:" . JText::_($event->title) . "\n";
    if ($event->webinar == 1) {
        $location = JText::_("COM_MATUKIO_WEBINAR");
    } elseif ($event->place_id != 0) {
        $locobj = MatukioHelperUtilsEvents::getLocation($event->place_id);
        $location = $locobj->location;
    } else {
        $location = $event->place;
    }
예제 #23
0
			</th>
			<th width="33%">
				<?php 
echo "<img src=\"" . $imgpath . "2501.png\" border=\"0\" align=\"absmiddle\" /> " . JTEXT::_('COM_MATUKIO_WAITLIST');
?>
			</th>
			<th width="33%">
				<?php 
echo "<img src=\"" . $imgpath . "2500.png\" border=\"0\" align=\"absmiddle\" /> " . JTEXT::_('COM_MATUKIO_EXCEEDED');
?>
			</th>
		</tr>
		<tr>
			<th width="33%">
				<?php 
echo "<img src=\"" . $imgpath . "2500.png\" border=\"0\" align=\"absmiddle\" /> " . JTEXT::_('COM_MATUKIO_EVENT_HAS_ENDED');
?>
			</th>
			<th width="33%">
				<?php 
echo "<img src=\"" . $imgpath . "2500.png\" border=\"0\" align=\"absmiddle\" /> " . JTEXT::_('COM_MATUKIO_FULLY_BOOKED');
?>
			</th>
			<th width="33%">
			</th>
		</tr>
	</table>
	</div>
<?php 
echo CompojoomHtmlCTemplate::getFooter(MatukioHelperUtilsBasic::getCopyright(false));
예제 #24
0
    } else {
        //proibida a inscricao em eventos simultaneos
        $erro = 4;
    }
} else {
    if (MatukioHelperSettings::getSettings('oldbookingform', 0) == 1) {
        if ($this->event->fees > 0) {
            $knopfunten .= " <input type=\"submit\" style=\"cursor:pointer;\" class=\"booking_button mat_button\" value=\"" . JTEXT::_('COM_MATUKIO_BOOK_PAID') . "\">";
        } else {
            $knopfunten .= " <input type=\"submit\" style=\"cursor:pointer;\" class=\"booking_button mat_button\" value=\"" . JTEXT::_('COM_MATUKIO_BOOK') . "\">";
        }
    } else {
        if ($this->event->catid == $idcatInscricao) {
            $bookinglink = JRoute::_("index.php?option=com_matukio&view=bookevent&cid=" . $this->event->id . ":" . JFilterOutput::stringURLSafe($this->event->title));
            $knopfoben .= "<a title=\"" . JTEXT::_('COM_MATUKIO_BOOK') . "\" href=\"" . $bookinglink . "\"><img src=\"" . MatukioHelperUtilsBasic::getComponentImagePath() . "1132.png\" border=\"0\" align=\"absmiddle\"></a>";
            $knopfunten .= " <a title=\"" . JTEXT::_('COM_MATUKIO_BOOK') . "\" href=\"" . $bookinglink . "\"><span class=\"mat_button\" style=\"cursor:pointer;\"><img src=\"" . MatukioHelperUtilsBasic::getComponentImagePath() . "1116.png\" border=\"0\" align=\"absmiddle\">&nbsp;" . JTEXT::_('COM_MATUKIO_BOOK') . "</span></a>";
        } else {
            //primeiramente deve haver alguma inscricao
            $erro = 5;
        }
    }
}
switch ($erro) {
    case 1:
        echo "<script type='text/javascript'>";
        echo "alert('Seu pacote de inscricao nao permite inscrições em Mini-Cursos!');";
        echo "</script>";
        break;
    case 2:
        echo "<script type='text/javascript'>";
        echo "alert('Seu pacote de inscricao nao permite inscrições em Palestras!');";
예제 #25
0
 /**
  * Save old booking form event
  *
  * @return object
  */
 function saveoldevent()
 {
     // Check authorization
     if (!JFactory::getUser()->authorise('core.edit', 'com_matukio')) {
         return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR'));
     }
     $database = JFactory::getDBO();
     $input = JFactory::getApplication()->input;
     $art = 4;
     $event_id = $input->getInt('event_id', 0);
     $uid = 0;
     $notify_participant = $input->getInt("notify_participant", 0);
     $notify_participant_invoice = $input->getInt("notify_participant_invoice", 0);
     $uuid = $input->get('uuid', 0, 'string');
     $nrbooked = $input->getInt('nrbooked', 1);
     $userid = $input->getInt('userid', 0);
     if (empty($event_id)) {
         return JError::raiseError(404, 'COM_MATUKIO_NO_ID');
     }
     // Load event (use model function)
     $emodel = JModelLegacy::getInstance('Event', 'MatukioModel');
     $event = $emodel->getItem($event_id);
     $reason = "";
     if (!empty($uid)) {
         // Setting booking to changed booking
         $userid = $uid;
         // uid = Negativ
     }
     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;
     $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);
     $neu->nrbooked = $nrbooked;
     if (!empty($event->fees)) {
         $neu->payment_method = "cash";
         // TODO Update to diffrent fees
         if ($nrbooked > 0) {
             $neu->payment_brutto = $event->fees * $nrbooked;
         } else {
             $neu->payment_brutto = $event->fees;
         }
     }
     if (empty($neu->uuid)) {
         $neu->uuid = MatukioHelperPayment::getUuid(true);
     }
     if (!$neu->check()) {
         return JError::raiseError(500, $database->stderr());
     }
     if (!$neu->store()) {
         return JError::raiseError(500, $database->stderr());
     }
     $neu->checkin();
     $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, false);
     }
     $viewteilnehmerlink = JRoute::_("index.php?option=com_matukio&view=participants&cid=" . $event->id . "&art=2");
     $msg = JText::_("COM_MATUKIO_BOOKING_EDITED");
     $this->setRedirect($viewteilnehmerlink, $msg);
 }
예제 #26
0
 /**
  * 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);
 }
예제 #27
0
}
?>

		<?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 -->
예제 #28
0
                    // Certificate USER LInk     javascript:semauf(13,'" . $row->sid . "','');
                    $certlink = JRoute::_("index.php?option=com_matukio&view=participants&task=certificateUser&uid=" . $row->sid . "&cid=" . $this->kurs->id);
                    $htxt = "<a title=\"" . $certtitel . "\" href=\"" . $certlink . "\"><img src=\"" . MatukioHelperUtilsBasic::getComponentImagePath() . "220" . $row->certificated . ".png\" border=\"0\" align=\"absmiddle\"></a>";
                    if ($row->certificated == 1) {
                        $htxt .= " " . MatukioHelperUtilsEvents::getPrintWindow(1, $row->sid, $row->id, '');
                    }
                }
                $html .= MatukioHelperUtilsEvents::getTableCell($htxt, 'd', 'c', '', "sem_row");
            }
            if (MatukioHelperSettings::getSettings('frontend_ratingsystem', 0) > 0) {
                $hinttext = JTEXT::_('COM_MATUKIO_RATING') . "::" . htmlspecialchars($row->comment);
                $htxt = "<img src=\"" . MatukioHelperUtilsBasic::getComponentImagePath() . "240" . $row->grade . ".png\" class=\"editlinktip hasTip\" title=\"" . $hinttext . "\">";
                $html .= MatukioHelperUtilsEvents::getTableCell($htxt, 'd', 'c', '', "sem_row");
            }
        }
        $html .= MatukioHelperUtilsEvents::getTableCell("<img src=\"" . MatukioHelperUtilsBasic::getComponentImagePath() . $bild . "\" border=\"0\" alt=\"" . $altbild . "\">", 'd', 'c', '', "sem_row");
        $html .= "\n</tr>";
    }
} else {
    $spalten = 3;
    if ($this->art == 2) {
        $spalten = 9;
    }
    $html .= "\n<tr>" . MatukioHelperUtilsEvents::getTableCell(JTEXT::_('COM_MATUKIO_NO_BOOKING_FOUND'), 'd', 'l', '', 'sem_row', $spalten) . "</tr>";
}
$html .= MatukioHelperUtilsEvents::getTableHeader('e');
// Hidden fields
if ($this->kurs->nrbooked <= 1 || MatukioHelperSettings::getSettings('frontend_usermehrereplaetze', 1) < 1) {
    $html .= "<input type=\"hidden\" name=\"nrbooked\" value=\"1\" />";
}
$html .= MatukioHelperUtilsEvents::getHiddenFormElements($zurueck[$this->art], $this->catid, $this->search, $this->limit, $this->limitstart, $this->kurs->id, $this->dateid, -1);
예제 #29
0
 /**
  * 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);
 }
예제 #30
0
 /**
  * Shows the form
  *
  * @param   string  $tpl  - The tmpl
  *
  * @return  bool|mixed|object
  */
 public function display($tpl = null)
 {
     $art = JFactory::getApplication()->input->getInt('art', 0);
     $cid = JFactory::getApplication()->input->getInt('cid', 0);
     if (empty($cid)) {
         JError::raiseError('404', "COM_MATUKIO_NO_ID");
     }
     $database = JFactory::getDBO();
     $dateid = JFactory::getApplication()->input->getInt('dateid', 1);
     $catid = JFactory::getApplication()->input->getInt('catid', 0);
     $search = JFactory::getApplication()->input->get('search', '');
     $limit = JFactory::getApplication()->input->getInt('limit', 5);
     $limitstart = JFactory::getApplication()->input->getInt('limitstart', 0);
     $user = JFactory::getUser();
     // Load event (use model function)
     $emodel = JModelLegacy::getInstance('Event', 'MatukioModel');
     $kurs = $emodel->getItem($cid);
     if ($art == 0) {
         $anztyp = array(JTEXT::_('COM_MATUKIO_EVENTS'), 0);
     } elseif ($art == 1) {
         $anztyp = array(JTEXT::_('COM_MATUKIO_MY_BOOKINGS'), 1);
     } elseif ($art == 2) {
         $anztyp = array(JTEXT::_('COM_MATUKIO_MY_OFFERS'), 2);
     } elseif ($art == 3) {
         $anztyp = array(JTEXT::_('COM_MATUKIO_MY_OFFERS'), 3);
     }
     if ($art == 0) {
         if (!(MatukioHelperSettings::getSettings('frontend_userviewteilnehmer', 0) == 2 and $user->id > 0 or MatukioHelperSettings::getSettings('frontend_userviewteilnehmer', 0) == 1)) {
             return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR'));
         }
     }
     if ($art == 1) {
         if (!(MatukioHelperSettings::getSettings('frontend_userviewteilnehmer', 0) == 2 and $user->id > 0 or MatukioHelperSettings::getSettings('frontend_userviewteilnehmer', 0) == 1)) {
             return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR'));
         }
     }
     if ($art == 2) {
         if ($kurs->publisher == JFactory::getUser()->id) {
             if (!JFactory::getUser()->authorise('core.edit.own', 'com_matukio')) {
                 return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR'));
             }
         } else {
             if (!JFactory::getUser()->authorise('core.edit', 'com_matukio')) {
                 return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR'));
             }
         }
     }
     $fstatus = JFactory::getApplication()->input->get("filter_status", 'activeandpending');
     $status = "AND (a.status = '1' OR a.status = '0')";
     if (!empty($fstatus)) {
         switch ($fstatus) {
             case "pending":
                 // 0 is active in Seminar :(
                 $status = "AND a.status = '0'";
                 break;
             case "active":
                 $status = "AND a.status = '1'";
                 break;
             case 'activeandpending':
                 $status = "AND (a.status = '1' OR a.status = '0')";
                 break;
             case "waitlist":
                 $status = "AND a.status = '2'";
                 break;
             case "archived":
                 $status = "AND a.status = '3'";
                 break;
             case "deleted":
                 $status = "AND a.status = '4'";
                 break;
             case "paid":
                 $status = "AND a.paid = '1'";
                 break;
             case "unpaid":
                 $status = "AND a.paid = '0'";
                 break;
             case "all":
                 $status = "";
                 break;
         }
     }
     $this->filterStatus = $fstatus;
     $database->setQuery("SELECT a.*, cc.*, a.id AS sid, a.name AS aname, a.email AS aemail FROM #__matukio_bookings\r\n                AS a LEFT JOIN #__users AS cc ON cc.id = a.userid WHERE a.semid = '" . $kurs->id . " '\r\n                " . $status . " ORDER BY a.id");
     $rows = $database->loadObjectList();
     if ($database->getErrorNum()) {
         echo $database->stderr();
         return false;
     }
     MatukioHelperUtilsBasic::expandPathway($anztyp[0], JRoute::_("index.php?option=com_matukio&art=" . $art));
     MatukioHelperUtilsBasic::expandPathway($kurs->title, "");
     $this->rows = $rows;
     $this->art = $art;
     $this->search = $search;
     $this->limit = $limit;
     $this->limitstart = $limitstart;
     $this->kurs = $kurs;
     $this->catid = $catid;
     $this->dateid = $dateid;
     parent::display($tpl);
 }