本文整理汇总了PHP中ArticleLog类的典型用法代码示例。如果您正苦于以下问题:PHP ArticleLog类的具体用法?PHP ArticleLog怎么用?PHP ArticleLog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ArticleLog类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: logEvent
/**
* Add a new event log entry with the specified parameters
* @param $request object
* @param $article object
* @param $eventType int
* @param $messageKey string
* @param $params array optional
* @return object ArticleLogEntry iff the event was logged
*/
function logEvent(&$request, &$article, $eventType, $messageKey, $params = array())
{
$journal =& $request->getJournal();
$user =& $request->getUser();
$userId = isset($user) ? $user->getId() : 0;
return ArticleLog::logEventHeadless($journal, $userId, $article, $eventType, $messageKey, $params);
}
示例2: logEventLevel
/**
* Add a new event log entry with the specified parameters, including log level.
* @param $articleId int
* @param $logLevel char
* @param $eventType int
* @param $assocType int
* @param $assocId int
* @param $messageKey string
* @param $messageParams array
*/
function logEventLevel($articleId, $logLevel, $eventType, $assocType = 0, $assocId = 0, $messageKey = null, $messageParams = array())
{
$entry =& new ArticleEventLogEntry();
$entry->setLogLevel($logLevel);
$entry->setEventType($eventType);
$entry->setAssocType($assocType);
$entry->setAssocId($assocId);
if (isset($messageKey)) {
$entry->setLogMessage($messageKey, $messageParams);
}
return ArticleLog::logEventEntry($articleId, $entry);
}
示例3: selectProofreader
/**
* Select a proofreader for submission
*/
function selectProofreader($userId, $article, $request)
{
$signoffDao =& DAORegistry::getDAO('SignoffDAO');
$proofSignoff = $signoffDao->build('SIGNOFF_PROOFREADING_PROOFREADER', ASSOC_TYPE_ARTICLE, $article->getId());
if (!HookRegistry::call('ProofreaderAction::selectProofreader', array(&$userId, &$article))) {
$proofSignoff->setUserId($userId);
$signoffDao->updateObject($proofSignoff);
// Add log entry
$user =& Request::getUser();
$userDao =& DAORegistry::getDAO('UserDAO');
$proofreader =& $userDao->getUser($userId);
if (!isset($proofreader)) {
return;
}
import('classes.article.log.ArticleLog');
import('classes.article.log.ArticleEventLogEntry');
ArticleLog::logEvent($request, $article, ARTICLE_LOG_PROOFREAD_ASSIGN, 'log.proofread.assign', array('assignerName' => $user->getFullName(), 'proofreaderName' => $proofreader->getFullName()));
}
}
示例4: selectProofreader
/**
* Select a proofreader for submission
*/
function selectProofreader($userId, $article)
{
$proofAssignmentDao =& DAORegistry::getDAO('ProofAssignmentDAO');
$proofAssignment =& $proofAssignmentDao->getProofAssignmentByArticleId($article->getArticleId());
if (!HookRegistry::call('ProofreaderAction::selectProofreader', array(&$userId, &$article, &$proofAssignment))) {
$proofAssignment->setProofreaderId($userId);
$proofAssignmentDao->updateProofAssignment($proofAssignment);
// Add log entry
$user =& Request::getUser();
$userDao =& DAORegistry::getDAO('UserDAO');
$proofreader =& $userDao->getUser($userId);
if (!isset($proofreader)) {
return;
}
import('article.log.ArticleLog');
import('article.log.ArticleEventLogEntry');
ArticleLog::logEvent($article->getArticleId(), ARTICLE_LOG_PROOFREAD_ASSIGN, ARTICLE_LOG_TYPE_PROOFREAD, $user->getUserId(), 'log.proofread.assign', array('assignerName' => $user->getFullName(), 'proofreaderName' => $proofreader->getFullName(), 'articleId' => $article->getArticleId()));
}
}
示例5: saveMetadata
/**
* Save metadata.
* @param $article object
* @param $request PKPRequest
*/
function saveMetadata($article, &$request)
{
$router =& $request->getRouter();
if (!HookRegistry::call('Action::saveMetadata', array(&$article))) {
import('classes.submission.form.MetadataForm');
$journal =& $request->getJournal();
$metadataForm = new MetadataForm($article, $journal);
$metadataForm->readInputData();
// Check for any special cases before trying to save
if ($request->getUserVar('addAuthor')) {
// Add an author
$editData = true;
$authors = $metadataForm->getData('authors');
array_push($authors, array());
$metadataForm->setData('authors', $authors);
} else {
if (($delAuthor = $request->getUserVar('delAuthor')) && count($delAuthor) == 1) {
// Delete an author
$editData = true;
list($delAuthor) = array_keys($delAuthor);
$delAuthor = (int) $delAuthor;
$authors = $metadataForm->getData('authors');
if (isset($authors[$delAuthor]['authorId']) && !empty($authors[$delAuthor]['authorId'])) {
$deletedAuthors = explode(':', $metadataForm->getData('deletedAuthors'));
array_push($deletedAuthors, $authors[$delAuthor]['authorId']);
$metadataForm->setData('deletedAuthors', join(':', $deletedAuthors));
}
array_splice($authors, $delAuthor, 1);
$metadataForm->setData('authors', $authors);
if ($metadataForm->getData('primaryContact') == $delAuthor) {
$metadataForm->setData('primaryContact', 0);
}
} else {
if ($request->getUserVar('moveAuthor')) {
// Move an author up/down
$editData = true;
$moveAuthorDir = $request->getUserVar('moveAuthorDir');
$moveAuthorDir = $moveAuthorDir == 'u' ? 'u' : 'd';
$moveAuthorIndex = (int) $request->getUserVar('moveAuthorIndex');
$authors = $metadataForm->getData('authors');
if (!($moveAuthorDir == 'u' && $moveAuthorIndex <= 0 || $moveAuthorDir == 'd' && $moveAuthorIndex >= count($authors) - 1)) {
$tmpAuthor = $authors[$moveAuthorIndex];
$primaryContact = $metadataForm->getData('primaryContact');
if ($moveAuthorDir == 'u') {
$authors[$moveAuthorIndex] = $authors[$moveAuthorIndex - 1];
$authors[$moveAuthorIndex - 1] = $tmpAuthor;
if ($primaryContact == $moveAuthorIndex) {
$metadataForm->setData('primaryContact', $moveAuthorIndex - 1);
} else {
if ($primaryContact == $moveAuthorIndex - 1) {
$metadataForm->setData('primaryContact', $moveAuthorIndex);
}
}
} else {
$authors[$moveAuthorIndex] = $authors[$moveAuthorIndex + 1];
$authors[$moveAuthorIndex + 1] = $tmpAuthor;
if ($primaryContact == $moveAuthorIndex) {
$metadataForm->setData('primaryContact', $moveAuthorIndex + 1);
} else {
if ($primaryContact == $moveAuthorIndex + 1) {
$metadataForm->setData('primaryContact', $moveAuthorIndex);
}
}
}
}
$metadataForm->setData('authors', $authors);
}
}
}
if (isset($editData)) {
$metadataForm->display();
return false;
} else {
if (!$metadataForm->validate()) {
return $metadataForm->display();
}
$metadataForm->execute($request);
// Send a notification to associated users
import('classes.notification.NotificationManager');
$notificationManager = new NotificationManager();
$notificationUsers = $article->getAssociatedUserIds();
foreach ($notificationUsers as $userRole) {
$notificationManager->createNotification($request, $userRole['id'], NOTIFICATION_TYPE_METADATA_MODIFIED, $article->getJournalId(), ASSOC_TYPE_ARTICLE, $article->getId());
}
// Add log entry
$user =& $request->getUser();
import('classes.article.log.ArticleLog');
ArticleLog::logEvent($request, $article, ARTICLE_LOG_METADATA_UPDATE, 'log.editor.metadataModified', array('editorName' => $user->getFullName()));
return true;
}
}
}
示例6: completeAuthorCopyedit
/**
* Author completes editor / author review.
* @param $authorSubmission object
* @param $send boolean
* @param $request object
*/
function completeAuthorCopyedit($authorSubmission, $send, $request)
{
$authorSubmissionDao =& DAORegistry::getDAO('AuthorSubmissionDAO');
$signoffDao =& DAORegistry::getDAO('SignoffDAO');
$userDao =& DAORegistry::getDAO('UserDAO');
$journal =& $request->getJournal();
$authorSignoff = $signoffDao->build('SIGNOFF_COPYEDITING_AUTHOR', ASSOC_TYPE_ARTICLE, $authorSubmission->getId());
if ($authorSignoff->getDateCompleted() != null) {
return true;
}
$user =& $request->getUser();
import('classes.mail.ArticleMailTemplate');
$email = new ArticleMailTemplate($authorSubmission, 'COPYEDIT_AUTHOR_COMPLETE');
$editAssignments = $authorSubmission->getEditAssignments();
$copyeditor = $authorSubmission->getUserBySignoffType('SIGNOFF_COPYEDITING_INITIAL');
if (!$email->isEnabled() || $send && !$email->hasErrors()) {
HookRegistry::call('AuthorAction::completeAuthorCopyedit', array(&$authorSubmission, &$email));
if ($email->isEnabled()) {
$email->send($request);
}
$authorSignoff->setDateCompleted(Core::getCurrentDate());
$finalSignoff = $signoffDao->build('SIGNOFF_COPYEDITING_FINAL', ASSOC_TYPE_ARTICLE, $authorSubmission->getId());
if ($copyeditor) {
$finalSignoff->setUserId($copyeditor->getId());
}
$finalSignoff->setDateNotified(Core::getCurrentDate());
$signoffDao->updateObject($authorSignoff);
$signoffDao->updateObject($finalSignoff);
// Add log entry
import('classes.article.log.ArticleLog');
ArticleLog::logEvent($request, $authorSubmission, ARTICLE_LOG_COPYEDIT_REVISION, 'log.copyedit.authorFile');
return true;
} else {
if (!$request->getUserVar('continued')) {
if (isset($copyeditor)) {
$email->addRecipient($copyeditor->getEmail(), $copyeditor->getFullName());
$assignedSectionEditors = $email->ccAssignedEditingSectionEditors($authorSubmission->getId());
$assignedEditors = $email->ccAssignedEditors($authorSubmission->getId());
if (empty($assignedSectionEditors) && empty($assignedEditors)) {
$email->addCc($journal->getSetting('contactEmail'), $journal->getSetting('contactName'));
$editorName = $journal->getSetting('contactName');
} else {
$editor = array_shift($assignedSectionEditors);
if (!$editor) {
$editor = array_shift($assignedEditors);
}
$editorName = $editor->getEditorFullName();
}
} else {
$assignedSectionEditors = $email->toAssignedEditingSectionEditors($authorSubmission->getId());
$assignedEditors = $email->ccAssignedEditors($authorSubmission->getId());
if (empty($assignedSectionEditors) && empty($assignedEditors)) {
$email->addRecipient($journal->getSetting('contactEmail'), $journal->getSetting('contactName'));
$editorName = $journal->getSetting('contactName');
} else {
$editor = array_shift($assignedSectionEditors);
if (!$editor) {
$editor = array_shift($assignedEditors);
}
$editorName = $editor->getEditorFullName();
}
}
$paramArray = array('editorialContactName' => isset($copyeditor) ? $copyeditor->getFullName() : $editorName, 'authorName' => $user->getFullName());
$email->assignParams($paramArray);
}
$email->displayEditForm($request->url(null, 'author', 'completeAuthorCopyedit', 'send'), array('articleId' => $authorSubmission->getId()));
return false;
}
}
示例7: uploadReviewerVersion
/**
* Upload the annotated version of an article.
* @param $reviewId int
*/
function uploadReviewerVersion($reviewId)
{
import("file.ArticleFileManager");
$reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
$reviewAssignment =& $reviewAssignmentDao->getReviewAssignmentById($reviewId);
$articleFileManager =& new ArticleFileManager($reviewAssignment->getArticleId());
// Only upload the file if the reviewer has yet to submit a recommendation
// and if review forms are not used
if (($reviewAssignment->getRecommendation() === null || $reviewAssignment->getRecommendation() === '') && !$reviewAssignment->getCancelled()) {
$fileName = 'upload';
if ($articleFileManager->uploadedFileExists($fileName)) {
HookRegistry::call('ReviewerAction::uploadReviewFile', array(&$reviewAssignment));
if ($reviewAssignment->getReviewerFileId() != null) {
$fileId = $articleFileManager->uploadReviewFile($fileName, $reviewAssignment->getReviewerFileId());
} else {
$fileId = $articleFileManager->uploadReviewFile($fileName);
}
}
}
if (isset($fileId) && $fileId != 0) {
$reviewAssignment->setReviewerFileId($fileId);
$reviewAssignment->stampModified();
$reviewAssignmentDao->updateReviewAssignment($reviewAssignment);
// Add log
import('article.log.ArticleLog');
import('article.log.ArticleEventLogEntry');
$userDao =& DAORegistry::getDAO('UserDAO');
$reviewer =& $userDao->getUser($reviewAssignment->getReviewerId());
$entry =& new ArticleEventLogEntry();
$entry->setArticleId($reviewAssignment->getArticleId());
$entry->setUserId($reviewer->getUserId());
$entry->setDateLogged(Core::getCurrentDate());
$entry->setEventType(ARTICLE_LOG_REVIEW_FILE);
$entry->setLogMessage('log.review.reviewerFile');
$entry->setAssocType(ARTICLE_LOG_TYPE_REVIEW);
$entry->setAssocId($reviewAssignment->getReviewId());
ArticleLog::logEventEntry($reviewAssignment->getArticleId(), $entry);
}
}
示例8: submissionEmailLog
/**
* View submission email log.
*/
function submissionEmailLog($args)
{
$articleId = isset($args[0]) ? (int) $args[0] : 0;
$logId = isset($args[1]) ? (int) $args[1] : 0;
list($journal, $submission) = SubmissionEditHandler::validate($articleId);
parent::setupTemplate(true, $articleId, 'history');
$templateMgr =& TemplateManager::getManager();
$templateMgr->assign('isEditor', Validation::isEditor());
$templateMgr->assign_by_ref('submission', $submission);
$articleFileDao =& DAORegistry::getDAO('ArticleFileDAO');
import('file.ArticleFileManager');
$templateMgr->assign('attachments', $articleFileDao->getArticleFilesByAssocId($logId, ARTICLE_FILE_ATTACHMENT));
if ($logId) {
$logDao =& DAORegistry::getDAO('ArticleEmailLogDAO');
$logEntry =& $logDao->getLogEntry($logId, $articleId);
}
if (isset($logEntry)) {
$templateMgr->assign_by_ref('logEntry', $logEntry);
$templateMgr->display('sectionEditor/submissionEmailLogEntry.tpl');
} else {
$rangeInfo =& Handler::getRangeInfo('emailLogEntries');
import('article.log.ArticleLog');
$emailLogEntries =& ArticleLog::getEmailLogEntries($articleId, $rangeInfo);
$templateMgr->assign_by_ref('emailLogEntries', $emailLogEntries);
$templateMgr->display('sectionEditor/submissionEmailLog.tpl');
}
}
示例9: execute
//.........这里部分代码省略.........
$layoutSignoff = $signoffDao->build('SIGNOFF_LAYOUT', ASSOC_TYPE_ARTICLE, $article->getId());
$layoutSignoff->setUserId(0);
$signoffDao->updateObject($layoutSignoff);
$proofAuthorSignoff = $signoffDao->build('SIGNOFF_PROOFREADING_AUTHOR', ASSOC_TYPE_ARTICLE, $article->getId());
$proofProofreaderSignoff = $signoffDao->build('SIGNOFF_PROOFREADING_PROOFREADER', ASSOC_TYPE_ARTICLE, $article->getId());
$proofLayoutEditorSignoff = $signoffDao->build('SIGNOFF_PROOFREADING_LAYOUT', ASSOC_TYPE_ARTICLE, $article->getId());
$proofAuthorSignoff->setUserId($user->getId());
$proofProofreaderSignoff->setUserId(0);
$proofLayoutEditorSignoff->setUserId(0);
$signoffDao->updateObject($proofAuthorSignoff);
$signoffDao->updateObject($proofProofreaderSignoff);
$signoffDao->updateObject($proofLayoutEditorSignoff);
$sectionEditorsDao =& DAORegistry::getDAO('SectionEditorsDAO');
$sectionEditors =& $sectionEditorsDao->getEditorsBySectionId($journal->getId(), $article->getSectionId());
$user =& Request::getUser();
// Update search index
import('classes.search.ArticleSearchIndex');
ArticleSearchIndex::indexArticleMetadata($article);
ArticleSearchIndex::indexArticleFiles($article);
// Send author notification email
import('classes.mail.ArticleMailTemplate');
$mail = new ArticleMailTemplate($article, null, 'SUBMISSION_ACK', null, null, null, false);
foreach ($sectionEditors as $sectionEditor) {
// If one of the secretary is the chair of the committee, send from the chair, if not, take the last secretary in the array
$from = $mail->getFrom();
if ($ercReviewersDao->isErcReviewer($journal->getId(), $sectionEditor->getId(), REVIEWER_CHAIR)) {
$mail->setFrom($sectionEditor->getEmail(), $sectionEditor->getFullName());
} elseif ($from['email'] == $user->getEmail()) {
$mail->setFrom($sectionEditor->getEmail(), $sectionEditor->getFullName());
}
$mail->addBcc($sectionEditor->getEmail(), $sectionEditor->getFullName());
unset($sectionEditor);
}
if ($mail->isEnabled()) {
$mail->addRecipient($user->getEmail(), $user->getFullName());
if ($journal->getSetting('copySubmissionAckSpecified')) {
$copyAddress = $journal->getSetting('copySubmissionAckAddress');
if (!empty($copyAddress)) {
$mail->addBcc($copyAddress);
}
}
$section = $sectionDao->getSection($article->getSectionId());
$mail->assignParams(array('authorName' => $user->getFullName(), 'authorUsername' => $user->getUsername(), 'address' => $sectionDao->getSettingValue($article->getSectionId(), 'address'), 'bankAccount' => $sectionDao->getSettingValue($article->getSectionId(), 'bankAccount'), 'proposalId' => $article->getProposalId(), 'submissionUrl' => Request::url(null, 'author', 'submission', $article->getId())));
$mail->send();
}
// Send a regular notification to section editors
$lastDecision = $article->getLastSectionDecision();
switch ($lastDecision->getReviewType()) {
case REVIEW_TYPE_INITIAL:
if ($lastDecision->getRound() == 1) {
$message = 'notification.type.articleSubmitted.initialReview';
} else {
$message = 'notification.type.articleReSubmitted.initialReview';
}
break;
case REVIEW_TYPE_PR:
if ($lastDecision->getRound() == 1) {
$message = 'notification.type.articleSubmitted.continuingReview';
} else {
$message = 'notification.type.articleReSubmitted.continuingReview';
}
break;
case REVIEW_TYPE_AMENDMENT:
if ($lastDecision->getRound() == 1) {
$message = 'notification.type.articleSubmitted.PAAmendmentReview';
} else {
$message = 'notification.type.articleReSubmitted.PAAmendmentReview';
}
break;
case REVIEW_TYPE_SAE:
if ($lastDecision->getRound() == 1) {
$message = 'notification.type.articleSubmitted.SAE';
} else {
$message = 'notification.type.articleReSubmitted.SAE';
}
break;
case REVIEW_TYPE_FR:
if ($lastDecision->getRound() == 1) {
$message = 'notification.type.articleSubmitted.EOS';
} else {
$message = 'notification.type.articleReSubmitted.EOS';
}
break;
}
import('lib.pkp.classes.notification.NotificationManager');
$notificationManager = new NotificationManager();
$url = Request::url($journal->getPath(), 'sectionEditor', 'submission', array($article->getId(), 'submissionReview'));
foreach ($sectionEditors as $sectionEditor) {
$notificationManager->createNotification($sectionEditor->getId(), $message, $article->getProposalId(), $url, 1, NOTIFICATION_TYPE_ARTICLE_SUBMITTED);
}
import('classes.article.log.ArticleLog');
import('classes.article.log.ArticleEventLogEntry');
if ($lastDecision->getRound() == 1) {
$message = 'log.author.submitted';
} else {
$message = 'log.author.resubmitted';
}
ArticleLog::logEvent($this->articleId, ARTICLE_LOG_ARTICLE_SUBMIT, ARTICLE_LOG_TYPE_AUTHOR, $user->getId(), $message, array('submissionId' => $article->getProposalId(), 'authorName' => $user->getFullName(), 'reviewType' => Locale::translate($lastDecision->getReviewTypeKey())));
return $this->articleId;
}
示例10: expediteSubmission
/**
* Rush a new submission into the end of the editing queue.
* @param $article object
*/
function expediteSubmission($article)
{
$user =& Request::getUser();
import('submission.editor.EditorAction');
import('submission.sectionEditor.SectionEditorAction');
import('submission.proofreader.ProofreaderAction');
$sectionEditorSubmissionDao =& DAORegistry::getDAO('SectionEditorSubmissionDAO');
$sectionEditorSubmission =& $sectionEditorSubmissionDao->getSectionEditorSubmission($article->getArticleId());
$submissionFile = $sectionEditorSubmission->getSubmissionFile();
// Add a long entry before doing anything.
import('article.log.ArticleLog');
import('article.log.ArticleEventLogEntry');
ArticleLog::logEvent($article->getArticleId(), ARTICLE_LOG_EDITOR_EXPEDITE, ARTICLE_LOG_TYPE_EDITOR, $user->getUserId(), 'log.editor.submissionExpedited', array('editorName' => $user->getFullName(), 'articleId' => $article->getArticleId()));
// 1. Ensure that an editor is assigned.
$editAssignments =& $sectionEditorSubmission->getEditAssignments();
if (empty($editAssignments)) {
// No editors are currently assigned; assign self.
EditorAction::assignEditor($article->getArticleId(), $user->getUserId(), true);
}
// 2. Accept the submission and send to copyediting.
$sectionEditorSubmission =& $sectionEditorSubmissionDao->getSectionEditorSubmission($article->getArticleId());
if (!$sectionEditorSubmission->getCopyeditFile()) {
SectionEditorAction::recordDecision($sectionEditorSubmission, SUBMISSION_EDITOR_DECISION_ACCEPT);
$reviewFile = $sectionEditorSubmission->getReviewFile();
SectionEditorAction::setCopyeditFile($sectionEditorSubmission, $reviewFile->getFileId(), $reviewFile->getRevision());
}
// 3. Add a galley.
$sectionEditorSubmission =& $sectionEditorSubmissionDao->getSectionEditorSubmission($article->getArticleId());
$galleys =& $sectionEditorSubmission->getGalleys();
if (empty($galleys)) {
// No galley present -- use copyediting file.
import('file.ArticleFileManager');
$copyeditFile =& $sectionEditorSubmission->getCopyeditFile();
$fileType = $copyeditFile->getFileType();
$articleFileManager =& new ArticleFileManager($article->getArticleId());
$fileId = $articleFileManager->copyPublicFile($copyeditFile->getFilePath(), $fileType);
if (strstr($fileType, 'html')) {
$galley =& new ArticleHTMLGalley();
} else {
$galley =& new ArticleGalley();
}
$galley->setArticleId($article->getArticleId());
$galley->setFileId($fileId);
$galley->setLocale(Locale::getLocale());
if ($galley->isHTMLGalley()) {
$galley->setLabel('HTML');
} else {
if (strstr($fileType, 'pdf')) {
$galley->setLabel('PDF');
} else {
if (strstr($fileType, 'postscript')) {
$galley->setLabel('Postscript');
} else {
if (strstr($fileType, 'xml')) {
$galley->setLabel('XML');
} else {
$galley->setLabel(Locale::translate('common.untitled'));
}
}
}
}
$galleyDao =& DAORegistry::getDAO('ArticleGalleyDAO');
$galleyDao->insertGalley($galley);
}
$sectionEditorSubmission->setStatus(STATUS_QUEUED);
$sectionEditorSubmissionDao->updateSectionEditorSubmission($sectionEditorSubmission);
}
示例11: completeAuthorCopyedit
/**
* Author completes editor / author review.
* @param $authorSubmission object
*/
function completeAuthorCopyedit($authorSubmission, $send = false)
{
$authorSubmissionDao =& DAORegistry::getDAO('AuthorSubmissionDAO');
$userDao =& DAORegistry::getDAO('UserDAO');
$journal =& Request::getJournal();
if ($authorSubmission->getCopyeditorDateAuthorCompleted() != null) {
return true;
}
$user =& Request::getUser();
import('mail.ArticleMailTemplate');
$email =& new ArticleMailTemplate($authorSubmission, 'COPYEDIT_AUTHOR_COMPLETE');
$editAssignments = $authorSubmission->getEditAssignments();
$copyeditor =& $authorSubmission->getCopyeditor();
if (!$email->isEnabled() || $send && !$email->hasErrors()) {
HookRegistry::call('AuthorAction::completeAuthorCopyedit', array(&$authorSubmission, &$email));
if ($email->isEnabled()) {
$email->setAssoc(ARTICLE_EMAIL_COPYEDIT_NOTIFY_AUTHOR_COMPLETE, ARTICLE_EMAIL_TYPE_COPYEDIT, $authorSubmission->getArticleId());
$email->send();
}
$authorSubmission->setCopyeditorDateAuthorCompleted(Core::getCurrentDate());
$authorSubmission->setCopyeditorDateFinalNotified(Core::getCurrentDate());
$authorSubmissionDao->updateAuthorSubmission($authorSubmission);
// Add log entry
import('article.log.ArticleLog');
import('article.log.ArticleEventLogEntry');
ArticleLog::logEvent($authorSubmission->getArticleId(), ARTICLE_LOG_COPYEDIT_REVISION, ARTICLE_LOG_TYPE_AUTHOR, $user->getUserId(), 'log.copyedit.authorFile');
return true;
} else {
if (!Request::getUserVar('continued')) {
if (isset($copyeditor)) {
$email->addRecipient($copyeditor->getEmail(), $copyeditor->getFullName());
$assignedSectionEditors = $email->ccAssignedEditingSectionEditors($authorSubmission->getArticleId());
$assignedEditors = $email->ccAssignedEditors($authorSubmission->getArticleId());
if (empty($assignedSectionEditors) && empty($assignedEditors)) {
$email->addCc($journal->getSetting('contactEmail'), $journal->getSetting('contactName'));
$editorName = $journal->getSetting('contactName');
} else {
$editor = array_shift($assignedSectionEditors);
if (!$editor) {
$editor = array_shift($assignedEditors);
}
$editorName = $editor->getEditorFullName();
}
} else {
$assignedSectionEditors = $email->toAssignedEditingSectionEditors($authorSubmission->getArticleId());
$assignedEditors = $email->ccAssignedEditors($authorSubmission->getArticleId());
if (empty($assignedSectionEditors) && empty($assignedEditors)) {
$email->addRecipient($journal->getSetting('contactEmail'), $journal->getSetting('contactName'));
$editorName = $journal->getSetting('contactName');
} else {
$editor = array_shift($assignedSectionEditors);
if (!$editor) {
$editor = array_shift($assignedEditors);
}
$editorName = $editor->getEditorFullName();
}
}
$paramArray = array('editorialContactName' => isset($copyeditor) ? $copyeditor->getFullName() : $editorName, 'authorName' => $user->getFullName());
$email->assignParams($paramArray);
}
$email->displayEditForm(Request::url(null, 'author', 'completeAuthorCopyedit', 'send'), array('articleId' => $authorSubmission->getArticleId()));
return false;
}
}
示例12: completeLayoutEditing
/**
* Marks layout assignment as completed.
* @param $submission object
* @param $send boolean
*/
function completeLayoutEditing($submission, $send = false)
{
$signoffDao =& DAORegistry::getDAO('SignoffDAO');
$userDao =& DAORegistry::getDAO('UserDAO');
$journal =& Request::getJournal();
$layoutSignoff = $signoffDao->build('SIGNOFF_LAYOUT', ASSOC_TYPE_ARTICLE, $submission->getArticleId());
if ($layoutSignoff->getDateCompleted() != null) {
return true;
}
import('classes.mail.ArticleMailTemplate');
$email = new ArticleMailTemplate($submission, 'LAYOUT_COMPLETE');
$editAssignments =& $submission->getEditAssignments();
if (empty($editAssignments)) {
return;
}
if (!$email->isEnabled() || $send && !$email->hasErrors()) {
HookRegistry::call('LayoutEditorAction::completeLayoutEditing', array(&$submission, &$editAssignments, &$email));
if ($email->isEnabled()) {
$email->setAssoc(ARTICLE_EMAIL_LAYOUT_NOTIFY_COMPLETE, ARTICLE_EMAIL_TYPE_LAYOUT, $layoutSignoff->getId());
$email->send();
}
$layoutSignoff->setDateCompleted(Core::getCurrentDate());
$signoffDao->updateObject($layoutSignoff);
// Add log entry
$user =& Request::getUser();
import('classes.article.log.ArticleLog');
import('classes.article.log.ArticleEventLogEntry');
ArticleLog::logEvent($submission->getArticleId(), ARTICLE_LOG_LAYOUT_COMPLETE, ARTICLE_LOG_TYPE_LAYOUT, $user->getId(), 'log.layout.layoutEditComplete', array('editorName' => $user->getFullName(), 'articleId' => $submission->getArticleId()));
return true;
} else {
$user =& Request::getUser();
if (!Request::getUserVar('continued')) {
$assignedSectionEditors = $email->toAssignedEditingSectionEditors($submission->getArticleId());
$assignedEditors = $email->ccAssignedEditors($submission->getArticleId());
if (empty($assignedSectionEditors) && empty($assignedEditors)) {
$email->addRecipient($journal->getSetting('contactEmail'), $journal->getSetting('contactName'));
$editorialContactName = $journal->getSetting('contactName');
} else {
$editorialContact = array_shift($assignedSectionEditors);
if (!$editorialContact) {
$editorialContact = array_shift($assignedEditors);
}
$editorialContactName = $editorialContact->getEditorFullName();
}
$paramArray = array('editorialContactName' => $editorialContactName, 'layoutEditorName' => $user->getFullName());
$email->assignParams($paramArray);
}
$email->displayEditForm(Request::url(null, 'layoutEditor', 'completeAssignment', 'send'), array('articleId' => $submission->getArticleId()));
return false;
}
}
示例13: saveMetadata
//.........这里部分代码省略.........
// Check for any special cases before trying to save
if ($request->getUserVar('addAuthor')) {
// Add an author
$editData = true;
$authors = $metadataForm->getData('authors');
array_push($authors, array());
$metadataForm->setData('authors', $authors);
} else {
if (($delAuthor = $request->getUserVar('delAuthor')) && count($delAuthor) == 1) {
// Delete an author
$editData = true;
list($delAuthor) = array_keys($delAuthor);
$delAuthor = (int) $delAuthor;
$authors = $metadataForm->getData('authors');
if (isset($authors[$delAuthor]['authorId']) && !empty($authors[$delAuthor]['authorId'])) {
$deletedAuthors = explode(':', $metadataForm->getData('deletedAuthors'));
array_push($deletedAuthors, $authors[$delAuthor]['authorId']);
$metadataForm->setData('deletedAuthors', join(':', $deletedAuthors));
}
array_splice($authors, $delAuthor, 1);
$metadataForm->setData('authors', $authors);
if ($metadataForm->getData('primaryContact') == $delAuthor) {
$metadataForm->setData('primaryContact', 0);
}
} else {
if ($request->getUserVar('moveAuthor')) {
// Move an author up/down
$editData = true;
$moveAuthorDir = $request->getUserVar('moveAuthorDir');
$moveAuthorDir = $moveAuthorDir == 'u' ? 'u' : 'd';
$moveAuthorIndex = (int) $request->getUserVar('moveAuthorIndex');
$authors = $metadataForm->getData('authors');
if (!($moveAuthorDir == 'u' && $moveAuthorIndex <= 0 || $moveAuthorDir == 'd' && $moveAuthorIndex >= count($authors) - 1)) {
$tmpAuthor = $authors[$moveAuthorIndex];
$primaryContact = $metadataForm->getData('primaryContact');
if ($moveAuthorDir == 'u') {
$authors[$moveAuthorIndex] = $authors[$moveAuthorIndex - 1];
$authors[$moveAuthorIndex - 1] = $tmpAuthor;
if ($primaryContact == $moveAuthorIndex) {
$metadataForm->setData('primaryContact', $moveAuthorIndex - 1);
} else {
if ($primaryContact == $moveAuthorIndex - 1) {
$metadataForm->setData('primaryContact', $moveAuthorIndex);
}
}
} else {
$authors[$moveAuthorIndex] = $authors[$moveAuthorIndex + 1];
$authors[$moveAuthorIndex + 1] = $tmpAuthor;
if ($primaryContact == $moveAuthorIndex) {
$metadataForm->setData('primaryContact', $moveAuthorIndex + 1);
} else {
if ($primaryContact == $moveAuthorIndex + 1) {
$metadataForm->setData('primaryContact', $moveAuthorIndex);
}
}
}
}
$metadataForm->setData('authors', $authors);
}
}
}
if (isset($editData)) {
$metadataForm->display();
return false;
} else {
if (!$metadataForm->validate()) {
return $metadataForm->display();
}
$metadataForm->execute($request);
// Send a notification to associated users
import('lib.pkp.classes.notification.NotificationManager');
$notificationManager = new NotificationManager();
$notificationUsers = $article->getAssociatedUserIds();
foreach ($notificationUsers as $userRole) {
$url = $router->url($request, null, $userRole['role'], 'submission', $article->getId(), null, 'metadata');
$notificationManager->createNotification($userRole['id'], 'notification.type.metadataModified', $article->getProposalId(), $url, 1, NOTIFICATION_TYPE_METADATA_MODIFIED);
}
//Added by AIM, Jan 20, 2012
$notificationUsers = array();
$roleDao =& DAORegistry::getDAO('RoleDAO');
$editors = $roleDao->getUsersByRoleId(ROLE_ID_EDITOR);
while (!$editors->eof()) {
$editor =& $editors->next();
$notificationUsers[] = array('id' => $editor->getId(), 'role' => $roleDao->getRolePath(ROLE_ID_EDITOR));
unset($editor);
}
//print_r($notificationUsers); die();
foreach ($notificationUsers as $userRole) {
$url = $router->url($request, null, $userRole['role'], 'submission', $article->getId(), null, 'metadata');
$notificationManager->createNotification($userRole['id'], 'notification.type.metadataModified', $article->getProposalId(), $url, 1, NOTIFICATION_TYPE_METADATA_MODIFIED);
}
// Add log entry
$user =& $request->getUser();
import('classes.article.log.ArticleLog');
import('classes.article.log.ArticleEventLogEntry');
ArticleLog::logEvent($article->getId(), ARTICLE_LOG_METADATA_UPDATE, ARTICLE_LOG_TYPE_DEFAULT, 0, 'log.editor.metadataModified', array('editorName' => $user->getFullName()));
return true;
}
}
}
示例14: uploadReviewerVersion
/**
* Upload the annotated version of an article.
* @param $reviewId int
* @param $reviewerSubmission object
* @param $request object
*/
function uploadReviewerVersion($reviewId, $reviewerSubmission, $request)
{
import('classes.file.ArticleFileManager');
$reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
$reviewAssignment =& $reviewAssignmentDao->getById($reviewId);
$articleFileManager = new ArticleFileManager($reviewAssignment->getSubmissionId());
// Only upload the file if the reviewer has yet to submit a recommendation
// and if review forms are not used
if (($reviewAssignment->getRecommendation() === null || $reviewAssignment->getRecommendation() === '') && !$reviewAssignment->getCancelled()) {
$fileName = 'upload';
if ($articleFileManager->uploadedFileExists($fileName)) {
HookRegistry::call('ReviewerAction::uploadReviewFile', array(&$reviewAssignment));
if ($reviewAssignment->getReviewerFileId() != null) {
$fileId = $articleFileManager->uploadReviewFile($fileName, $reviewAssignment->getReviewerFileId());
} else {
$fileId = $articleFileManager->uploadReviewFile($fileName);
}
}
}
if (isset($fileId) && $fileId != 0) {
$reviewAssignment->setReviewerFileId($fileId);
$reviewAssignment->stampModified();
$reviewAssignmentDao->updateReviewAssignment($reviewAssignment);
$userDao =& DAORegistry::getDAO('UserDAO');
$reviewer =& $userDao->getUser($reviewAssignment->getReviewerId());
// Add log
import('classes.article.log.ArticleLog');
ArticleLog::logEvent($request, $reviewerSubmission, ARTICLE_LOG_REVIEW_FILE, 'log.review.reviewerFile', array('reviewId' => $reviewAssignment->getId()));
}
}
示例15: uploadReviewForReviewer
/**
* Upload a review on behalf of its reviewer.
* @param $reviewId int
*/
function uploadReviewForReviewer($reviewId)
{
$reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
$sectionDecisionDao =& DAORegistry::getDAO('SectionDecisionDAO');
$userDao =& DAORegistry::getDAO('UserDAO');
$articleDao =& DAORegistry::getDAO('ArticleDAO');
$user =& Request::getUser();
$reviewAssignment =& $reviewAssignmentDao->getById($reviewId);
$sectionDecision =& $sectionDecisionDao->getSectionDecision($reviewAssignment->getDecisionId());
$article =& $articleDao->getArticle($sectionDecision->getArticleId());
$reviewer =& $userDao->getUser($reviewAssignment->getReviewerId(), true);
if (HookRegistry::call('SectionEditorAction::uploadReviewForReviewer', array(&$reviewAssignment, &$reviewer))) {
return;
}
// Upload the review file.
import('classes.file.ArticleFileManager');
$articleFileManager = new ArticleFileManager($sectionDecision->getArticleId());
// Only upload the file if the reviewer has yet to submit a recommendation
if (($reviewAssignment->getRecommendation() === null || $reviewAssignment->getRecommendation() === '') && !$reviewAssignment->getCancelled()) {
$fileName = 'upload';
if ($articleFileManager->uploadedFileExists($fileName)) {
// Check if file already uploaded
$reviewFile =& $reviewAssignment->getReviewerFile();
if ($reviewFile != null) {
$articleFileManager->deleteFile($reviewFile->getFileId());
}
if ($reviewAssignment->getReviewerFileId() != null) {
$fileId = $articleFileManager->uploadReviewFile($fileName, $reviewAssignment->getDecisionId(), $reviewAssignment->getReviewerFileId());
} else {
$fileId = $articleFileManager->uploadReviewFile($fileName, $reviewAssignment->getDecisionId());
}
}
}
if (isset($fileId) && $fileId != 0) {
// Only confirm the review for the reviewer if
// he has not previously done so.
if ($reviewAssignment->getDateConfirmed() == null) {
$reviewAssignment->setDeclined(0);
$reviewAssignment->setDateConfirmed(Core::getCurrentDate());
}
$reviewAssignment->setReviewerFileId($fileId);
$reviewAssignment->stampModified();
$reviewAssignmentDao->updateReviewAssignment($reviewAssignment);
// Add log
import('classes.article.log.ArticleLog');
import('classes.article.log.ArticleEventLogEntry');
Locale::requireComponents(array(LOCALE_COMPONENT_APPLICATION_COMMON));
$entry = new ArticleEventLogEntry();
$entry->setArticleId($sectionDecision->getArticleId());
$entry->setUserId($user->getId());
$entry->setDateLogged(Core::getCurrentDate());
$entry->setEventType(ARTICLE_LOG_REVIEW_FILE_BY_PROXY);
$entry->setLogMessage('log.review.reviewFileByProxy', array('reviewerName' => $reviewer->getFullName(), 'articleId' => $article->getProposalId(), 'userName' => $user->getFullName()));
$entry->setAssocType(ARTICLE_LOG_TYPE_REVIEW);
$entry->setAssocId($reviewAssignment->getId());
ArticleLog::logEventEntry($sectionDecision->getArticleId(), $entry);
}
}