当前位置: 首页>>代码示例>>PHP>>正文


PHP SubmissionLog::logEvent方法代码示例

本文整理汇总了PHP中SubmissionLog::logEvent方法的典型用法代码示例。如果您正苦于以下问题:PHP SubmissionLog::logEvent方法的具体用法?PHP SubmissionLog::logEvent怎么用?PHP SubmissionLog::logEvent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SubmissionLog的用法示例。


在下文中一共展示了SubmissionLog::logEvent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: execute

 /**
  * Save changes to submission.
  * @param $submission Submission
  * @param $request PKPRequest
  * @return Submission
  */
 function execute($submission, $request)
 {
     parent::execute($submission, $request);
     // Log the modification event.
     import('lib.pkp.classes.log.SubmissionLog');
     import('classes.log.SubmissionEventLogEntry');
     SubmissionLog::logEvent($request, $submission, SUBMISSION_LOG_METADATA_UPDATE, 'submission.event.general.metadataUpdated');
 }
开发者ID:jalperin,项目名称:ojs,代码行数:14,代码来源:SubmissionMetadataFormImplementation.inc.php

示例2: expedite

 /**
  * Expedites a submission through the submission process, if the submitter is a manager or editor.
  * @param $args array
  * @param $request PKPRequest
  */
 function expedite($args, $request)
 {
     $submission = $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION);
     import('controllers.tab.issueEntry.form.IssueEntryPublicationMetadataForm');
     $user = $request->getUser();
     $form = new IssueEntryPublicationMetadataForm($submission->getId(), $user, null, array('expeditedSubmission' => true));
     if ($submission && (int) $request->getUserVar('issueId') > 0) {
         // Process our submitted form in order to create the published article entry.
         $form->readInputData();
         if ($form->validate()) {
             $form->execute($request);
             // Create trivial notification in place on the form, and log the event.
             $notificationManager = new NotificationManager();
             $user = $request->getUser();
             import('lib.pkp.classes.log.SubmissionLog');
             SubmissionLog::logEvent($request, $submission, SUBMISSION_LOG_ISSUE_METADATA_UPDATE, 'submission.event.issueMetadataUpdated');
             $notificationManager->createTrivialNotification($user->getId(), NOTIFICATION_TYPE_SUCCESS, array('contents' => __('notification.savedIssueMetadata')));
             // Now, create a galley for this submission.  Assume PDF, and set to 'available'.
             $articleGalleyDao = DAORegistry::getDAO('ArticleGalleyDAO');
             $articleGalley = $articleGalleyDao->newDataObject();
             $articleGalley->setGalleyType('pdfarticlegalleyplugin');
             $articleGalley->setIsAvailable(true);
             $articleGalley->setSubmissionId($submission->getId());
             $articleGalley->setLocale($submission->getLocale());
             $articleGalley->setLabel('PDF');
             $articleGalley->setSeq($articleGalleyDao->getNextGalleySequence($submission->getId()));
             $articleGalleyId = $articleGalleyDao->insertObject($articleGalley);
             // Next, create a galley PROOF file out of the submission file uploaded.
             $submissionFileDao = DAORegistry::getDAO('SubmissionFileDAO');
             $submissionFiles = $submissionFileDao->getLatestRevisions($submission->getId(), SUBMISSION_FILE_SUBMISSION);
             // Assume a single file was uploaded, but check for something that's PDF anyway.
             foreach ($submissionFiles as $submissionFile) {
                 // test both mime type and file extension in case the mime type isn't correct after uploading.
                 if ($submissionFile->getFileType() == 'application/pdf' || preg_match('/\\.pdf$/', $submissionFile->getOriginalFileName())) {
                     // Get the path of the current file because we change the file stage in a bit.
                     $currentFilePath = $submissionFile->getFilePath();
                     // this will be a new file based on the old one.
                     $submissionFile->setFileId(null);
                     $submissionFile->setRevision(1);
                     $submissionFile->setFileStage(SUBMISSION_FILE_PROOF);
                     $submissionFile->setAssocType(ASSOC_TYPE_GALLEY);
                     $submissionFile->setAssocId($articleGalleyId);
                     $submissionFileDao->insertObject($submissionFile, $currentFilePath);
                     break;
                 }
             }
             // no errors, clear all notifications for this submission which may have been created during the submission process and close the modal.
             $context = $request->getContext();
             $notificationDao = DAORegistry::getDAO('NotificationDAO');
             $notificationFactory = $notificationDao->deleteByAssoc(ASSOC_TYPE_SUBMISSION, $submission->getId(), null, null, $context->getId());
             return new JSONMessage(true);
         } else {
             return new JSONMessage(true, $form->fetch($request));
         }
     }
     return new JSONMessage(true, $form->fetch($request));
 }
