示例#1
1
 function display($tpl = null)
 {
     $mainframe =& JFactory::getApplication();
     $dispatcher =& JDispatcher::getInstance();
     /* Load the event details */
     $course = $this->get('Details');
     $venue = $this->get('Venue');
     $pdf = new TCPDF("P", "mm", "A4", true);
     $pdf->SetCreator($mainframe->getCfg('sitename'));
     $pdf->SetAuthor($mainframe->getCfg('sitename'));
     $pdf->SetTitle($course->title);
     $pdf->SetSubject($course->title);
     $pdf->setHeaderFont(array('freesans', '', 8));
     $pdf->setFooterFont(array('freesans', '', 8));
     $pdf->setFont('freesans');
     // disable header and footer
     $pdf->setPrintHeader(false);
     $pdf->setPrintFooter(true);
     //set the display mode
     $pdf->SetDisplayMode('default');
     //initialize document
     $pdf->AliasNbPages();
     // add a page
     $pdf->AddPage();
     $pdf->SetFontSize(10);
     /* This loads the tags replacer */
     JView::loadHelper('tags');
     $tags = new redEVENT_tags();
     $tags->setXref(JRequest::getInt('xref'));
     $message = $tags->ReplaceTags($course->submission_type_email_pdf);
     // convert urls
     $htmlmsg = REOutput::ImgRelAbs($message);
     $pdf->WriteHTML($message, true);
     // add the form data if requested
     if ($course->pdf_form_data) {
         JRequest::setVar('pdfform', $pdf);
         JPluginHelper::importPlugin('content');
         $form = new stdClass();
         $form->text = '{redform}' . $course->redform_id . ',1{/redform}';
         $form->eventid = $course->did;
         $form->task = 'userregister';
         $results = $dispatcher->trigger('onPrepareEvent', array(&$form, array(), 0));
         $pdf->WriteHTML($form->text, true);
     }
     // output the file
     $pdf->Output($course->title . ".pdf", "I");
     exit;
 }
示例#2
0
 /**
  * send reminder emails
  */
 function reminder()
 {
     jimport('joomla.filesystem.file');
     $app =& JFactory::getApplication();
     $params = $app->getParams('com_redevent');
     $file = JPATH_COMPONENT_SITE . DS . 'reminder.txt';
     if (JFile::exists($file)) {
         $date = (int) JFile::read($file);
     } else {
         $date = 0;
     }
     // only run this once a day
     echo sprintf("last update on %s<br/>", strftime('%Y-%m-%d %H:%M', $date));
     if (time() - $date < 3600 * 23.9 && !JRequest::getVar('force', 0)) {
         echo "reminder sent less the 24 hours ago<br/>";
         return;
     }
     $model = $this->getModel('attendees');
     $events = $model->getReminderEvents($params->get('reminder_days', 14));
     if ($events && count($events)) {
         $mailer =& JFactory::getMailer();
         $MailFrom = $app->getCfg('mailfrom');
         $FromName = $app->getCfg('fromname');
         $mailer->setSender(array($MailFrom, $FromName));
         $mailer->IsHTML(true);
         $subject = $params->get('reminder_subject');
         $body = $params->get('reminder_body');
         foreach ($events as $event) {
             echo "sending reminder for event: " . $event->full_title . "<br>";
             $tags = new redEVENT_tags();
             $tags->setXref($event->id);
             // get attendees
             $attendees = $model->getAttendeesEmails($event->id, $params->get('reminder_include_waiting', 1));
             if (!$attendees) {
                 continue;
             }
             foreach ($attendees as $sid => $a) {
                 $msubject = $tags->ReplaceTags($subject, array('sids' => array($sid)));
                 $mbody = '<html><body>' . $tags->ReplaceTags($body) . '</body></html>';
                 // convert urls
                 $mbody = REOutput::ImgRelAbs($mbody);
                 $mailer->setSubject($msubject);
                 $mailer->setBody($mbody);
                 $mailer->clearAllRecipients();
                 $mailer->addRecipient($a);
                 $sent = $mailer->Send();
             }
         }
     } else {
         echo 'No events for this reminder interval<br/>';
     }
     // update file
     JFile::write($file, time());
 }
