classes/mail/PaperMailTemplate.inc.php

Go to the documentation of this file.
00001 <?php
00002 
00016 import('mail.MailTemplate');
00017 import('paper.log.PaperEmailLogEntry'); // Bring in log constants
00018 
00019 class PaperMailTemplate extends MailTemplate {
00020 
00022    var $paper;
00023 
00025    var $conference;
00026 
00028    var $schedConf;
00029 
00031    var $eventType;
00032 
00034    var $assocType;
00035 
00037    var $assocId;
00038 
00051    function PaperMailTemplate($paper, $emailKey = null, $locale = null, $enableAttachments = null, $conference = null, $schedConf = null, $includeSignature = true, $ignorePostedData = false) {
00052       parent::MailTemplate($emailKey, $locale, $enableAttachments, $conference, $schedConf, $includeSignature, $ignorePostedData);
00053       $this->paper = $paper;
00054    }
00055 
00056    function assignParams($paramArray = array()) {
00057       $paper =& $this->paper;
00058       $conference = isset($this->conference)?$this->conference:Request::getConference();
00059       $schedConf = isset($this->schedConf)?$this->schedConf:Request::getSchedConf();
00060 
00061       $paramArray['paperTitle'] = strip_tags($paper->getLocalizedTitle());
00062       $paramArray['conferenceName'] = strip_tags($conference->getConferenceTitle());
00063       $paramArray['schedConfName'] = strip_tags($schedConf->getSchedConfTitle());
00064       $paramArray['trackName'] = strip_tags($paper->getTrackTitle());
00065       $paramArray['paperAbstract'] = strip_tags($paper->getLocalizedAbstract());
00066       $paramArray['authorString'] = strip_tags($paper->getAuthorString());
00067 
00068       parent::assignParams($paramArray);
00069    }
00070 
00074    function send() {
00075       if (parent::send()) {
00076          if (!isset($this->skip) || !$this->skip) $this->log();
00077          return true;
00078 
00079       } else {
00080          return false;
00081       }
00082    }
00083 
00087    function sendWithParams($paramArray) {
00088       $savedSubject = $this->getSubject();
00089       $savedBody = $this->getBody();
00090 
00091       $this->assignParams($paramArray);
00092 
00093       $ret = $this->send();
00094 
00095       $this->setSubject($savedSubject);
00096       $this->setBody($savedBody);
00097 
00098       return $ret;
00099    }
00100 
00107    function setAssoc($eventType, $assocType, $assocId) {
00108       $this->eventType = $eventType;
00109       $this->assocType = $assocType;
00110       $this->assocId = $assocId;
00111    }
00112 
00117    function setConference($conference) {
00118       $this->conference = $conference;
00119    }
00120 
00125    function setSchedConf($schedConf) {
00126       $this->schedConf = $schedConf;
00127    }
00128 
00132    function log() {
00133       import('paper.log.PaperEmailLogEntry');
00134       import('paper.log.PaperLog');
00135       $entry = new PaperEmailLogEntry();
00136 
00137       // Log data
00138       $entry->setEventType($this->eventType);
00139       $entry->setAssocType($this->assocType);
00140       $entry->setAssocId($this->assocId);
00141 
00142       // Email data
00143       $entry->setSubject($this->getSubject());
00144       $entry->setBody($this->getBody());
00145       $entry->setFrom($this->getFromString());
00146       $entry->setRecipients($this->getRecipientString());
00147       $entry->setCcs($this->getCcString());
00148       $entry->setBccs($this->getBccString());
00149 
00150       // Add log entry
00151       $paper =& $this->paper;
00152       PaperLog::logEmailEntry($paper->getId(), $entry);
00153    }
00154 
00155    function ccAssignedDirectors($paperId) {
00156       $returner = array();
00157       $editAssignmentDao =& DAORegistry::getDAO('EditAssignmentDAO');
00158       $editAssignments =& $editAssignmentDao->getDirectorAssignmentsByPaperId($paperId);
00159       while ($editAssignment =& $editAssignments->next()) {
00160          $this->addCc($editAssignment->getDirectorEmail(), $editAssignment->getDirectorFullName());
00161          $returner[] =& $editAssignment;
00162          unset($editAssignment);
00163       }
00164       return $returner;
00165    }
00166 
00167    function toAssignedDirectors($paperId) {
00168       $returner = array();
00169       $editAssignmentDao =& DAORegistry::getDAO('EditAssignmentDAO');
00170       $editAssignments =& $editAssignmentDao->getDirectorAssignmentsByPaperId($paperId);
00171       while ($editAssignment =& $editAssignments->next()) {
00172          $this->addRecipient($editAssignment->getDirectorEmail(), $editAssignment->getDirectorFullName());
00173          $returner[] =& $editAssignment;
00174          unset($editAssignment);
00175       }
00176       return $returner;
00177    }
00178 
00179    function toAssignedTrackDirectors($paperId) {
00180       $returner = array();
00181       $editAssignmentDao =& DAORegistry::getDAO('EditAssignmentDAO');
00182       $editAssignments =& $editAssignmentDao->getTrackDirectorAssignmentsByPaperId($paperId);
00183       while ($editAssignment =& $editAssignments->next()) {
00184          $this->addRecipient($editAssignment->getDirectorEmail(), $editAssignment->getDirectorFullName());
00185          $returner[] =& $editAssignment;
00186          unset($editAssignment);
00187       }
00188       return $returner;
00189    }
00190 
00191    function ccAssignedTrackDirectors($paperId) {
00192       $returner = array();
00193       $editAssignmentDao =& DAORegistry::getDAO('EditAssignmentDAO');
00194       $editAssignments =& $editAssignmentDao->getTrackDirectorAssignmentsByPaperId($paperId);
00195       while ($editAssignment =& $editAssignments->next()) {
00196          $this->addCc($editAssignment->getDirectorEmail(), $editAssignment->getDirectorFullName());
00197          $returner[] =& $editAssignment;
00198          unset($editAssignment);
00199       }
00200       return $returner;
00201    }
00202 }
00203 
00204 ?>

Generated on 25 Jul 2013 for Open Conference Systems by  doxygen 1.4.7