public static function generateCSVFile($backend, $cid = 0, $bookings = null, $kurs = null)
 {
     $db = JFactory::getDbo();
     // Load event only if we are not in the backend / or got an whole event to print
     if (!$backend) {
         $kurs = MatukioHelperUtilsEvents::getEventRecurring($cid);
     }
     $tmpl = MatukioHelperTemplates::getTemplate("export_csv");
     if (!empty($kurs)) {
         $db->setQuery("SELECT a.*, cc.*, a.id AS sid, a.name AS aname, a.email AS aemail FROM #__matukio_bookings AS a " . "LEFT JOIN #__users AS cc ON cc.id = a.userid WHERE a.semid = '" . $kurs->id . "' AND (a.status = 0 OR a.status = 1) ORDER BY a.id");
     } elseif (count($bookings)) {
         $db->setQuery("SELECT a.*, cc.*, a.id AS sid, a.name AS aname, a.email AS aemail FROM #__matukio_bookings AS a " . "LEFT JOIN #__users AS cc ON cc.id = a.userid WHERE a.id IN (" . implode(",", $bookings) . ") ORDER BY a.id");
     } else {
         throw new Exception("No data supplied (bookings / event)");
     }
     $bookings = $db->loadObjectList();
     if ($db->getErrorNum()) {
         throw new Exception($db->stderr());
     }
     $csvdata = MatukioHelperTemplates::getCSVHeader($tmpl, $kurs);
     $csvdata .= MatukioHelperTemplates::getCSVData($tmpl, $bookings, $kurs);
     return $csvdata;
 }
<?php

/**
 * @package    Matukio
 * @author     Yves Hoppe <*****@*****.**>
 * @date       29.01.14
 *
 * @copyright  Copyright (C) 2008 - 2014 compojoom.com . All rights reserved.
 * @license    GNU General Public License version 2 or later; see LICENSE
 */
defined('_JEXEC') or die('Restricted access');
$database = JFactory::getDBO();
if (!empty($this->uuid)) {
    $database->setQuery("SELECT * FROM #__matukio_bookings WHERE uuid='" . $this->uuid . "'");
}
$booking = $database->loadObject();
$kurs = MatukioHelperUtilsEvents::getEventRecurring($booking->semid);
$tmpl_code = MatukioHelperTemplates::getTemplate("ticket")->value;
// Parse language strings
$tmpl_code = MatukioHelperTemplates::replaceLanguageStrings($tmpl_code);
$replaces = MatukioHelperTemplates::getReplaces($kurs, $booking);
foreach ($replaces as $key => $replace) {
    $tmpl_code = str_replace($key, $replace, $tmpl_code);
}
$subject = "TICKET";
MatukioHelperPDF::generateTicket($booking, $tmpl_code, $subject);
exit;
				<?php 
    echo MatukioHelperUtilsEvents::getFormatedCurrency($this->booking->payment_brutto, MatukioHelperSettings::getSettings('currency_symbol', '$'));
    ?>
			</td>
		</tr>
		<?php 
    if (MatukioHelperSettings::getSettings('oldbookingform', 0) == 0) {
        ?>
			<tr>
				<td class="key" width="150px"><?php 
        echo JText::_("COM_MATUKIO_FIELD_PAYMENT_METHOD");
        ?>
</td>
				<td>
					<?php 
        echo MatukioHelperTemplates::getPaymentMethodTitle($this->booking->payment_method);
        ?>
				</td>
			</tr>
		<?php 
    }
    ?>
		<tr>
			<td class="key"><?php 
    echo JText::_("COM_MATUKIO_YOUR_PAYMENT_STATUS");
    ?>
</td>
			<td>
				<?php 
    if ($this->booking->paid) {
        echo JText::_("COM_MATUKIO_PAID");
Example #4
0
 /**
  * Gets the invoice
  *
  * @param   string  $booking      - The booking
  * @param   string  $kurs         - The event
  * @param   string  $subject      - The subject
  * @param   string  $destination  - The destination
  *
  * @return string
  */
 public static function getTicket($booking, $kurs, $subject = "Ticket", $destination = "D")
 {
     $tmpl_code = MatukioHelperTemplates::getTemplate("ticket")->value;
     // Parse language strings
     $tmpl_code = MatukioHelperTemplates::replaceLanguageStrings($tmpl_code);
     $replaces = MatukioHelperTemplates::getReplaces($kurs, $booking);
     foreach ($replaces as $key => $replace) {
         $tmpl_code = str_replace($key, $replace, $tmpl_code);
     }
     return MatukioHelperPDF::generateTicket($booking, $tmpl_code, $subject, $destination);
 }
$tmpl = MatukioHelperTemplates::getParsedExportTemplateHeadding($tmpl, $kurs);
echo "\n<body onload=\" parent.sbox-window.focus(); parent.sbox-window.print(); \">";
echo "<div class=\"compojoom-bootstrap\">";
if (!empty($tmpl->subject)) {
    echo "\n<br /><center><span class=\"sem_list_title\">" . JTEXT::_($tmpl->subject) . "</span></center><br />";
}
/* Header before out of value_text */
if (!empty($kurs)) {
    echo $tmpl->value_text;
}
/* Participants */
// Move to function
$i = 1;
$ptable = "";
foreach ($bookings as $b) {
    // We are in the backend with bookings instead of an event!
    if (empty($cid)) {
        $kurs = MatukioHelperUtilsEvents::getEventRecurring($b->semid);
    }
    $replaces = MatukioHelperTemplates::getReplaces($kurs, $b, $i);
    $participant_line = $tmpl->value;
    foreach ($replaces as $key => $replace) {
        $participant_line = str_replace($key, $replace, $participant_line);
    }
    $ptable .= $participant_line;
    $i++;
}
echo $ptable;
echo "<br />" . MatukioHelperUtilsBasic::getCopyright();
echo "</div>";
echo "</body>";