示例#3
0
 /**
  * Send the signup email
  */
 public function getSendFormalOfferEmail($tags)
 {
     /* Initialise the mailer */
     $this->Mailer();
     /* Load the details for this course */
     $db = JFactory::getDBO();
     $q = "SELECT * \n\t\t\tFROM #__redevent_event_venue_xref x\n\t\t\tLEFT JOIN #__redevent_events e\n\t\t\tON e.id = x.eventid\n\t\t\tLEFT JOIN #__redevent_venues v\n\t\t\tON v.id = x.venueid\n\t\t\tWHERE x.id = " . JRequest::getInt('xref');
     $db->setQuery($q);
     $details = $db->loadObject();
     /* Add the recipient */
     $this->mailer->AddAddress(JRequest::getVar('subemailaddress'), JRequest::getVar('subemailname'));
     /* Set the subject */
     $this->mailer->setSubject($tags->ReplaceTags($details->submission_type_formal_offer_subject));
     /* Add the body to the mail */
     /* Read the template */
     $message = $tags->ReplaceTags($details->submission_type_formal_offer_body);
     // convert urls
     $message = REOutput::ImgRelAbs($message);
     $this->mailer->setBody($message);
     /* Sent out the mail */
     if (!$this->mailer->Send()) {
         RedeventError::raiseWarning(0, JText::_('COM_REDEVENT_NO_MAIL_SEND') . ' ' . $this->mailer->error);
         return false;
     }
     /* Clear the mail details */
     $this->mailer->ClearAddresses();
     return true;
 }
示例#4
0
    function notifyManagers($unreg = false)
    {
        jimport('joomla.mail.helper');
        $app =& JFactory::getApplication();
        $params = $app->getParams('com_redevent');
        $tags = new redEVENT_tags();
        $tags->setXref($this->getXref());
        $tags->setSubmitkey($this->load()->submit_key);
        $tags->addOptions(array('sids' => array($this->load()->sid)));
        $event = $this->getSessionDetails();
        $recipients = $this->getAdminEmails();
        if (!count($recipients)) {
            return true;
        }
        $mailer =& JFactory::getMailer();
        if ($this->getEmail() && $params->get('allow_email_aliasing', 1)) {
            $sender = array($this->getEmail(), $this->getFullname());
        } else {
            // default to site settings
            $sender = array($app->getCfg('mailfrom'), $app->getCfg('sitename'));
        }
        $mailer->setSender($sender);
        $mailer->addReplyTo($sender);
        foreach ($recipients as $r) {
            $mailer->addAddress($r['email'], $r['name']);
        }
        $mail = '<HTML><HEAD>
			<STYLE TYPE="text/css">
			<!--
			  table.formanswers , table.formanswers td, table.formanswers th
				{
				    border-color: darkgrey;
				    border-style: solid;
				    text-align:left;
				}			
				table.formanswers
				{
				    border-width: 0 0 1px 1px;
				    border-spacing: 0;
				    border-collapse: collapse;
				    padding: 5px;
				}			
				table.formanswers td, table.formanswers th
				{
				    margin: 0;
				    padding: 4px;
				    border-width: 1px 1px 0 0;
				}		  
			-->
			</STYLE>
			</head>
			<BODY bgcolor="#FFFFFF">
			' . $tags->ReplaceTags($unreg ? $params->get('unregistration_notification_body') : $params->get('registration_notification_body')) . '
			</body>
			</html>';
        // convert urls
        $mail = REOutput::ImgRelAbs($mail);
        if (!$unreg && $params->get('registration_notification_attach_rfuploads', 1)) {
            // files submitted through redform
            $files = $this->getRFFiles();
            $filessize = 0;
            foreach ($files as $f) {
                $filessize += filesize($f);
            }
            if ($filessize < $params->get('registration_notification_attach_rfuploads_maxsize', 1500) * 1000) {
                foreach ($files as $f) {
                    $mailer->addAttachment($f);
                }
            }
        }
        $mailer->setSubject($tags->ReplaceTags($unreg ? $params->get('unregistration_notification_subject') : $params->get('registration_notification_subject')));
        $mailer->MsgHTML($mail);
        if (!$mailer->send()) {
            RedeventHelperLog::simplelog(JText::_('COM_REDEVENT_ERROR_REGISTRATION_MANAGERS_NOTIFICATION_FAILED'));
            $this->setError(JText::_('COM_REDEVENT_ERROR_REGISTRATION_MANAGERS_NOTIFICATION_FAILED'));
            return false;
        }
        return true;
    }
