/** * Displays the participant edit form * * @param string $tpl - The template * * @throws Exception * @return mixed|void */ public function display($tpl = null) { $booking_id = JFactory::getApplication()->input->getInt('booking_id', 0); $model = $this->getModel(); $booking = null; if (!empty($booking_id)) { $booking = $model->getBooking(); } if (!$booking) { $booking = JTable::getInstance('bookings', 'Table'); $event_id = JFactory::getApplication()->input->getInt("event_id", 0); if (!empty($event_id)) { $booking->semid = $event_id; } $booking->uuid = MatukioHelperPayment::getUuid(true); } $db = JFactory::getDbo(); $db->setQuery("SELECT r.id AS value, CONCAT(a.title, ' ', r.begin) AS text FROM #__matukio_recurring AS r LEFT JOIN #__matukio AS a ON r.event_id = a.id "); $events = (array) $db->loadObjectList(); $this->event_select = JHtml::_('select.genericlist', $events, 'event_id', '', 'value', 'text', $booking->semid); $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); } // Booking status $options[] = array("value" => MatukioHelperUtilsBooking::$PENDING, "text" => MatukioHelperUtilsBooking::getBookingStatusName(MatukioHelperUtilsBooking::$PENDING)); $options[] = array("value" => MatukioHelperUtilsBooking::$ACTIVE, "text" => MatukioHelperUtilsBooking::getBookingStatusName(MatukioHelperUtilsBooking::$ACTIVE)); $options[] = array("value" => MatukioHelperUtilsBooking::$WAITLIST, "text" => MatukioHelperUtilsBooking::getBookingStatusName(MatukioHelperUtilsBooking::$WAITLIST)); $options[] = array("value" => MatukioHelperUtilsBooking::$ARCHIVED, "text" => JText::_("COM_MATUKIO_ARCHIVED")); $options[] = array("value" => MatukioHelperUtilsBooking::$DELETED, "text" => JText::_("COM_MATUKIO_DELETED")); $this->status_select = JHtml::_('select.genericlist', $options, 'status', '', 'value', 'text', $booking->status); $marks[] = array("value" => 0, "text" => JText::_("COM_MATUKIO_NONE")); $marks[] = array("value" => 1, "text" => "1"); $marks[] = array("value" => 2, "text" => "2"); $marks[] = array("value" => 3, "text" => "3"); $marks[] = array("value" => 4, "text" => "4"); $marks[] = array("value" => 5, "text" => "5"); $marks[] = array("value" => 6, "text" => "6"); $this->mark_select = JHtml::_('select.genericlist', $marks, 'mark', '', 'value', 'text', $booking->mark); $this->select_checkedin = MatukioHelperInput::getRadioButtonBool("checked_in", "checked_in", $booking->checked_in); $this->booking = $booking; $this->payment = $payment; $this->addToolbar(); parent::display($tpl); }
/** * $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); }
"/> <input type="hidden" name="event_id" value="<?php echo $this->event->id; ?> "/> <input type="hidden" name="catid" value="<?php echo $this->event->catid; ?> "/> <input type="hidden" name="semid" value="<?php echo $this->event->id; ?> "/> <input type="hidden" name="userid" value="<?php echo $this->user->id; ?> "/> <input type="hidden" name="uuid" value="<?php echo MatukioHelperPayment::getUuid(true); ?> "/> <input type="hidden" name="ccval" value="<?php if (!empty($captchatext)) { echo md5($captchatext); } ?> "/> </form> <?php echo MatukioHelperUtilsBasic::getCopyright();
/** * 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); }