开发者ID:jmacgreg,项目名称:ojs,代码行数:62,代码来源:WorkflowHandler.inc.php

示例3: execute

 /**
  * Save changes to submission.
  * @param $args array
  * @param $request PKPRequest
  * @return int the submission ID
  */
 function execute($args, $request)
 {
     parent::execute($args, $request);
     $submission = $this->submission;
     // Send author notification email
     import('classes.mail.ArticleMailTemplate');
     $mail = new ArticleMailTemplate($submission, 'SUBMISSION_ACK');
     $authorMail = new ArticleMailTemplate($submission, 'SUBMISSION_ACK_NOT_USER');
     $context = $request->getContext();
     $router = $request->getRouter();
     if ($mail->isEnabled()) {
         // submission ack emails should be from the contact.
         $mail->setFrom($this->context->getSetting('contactEmail'), $this->context->getSetting('contactName'));
         $authorMail->setFrom($this->context->getSetting('contactEmail'), $this->context->getSetting('contactName'));
         $user = $request->getUser();
         $primaryAuthor = $submission->getPrimaryAuthor();
         if (!isset($primaryAuthor)) {
             $authors = $submission->getAuthors();
             $primaryAuthor = $authors[0];
         }
         $mail->addRecipient($user->getEmail(), $user->getFullName());
         // Add primary contact and e-mail address as specified in the journal submission settings
         if ($context->getSetting('copySubmissionAckPrimaryContact')) {
             $mail->addBcc($context->getSetting('contactEmail'), $context->getSetting('contactName'));
         }
         if ($copyAddress = $context->getSetting('copySubmissionAckAddress')) {
             $mail->addBcc($copyAddress);
         }
         if ($user->getEmail() != $primaryAuthor->getEmail()) {
             $authorMail->addRecipient($primaryAuthor->getEmail(), $primaryAuthor->getFullName());
         }
         $assignedAuthors = $submission->getAuthors();
         foreach ($assignedAuthors as $author) {
             $authorEmail = $author->getEmail();
             // only add the author email if they have not already been added as the primary author
             // or user creating the submission.
             if ($authorEmail != $primaryAuthor->getEmail() && $authorEmail != $user->getEmail()) {
                 $authorMail->addRecipient($author->getEmail(), $author->getFullName());
             }
         }
         $mail->bccAssignedSubEditors($submission->getId(), WORKFLOW_STAGE_ID_SUBMISSION);
         $mail->assignParams(array('authorName' => $user->getFullName(), 'authorUsername' => $user->getUsername(), 'editorialContactSignature' => $context->getSetting('contactName'), 'submissionUrl' => $router->url($request, null, 'authorDashboard', 'submission', $submission->getId())));
         $authorMail->assignParams(array('submitterName' => $user->getFullName(), 'editorialContactSignature' => $context->getSetting('contactName')));
         $mail->send($request);
         $recipients = $authorMail->getRecipients();
         if (!empty($recipients)) {
             $authorMail->send($request);
         }
     }
     // Log submission.
     import('classes.log.SubmissionEventLogEntry');
     // Constants
     import('lib.pkp.classes.log.SubmissionLog');
     SubmissionLog::logEvent($request, $submission, SUBMISSION_LOG_SUBMISSION_SUBMIT, 'submission.event.submissionSubmitted');
     return $this->submissionId;
 }
开发者ID:pkp,项目名称:ojs,代码行数:62,代码来源:SubmissionSubmitStep4Form.inc.php

