Ejemplo n.º 1
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;
    }