Ejemplo n.º 1
0
 /**
  * Internal function to return a MonographEmailLogEntry object from a row.
  * @param $row array
  * @return MonographEmailLogEntry
  */
 function &_returnLogEntryFromRow(&$row)
 {
     $entry = new MonographEmailLogEntry();
     $entry->setLogId($row['log_id']);
     $entry->setMonographId($row['monograph_id']);
     $entry->setSenderId($row['sender_id']);
     $entry->setDateSent($this->datetimeFromDB($row['date_sent']));
     $entry->setIPAddress($row['ip_address']);
     $entry->setEventType($row['event_type']);
     $entry->setAssocType($row['assoc_type']);
     $entry->setAssocId($row['assoc_id']);
     $entry->setFrom($row['from_address']);
     $entry->setRecipients($row['recipients']);
     $entry->setCcs($row['cc_recipients']);
     $entry->setBccs($row['bcc_recipients']);
     $entry->setSubject($row['subject']);
     $entry->setBody($row['body']);
     HookRegistry::call('MonographEmailLogDAO::_returnLogEntryFromRow', array(&$entry, &$row));
     return $entry;
 }
Ejemplo n.º 2
0
 function newDataObject()
 {
     $returner = new MonographEmailLogEntry();
     $returner->setAssocType(ASSOC_TYPE_MONOGRAPH);
     return $returner;
 }
Ejemplo n.º 3
0
 /**
  * Save the email in the monograph email log.
  */
 function log()
 {
     import('classes.monograph.log.MonographEmailLogEntry');
     import('classes.monograph.log.MonographLog');
     $entry = new MonographEmailLogEntry();
     $monograph =& $this->monograph;
     // Log data
     $entry->setEventType($this->eventType);
     $entry->setAssocType($this->assocType);
     $entry->setAssocId($this->assocId);
     // Email data
     $entry->setSubject($this->getSubject());
     $entry->setBody($this->getBody());
     $entry->setFrom($this->getFromString(false));
     $entry->setRecipients($this->getRecipientString());
     $entry->setCcs($this->getCcString());
     $entry->setBccs($this->getBccString());
     // Add log entry
     $logEntryId = MonographLog::logEmailEntry($monograph->getId(), $entry);
     // Add attachments
     import('classes.file.MonographFileManager');
     foreach ($this->getAttachmentFiles() as $attachment) {
         MonographFileManager::temporaryFileToMonographFile($monograph->getId(), $attachment, MONOGRAPH_FILE_ATTACHMENT, $logEntryId, ASSOC_TYPE_MONOGRAPH_EMAIL_LOG_ENTRY);
     }
 }
Ejemplo n.º 4
0
 /**
  * Save the email in the monograph email log.
  */
 function log($request = null)
 {
     import('classes.log.MonographLog');
     $entry = new MonographEmailLogEntry();
     $monograph =& $this->monograph;
     // Event data
     $entry->setEventType($this->logEventType);
     $entry->setAssocType(ASSOC_TYPE_MONOGRAPH);
     $entry->setAssocId($monograph->getId());
     $entry->setDateSent(Core::getCurrentDate());
     // User data
     if ($request) {
         $user =& $request->getUser();
         $entry->setSenderId($user == null ? 0 : $user->getId());
         $entry->setIPAddress($request->getRemoteAddr());
     }
     // Email data
     $entry->setSubject($this->getSubject());
     $entry->setBody($this->getBody());
     $entry->setFrom($this->getFromString(false));
     $entry->setRecipients($this->getRecipientString());
     $entry->setCcs($this->getCcString());
     $entry->setBccs($this->getBccString());
     // Add log entry
     $logDao =& DAORegistry::getDAO('MonographEmailLogDAO');
     $logDao->insertObject($entry);
     // Add attachments
     import('classes.file.MonographFileManager');
     foreach ($this->getAttachmentFiles() as $attachment) {
         MonographFileManager::temporaryFileToMonographFile($monograph->getId(), $attachment, MONOGRAPH_FILE_ATTACHMENT, $logEntryId, ASSOC_TYPE_MONOGRAPH_EMAIL_LOG_ENTRY);
     }
 }