示例4: _logEvent

 /**
  * Log an event for this file
  * @param $request PKPRequest
  * @param $eventType SUBMISSION_LOG_...
  */
 function _logEvent($request, $eventType)
 {
     // Get the log event message
     switch ($eventType) {
         case SUBMISSION_LOG_MESSAGE_SENT:
             $logMessage = 'informationCenter.history.messageSent';
             break;
         default:
             assert(false);
     }
     import('lib.pkp.classes.log.SubmissionLog');
     SubmissionLog::logEvent($request, $this->getSubmission(), $eventType, $logMessage);
 }
开发者ID:jalperin,项目名称:ojs,代码行数:18,代码来源:StageParticipantGridHandler.inc.php

示例5: _logEvent

 /**
  * Log an event for this file
  * @param $request PKPRequest
  * @param $eventType SUBMISSION_LOG_...
  */
 function _logEvent($request, $eventType)
 {
     // Get the log event message
     switch ($eventType) {
         case SUBMISSION_LOG_NOTE_POSTED:
             $logMessage = 'informationCenter.history.notePosted';
             break;
         default:
             assert(false);
     }
     import('lib.pkp.classes.log.SubmissionLog');
     SubmissionLog::logEvent($request, $this->_submission, $eventType, $logMessage);
 }
开发者ID:utlib,项目名称:ojs,代码行数:18,代码来源:SubmissionInformationCenterHandler.inc.php

示例6: logDeletionEvent

 /**
  * logs the deletion event using app-specific logging classes.
  * @param $request PKPRequest
  * @param $submission Submission
  * @param $submissionFile SubmissionFile
  * @param $user PKPUser
  */
 function logDeletionEvent($request, $submission, $submissionFile, $user)
 {
     // log the deletion event.
     import('lib.pkp.classes.log.SubmissionFileLog');
     import('lib.pkp.classes.log.SubmissionFileEventLogEntry');
     // constants
     if ($submissionFile->getRevision() > 1) {
         SubmissionFileLog::logEvent($request, $submissionFile, SUBMISSION_LOG_FILE_REVISION_DELETE, 'submission.event.revisionDeleted', array('fileStage' => $submissionFile->getFileStage(), 'sourceFileId' => $submissionFile->getSourceFileId(), 'fileId' => $submissionFile->getFileId(), 'fileRevision' => $submissionFile->getRevision(), 'originalFileName' => $submissionFile->getOriginalFileName(), 'submissionId' => $submissionFile->getSubmissionId(), 'username' => $user->getUsername()));
     } else {
         SubmissionFileLog::logEvent($request, $submissionFile, SUBMISSION_LOG_FILE_DELETE, 'submission.event.fileDeleted', array('fileStage' => $submissionFile->getFileStage(), 'sourceFileId' => $submissionFile->getSourceFileId(), 'fileId' => $submissionFile->getFileId(), 'fileRevision' => $submissionFile->getRevision(), 'originalFileName' => $submissionFile->getOriginalFileName(), 'submissionId' => $submissionFile->getSubmissionId(), 'username' => $user->getUsername()));
     }
     if ($submissionFile->getRevision() == 1 && $submissionFile->getSourceFileId() == null) {
         import('lib.pkp.classes.log.SubmissionLog');
         import('classes.log.SubmissionEventLogEntry');
         // constants
         SubmissionLog::logEvent($request, $submission, SUBMISSION_LOG_LAST_REVISION_DELETED, 'submission.event.lastRevisionDeleted', array('title' => $submissionFile->getOriginalFileName(), 'submissionId' => $submissionFile->getSubmissionId(), 'username' => $user->getUsername()));
     }
 }
开发者ID:selwyntcy,项目名称:ojs,代码行数:25,代码来源:ManageFileApiHandler.inc.php

