?>
0009.png"
					     style="vertical-align:middle; margin-top: 0px;">
					</button>

					<?php 
    if ($confusers->get('allowUserRegistration', 0) > 0) {
        ?>
						<button class="mat_button btn" type="button"
						        style="cursor:pointer;vertical-align:middle;padding:3px 5px;"
						        title="<?php 
        echo JTEXT::_('COM_MATUKIO_REGISTER');
        ?>
"
						        onClick="location.href='<?php 
        echo MatukioHelperUtilsBasic::getSitePath() . $baseuserurl . $registrationurl;
        ?>
'">
							<img src="<?php 
        echo MatukioHelperUtilsBasic::getComponentImagePath();
        ?>
0006.png"
							     style="vertical-align:middle; margin-top: 0px;">
						</button>
					<?php 
    }
    ?>
				</div>
			</div>
		<?php 
}
 * @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;
    }
 /**
  * Gets the link (modal) to the E-Mail window
  * sem_f034
  *
  * @param   string  $dir    - The image directory
  * @param   int     $cid    - The event id
  * @param   int     $art    - The art (0, 1, 2 see other)
  * @param   string  $class  - The class
  *
  * @todo rewrite and move to code
  * @return  string
  */
 public static function getEmailWindow($dir, $cid, $art = 0, $class = "default")
 {
     $html = "";
     $href = MatukioHelperUtilsBasic::getSitePath() . "index.php?tmpl=component&s=" . MatukioHelperUtilsBasic::getRandomChar() . "&option=" . JFactory::getApplication()->input->get('option') . "&view=contactorganizer&cid=" . $cid . "&art=" . $art . "&task=";
     $x = 600;
     $y = 550;
     $htxt = "<a class=\"modal cjmodal\" rel=\"{handler: 'iframe', size: {x: " . $x . ", y: " . $y . "}}\" href=\"" . $href;
     $btnclass = "mat_button";
     if ($class == "bootstrap") {
         $btnclass = "btn";
     }
     if ($art == 1 and MatukioHelperSettings::getSettings('contact_organizer', 1) > 0) {
         $html = $htxt . "19\" title=\"" . JTEXT::_('COM_MATUKIO_CONTACT') . "\"><span class=\"" . $btnclass . "\" type=\"button\">";
         if ($class != "bootstrap") {
             $html .= "<img src=\"" . $dir . "1716.png\" border=\"0\" align=\"absmiddle\">";
         }
         $html .= "&nbsp;" . JTEXT::_('COM_MATUKIO_CONTACT') . "</span></a>";
     } elseif ($art == 2 && JFactory::getUser()->authorise('core.edit.own', 'com_matukio') && MatukioHelperSettings::getSettings('sendmail_contact', 1) > 0) {
         $html = $htxt . "19\"><span class=\"" . $btnclass . "\" type=\"button\"><img src=\"" . $dir . "1716.png\" border=\"0\" align=\"absmiddle\">&nbsp;" . JTEXT::_('COM_MATUKIO_CONTACT') . "</span></a>";
     } elseif ($art == 3 and JFactory::getUser()->authorise('core.edit.own', 'com_matukio')) {
         $html = $htxt . "30\" title=\"" . JTEXT::_('COM_MATUKIO_CONTACT') . "\"><img src=\"" . $dir . "1732.png\" border=\"0\" align=\"absmiddle\"></a>";
     } elseif ($art == 4 and JFactory::getUser()->authorise('core.edit.own', 'com_matukio')) {
         $html = $htxt . "30\"><span class=\"" . $btnclass . "\" type=\"button\"><img src=\"" . $dir . "1716.png\" border=\"0\" align=\"absmiddle\">&nbsp;" . JTEXT::_('COM_MATUKIO_CONTACT') . "</span></a>";
     } elseif ($art == 2) {
         $html = $htxt . "19\"><span class=\"" . $btnclass . "\" type=\"button\"><img src=\"" . $dir . "1716.png\" border=\"0\" align=\"absmiddle\">&nbsp;" . JTEXT::_('COM_MATUKIO_CONTACT') . "</span></a>";
     } elseif ($art == "organizer") {
         $html = $htxt . "19\"><span class=\"" . $btnclass . "\" type=\"button\">" . JTEXT::_('COM_MATUKIO_CONTACT') . "</span></a>";
     }
     return $html;
 }
 /**
  * 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);
 }