示例#5
0
 function notifyManagers()
 {
     jimport('joomla.mail.helper');
     $app =& JFactory::getApplication();
     $params = $app->getParams('com_redevent');
     $event = $this->getDetails();
     $tags = new redEVENT_tags();
     $tags->setXref($this->_xref);
     $tags->setSubmitkey(JRequest::getVar('submit_key'));
     $recipients = array();
     // default recipients
     $default = $params->get('registration_default_recipients');
     if (!empty($default)) {
         if (strstr($default, ';')) {
             $addresses = explode(";", $default);
         } else {
             $addresses = explode(",", $default);
         }
         foreach ($addresses as $a) {
             $a = trim($a);
             if (JMailHelper::isEmailAddress($a)) {
                 $recipients[] = array('email' => $a, 'name' => '');
             }
         }
     }
     // creator
     if ($params->get('registration_notify_creator', 1)) {
         if (JMailHelper::isEmailAddress($event->creator_email)) {
             $recipients[] = array('email' => $event->creator_email, 'name' => $event->creator_name);
         }
     }
     // group recipients
     $gprecipients = $this->_getXrefRegistrationRecipients();
     foreach ($gprecipients as $r) {
         $recipients[] = array('email' => $r->email, 'name' => $r->name);
     }
     if (!count($recipients)) {
         return true;
     }
     $mailer =& JFactory::getMailer();
     foreach ($recipients as $r) {
         $mailer->addAddress($r['email'], $r['name']);
     }
     $mailer->setSubject($tags->ReplaceTags($params->get('registration_notification_subject')));
     // convert urls
     $htmlmsg = '<html><body>' . $tags->ReplaceTags($params->get('registration_notification_body')) . '</body></html>';
     $htmlmsg = REOutput::ImgRelAbs($htmlmsg);
     $mailer->MsgHTML($htmlmsg);
     if (!$mailer->send()) {
         RedeventHelperLog::simplelog(JText::_('COM_REDEVENT_ERROR_REGISTRATION_MANAGERS_NOTIFICATION_FAILED'));
         $this->setError(JText::_('COM_REDEVENT_ERROR_REGISTRATION_MANAGERS_NOTIFICATION_FAILED'));
         return false;
     }
     return true;
 }
示例#6
0
 /**
  * Confirms the users request
  */
 function activate()
 {
     $mainframe =& JFactory::getApplication();
     $msgtype = 'message';
     /* Get the confirm ID */
     $confirmid = JRequest::getVar('confirmid', '', 'get');
     /* Get the details out of the confirmid */
     list($uip, $xref, $uid, $register_id, $submit_key) = explode("x", $confirmid);
     /* Confirm sign up via mail */
     $model = $this->getModel('Registration', 'RedEventModel');
     $model->setXref($xref);
     $eventdata = $model->getSessionDetails();
     /* This loads the tags replacer */
     JRequest::setVar('xref', $xref);
     require_once JPATH_COMPONENT_SITE . DS . 'helpers' . DS . 'tags.php';
     $tags = new redEVENT_tags();
     $tags->setXref($xref);
     $tags->setSubmitkey($submit_key);
     /* Check the db if this entry exists */
     $db = JFactory::getDBO();
     $q = ' SELECT r.confirmed ' . ' FROM #__redevent_register r ' . ' WHERE r.uid = ' . $db->Quote($uid) . ' AND r.submit_key = ' . $db->Quote($submit_key) . ' AND r.xref = ' . $db->Quote($xref) . ' AND r.id = ' . $db->Quote($register_id);
     $db->setQuery($q);
     $regdata = $db->loadObject();
     if ($regdata && $regdata->confirmed == 0) {
         $model->confirm($register_id);
         // send activation confirmation email if activated
         if ($eventdata->enable_activation_confirmation) {
             $this->_Mailer();
             $rfcore = new RedFormCore();
             $addresses = $rfcore->getSubmissionContactEmail($submit_key);
             /* Check if there are any addresses to be mailed */
             if (count($addresses) > 0) {
                 /* Start mailing */
                 foreach ($addresses as $key => $sid) {
                     foreach ($sid as $email) {
                         /* Send a off mailinglist mail to the submitter if set */
                         /* Add the email address */
                         $this->mailer->AddAddress($email['email']);
                         /* Mail submitter */
                         $htmlmsg = '<html><head><title></title></title></head><body>' . $tags->ReplaceTags($eventdata->notify_confirm_body) . '</body></html>';
                         // convert urls
                         $htmlmsg = REOutput::ImgRelAbs($htmlmsg);
                         $this->mailer->setBody($htmlmsg);
                         $this->mailer->setSubject($tags->ReplaceTags($eventdata->notify_confirm_subject));
                         /* Send the mail */
                         if (!$this->mailer->Send()) {
                             $mainframe->enqueueMessage(JText::_('COM_REDEVENT_THERE_WAS_A_PROBLEM_SENDING_MAIL'));
                             RedeventHelperLog::simpleLog('Error sending confirm email' . ': ' . $this->mailer->error);
                         }
                         /* Clear the mail details */
                         $this->mailer->ClearAddresses();
                     }
                 }
             }
         }
         $msg = JText::_('COM_REDEVENT_REGISTRATION_ACTIVATION_SUCCESSFULL');
     } else {
         if ($regdata && $regdata->confirmed == 1) {
             $msg = JText::_('COM_REDEVENT_YOUR_SUBMISSION_HAS_ALREADY_BEEN_CONFIRMED');
             $msgtype = 'error';
         } else {
             $msg = JText::_('COM_REDEVENT_YOUR_SUBMISSION_CANNOT_BE_CONFIRMED');
             $msgtype = 'error';
         }
     }
     $this->setRedirect(JRoute::_(RedeventHelperRoute::getDetailsRoute($eventdata->did, $xref)), $msg, $msgtype);
 }