示例7: _getFormFromCurrentTab

 /**
  * Get the form for a particular tab.
  */
 function _getFormFromCurrentTab(&$form, &$notificationKey, $request)
 {
     parent::_getFormFromCurrentTab($form, $notificationKey, $request);
     // give PKP-lib a chance to set the form and key.
     if (!$form) {
         // nothing applicable in parent.
         $submission = $this->getSubmission();
         switch ($this->getCurrentTab()) {
             case 'publication':
                 import('controllers.tab.issueEntry.form.IssueEntryPublicationMetadataForm');
                 $user = $request->getUser();
                 $form = new IssueEntryPublicationMetadataForm($submission->getId(), $user->getId(), $this->getStageId(), array('displayedInContainer' => true, 'tabPos' => $this->getTabPosition()));
                 $notificationKey = 'notification.savedIssueMetadata';
                 import('lib.pkp.classes.log.SubmissionLog');
                 SubmissionLog::logEvent($request, $submission, SUBMISSION_LOG_ISSUE_METADATA_UPDATE, 'submission.event.issueMetadataUpdated');
                 break;
         }
     }
 }
开发者ID:utlib,项目名称:ojs,代码行数:22,代码来源:IssueEntryTabHandler.inc.php

示例8: reviewRead

 /**
  * @copydoc PKPReviewerGridHandler::reviewRead()
  */
 function reviewRead($args, $request)
 {
     // Retrieve review assignment.
     $reviewAssignment = $this->getAuthorizedContextObject(ASSOC_TYPE_REVIEW_ASSIGNMENT);
     /* @var $reviewAssignment ReviewAssignment */
     // Recommendation
     $newRecommendation = $request->getUserVar('recommendation');
     // If editor set or changed the recommendation
     if ($newRecommendation && $reviewAssignment->getRecommendation() != $newRecommendation) {
         $reviewAssignment->setRecommendation($newRecommendation);
         // Add log entry
         import('lib.pkp.classes.log.SubmissionLog');
         import('classes.log.SubmissionEventLogEntry');
         $submission = $this->getSubmission();
         $userDao = DAORegistry::getDAO('UserDAO');
         $reviewer = $userDao->getById($reviewAssignment->getReviewerId());
         $user = $request->getUser();
         AppLocale::requireComponents(LOCALE_COMPONENT_APP_COMMON, LOCALE_COMPONENT_APP_EDITOR);
         SubmissionLog::logEvent($request, $submission, SUBMISSION_LOG_REVIEW_RECOMMENDATION_BY_PROXY, 'log.review.reviewRecommendationSetByProxy', array('round' => $reviewAssignment->getRound(), 'submissionId' => $submission->getId(), 'editorName' => $user->getFullName(), 'reviewerName' => $reviewer->getFullName()));
     }
     return parent::reviewRead($args, $request);
 }
开发者ID:bkroll,项目名称:ojs,代码行数:25,代码来源:ReviewerGridHandler.inc.php

示例9: confirmReview

 /**
  * Records whether or not the reviewer accepts the review assignment.
  * @param $request PKPRequest
  * @param $reviewAssignment ReviewAssignment
  * @param $submission Submission
  * @param $decline boolean
  * @param $emailText string optional
  */
 function confirmReview($request, $reviewAssignment, $submission, $decline, $emailText = null)
 {
     $reviewAssignmentDao = DAORegistry::getDAO('ReviewAssignmentDAO');
     $userDao = DAORegistry::getDAO('UserDAO');
     $reviewer = $userDao->getById($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) {
         $email = $this->getResponseEmail($submission, $reviewAssignment, $request, $decline);
         // Must explicitly set sender because we may be here on an access
         // key, in which case the user is not technically logged in
         $email->setReplyTo($reviewer->getEmail(), $reviewer->getFullName());
         HookRegistry::call('ReviewerAction::confirmReview', array($request, &$submission, &$email, $decline));
         import('lib.pkp.classes.log.PKPSubmissionEmailLogEntry');
         // Import email event constants
         $email->setEventType($decline ? SUBMISSION_EMAIL_REVIEW_DECLINE : SUBMISSION_EMAIL_REVIEW_CONFIRM);
         if ($emailText) {
             $email->setBody($emailText);
         }
         $email->send($request);
         $reviewAssignment->setDeclined($decline);
         $reviewAssignment->setDateConfirmed(Core::getCurrentDate());
         $reviewAssignment->stampModified();
         $reviewAssignmentDao->updateObject($reviewAssignment);
         // Add log
         import('lib.pkp.classes.log.SubmissionLog');
         import('classes.log.SubmissionEventLogEntry');
         $entry = new SubmissionEventLogEntry();
         $entry->setSubmissionId($reviewAssignment->getSubmissionId());
         $entry->setUserId($reviewer->getId());
         $entry->setDateLogged(Core::getCurrentDate());
         $entry->setEventType($decline ? SUBMISSION_LOG_REVIEW_DECLINE : SUBMISSION_LOG_REVIEW_ACCEPT);
         SubmissionLog::logEvent($request, $submission, $decline ? SUBMISSION_LOG_REVIEW_DECLINE : SUBMISSION_LOG_REVIEW_ACCEPT, $decline ? 'log.review.reviewDeclined' : 'log.review.reviewAccepted', array('reviewerName' => $reviewer->getFullName(), 'submissionId' => $reviewAssignment->getSubmissionId(), 'round' => $reviewAssignment->getRound()));
     }
 }
