Ejemplo n.º 1
0
 /**
  * Add a new event log entry with the specified parameters, including log level.
  * @param $monographId int
  * @param $logLevel char
  * @param $eventType int
  * @param $assocType int
  * @param $assocId int
  * @param $messageKey string
  * @param $messageParams array
  */
 function logEventLevel($monographId, $logLevel, $eventType, $assocType = 0, $assocId = 0, $messageKey = null, $messageParams = array())
 {
     $entry = new MonographEventLogEntry();
     $entry->setLogLevel($logLevel);
     $entry->setEventType($eventType);
     $entry->setAssocType($assocType);
     $entry->setAssocId($assocId);
     if (isset($messageKey)) {
         $entry->setLogMessage($messageKey, $messageParams);
     }
     return MonographLog::logEventEntry($monographId, $entry);
 }
Ejemplo n.º 2
0
 /**
  * Sets the due date for a review assignment.
  * @param $monographId int
  * @param $reviewId int
  * @param $dueDate string
  * @param $numWeeks int
  * @param $logEntry boolean
  */
 function setDueDate($monographId, $reviewId, $dueDate = null, $numWeeks = null, $logEntry = false)
 {
     $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
     $userDao =& DAORegistry::getDAO('UserDAO');
     $user =& Request::getUser();
     $reviewAssignment =& $reviewAssignmentDao->getById($reviewId);
     $reviewer =& $userDao->getUser($reviewAssignment->getReviewerId());
     if (!isset($reviewer)) {
         return false;
     }
     if ($reviewAssignment->getSubmissionId() == $monographId && !HookRegistry::call('SeriesEditorAction::setDueDate', array(&$reviewAssignment, &$reviewer, &$dueDate, &$numWeeks))) {
         $today = getDate();
         $todayTimestamp = mktime(0, 0, 0, $today['mon'], $today['mday'], $today['year']);
         if ($dueDate != null) {
             $dueDateParts = explode('-', $dueDate);
             // Ensure that the specified due date is today or after today's date.
             if ($todayTimestamp <= strtotime($dueDate)) {
                 $reviewAssignment->setDateDue(date('Y-m-d H:i:s', mktime(0, 0, 0, $dueDateParts[1], $dueDateParts[2], $dueDateParts[0])));
             } else {
                 $reviewAssignment->setDateDue(date('Y-m-d H:i:s', $todayTimestamp));
             }
         } else {
             // Add the equivilant of $numWeeks weeks, measured in seconds, to $todaysTimestamp.
             $numWeeks = max((int) $numWeeks, 2);
             $newDueDateTimestamp = $todayTimestamp + $numWeeks * 7 * 24 * 60 * 60;
             $reviewAssignment->setDateDue(date('Y-m-d H:i:s', $newDueDateTimestamp));
         }
         $reviewAssignment->stampModified();
         $reviewAssignmentDao->updateObject($reviewAssignment);
         if ($logEntry) {
             // Add log
             import('classes.monograph.log.MonographLog');
             import('classes.monograph.log.MonographEventLogEntry');
             MonographLog::logEvent($monographId, MONOGRAPH_LOG_REVIEW_SET_DUE_DATE, MONOGRAPH_LOG_TYPE_REVIEW, $reviewAssignment->getId(), 'log.review.reviewDueDateSet', array('reviewerName' => $reviewer->getFullName(), 'dueDate' => strftime(Config::getVar('general', 'date_format_short'), strtotime($reviewAssignment->getDateDue())), 'monographId' => $monographId, 'reviewType' => $reviewAssignment->getReviewType(), 'round' => $reviewAssignment->getRound()));
         }
     }
 }
