本文整理汇总了PHP中NotificationManager::updateNotification方法的典型用法代码示例。如果您正苦于以下问题:PHP NotificationManager::updateNotification方法的具体用法?PHP NotificationManager::updateNotification怎么用?PHP NotificationManager::updateNotification使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NotificationManager
的用法示例。
在下文中一共展示了NotificationManager::updateNotification方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: deleteFile
/**
* Delete a file or revision
* @param $args array
* @param $request Request
* @return string a serialized JSON object
*/
function deleteFile($args, $request)
{
$submissionFile = $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION_FILE);
$submission = $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION);
$stageId = $request->getUserVar('stageId');
if ($stageId) {
// validate the stage id.
$stageAssignmentDao = DAORegistry::getDAO('StageAssignmentDAO');
$user = $request->getUser();
$stageAssignments = $stageAssignmentDao->getBySubmissionAndStageId($submission->getId(), $stageId, null, $user->getId());
}
assert($submissionFile && $submission);
// Should have been validated already
$noteDao = DAORegistry::getDAO('NoteDAO');
$noteDao->deleteByAssoc(ASSOC_TYPE_SUBMISSION_FILE, $submissionFile->getFileId());
// Delete all signoffs related with this file.
$signoffDao = DAORegistry::getDAO('SignoffDAO');
/* @var $signoffDao SignoffDAO */
$signoffFactory = $signoffDao->getAllByAssocType(ASSOC_TYPE_SUBMISSION_FILE, $submissionFile->getFileId());
$signoffs = $signoffFactory->toArray();
$notificationMgr = new NotificationManager();
foreach ($signoffs as $signoff) {
$signoffDao->deleteObject($signoff);
// Delete for all users.
$notificationMgr->updateNotification($request, array(NOTIFICATION_TYPE_AUDITOR_REQUEST, NOTIFICATION_TYPE_COPYEDIT_ASSIGNMENT), null, ASSOC_TYPE_SIGNOFF, $signoff->getId());
$notificationMgr->updateNotification($request, array(NOTIFICATION_TYPE_SIGNOFF_COPYEDIT, NOTIFICATION_TYPE_SIGNOFF_PROOF), array($signoff->getUserId()), ASSOC_TYPE_SUBMISSION, $submission->getId());
}
// Delete the submission file.
$submissionFileDao = DAORegistry::getDAO('SubmissionFileDAO');
/* @var $submissionFileDao SubmissionFileDAO */
// check to see if we need to remove review_round_file associations
if (!$stageAssignments->wasEmpty()) {
$submissionFileDao->deleteReviewRoundAssignment($submission->getId(), $stageId, $submissionFile->getFileId(), $submissionFile->getRevision());
}
$success = (bool) $submissionFileDao->deleteRevisionById($submissionFile->getFileId(), $submissionFile->getRevision(), $submissionFile->getFileStage(), $submission->getId());
if ($success) {
if ($submissionFile->getFileStage() == SUBMISSION_FILE_REVIEW_REVISION) {
$notificationMgr->updateNotification($request, array(NOTIFICATION_TYPE_PENDING_INTERNAL_REVISIONS, NOTIFICATION_TYPE_PENDING_EXTERNAL_REVISIONS), array($submission->getUserId()), ASSOC_TYPE_SUBMISSION, $submission->getId());
$reviewRoundDao = DAORegistry::getDAO('ReviewRoundDAO');
$lastReviewRound = $reviewRoundDao->getLastReviewRoundBySubmissionId($submission->getId(), $stageId);
$notificationMgr->updateNotification($request, array(NOTIFICATION_TYPE_ALL_REVISIONS_IN), null, ASSOC_TYPE_REVIEW_ROUND, $lastReviewRound->getId());
}
$this->indexSubmissionFiles($submission, $submissionFile);
$fileManager = $this->getFileManager($submission->getContextId(), $submission->getId());
$fileManager->deleteFile($submissionFile->getFileId(), $submissionFile->getRevision());
$this->setupTemplate($request);
$user = $request->getUser();
if (!$request->getUserVar('suppressNotification')) {
NotificationManager::createTrivialNotification($user->getId(), NOTIFICATION_TYPE_SUCCESS, array('contents' => __('notification.removedFile')));
}
$this->logDeletionEvent($request, $submission, $submissionFile, $user);
return DAO::getDataChangedEvent();
} else {
$json = new JSONMessage(false);
return $json->getString();
}
}
示例2: updateCopyeditFiles
/**
* Save 'manage copyedited files' form
* @param $args array
* @param $request PKPRequest
* @return JSONMessage JSON object
*/
function updateCopyeditFiles($args, $request)
{
$submission = $this->getSubmission();
import('lib.pkp.controllers.grid.files.copyedit.form.ManageCopyeditFilesForm');
$manageCopyeditFilesForm = new ManageCopyeditFilesForm($submission->getId());
$manageCopyeditFilesForm->readInputData();
if ($manageCopyeditFilesForm->validate()) {
$manageCopyeditFilesForm->execute($args, $request, $this->getGridCategoryDataElements($request, $this->getStageId()));
$notificationMgr = new NotificationManager();
$notificationMgr->updateNotification($request, array(NOTIFICATION_TYPE_ASSIGN_COPYEDITOR, NOTIFICATION_TYPE_AWAITING_COPYEDITS), null, ASSOC_TYPE_SUBMISSION, $submission->getId());
// Let the calling grid reload itself
return DAO::getDataChangedEvent();
} else {
return new JSONMessage(false);
}
}
示例3: execute
function execute($request, $userRoles)
{
$user = $request->getUser();
// Retrieve the signoff we're working with.
$signoffDao = DAORegistry::getDAO('SubmissionFileSignoffDAO');
$signoff = $signoffDao->getById($this->getData('signoffId'));
assert(is_a($signoff, 'Signoff'));
// Insert the note, if existing content and/or file.
$temporaryFileId = $this->getData('temporaryFileId');
if ($temporaryFileId || $this->getData('newNote')) {
$noteDao = DAORegistry::getDAO('NoteDAO');
$note = $noteDao->newDataObject();
$note->setUserId($user->getId());
$note->setContents($this->getData('newNote'));
$note->setAssocType(ASSOC_TYPE_SIGNOFF);
$note->setAssocId($signoff->getId());
$noteId = $noteDao->insertObject($note);
$note->setId($noteId);
// Upload the file, if any, and associate it with the note.
if ($temporaryFileId) {
// Fetch the temporary file storing the uploaded library file
$temporaryFileDao = DAORegistry::getDAO('TemporaryFileDAO');
$temporaryFile =& $temporaryFileDao->getTemporaryFile($temporaryFileId, $user->getId());
// Upload the file.
// Bring in the SUBMISSION_FILE_* constants
import('lib.pkp.classes.submission.SubmissionFile');
$context = $request->getContext();
import('lib.pkp.classes.file.SubmissionFileManager');
$submissionFileManager = new SubmissionFileManager($context->getId(), $this->_submissionId);
// Get the submission file that is associated with the signoff.
$submissionFileDao = DAORegistry::getDAO('SubmissionFileDAO');
/** @var $submissionFileDao SubmissionFileDAO */
$signoffFile =& $submissionFileDao->getLatestRevision($signoff->getAssocId());
assert(is_a($signoffFile, 'SubmissionFile'));
$noteFileId = $submissionFileManager->temporaryFileToSubmissionFile($temporaryFile, SUBMISSION_FILE_NOTE, $signoff->getUserId(), $signoff->getUserGroupId(), null, $signoffFile->getGenreId(), ASSOC_TYPE_NOTE, $noteId);
}
if ($user->getId() == $signoff->getUserId() && !$signoff->getDateCompleted()) {
// Considered as a signoff response.
// Mark the signoff as completed (we have a note with content
// or a file or both).
$signoff->setDateCompleted(Core::getCurrentDate());
$signoffDao->updateObject($signoff);
$notificationMgr = new NotificationManager();
$notificationMgr->updateNotification($request, array(NOTIFICATION_TYPE_AUDITOR_REQUEST), array($signoff->getUserId()), ASSOC_TYPE_SIGNOFF, $signoff->getId());
$notificationMgr->updateNotification($request, array(NOTIFICATION_TYPE_SIGNOFF_COPYEDIT, NOTIFICATION_TYPE_SIGNOFF_PROOF), array($signoff->getUserId()), ASSOC_TYPE_SUBMISSION, $this->_submissionId);
// Define the success trivial notification locale key.
$successLocaleKey = 'notification.uploadedResponse';
// log the event.
import('lib.pkp.classes.log.SubmissionFileLog');
import('lib.pkp.classes.log.SubmissionFileEventLogEntry');
// constants
$submissionDao = Application::getSubmissionDAO();
$submission = $submissionDao->getById($this->_submissionId);
$submissionFileDao = DAORegistry::getDAO('SubmissionFileDAO');
$submissionFile = $submissionFileDao->getLatestRevision($signoff->getFileId());
if (isset($submissionFile)) {
SubmissionFileLog::logEvent($request, $submissionFile, SUBMISSION_LOG_FILE_AUDIT_UPLOAD, 'submission.event.fileAuditUploaded', array('file' => $submissionFile->getOriginalFileName(), 'name' => $user->getFullName(), 'username' => $user->getUsername()));
}
} else {
// Common note addition.
if ($user->getId() !== $signoff->getUserId() && array_intersect($userRoles, array(ROLE_ID_MANAGER, ROLE_ID_ASSISTANT, ROLE_ID_SUB_EDITOR))) {
// If the current user is a context/series/sub editor or assistant, open the signoff again.
if ($signoff->getDateCompleted()) {
$signoff->setDateCompleted(null);
$signoffDao->updateObject($signoff);
$notificationMgr = new NotificationManager();
$notificationMgr->updateNotification($request, array(NOTIFICATION_TYPE_AUDITOR_REQUEST), array($signoff->getUserId()), ASSOC_TYPE_SIGNOFF, $signoff->getId());
$notificationMgr->updateNotification($request, array(NOTIFICATION_TYPE_SIGNOFF_COPYEDIT, NOTIFICATION_TYPE_SIGNOFF_PROOF), array($signoff->getUserId()), ASSOC_TYPE_SUBMISSION, $this->_submissionId);
}
}
$successLocaleKey = 'notification.addedNote';
}
NotificationManager::createTrivialNotification($user->getId(), NOTIFICATION_TYPE_SUCCESS, array('contents' => __($successLocaleKey)));
return $signoff->getId();
}
}
示例4: signOffsignOff
/**
* Let the user signoff on the signoff
* @param $args array
* @param $request Request
* @return JSONMessage JSON object
*/
function signOffsignOff($args, $request)
{
$rowSignoff = $this->getAuthorizedContextObject(ASSOC_TYPE_SIGNOFF);
if (!$rowSignoff) {
fatalError('Invalid Signoff given');
}
$user = $request->getUser();
$signoffDao = DAORegistry::getDAO('SignoffDAO');
$signoff = $signoffDao->build('SIGNOFF_SIGNOFF', ASSOC_TYPE_SIGNOFF, $rowSignoff->getId(), $user->getId());
$signoff->setDateCompleted(Core::getCurrentDate());
$signoffDao->updateObject($signoff);
// Delete for all users.
$notificationMgr = new NotificationManager();
$notificationMgr->updateNotification($request, array(NOTIFICATION_TYPE_COPYEDIT_ASSIGNMENT), null, ASSOC_TYPE_SIGNOFF, $signoff->getAssocId());
// log the sign off sign off
import('lib.pkp.classes.log.SubmissionFileLog');
import('lib.pkp.classes.log.SubmissionFileEventLogEntry');
// constants
$submissionFileDao = DAORegistry::getDAO('SubmissionFileDAO');
$submissionFile = $submissionFileDao->getLatestRevision($rowSignoff->getAssocId());
if (isset($submissionFile)) {
SubmissionFileLog::logEvent($request, $submissionFile, SUBMISSION_LOG_FILE_SIGNOFF_SIGNOFF, 'submission.event.signoffSignoff', array('file' => $submissionFile->getOriginalFileName(), 'name' => $user->getFullName(), 'username' => $user->getUsername()));
}
// Redraw the row.
return DAO::getDataChangedEvent($rowSignoff->getId(), $rowSignoff->getAssocId());
}
示例5: deleteParticipant
/**
* Delete the participant from the user groups
* @param $args
* @param $request
* @return JSONMessage JSON object
*/
function deleteParticipant($args, $request)
{
$submission = $this->getSubmission();
$stageId = $this->getStageId();
$assignmentId = (int) $request->getUserVar('assignmentId');
$stageAssignmentDao = DAORegistry::getDAO('StageAssignmentDAO');
/* @var $stageAssignmentDao StageAssignmentDAO */
$stageAssignment = $stageAssignmentDao->getById($assignmentId);
if (!$stageAssignment || $stageAssignment->getSubmissionId() != $submission->getId()) {
fatalError('Invalid Assignment');
}
// Delete the assignment
$stageAssignmentDao->deleteObject($stageAssignment);
// FIXME: perhaps we can just insert the notification on page load
// instead of having it there all the time?
$stages = Application::getApplicationStages();
foreach ($stages as $workingStageId) {
// remove user's assignment from this user group from all the stages
// (no need to check if user group is assigned, since nothing will be deleted if there isn't)
$stageAssignmentDao->deleteByAll($submission->getId(), $workingStageId, $stageAssignment->getUserGroupId(), $stageAssignment->getUserId());
}
$notificationMgr = new NotificationManager();
import('classes.workflow.EditorDecisionActionsManager');
$notificationMgr->updateNotification($request, EditorDecisionActionsManager::getStageNotifications(), null, ASSOC_TYPE_SUBMISSION, $submission->getId());
// Log removal.
$userDao = DAORegistry::getDAO('UserDAO');
$assignedUser = $userDao->getById($userId);
$userGroupDao = DAORegistry::getDAO('UserGroupDAO');
$userGroup = $userGroupDao->getById($stageAssignment->getUserGroupId());
import('lib.pkp.classes.log.SubmissionLog');
SubmissionLog::logEvent($request, $submission, SUBMISSION_LOG_REMOVE_PARTICIPANT, 'submission.event.participantRemoved', array('name' => $assignedUser->getFullName(), 'username' => $assignedUser->getUsername(), 'userGroupName' => $userGroup->getLocalizedName()));
// Redraw the category
return DAO::getDataChangedEvent($stageAssignment->getUserGroupId());
}
示例6: reviewRead
/**
* Mark the review as read and trigger a rewrite of the row.
* @param $args array
* @param $request PKPRequest
* @return JSONMessage JSON object
*/
function reviewRead($args, $request)
{
// Retrieve review assignment.
$reviewAssignment = $this->getAuthorizedContextObject(ASSOC_TYPE_REVIEW_ASSIGNMENT);
/* @var $reviewAssignment ReviewAssignment */
// Mark the latest read date of the review by the editor.
$user = $request->getUser();
$viewsDao = DAORegistry::getDAO('ViewsDAO');
$viewsDao->recordView(ASSOC_TYPE_REVIEW_RESPONSE, $reviewAssignment->getId(), $user->getId());
// if the review assignment had been unconsidered, update the flag.
if ($reviewAssignment->getUnconsidered() == REVIEW_ASSIGNMENT_UNCONSIDERED) {
$reviewAssignmentDao = DAORegistry::getDAO('ReviewAssignmentDAO');
$reviewAssignment->setUnconsidered(REVIEW_ASSIGNMENT_UNCONSIDERED_READ);
$reviewAssignmentDao->updateObject($reviewAssignment);
}
if (!$reviewAssignment->getDateCompleted()) {
// Editor completes the review.
$reviewAssignment->setDateConfirmed(Core::getCurrentDate());
$reviewAssignment->setDateCompleted(Core::getCurrentDate());
}
$this->_updateReviewRoundStatus($reviewAssignment);
// Remove the reviewer task.
$notificationDao = DAORegistry::getDAO('NotificationDAO');
$notificationDao->deleteByAssoc(ASSOC_TYPE_REVIEW_ASSIGNMENT, $reviewAssignment->getId(), $reviewAssignment->getReviewerId(), NOTIFICATION_TYPE_REVIEW_ASSIGNMENT);
$notificationMgr = new NotificationManager();
$reviewRound = $this->getReviewRound();
$notificationMgr->updateNotification($request, array(NOTIFICATION_TYPE_ALL_REVIEWS_IN), null, ASSOC_TYPE_REVIEW_ROUND, $reviewRound->getId());
return DAO::getDataChangedEvent($reviewAssignment->getId());
}
示例7: _saveEditorDecision
/**
* Save an editor decision.
* @param $args array
* @param $request PKPRequest
* @param $formName string Name of form to call
* @param $redirectOp string A workflow stage operation to
* redirect to if successful (if any).
* @return string Serialized JSON object
*/
protected function _saveEditorDecision($args, $request, $formName, $redirectOp = null, $decision = null)
{
// Retrieve the authorized submission.
$submission = $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION);
// Retrieve the decision
if (is_null($decision)) {
$decision = (int) $request->getUserVar('decision');
}
$editorDecisionForm = $this->_getEditorDecisionForm($formName, $decision);
$editorDecisionForm->readInputData();
if ($editorDecisionForm->validate()) {
$editorDecisionForm->execute($args, $request);
// Update editor decision and pending revisions notifications.
$notificationMgr = new NotificationManager();
$editorDecisionNotificationType = $this->_getNotificationTypeByEditorDecision($decision);
$notificationTypes = $this->_getReviewNotificationTypes();
$notificationTypes[] = $editorDecisionNotificationType;
$notificationMgr->updateNotification($request, $notificationTypes, array($submission->getUserId()), ASSOC_TYPE_SUBMISSION, $submission->getId());
$reviewRound = $this->getAuthorizedContextObject(ASSOC_TYPE_REVIEW_ROUND);
if ($reviewRound) {
$notificationMgr->updateNotification($request, array(NOTIFICATION_TYPE_ALL_REVIEWS_IN), null, ASSOC_TYPE_REVIEW_ROUND, $reviewRound->getId());
$notificationMgr->updateNotification($request, array(NOTIFICATION_TYPE_ALL_REVISIONS_IN), null, ASSOC_TYPE_REVIEW_ROUND, $reviewRound->getId());
}
if ($redirectOp) {
$dispatcher = $this->getDispatcher();
$redirectUrl = $dispatcher->url($request, ROUTE_PAGE, null, 'workflow', $redirectOp, array($submission->getId()));
return $request->redirectUrlJson($redirectUrl);
} else {
// Needed to update review round status notifications.
return DAO::getDataChangedEvent();
}
} else {
$json = new JSONMessage(false);
}
return $json->getString();
}
示例8: _attachEntities
/**
* Attach any dependent entities to a new file upload.
* @param $submissionFile SubmissionFile
*/
protected function _attachEntities($submissionFile)
{
switch ($submissionFile->getFileStage()) {
case SUBMISSION_FILE_REVIEW_FILE:
case SUBMISSION_FILE_REVIEW_ATTACHMENT:
case SUBMISSION_FILE_REVIEW_REVISION:
// Add the uploaded review file to the review round.
$reviewRound = $this->getReviewRound();
$submissionFileDao = DAORegistry::getDAO('SubmissionFileDAO');
$submissionFileDao->assignRevisionToReviewRound($submissionFile->getFileId(), $submissionFile->getRevision(), $reviewRound);
if ($submissionFile->getFileStage() == SUBMISSION_FILE_REVIEW_REVISION) {
// Get a list of author user IDs
$authorUserIds = array();
$stageAssignmentDao = DAORegistry::getDAO('StageAssignmentDAO');
$submitterAssignments = $stageAssignmentDao->getBySubmissionAndRoleId($reviewRound->getSubmissionId(), ROLE_ID_AUTHOR);
while ($assignment = $submitterAssignments->next()) {
$authorUserIds[] = $assignment->getUserId();
}
// Update the notifications
$notificationMgr = new NotificationManager();
$notificationMgr->updateNotification(PKPApplication::getRequest(), array(NOTIFICATION_TYPE_PENDING_INTERNAL_REVISIONS, NOTIFICATION_TYPE_PENDING_EXTERNAL_REVISIONS), $authorUserIds, ASSOC_TYPE_SUBMISSION, $reviewRound->getSubmissionId());
$notificationMgr->updateNotification(PKPApplication::getRequest(), array(NOTIFICATION_TYPE_ALL_REVISIONS_IN), null, ASSOC_TYPE_REVIEW_ROUND, $reviewRound->getId());
}
break;
}
}
示例9: execute
//.........这里部分代码省略.........
$temporaryFilePath = $temporaryFile->getFilePath();
import('classes.file.SimpleMonographFileManager');
$simpleMonographFileManager = new SimpleMonographFileManager($monograph->getPressId(), $publishedMonograph->getId());
$basePath = $simpleMonographFileManager->getBasePath();
// Delete the old file if it exists
$oldSetting = $publishedMonograph->getCoverImage();
if ($oldSetting) {
$simpleMonographFileManager->deleteFile($basePath . $oldSetting['thumbnailName']);
$simpleMonographFileManager->deleteFile($basePath . $oldSetting['catalogName']);
$simpleMonographFileManager->deleteFile($basePath . $oldSetting['name']);
}
// The following variables were fetched in validation
assert($this->_sizeArray && $this->_imageExtension);
// Load the cover image for surrogate production
$cover = null;
// Scrutinizer
switch ($this->_imageExtension) {
case '.jpg':
$cover = imagecreatefromjpeg($temporaryFilePath);
break;
case '.png':
$cover = imagecreatefrompng($temporaryFilePath);
break;
case '.gif':
$cover = imagecreatefromgif($temporaryFilePath);
break;
}
assert(isset($cover));
// Copy the new file over (involves creating the appropriate subdirectory too)
$filename = 'cover' . $this->_imageExtension;
$simpleMonographFileManager->copyFile($temporaryFile->getFilePath(), $basePath . $filename);
// Generate surrogate images (thumbnail and catalog image)
$press = $request->getPress();
$coverThumbnailsMaxWidth = $press->getSetting('coverThumbnailsMaxWidth');
$coverThumbnailsMaxHeight = $press->getSetting('coverThumbnailsMaxHeight');
$thumbnailImageInfo = $this->_buildSurrogateImage($cover, $basePath, SUBMISSION_IMAGE_TYPE_THUMBNAIL, $coverThumbnailsMaxWidth, $coverThumbnailsMaxHeight);
$catalogImageInfo = $this->_buildSurrogateImage($cover, $basePath, SUBMISSION_IMAGE_TYPE_CATALOG);
// Clean up
imagedestroy($cover);
$publishedMonograph->setCoverImage(array('name' => $filename, 'width' => $this->_sizeArray[0], 'height' => $this->_sizeArray[1], 'thumbnailName' => $thumbnailImageInfo['filename'], 'thumbnailWidth' => $thumbnailImageInfo['width'], 'thumbnailHeight' => $thumbnailImageInfo['height'], 'catalogName' => $catalogImageInfo['filename'], 'catalogWidth' => $catalogImageInfo['width'], 'catalogHeight' => $catalogImageInfo['height'], 'uploadName' => $temporaryFile->getOriginalFileName(), 'dateUploaded' => Core::getCurrentDate()));
// Clean up the temporary file
import('lib.pkp.classes.file.TemporaryFileManager');
$temporaryFileManager = new TemporaryFileManager();
$temporaryFileManager->deleteFile($temporaryFileId, $this->_userId);
}
if ($this->getData('attachPermissions')) {
$monograph->setCopyrightYear($this->getData('copyrightYear'));
$monograph->setCopyrightHolder($this->getData('copyrightHolder'), null);
// Localized
$monograph->setLicenseURL($this->getData('licenseURL'));
} else {
$monograph->setCopyrightYear(null);
$monograph->setCopyrightHolder(null, null);
$monograph->setLicenseURL(null);
}
$monographDao->updateObject($monograph);
// Update the modified fields or insert new.
if ($isExistingEntry) {
$publishedMonographDao->updateObject($publishedMonograph);
} else {
$publishedMonographDao->insertObject($publishedMonograph);
}
import('classes.publicationFormat.PublicationFormatTombstoneManager');
$publicationFormatTombstoneMgr = new PublicationFormatTombstoneManager();
$publicationFormatDao = DAORegistry::getDAO('PublicationFormatDAO');
$publicationFormatFactory = $publicationFormatDao->getBySubmissionId($monograph->getId());
$publicationFormats = $publicationFormatFactory->toAssociativeArray();
$notificationMgr = new NotificationManager();
if ($this->getData('confirm')) {
// Update the monograph status.
$monograph->setStatus(STATUS_PUBLISHED);
$monographDao->updateObject($monograph);
$publishedMonograph->setDatePublished(Core::getCurrentDate());
$publishedMonographDao->updateObject($publishedMonograph);
$notificationMgr->updateNotification($request, array(NOTIFICATION_TYPE_APPROVE_SUBMISSION), null, ASSOC_TYPE_MONOGRAPH, $publishedMonograph->getId());
// Remove publication format tombstones.
$publicationFormatTombstoneMgr->deleteTombstonesByPublicationFormats($publicationFormats);
// Update the search index for this published monograph.
import('classes.search.MonographSearchIndex');
MonographSearchIndex::indexMonographMetadata($monograph);
// Log the publication event.
import('lib.pkp.classes.log.SubmissionLog');
SubmissionLog::logEvent($request, $monograph, SUBMISSION_LOG_METADATA_PUBLISH, 'submission.event.metadataPublished');
} else {
if ($isExistingEntry) {
// Update the monograph status.
$monograph->setStatus(STATUS_QUEUED);
$monographDao->updateObject($monograph);
// Unpublish monograph.
$publishedMonograph->setDatePublished(null);
$publishedMonographDao->updateObject($publishedMonograph);
$notificationMgr->updateNotification($request, array(NOTIFICATION_TYPE_APPROVE_SUBMISSION), null, ASSOC_TYPE_MONOGRAPH, $publishedMonograph->getId());
// Create tombstones for each publication format.
$publicationFormatTombstoneMgr->insertTombstonesByPublicationFormats($publicationFormats, $request->getContext());
// Log the unpublication event.
import('lib.pkp.classes.log.SubmissionLog');
SubmissionLog::logEvent($request, $monograph, SUBMISSION_LOG_METADATA_UNPUBLISH, 'submission.event.metadataUnpublished');
}
}
}
示例10: sendNotification
/**
* Send a notification from the notify tab.
* @param $args array
* @param $request PKPRequest
* @return JSONMessage JSON object
*/
function sendNotification($args, $request)
{
$this->setupTemplate($request);
import('controllers.grid.users.stageParticipant.form.StageParticipantNotifyForm');
// exists in each app.
$notifyForm = new StageParticipantNotifyForm($this->getSubmission()->getId(), ASSOC_TYPE_SUBMISSION, $this->getAuthorizedContextObject(ASSOC_TYPE_WORKFLOW_STAGE));
$notifyForm->readInputData($request);
if ($notifyForm->validate()) {
$noteId = $notifyForm->execute($request);
// Return a JSON string indicating success
// (will clear the form on return)
$this->_logEventAndCreateNotification($request);
// Update submission notifications
$notificationMgr = new NotificationManager();
$notificationMgr->updateNotification($request, array(NOTIFICATION_TYPE_ASSIGN_COPYEDITOR, NOTIFICATION_TYPE_AWAITING_COPYEDITS, NOTIFICATION_TYPE_ASSIGN_PRODUCTIONUSER, NOTIFICATION_TYPE_AWAITING_REPRESENTATIONS), null, ASSOC_TYPE_SUBMISSION, $this->getSubmission()->getId());
return new JSONMessage(true);
} else {
// Return a JSON string indicating failure
return new JSONMessage(false);
}
}
示例11: execute
/**
* Save changes to submission.
* @param $args array
* @param $request PKPRequest
* @return int the submission ID
*/
function execute($args, $request)
{
$submissionDao = Application::getSubmissionDAO();
// Set other submission data.
if ($this->submission->getSubmissionProgress() <= $this->step) {
$this->submission->setDateSubmitted(Core::getCurrentDate());
$this->submission->stampStatusModified();
$this->submission->setSubmissionProgress(0);
}
parent::execute($this->submission);
// Save the submission.
$submissionDao->updateObject($this->submission);
// Assign the default stage participants.
$userGroupDao = DAORegistry::getDAO('UserGroupDAO');
// Assistant roles -- For each assistant role user group assigned to this
// stage in setup, iff there is only one user for the group,
// automatically assign the user to the stage
// But skip authors and reviewers, since these are very submission specific
$stageAssignmentDao = DAORegistry::getDAO('StageAssignmentDAO');
$submissionStageGroups = $userGroupDao->getUserGroupsByStage($this->submission->getContextId(), WORKFLOW_STAGE_ID_SUBMISSION, true, true);
$managerFound = false;
while ($userGroup = $submissionStageGroups->next()) {
$users = $userGroupDao->getUsersById($userGroup->getId(), $this->submission->getContextId());
if ($users->getCount() == 1) {
$user = $users->next();
$stageAssignmentDao->build($this->submission->getId(), $userGroup->getId(), $user->getId());
if ($userGroup->getRoleId() == ROLE_ID_MANAGER) {
$managerFound = true;
}
}
}
// Author roles
// Assign only the submitter in whatever ROLE_ID_AUTHOR capacity they were assigned previously
$user = $request->getUser();
$submitterAssignments = $stageAssignmentDao->getBySubmissionAndStageId($this->submission->getId(), null, null, $user->getId());
while ($assignment = $submitterAssignments->next()) {
$userGroup = $userGroupDao->getById($assignment->getUserGroupId());
if ($userGroup->getRoleId() == ROLE_ID_AUTHOR) {
$stageAssignmentDao->build($this->submission->getId(), $userGroup->getId(), $assignment->getUserId());
// Only assign them once, since otherwise we'll one assignment for each previous stage.
// And as long as they are assigned once, they will get access to their submission.
break;
}
}
$notificationManager = new NotificationManager();
// Assign sub editors for that section
$submissionSubEditorFound = false;
$subEditorsDao = DAORegistry::getDAO('SubEditorsDAO');
$subEditors = $subEditorsDao->getBySectionId($this->submission->getSectionId(), $this->submission->getContextId());
foreach ($subEditors as $subEditor) {
$userGroups = $userGroupDao->getByUserId($subEditor->getId(), $this->submission->getContextId());
while ($userGroup = $userGroups->next()) {
if ($userGroup->getRoleId() != ROLE_ID_SUB_EDITOR) {
continue;
}
$stageAssignmentDao->build($this->submission->getId(), $userGroup->getId(), $subEditor->getId());
// If we assign a stage assignment in the Submission stage to a sub editor, make note.
if ($userGroupDao->userGroupAssignedToStage($userGroup->getId(), WORKFLOW_STAGE_ID_SUBMISSION)) {
$submissionSubEditorFound = true;
}
}
}
// Update assignment notifications
import('classes.workflow.EditorDecisionActionsManager');
$notificationManager->updateNotification($request, EditorDecisionActionsManager::getStageNotifications(), null, ASSOC_TYPE_SUBMISSION, $this->submission->getId());
// Send a notification to associated users if an editor needs assigning
if (!$managerFound && !$submissionSubEditorFound) {
$roleDao = DAORegistry::getDAO('RoleDAO');
/* @var $roleDao RoleDAO */
// Get the managers.
$managers = $roleDao->getUsersByRoleId(ROLE_ID_MANAGER, $this->submission->getContextId());
$managersArray = $managers->toAssociativeArray();
$allUserIds = array_keys($managersArray);
foreach ($allUserIds as $userId) {
$notificationManager->createNotification($request, $userId, NOTIFICATION_TYPE_SUBMISSION_SUBMITTED, $this->submission->getContextId(), ASSOC_TYPE_SUBMISSION, $this->submission->getId());
// Add TASK notification indicating that a submission is unassigned
$notificationManager->createNotification($request, $userId, NOTIFICATION_TYPE_EDITOR_ASSIGNMENT_REQUIRED, $this->submission->getContextId(), ASSOC_TYPE_SUBMISSION, $this->submission->getId(), NOTIFICATION_LEVEL_TASK);
}
}
$notificationManager->updateNotification($request, array(NOTIFICATION_TYPE_APPROVE_SUBMISSION), null, ASSOC_TYPE_SUBMISSION, $this->submission->getId());
return $this->submissionId;
}
示例12: execute
/**
* @see Form::execute()
* @param $request Request
* @return MonographFile if successful, otherwise null
*/
function execute($request)
{
// Retrieve the signoff we're working with.
$signoffDao = DAORegistry::getDAO('SubmissionFileSignoffDAO');
$signoff = $signoffDao->getById($this->getData('signoffId'));
assert(is_a($signoff, 'Signoff'));
// Insert the note, if existing content and/or file.
$temporaryFileId = $this->getData('temporaryFileId');
if ($temporaryFileId || $this->getData('newNote')) {
$user = $request->getUser();
$noteDao = DAORegistry::getDAO('NoteDAO');
$note = $noteDao->newDataObject();
$note->setUserId($user->getId());
$note->setContents($this->getData('newNote'));
$note->setAssocType(ASSOC_TYPE_SIGNOFF);
$note->setAssocId($signoff->getId());
$noteId = $noteDao->insertObject($note);
$note->setId($noteId);
// Upload the file, if any, and associate it with the note.
if ($temporaryFileId) {
// Fetch the temporary file storing the uploaded library file
$temporaryFileDao = DAORegistry::getDAO('TemporaryFileDAO');
$temporaryFile = $temporaryFileDao->getTemporaryFile($temporaryFileId, $user->getId());
// Upload the file.
// Bring in the SUBMISSION_FILE_* constants
import('classes.monograph.MonographFile');
$press = $request->getPress();
import('lib.pkp.classes.file.SubmissionFileManager');
$monographFileManager = new SubmissionFileManager($press->getId(), $this->getMonographId());
$signoffFileId = $monographFileManager->temporaryFileToSubmissionFile($temporaryFile, SUBMISSION_FILE_NOTE, $signoff->getUserId(), $signoff->getUserGroupId(), $signoff->getAssocId(), null, ASSOC_TYPE_NOTE, $noteId);
// FIXME: Currently the code allows for a signoff to be
// added many times (if the option is presented in the
// form). Need to delete previous files uploaded to this
// signoff. Partially due to #6799.
// Mark ALL the signoffs for this user as completed with this file upload.
if ($signoffFileId) {
$signoff->setFileId($signoffFileId);
$signoff->setFileRevision(1);
}
}
// Now mark the signoff as completed (we have a note with content
// or a file or both).
$signoff->setDateCompleted(Core::getCurrentDate());
$signoffDao->updateObject($signoff);
$notificationMgr = new NotificationManager();
$notificationMgr->updateNotification($request, array(NOTIFICATION_TYPE_AUDITOR_REQUEST), array($signoff->getUserId()), ASSOC_TYPE_SIGNOFF, $signoff->getId());
$notificationMgr->updateNotification($request, array(NOTIFICATION_TYPE_SIGNOFF_COPYEDIT, NOTIFICATION_TYPE_SIGNOFF_PROOF), array($signoff->getUserId()), ASSOC_TYPE_SUBMISSION, $this->getMonographId());
// log the event.
import('lib.pkp.classes.log.SubmissionFileLog');
import('lib.pkp.classes.log.SubmissionFileEventLogEntry');
// constants
$submissionFileDao = DAORegistry::getDAO('SubmissionFileDAO');
$monographFile = $submissionFileDao->getLatestRevision($signoff->getFileId());
if (isset($monographFile)) {
SubmissionFileLog::logEvent($request, $monographFile, SUBMISSION_LOG_FILE_AUDIT_UPLOAD, 'submission.event.fileAuditUploaded', array('file' => $monographFile->getOriginalFileName(), 'name' => $user->getFullName(), 'username' => $user->getUsername()));
}
return $signoff->getId();
}
}
示例13: saveMetadata
/**
* Save the metadata of the latest revision of
* the requested submission file
* @param $args array
* @param $request Request
* @return string a serialized JSON object
*/
function saveMetadata($args, $request)
{
$submission = $this->getSubmission();
$metadataForm = $this->_getMetadataForm($request);
$metadataForm->readInputData();
if ($metadataForm->validate()) {
$metadataForm->execute($args, $request);
$submissionFile = $metadataForm->getSubmissionFile();
$notificationMgr = new NotificationManager();
/* @var $notificationMgr NotificationManager */
$submission = $this->getSubmission();
$notificationMgr->updateNotification($request, $this->_getUpdateNotifications(), array($submission->getUserId()), ASSOC_TYPE_SUBMISSION, $submission->getId());
$reviewRound = $this->getReviewRound();
if ($reviewRound) {
$notificationMgr->updateNotification($request, array(NOTIFICATION_TYPE_ALL_REVISIONS_IN), null, ASSOC_TYPE_REVIEW_ROUND, $reviewRound->getId());
// Delete any 'revision requested' notifications since all revisions are now in.
$context = $request->getContext();
$notificationDao = DAORegistry::getDAO('NotificationDAO');
$notificationDao->deleteByAssoc(ASSOC_TYPE_SUBMISSION, $submission->getId(), $submission->getUserId(), NOTIFICATION_TYPE_EDITOR_DECISION_PENDING_REVISIONS, $context->getId());
}
// Log the upload event
import('lib.pkp.classes.log.SubmissionLog');
import('classes.log.SubmissionEventLogEntry');
import('lib.pkp.classes.log.SubmissionFileEventLogEntry');
// constants
$user = $request->getUser();
SubmissionLog::logEvent($request, $submission, $submissionFile->getRevision() > 1 ? SUBMISSION_LOG_FILE_REVISION_UPLOAD : SUBMISSION_LOG_FILE_UPLOAD, $submissionFile->getRevision() > 1 ? 'submission.event.fileRevised' : 'submission.event.fileUploaded', array('fileStage' => $submissionFile->getFileStage(), 'fileId' => $submissionFile->getFileId(), 'fileRevision' => $submissionFile->getRevision(), 'originalFileName' => $submissionFile->getOriginalFileName(), 'submissionId' => $submissionFile->getSubmissionId(), 'username' => $user->getUsername()));
return DAO::getDataChangedEvent();
} else {
$json = new JSONMessage(false, $metadataForm->fetch($request));
}
return $json->getString();
}
示例14: insertEntry
/**
* Persist a signoff insertion
* @see ListbuilderHandler::insertEntry
*/
function insertEntry($request, $newRowId)
{
// Fetch and validate the file ID
$fileId = (int) $newRowId['name'];
$submission = $this->getSubmission();
$submissionFileDao = DAORegistry::getDAO('SubmissionFileDAO');
$submissionFile = $submissionFileDao->getLatestRevision($fileId, null, $submission->getId());
assert($submissionFile);
// FIXME: How to validate user IDs?
$userId = (int) $this->getData('userId');
// Fetch and validate user group ID
$userGroupId = (int) $this->getData('userGroupId');
$context = $request->getContext();
$userGroupDao = DAORegistry::getDAO('UserGroupDAO');
$userGroup = $userGroupDao->getById($userGroupId, $context->getId());
// Build the signoff.
$submissionFileSignoffDao = DAORegistry::getDAO('SubmissionFileSignoffDAO');
$signoff = $submissionFileSignoffDao->build($this->getSymbolic(), $submissionFile->getFileId(), $userId, $userGroup->getId());
/* @var $signoff Signoff */
// Set the date notified
$signoff->setDateNotified(Core::getCurrentDate());
// Set the date response due (stored as date underway in signoffs table)
$dueDateParts = explode('-', $this->getData('responseDueDate'));
$signoff->setDateUnderway(date('Y-m-d H:i:s', mktime(0, 0, 0, $dueDateParts[0], $dueDateParts[1], $dueDateParts[2])));
$submissionFileSignoffDao->updateObject($signoff);
$this->_signoffId = $signoff->getId();
$this->_fileId = $signoff->getAssocId();
$notificationMgr = new NotificationManager();
$notificationMgr->updateNotification($request, array(NOTIFICATION_TYPE_AUDITOR_REQUEST), array($signoff->getUserId()), ASSOC_TYPE_SIGNOFF, $signoff->getId());
// log the add auditor event.
import('lib.pkp.classes.log.SubmissionFileLog');
import('lib.pkp.classes.log.SubmissionFileEventLogEntry');
// constants
$userDao = DAORegistry::getDAO('UserDAO');
$user = $userDao->getById($userId);
if (isset($user)) {
SubmissionFileLog::logEvent($request, $submissionFile, SUBMISSION_LOG_FILE_AUDITOR_ASSIGN, 'submission.event.fileAuditorAdded', array('file' => $submissionFile->getOriginalFileName(), 'name' => $user->getFullName(), 'username' => $user->getUsername()));
}
$notificationMgr->updateNotification($request, array(NOTIFICATION_TYPE_SIGNOFF_COPYEDIT, NOTIFICATION_TYPE_SIGNOFF_PROOF), array($signoff->getUserId()), ASSOC_TYPE_SUBMISSION, $submission->getId());
}
示例15: addReviewer
/**
* Assigns a reviewer to a submission.
* @param $request PKPRequest
* @param $submission object
* @param $reviewerId int
* @param $reviewRound ReviewRound
* @param $reviewDueDate datetime optional
* @param $responseDueDate datetime optional
*/
function addReviewer($request, $submission, $reviewerId, &$reviewRound, $reviewDueDate = null, $responseDueDate = null, $reviewMethod = null)
{
$reviewAssignmentDao = DAORegistry::getDAO('ReviewAssignmentDAO');
$userDao = DAORegistry::getDAO('UserDAO');
$reviewer = $userDao->getById($reviewerId);
// Check to see if the requested reviewer is not already
// assigned to review this submission.
$assigned = $reviewAssignmentDao->reviewerExists($reviewRound->getId(), $reviewerId);
// Only add the reviewer if he has not already
// been assigned to review this submission.
$stageId = $reviewRound->getStageId();
$round = $reviewRound->getRound();
if (!$assigned && isset($reviewer) && !HookRegistry::call('EditorAction::addReviewer', array(&$submission, $reviewerId))) {
$reviewAssignment = new ReviewAssignment();
$reviewAssignment->setSubmissionId($submission->getId());
$reviewAssignment->setReviewerId($reviewerId);
$reviewAssignment->setDateAssigned(Core::getCurrentDate());
$reviewAssignment->setStageId($stageId);
$reviewAssignment->setRound($round);
$reviewAssignment->setReviewRoundId($reviewRound->getId());
if (isset($reviewMethod)) {
$reviewAssignment->setReviewMethod($reviewMethod);
}
$reviewAssignmentDao->insertObject($reviewAssignment);
// Stamp modification date
$submission->stampStatusModified();
$submissionDao = Application::getSubmissionDAO();
$submissionDao->updateObject($submission);
$this->setDueDates($request, $submission, $reviewAssignment, $reviewDueDate, $responseDueDate);
// Add notification
$notificationMgr = new NotificationManager();
$notificationMgr->createNotification($request, $reviewerId, NOTIFICATION_TYPE_REVIEW_ASSIGNMENT, $submission->getContextId(), ASSOC_TYPE_REVIEW_ASSIGNMENT, $reviewAssignment->getId(), NOTIFICATION_LEVEL_TASK);
// Insert a trivial notification to indicate the reviewer was added successfully.
$currentUser = $request->getUser();
$notificationMgr = new NotificationManager();
$notificationMgr->createTrivialNotification($currentUser->getId(), NOTIFICATION_TYPE_SUCCESS, array('contents' => __('notification.addedReviewer')));
// Update the review round status.
$reviewRoundDao = DAORegistry::getDAO('ReviewRoundDAO');
/* @var $reviewRoundDao ReviewRoundDAO */
$reviewAssignments = $reviewAssignmentDao->getBySubmissionId($submission->getId(), $reviewRound->getId(), $stageId);
$reviewRoundDao->updateStatus($reviewRound, $reviewAssignments);
$notificationMgr->updateNotification($request, array(NOTIFICATION_TYPE_ALL_REVIEWS_IN), null, ASSOC_TYPE_REVIEW_ROUND, $reviewRound->getId());
// Add log
import('lib.pkp.classes.log.SubmissionLog');
import('lib.pkp.classes.log.PKPSubmissionEventLogEntry');
SubmissionLog::logEvent($request, $submission, SUBMISSION_LOG_REVIEW_ASSIGN, 'log.review.reviewerAssigned', array('reviewerName' => $reviewer->getFullName(), 'submissionId' => $submission->getId(), 'stageId' => $stageId, 'round' => $round));
}
}