开发者ID:jprk,项目名称:pkp-lib,代码行数:46,代码来源:ReviewerAction.inc.php

示例10: saveApproveProof

 /**
  * Approve a galley submission file.
  * @param $args array
  * @param $request PKPRequest
  */
 function saveApproveProof($args, $request)
 {
     $submissionFile = $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION_FILE);
     $submission = $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION);
     // Make sure we only alter files associated with a galley.
     if ($submissionFile->getAssocType() !== ASSOC_TYPE_GALLEY) {
         fatalError('The requested file is not associated with any galley.');
     }
     if ($submissionFile->getViewable()) {
         // No longer expose the file to readers.
         $submissionFile->setViewable(false);
     } else {
         // Expose the file to readers (e.g. via e-commerce).
         $submissionFile->setViewable(true);
         // Log the approve proof event.
         import('lib.pkp.classes.log.SubmissionLog');
         import('classes.log.SubmissionEventLogEntry');
         // constants
         $user = $request->getUser();
         $articleGalleyDao = DAORegistry::getDAO('ArticleGalleyDAO');
         $galley = $articleGalleyDao->getByBestGalleyId($submissionFile->getAssocId(), $submission->getId());
         SubmissionLog::logEvent($request, $submission, SUBMISSION_LOG_PROOFS_APPROVED, 'submission.event.proofsApproved', array('formatName' => $galley->getLabel(), 'name' => $user->getFullName(), 'username' => $user->getUsername()));
     }
     $submissionFileDao = DAORegistry::getDAO('SubmissionFileDAO');
     $submissionFileDao->updateObject($submissionFile);
     // update the submission's file index
     import('classes.search.ArticleSearchIndex');
     ArticleSearchIndex::submissionFilesChanged($submission);
     return DAO::getDataChangedEvent($submissionFile->getId());
 }
开发者ID:mariojp,项目名称:ojs,代码行数:35,代码来源:EditorDecisionHandler.inc.php

示例11: setAvailable

 /**
  * Set a galley's "available" state
  * @param $args array
  * @param $request PKPRequest
  * @return JSONMessage JSON object
  */
 function setAvailable($args, $request)
 {
     $submission = $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION);
     $articleGalleyDao = DAORegistry::getDAO('ArticleGalleyDAO');
     $articleGalley = $articleGalleyDao->getByBestGalleyId($request->getUserVar('representationId'), $submission->getId());
     if ($articleGalley) {
         $newAvailableState = (int) $request->getUserVar('newAvailableState');
         $articleGalley->setIsAvailable($newAvailableState);
         $articleGalleyDao->updateObject($articleGalley);
         // log the state changing of the format.
         import('lib.pkp.classes.log.SubmissionLog');
         import('classes.log.SubmissionEventLogEntry');
         SubmissionLog::logEvent($request, $submission, $newAvailableState ? SUBMISSION_LOG_LAYOUT_GALLEY_AVAILABLE : SUBMISSION_LOG_LAYOUT_GALLEY_UNAVAILABLE, $newAvailableState ? 'submission.event.articleGalleyMadeAvailable' : 'submission.event.articleGalleyMadeUnavailable', array('galleyFormatName' => $articleGalley->getLocalizedName()));
         return DAO::getDataChangedEvent($articleGalley->getId());
     } else {
         return new JSONMessage(false, __('manager.setup.errorDeletingItem'));
     }
 }
