Example #1
0
 public static function raiseWarning($code, $msg, $info = null)
 {
     RedeventHelperLog::simplelog("Notice {$code}: {$msg}");
     return parent::raiseWarning($code, $msg, $info = null);
 }
Example #2
0
 /**
  * Saves xref data
  * @param array
  * @return boolean true on success
  */
 function storeXref($data)
 {
     $user =& JFactory::getUser();
     $settings =& redEVENTHelper::config();
     // TODO : check user group access ?
     $row =& JTable::getInstance('RedEvent_eventvenuexref', '');
     if ($data['id']) {
         if (!$this->canManageXref($data['id'])) {
             $this->setError('YOU ARE NOT ALLOWED TO EDIT THIS DATE');
             return false;
         }
         $row->load($data['id']);
     } else {
         if (!$this->getCanAddXref()) {
             $this->setError('YOU ARE NOT ALLOWED TO ADD EVENT DATE');
             return false;
         }
     }
     if (!$row->bind($data)) {
         $this->setError('SUBMIT XREF ERROR BINDING DATA');
         RedeventHelperLog::simplelog('SUBMIT XREF ERROR BINDING DATA');
         return false;
     }
     if (!$row->check()) {
         $this->setError('SUBMIT XREF ERROR CHECK DATA');
         RedeventHelperLog::simplelog('SUBMIT XREF ERROR CHECK DATA');
         return false;
     }
     if (!$row->store(true)) {
         $this->setError('SUBMIT XREF ERROR STORE DATA');
         RedeventHelperLog::simplelog('SUBMIT XREF ERROR STORE DATA');
         return false;
     }
     /** roles **/
     // first remove current rows
     $query = ' DELETE FROM #__redevent_sessions_roles ' . ' WHERE xref = ' . $this->_db->Quote($row->id);
     $this->_db->setQuery($query);
     if (!$this->_db->query()) {
         $this->setError($this->_db->getErrorMsg());
         return false;
     }
     // then recreate them if any
     foreach ((array) $data['rrole'] as $k => $r) {
         if (!($data['rrole'][$k] && $data['urole'][$k])) {
             continue;
         }
         $new =& JTable::getInstance('RedEvent_sessions_roles', '');
         $new->set('xref', $row->id);
         $new->set('role_id', $r);
         $new->set('user_id', $data['urole'][$k]);
         if (!($new->check() && $new->store())) {
             $this->setError($new->getError());
             return false;
         }
     }
     /** roles END **/
     /** prices **/
     // first remove current rows
     $query = ' DELETE FROM #__redevent_sessions_pricegroups ' . ' WHERE xref = ' . $this->_db->Quote($row->id);
     $this->_db->setQuery($query);
     if (!$this->_db->query()) {
         $this->setError($this->_db->getErrorMsg());
         return false;
     }
     // then recreate them if any
     foreach ((array) $data['pricegroup'] as $k => $r) {
         if (!$data['pricegroup'][$k]) {
             continue;
         }
         $new =& JTable::getInstance('RedEvent_sessions_pricegroups', '');
         $new->set('xref', $row->id);
         $new->set('pricegroup_id', $r);
         $new->set('price', $data['price'][$k]);
         if (!($new->check() && $new->store())) {
             $this->setError($new->getError());
             return false;
         }
     }
     /** prices END **/
     // we need to save the recurrence too
     $recurrence =& JTable::getInstance('RedEvent_recurrences', '');
     if (!isset($data['recurrenceid']) || !$data['recurrenceid']) {
         $rrule = RedeventHelperRecurrence::parsePost($data);
         if (!empty($rrule)) {
             // new recurrence
             $recurrence->rrule = $rrule;
             if (!$recurrence->store()) {
                 $this->setError($recurrence->getError());
                 return false;
             }
             // add repeat record
             $repeat =& JTable::getInstance('RedEvent_repeats', '');
             $repeat->set('xref_id', $row->id);
             $repeat->set('recurrence_id', $recurrence->id);
             $repeat->set('count', 0);
             if (!$repeat->store()) {
                 $this->setError($repeat->getError());
                 return false;
             }
         }
     } else {
         if ($data['repeat'] == 0) {
             $recurrence->load($data['recurrenceid']);
             // reset the status
             $recurrence->ended = 0;
             // TODO: maybe add a check to have a choice between updating rrule or not...
             $rrule = RedeventHelperRecurrence::parsePost($data);
             $recurrence->rrule = $rrule;
             if (!$recurrence->store()) {
                 $this->setError($recurrence->getError());
                 return false;
             }
         }
     }
     if ($recurrence->id) {
         redEVENTHelper::generaterecurrences($recurrence->id);
     }
     return true;
 }
Example #3
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;
    }
Example #4
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;
 }