<?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;
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; }
/** * @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'); CompojoomHtmlBehavior::bootstrap31(false, false, false, false); $database = JFactory::getDBO(); $database->setQuery("SELECT * FROM #__matukio_bookings WHERE id = '" . $this->uid . "'"); $booking = $database->loadObject(); $kurs = MatukioHelperUtilsEvents::getEventRecurring($booking->semid); $tmpl_code = MatukioHelperTemplates::getTemplate("export_certificate")->value; if (!empty($kurs->certicate_code)) { // Custom code for certificates $tmpl_code = $kurs->certificate_code; } // Parse language strings $tmpl_code = MatukioHelperTemplates::replaceLanguageStrings($tmpl_code); echo "\n<body onload=\" parent.sbox-window.focus(); parent.sbox-window.print(); \">"; echo "<div class=\"compojoom-bootstrap\">"; $replaces = MatukioHelperTemplates::getReplaces($kurs, $booking); foreach ($replaces as $key => $replace) { $tmpl_code = str_replace($key, $replace, $tmpl_code); } echo $tmpl_code; echo "</div>"; echo "</body>";
<?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'); CompojoomHtmlBehavior::bootstrap31(false, false, false, false); $database = JFactory::getDBO(); if (!empty($this->uid)) { $database->setQuery("SELECT * FROM #__matukio_bookings WHERE id='" . $this->uid . "'"); } elseif (!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("invoice")->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 = "INVOICE"; MatukioHelperPDF::generateInvoice($booking, $tmpl_code, $subject); exit;
/** * 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); }
} if (!empty($kurs)) { $database->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 (isset($this->bookings)) { if (count($this->bookings)) { $database->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(",", $this->bookings) . ") ORDER BY a.id"); } } else { throw new Exception("No data supplied (bookings / event)"); } $bookings = $database->loadObjectList(); if ($this->art > 2) { echo MatukioHelperUtilsBasic::getHTMLHeader(); $this->art -= 2; } $tmpl = MatukioHelperTemplates::getTemplate("export_participantslist"); $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) {
if (!empty($kurs)) { // TODO add option for status filtering $database->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 (isset($this->bookings)) { if (count($this->bookings)) { $database->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(",", $this->bookings) . ") ORDER BY a.id"); } } else { throw new Exception("No data supplied (bookings / event)"); } $bookings = $database->loadObjectList(); if ($this->art > 2) { echo MatukioHelperUtilsBasic::getHTMLHeader(); $this->art -= 2; } $tmpl = MatukioHelperTemplates::getTemplate("export_signaturelist"); $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=\"mat_title\">" . JTEXT::_($tmpl->subject) . "</span></center><br />"; } /* Header before out of value_text */ if (!empty($kurs)) { echo $tmpl->value_text; } /* Single lines from value */ $signature_line = str_replace("</p>", "", str_replace("<p>", "", $tmpl->value)); $signatures = "<table class=\"mat_table table\" style=\"width: 100%;\">"; // Header table if (!empty($kurs)) {