开发者ID:relaciones-internacionales-journal,项目名称:ojs,代码行数:24,代码来源:ArticleGalleyGridHandler.inc.php

示例12: execute

 /**
  * Save changes to submission.
  * @param $args array
  * @param $request PKPRequest
  * @return int the submission ID
  */
 function execute($args, $request)
 {
     parent::execute($args, $request);
     // handle category assignment.
     ListbuilderHandler::unpack($request, $this->getData('categories'));
     $submissionDao = Application::getSubmissionDAO();
     $submission = $submissionDao->getById($this->submissionId);
     // Send author notification email
     import('classes.mail.MonographMailTemplate');
     $mail = new MonographMailTemplate($submission, 'SUBMISSION_ACK', null, null, null, false);
     $authorMail = new MonographMailTemplate($submission, 'SUBMISSION_ACK_NOT_USER', null, null, null, false);
     $context = $request->getContext();
     $router = $request->getRouter();
     if ($mail->isEnabled()) {
         // submission ack emails should be from the contact.
         $mail->setReplyTo($this->context->getSetting('contactEmail'), $this->context->getSetting('contactName'));
         $authorMail->setReplyTo($this->context->getSetting('contactEmail'), $this->context->getSetting('contactName'));
         $user = $request->getUser();
         $primaryAuthor = $submission->getPrimaryAuthor();
         if (!isset($primaryAuthor)) {
             $authors = $submission->getAuthors();
             $primaryAuthor = $authors[0];
         }
         $mail->addRecipient($user->getEmail(), $user->getFullName());
         if ($user->getEmail() != $primaryAuthor->getEmail()) {
             $authorMail->addRecipient($primaryAuthor->getEmail(), $primaryAuthor->getFullName());
         }
         if ($context->getSetting('copySubmissionAckPrimaryContact')) {
             $authorMail->addBcc($context->getSetting('contactEmail'), $context->getSetting('contactName'));
         }
         if ($copyAddress = $context->getSetting('copySubmissionAckAddress')) {
             $authorMail->addBcc($copyAddress);
         }
         $assignedAuthors = $submission->getAuthors();
         foreach ($assignedAuthors as $author) {
             $authorEmail = $author->getEmail();
             // only add the author email if they have not already been added as the primary author
             // or user creating the submission.
             if ($authorEmail != $primaryAuthor->getEmail() && $authorEmail != $user->getEmail()) {
                 $authorMail->addRecipient($author->getEmail(), $author->getFullName());
             }
         }
         $mail->bccAssignedSeriesEditors($submission->getId(), WORKFLOW_STAGE_ID_SUBMISSION);
         $mail->assignParams(array('authorName' => $user->getFullName(), 'authorUsername' => $user->getUsername(), 'editorialContactSignature' => $context->getSetting('contactName') . "\n" . $context->getLocalizedName(), 'submissionUrl' => $router->url($request, null, 'authorDashboard', 'submission', $submission->getId())));
         $authorMail->assignParams(array('submitterName' => $user->getFullName(), 'editorialContactSignature' => $context->getSetting('contactName') . "\n" . $context->getLocalizedName()));
         $mail->send($request);
         $recipients = $authorMail->getRecipients();
         if (!empty($recipients)) {
             $authorMail->send($request);
         }
     }
     // Log submission.
     import('lib.pkp.classes.log.SubmissionLog');
     import('classes.log.SubmissionEventLogEntry');
     // constants
     SubmissionLog::logEvent($request, $submission, SUBMISSION_LOG_SUBMISSION_SUBMIT, 'submission.event.submissionSubmitted');
     return $this->submissionId;
 }
开发者ID:austinvernsonger,项目名称:omp,代码行数:64,代码来源:SubmissionSubmitStep3Form.inc.php

示例13: 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');
         }
     }
 }
开发者ID:josekarvalho,项目名称:omp,代码行数:101,代码来源:CatalogEntryCatalogMetadataForm.inc.php

