public function getDataEnviament($idl) { $OMISSATGE = MissatgesllistesPeer::retrieveByPK($this->getIdmissatge(), $idl); if ($OMISSATGE instanceof Missatgesllistes) { return $OMISSATGE->getEnviat('d-m-Y'); } else { return null; } }
public function saveMissatges() { $M = new Missatgesllistes(); if ($this->getRequestParameter('IDM') > 0) { $M = MissatgesllistesPeer::retrieveByPK($this->getRequestParameter('IDM')); $M->setNew(false); } $M->setTitol($this->getRequestParameter('TITOL')); $M->setText($this->getRequestParameter('TEXT')); $M->setDate(time()); $M->setLlistesIdllistes($this->getRequestParameter('IDL')); $M->save(); $RET['ERRORS'] = array(); $RET['MISSATGE'] = $M; return $RET; }
public static function EnviaMissatge($IDM, $idS) { $M = MissatgesllistesPeer::retrieveByPK($IDM); require_once 'lib/vendor/swift/swift_init.php'; # needed due to symfony autoloader $mailer = Swift_Mailer::newInstance(Swift_MailTransport::newInstance()); $MAILS = UsuarisllistesPeer::getUsuarisLlistaEmail($M->getLlistesIdllistes()); foreach ($MAILS as $Email) { $message = Swift_Message::newInstance($M->getTitol())->setFrom(OptionsPeer::getString('MAIL_FROM', $idS))->setTo($Email)->setBody($M->getText(), 'text/html'); $mailer->send($message); } $M->setEnviat(date('Y-m-d', time())); $M->save(); return sizeof($MAILS); }