Ejemplo n.º 3
0
 /**
  * Records whether or not the reviewer accepts the review assignment.
  * @param $reviewerSubmission object
  * @param $decline boolean
  * @param $send boolean
  */
 function confirmReview($request, $reviewerSubmission, $decline, $send)
 {
     $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
     $userDao =& DAORegistry::getDAO('UserDAO');
     $reviewId = $reviewerSubmission->getReviewId();
     $reviewAssignment =& $reviewAssignmentDao->getById($reviewId);
     $reviewer =& $userDao->getUser($reviewAssignment->getReviewerId());
     if (!isset($reviewer)) {
         return true;
     }
     // Only confirm the review for the reviewer if
     // he has not previously done so.
     if ($reviewAssignment->getDateConfirmed() == null) {
         import('classes.mail.MonographMailTemplate');
         $email = new MonographMailTemplate($reviewerSubmission, $decline ? 'REVIEW_DECLINE' : 'REVIEW_CONFIRM');
         // Must explicitly set sender because we may be here on an access
         // key, in which case the user is not technically logged in
         $email->setFrom($reviewer->getEmail(), $reviewer->getFullName());
         if (!$email->isEnabled() || $send && !$email->hasErrors()) {
             HookRegistry::call('ReviewerAction::confirmReview', array(&$request, &$reviewerSubmission, &$email, $decline));
             if ($email->isEnabled()) {
                 $email->setEventType($decline ? MONOGRAPH_EMAIL_REVIEW_DECLINE : MONOGRAPH_EMAIL_REVIEW_CONFIRM);
                 $email->send($request);
             }
             $reviewAssignment->setDeclined($decline);
             $reviewAssignment->setDateConfirmed(Core::getCurrentDate());
             $reviewAssignment->stampModified();
             $reviewAssignmentDao->updateObject($reviewAssignment);
             // Add log
             import('classes.log.MonographLog');
             import('classes.log.MonographEventLogEntry');
             $entry = new MonographEventLogEntry();
             $entry->setMonographId($reviewAssignment->getSubmissionId());
             $entry->setUserId($reviewer->getId());
             $entry->setDateLogged(Core::getCurrentDate());
             $entry->setEventType($decline ? MONOGRAPH_LOG_REVIEW_DECLINE : MONOGRAPH_LOG_REVIEW_ACCEPT);
             MonographLog::logEvent($request, $reviewerSubmission, $decline ? MONOGRAPH_LOG_REVIEW_DECLINE : MONOGRAPH_LOG_REVIEW_ACCEPT, $decline ? 'log.review.reviewDeclined' : 'log.review.reviewAccepted', array('reviewerName' => $reviewer->getFullName(), 'monographId' => $reviewAssignment->getSubmissionId(), 'round' => $reviewAssignment->getRound()));
             return true;
         } else {
             if (!$request->getUserVar('continued')) {
                 $assignedEditors = $email->ccAssignedEditors($reviewerSubmission->getId());
                 $reviewingSeriesEditors = $email->toAssignedReviewingSeriesEditors($reviewerSubmission->getId());
                 if (empty($assignedEditors) && empty($reviewingSeriesEditors)) {
                     $press =& $request->getPress();
                     $email->addRecipient($press->getSetting('contactEmail'), $press->getSetting('contactName'));
                     $editorialContactName = $press->getSetting('contactName');
                 } else {
                     if (!empty($reviewingSeriesEditors)) {
                         $editorialContact = array_shift($reviewingSeriesEditors);
                     } else {
                         $editorialContact = array_shift($assignedEditors);
                     }
                     $editorialContactName = $editorialContact->getEditorFullName();
                 }
                 // Format the review due date
                 $reviewDueDate = strtotime($reviewAssignment->getDateDue());
                 $dateFormatShort = Config::getVar('general', 'date_format_short');
                 if ($reviewDueDate == -1) {
                     $reviewDueDate = $dateFormatShort;
                 } else {
                     $reviewDueDate = strftime($dateFormatShort, $reviewDueDate);
                 }
                 $email->assignParams(array('editorialContactName' => $editorialContactName, 'reviewerName' => $reviewer->getFullName(), 'reviewDueDate' => $reviewDueDate));
             }
             $paramArray = array('reviewId' => $reviewId);
             if ($decline) {
                 $paramArray['declineReview'] = 1;
             }
             $email->displayEditForm($request->url(null, 'reviewer', 'confirmReview'), $paramArray);
             return false;
         }
     }
     return true;
 }
Ejemplo n.º 4
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);
     }
 }
 /**
  * Log an event for this file
  * @param $args array
  * @param $request PKPRequest
  */
 function _logEvent($itemId, $eventType, $userId)
 {
     assert(!empty($itemId) && !empty($eventType) && !empty($userId));
     // Get the log event message
     switch ($eventType) {
         case MONOGRAPH_LOG_NOTE_POSTED:
             $logMessage = 'informationCenter.history.notePosted';
             break;
         case MONOGRAPH_LOG_MESSAGE_SENT:
             $logMessage = 'informationCenter.history.messageSent';
             break;
     }
     // Get the file in question to get the monograph Id
     $submissionFileDao =& DAORegistry::getDAO('SubmissionFileDAO');
     /* @var $submissionFileDao SubmissionFileDAO */
     $monographFile =& $submissionFileDao->getLatestRevision($itemId);
     $entry = new MonographEventLogEntry();
     $entry->setMonographId($monographFile->getMonographId());
     $entry->setUserId($userId);
     $entry->setDateLogged(Core::getCurrentDate());
     $entry->setEventType($eventType);
     $entry->setLogMessage($logMessage);
     $entry->setAssocType(ASSOC_TYPE_MONOGRAPH_FILE);
     $entry->setAssocId($itemId);
     import('classes.monograph.log.MonographLog');
     MonographLog::logEventEntry($monographFile->getMonographId(), $entry);
 }
 /**
  * Log an event for this file
  */
 function _logEvent($monographId, $eventType, $userId)
 {
     assert(!empty($monographId) && !empty($eventType) && !empty($userId));
     // Get the log event message
     switch ($eventType) {
         case MONOGRAPH_LOG_NOTE_POSTED:
             $logMessage = 'informationCenter.history.notePosted';
             break;
         case MONOGRAPH_LOG_MESSAGE_SENT:
             $logMessage = 'informationCenter.history.messageSent';
             break;
     }
     $entry = new MonographEventLogEntry();
     $entry->setMonographId($monographId);
     $entry->setUserId($userId);
     $entry->setDateLogged(Core::getCurrentDate());
     $entry->setEventType($eventType);
     $entry->setLogMessage($logMessage);
     import('classes.monograph.log.MonographLog');
     MonographLog::logEventEntry($monographId, $entry);
 }
 /**
  * Log an event for this file
  * @param $request PKPRequest
  * @param $eventType MONOGRAPH_LOG_...
  */
 function _logEvent($request, $eventType)
 {
     // Get the log event message
     switch ($eventType) {
         case MONOGRAPH_LOG_NOTE_POSTED:
             $logMessage = 'informationCenter.history.notePosted';
             break;
         case MONOGRAPH_LOG_MESSAGE_SENT:
             $logMessage = 'informationCenter.history.messageSent';
             break;
         default:
             assert(false);
     }
     import('classes.log.MonographLog');
     MonographLog::logEvent($request, $this->monograph, $eventType, $logMessage);
 }