示例14: execute

 /**
  * Save the assigned format
  * @param PKPRequest request
  * @return int Publication format ID
  * @see Form::execute()
  */
 function execute($request)
 {
     $publicationFormatDao = DAORegistry::getDAO('PublicationFormatDAO');
     $monograph = $this->getMonograph();
     $publicationFormat = $this->getPublicationFormat();
     if (!$publicationFormat) {
         // this is a new format to this published monograph
         $publicationFormat = $publicationFormatDao->newDataObject();
         $publicationFormat->setMonographId($monograph->getId());
         $existingFormat = false;
     } else {
         $existingFormat = true;
         if ($monograph->getId() !== $publicationFormat->getMonographId()) {
             fatalError('Invalid format!');
         }
     }
     $publicationFormat->setName($this->getData('name'));
     $publicationFormat->setEntryKey($this->getData('entryKey'));
     $publicationFormat->setPhysicalFormat($this->getData('isPhysicalFormat') ? true : false);
     $publicationFormat->setRemoteURL($this->getData('remoteURL'));
     if ($existingFormat) {
         $publicationFormatDao->updateObject($publicationFormat);
         $representationId = $publicationFormat->getId();
     } else {
         $representationId = $publicationFormatDao->insertObject($publicationFormat);
         // log the creation of the format.
         import('lib.pkp.classes.log.SubmissionLog');
         import('classes.log.SubmissionEventLogEntry');
         SubmissionLog::logEvent($request, $monograph, SUBMISSION_LOG_PUBLICATION_FORMAT_CREATE, 'submission.event.publicationFormatCreated', array('formatName' => $publicationFormat->getLocalizedName()));
     }
     return $representationId;
 }
开发者ID:PublishingWithoutWalls,项目名称:omp,代码行数:38,代码来源:PublicationFormatForm.inc.php

示例15: setAvailable

 /**
  * Set a format's "available" state
  * @param $args array
  * @param $request PKPRequest
  * @return JSONMessage JSON object
  */
 function setAvailable($args, $request)
 {
     $context = $request->getContext();
     $publicationFormatDao = DAORegistry::getDAO('PublicationFormatDAO');
     $publicationFormat = $publicationFormatDao->getById($request->getUserVar('representationId'), null, $context->getId());
     if (!$publicationFormat) {
         return new JSONMessage(false, __('manager.setup.errorDeletingItem'));
     }
     $newAvailableState = (int) $request->getUserVar('newAvailableState');
     $publicationFormat->setIsAvailable($newAvailableState);
     $publicationFormatDao->updateObject($publicationFormat);
     // log the state changing of the format.
     import('lib.pkp.classes.log.SubmissionLog');
     import('classes.log.SubmissionEventLogEntry');
     SubmissionLog::logEvent($request, $this->getSubmission(), $newAvailableState ? SUBMISSION_LOG_PUBLICATION_FORMAT_AVAILABLE : SUBMISSION_LOG_PUBLICATION_FORMAT_UNAVAILABLE, $newAvailableState ? 'submission.event.publicationFormatMadeAvailable' : 'submission.event.publicationFormatMadeUnavailable', array('publicationFormatName' => $publicationFormat->getLocalizedName()));
     // Update the formats tombstones.
     import('classes.publicationFormat.PublicationFormatTombstoneManager');
     $publicationFormatTombstoneMgr = new PublicationFormatTombstoneManager();
     if ($publicationFormat->getIsAvailable() && $publicationFormat->getIsApproved()) {
         // Delete any existing tombstone.
         $publicationFormatTombstoneMgr->deleteTombstonesByPublicationFormats(array($publicationFormat));
     } else {
         // (Re)create a tombstone for this publication format.
         $publicationFormatTombstoneMgr->deleteTombstonesByPublicationFormats(array($publicationFormat));
         $publicationFormatTombstoneMgr->insertTombstoneByPublicationFormat($publicationFormat, $context);
     }
     return DAO::getDataChangedEvent($publicationFormat->getId());
 }
开发者ID:NateWr,项目名称:omp,代码行数:34,代码来源:PublicationFormatGridHandler.inc.php


注:本文中的SubmissionLog::logEvent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。