/** * @see OAIMetadataFormat#toXml */ function toXml(&$record, $format = null) { $article = $record->getData('article'); $journal = $record->getData('journal'); $templateMgr = TemplateManager::getManager(); $templateMgr->assign(array('journal' => $journal, 'article' => $article, 'issue' => $record->getData('issue'), 'section' => $record->getData('section'))); $subjects = array_merge_recursive($this->stripAssocArray((array) $article->getDiscipline(null)), $this->stripAssocArray((array) $article->getSubject(null)), $this->stripAssocArray((array) $article->getSubjectClass(null))); $templateMgr->assign(array('subject' => isset($subjects[$journal->getPrimaryLocale()]) ? $subjects[$journal->getPrimaryLocale()] : '', 'abstract' => String::html2text($article->getAbstract($article->getLocale())), 'language' => AppLocale::get3LetterIsoFromLocale($article->getLocale()))); return $templateMgr->fetch(dirname(__FILE__) . '/record.tpl'); }
function assignParams($paramArray = array()) { $submission = $this->submission; $application = PKPApplication::getApplication(); $request = $application->getRequest(); $paramArray['submissionTitle'] = strip_tags($submission->getLocalizedTitle()); $paramArray['submissionId'] = $submission->getId(); $paramArray['submissionAbstract'] = String::html2text($submission->getLocalizedAbstract()); $paramArray['authorString'] = strip_tags($submission->getAuthorString()); parent::assignParams($paramArray); }
function assignParams($paramArray = array()) { $article =& $this->article; $journal = isset($this->journal) ? $this->journal : Request::getJournal(); $paramArray['articleTitle'] = strip_tags($article->getLocalizedTitle()); $paramArray['articleId'] = $article->getId(); $paramArray['journalName'] = strip_tags($journal->getLocalizedTitle()); $paramArray['sectionName'] = strip_tags($article->getSectionTitle()); $paramArray['articleAbstract'] = String::html2text($article->getLocalizedAbstract()); $paramArray['authorString'] = strip_tags($article->getAuthorString()); parent::assignParams($paramArray); }
function assignParams($paramArray = array()) { $monograph =& $this->monograph; $press = isset($this->press) ? $this->press : Request::getPress(); $paramArray['monographTitle'] = strip_tags($monograph->getLocalizedTitle()); $paramArray['monographId'] = $monograph->getId(); $paramArray['pressName'] = strip_tags($press->getLocalizedName()); $paramArray['seriesName'] = strip_tags($monograph->getSeriesTitle()); $paramArray['monographAbstract'] = String::html2text($monograph->getLocalizedAbstract()); $paramArray['authorString'] = strip_tags($monograph->getAuthorString()); parent::assignParams($paramArray); }
function assignParams($paramArray = array()) { $paper =& $this->paper; $conference = isset($this->conference) ? $this->conference : Request::getConference(); $schedConf = isset($this->schedConf) ? $this->schedConf : Request::getSchedConf(); $paramArray['paperId'] = $paper->getId(); $paramArray['paperTitle'] = strip_tags($paper->getLocalizedTitle()); $paramArray['conferenceName'] = strip_tags($conference->getConferenceTitle()); $paramArray['schedConfName'] = strip_tags($schedConf->getLocalizedTitle()); $paramArray['trackName'] = strip_tags($paper->getTrackTitle()); $paramArray['paperAbstract'] = String::html2text($paper->getLocalizedAbstract()); $paramArray['authorString'] = strip_tags($paper->getAuthorString()); parent::assignParams($paramArray); }
function assignParams($paramArray = array()) { $article =& $this->article; $journal = isset($this->journal) ? $this->journal : Request::getJournal(); $sectionDao =& DAORegistry::getDAO('SectionDAO'); $section =& $sectionDao->getSection($this->sectionDecision->getSectionId()); $abstract =& $article->getLocalizedAbstract(); $paramArray['articleTitle'] = strip_tags($abstract->getScientificTitle()); $paramArray['articleId'] = $article->getProposalId(); $paramArray['journalName'] = strip_tags($journal->getLocalizedTitle()); $paramArray['sectionName'] = strip_tags($section->getLocalizedTitle()); $paramArray['articleBackground'] = String::html2text($abstract->getBackground()); $paramArray['articleObjectives'] = String::html2text($abstract->getObjectives()); $paramArray['articleStudyMethods'] = String::html2text($abstract->getStudyMethods()); $paramArray['articleExpectedOutcomes'] = String::html2text($abstract->getExpectedOutcomes()); $paramArray['authorString'] = strip_tags($article->getAuthorString()); parent::assignParams($paramArray); }
/** * Author requests a book for review. */ function requestBookForReview($args = array(), $request) { $this->setupTemplate($request); if (empty($args)) { $request->redirect(null, 'user'); } $bfrPlugin = PluginRegistry::getPlugin('generic', BOOKS_FOR_REVIEW_PLUGIN_NAME); $journal = $request->getJournal(); $journalId = $journal->getId(); $bookId = (int) $args[0]; $bfrDao = DAORegistry::getDAO('BookForReviewDAO'); // Ensure book for review is for this journal if ($bfrDao->getBookForReviewJournalId($bookId) == $journalId) { import('lib.pkp.classes.mail.MailTemplate'); $email = new MailTemplate('BFR_BOOK_REQUESTED'); $send = $request->getUserVar('send'); // Author has filled out mail form or decided to skip email if ($send && !$email->hasErrors()) { // Update book for review as requested $book = $bfrDao->getBookForReview($bookId); $status = $book->getStatus(); $bfrPlugin->import('classes.BookForReview'); // Ensure book for review is avaliable if ($status == BFR_STATUS_AVAILABLE) { $user = $request->getUser(); $userId = $user->getId(); $book->setStatus(BFR_STATUS_REQUESTED); $book->setUserId($userId); $book->setDateRequested(date('Y-m-d H:i:s', time())); $bfrDao->updateObject($book); $email->send(); import('classes.notification.NotificationManager'); $notificationManager = new NotificationManager(); $notificationManager->createTrivialNotification($userId, NOTIFICATION_TYPE_BOOK_REQUESTED); } $request->redirect(null, 'author', 'booksForReview'); // Display mail form for author } else { if (!$request->getUserVar('continued')) { $book = $bfrDao->getBookForReview($bookId); $status = $book->getStatus(); $bfrPlugin->import('classes.BookForReview'); // Ensure book for review is avaliable if ($status == BFR_STATUS_AVAILABLE) { $user = $request->getUser(); $userId = $user->getId(); $editorFullName = $book->getEditorFullName(); $editorEmail = $book->getEditorEmail(); $paramArray = array('editorName' => strip_tags($editorFullName), 'bookForReviewTitle' => '"' . strip_tags($book->getLocalizedTitle()) . '"', 'authorContactSignature' => String::html2text($user->getContactSignature())); $email->addRecipient($editorEmail, $editorFullName); $email->assignParams($paramArray); } $returnUrl = $request->url(null, 'author', 'requestBookForReview', $bookId); $email->displayEditForm($returnUrl); } } } $request->redirect(null, 'booksForReview'); }
/** * Create a content item element. * * @param $author Author * @param $objectLocalePrecedence array * * @return XMLNode|DOMImplementation */ function &_contributorElement(&$author, $objectLocalePrecedence) { $contributorElement =& XMLCustomWriter::createElement($this->getDoc(), 'Contributor'); // Sequence number $seq = $author->getSequence(); assert(!empty($seq)); XMLCustomWriter::createChildWithText($this->getDoc(), $contributorElement, 'SequenceNumber', $seq); // Contributor role (mandatory) XMLCustomWriter::createChildWithText($this->getDoc(), $contributorElement, 'ContributorRole', O4DOI_CONTRIBUTOR_ROLE_ACTUAL_AUTHOR); // Person name (mandatory) $personName = $author->getFullName(); assert(!empty($personName)); XMLCustomWriter::createChildWithText($this->getDoc(), $contributorElement, 'PersonName', $personName); // Inverted person name $invertedPersonName = $author->getFullName(true); assert(!empty($invertedPersonName)); XMLCustomWriter::createChildWithText($this->getDoc(), $contributorElement, 'PersonNameInverted', $invertedPersonName); // Affiliation $affiliation = $this->getPrimaryTranslation($author->getAffiliation(null), $objectLocalePrecedence); if (!empty($affiliation)) { $affiliationElement = XMLCustomWriter::createElement($this->getDoc(), 'ProfessionalAffiliation'); XMLCustomWriter::createChildWithText($this->getDoc(), $affiliationElement, 'Affiliation', $affiliation); XMLCustomWriter::appendChild($contributorElement, $affiliationElement); } // Biographical note $bioNote = $this->getPrimaryTranslation($author->getBiography(null), $objectLocalePrecedence); if (!empty($bioNote)) { XMLCustomWriter::createChildWithText($this->getDoc(), $contributorElement, 'BiographicalNote', String::html2text($bioNote)); } return $contributorElement; }
/** * Email the comment. * @param $recipients array of recipients (email address => name) */ function email($recipients) { import('mail.PaperMailTemplate'); $email = new PaperMailTemplate($this->paper, 'SUBMISSION_COMMENT'); foreach ($recipients as $emailAddress => $name) { $email->addRecipient($emailAddress, $name); $email->setSubject(strip_tags($this->paper->getLocalizedTitle())); $paramArray = array('name' => $name, 'commentName' => $this->user->getFullName(), 'comments' => String::html2text($this->getData('comments'))); $email->assignParams($paramArray); $email->send(); $email->clearRecipients(); } }
/** * Display email form for the editor * @param $email MailTemplate * @param $objectForReview ObjectForReview * @param $user User * @param $returnUrl string * @param $action string * @param $request PKPRequest */ function _displayEmailForm($email, $objectForReview, $user, $returnUrl, $action, $request) { if (!$request->getUserVar('continued')) { $userFullName = $user->getFullName(); $userEmail = $user->getEmail(); $userMailingAddress = $user->getMailingAddress(); $userCountryCode = $user->getCountry(); if (empty($userMailingAddress)) { $userMailingAddress = __('plugins.generic.objectsForReview.editor.noMailingAddress'); } else { $countryDao =& DAORegistry::getDAO('CountryDAO'); $countries =& $countryDao->getCountries(); $userCountry = $countries[$userCountryCode]; $userMailingAddress .= "\n" . $userCountry; } $editor =& $objectForReview->getEditor(); $editorFullName = $editor->getFullName(); $editorEmail = $editor->getEmail(); $editorContactSignature = $editor->getContactSignature(); if ($action == 'OFR_OBJECT_ASSIGNED') { $ofrPlugin =& $this->_getObjectsForReviewPlugin(); $journal =& $request->getJournal(); $dueWeeks = $ofrPlugin->getSetting($journal->getId(), 'dueWeeks'); $dueDateTimestamp = time() + $dueWeeks * 7 * 24 * 60 * 60; $paramArray = array('authorName' => strip_tags($userFullName), 'authorMailingAddress' => String::html2text($userMailingAddress), 'objectForReviewTitle' => '"' . strip_tags($objectForReview->getTitle()) . '"', 'objectForReviewDueDate' => date('l, F j, Y', $dueDateTimestamp), 'userProfileUrl' => $request->url(null, 'user', 'profile'), 'submissionUrl' => $request->url(null, 'author', 'submit'), 'editorialContactSignature' => String::html2text($editorContactSignature)); } elseif ($action == 'OFR_OBJECT_DENIED') { $paramArray = array('authorName' => strip_tags($userFullName), 'objectForReviewTitle' => '"' . strip_tags($objectForReview->getTitle()) . '"', 'submissionUrl' => $request->url(null, 'author', 'submit'), 'editorialContactSignature' => String::html2text($editorContactSignature)); } elseif ($action == 'OFR_OBJECT_MAILED') { $paramArray = array('authorName' => strip_tags($userFullName), 'authorMailingAddress' => String::html2text($userMailingAddress), 'objectForReviewTitle' => '"' . strip_tags($objectForReview->getTitle()) . '"', 'submissionUrl' => $request->url(null, 'author', 'submit'), 'editorialContactSignature' => String::html2text($editorContactSignature)); } elseif ($action == 'OFR_REVIEWER_REMOVED') { $paramArray = array('authorName' => strip_tags($userFullName), 'objectForReviewTitle' => '"' . strip_tags($objectForReview->getTitle()) . '"', 'editorialContactSignature' => String::html2text($editorContactSignature)); } $email->addRecipient($userEmail, $userFullName); $email->setReplyTo($editorEmail, $editorFullName); $email->assignParams($paramArray); } $email->displayEditForm($returnUrl); }
/** * Blind CC the reviews to reviewers. * @param $article object * @param $send boolean * @param $inhibitExistingEmail boolean * @return boolean true iff ready for redirect */ function blindCcReviewsToReviewers($article, $send = false, $inhibitExistingEmail = false) { $commentDao =& DAORegistry::getDAO('ArticleCommentDAO'); $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO'); $userDao =& DAORegistry::getDAO('UserDAO'); $journal =& Request::getJournal(); $comments =& $commentDao->getArticleComments($article->getId(), COMMENT_TYPE_EDITOR_DECISION); $reviewAssignments =& $reviewAssignmentDao->getBySubmissionId($article->getId(), $article->getCurrentRound()); $commentsText = ""; foreach ($comments as $comment) { $commentsText .= String::html2text($comment->getComments()) . "\n\n"; } $user =& Request::getUser(); import('classes.mail.ArticleMailTemplate'); $email = new ArticleMailTemplate($article, 'SUBMISSION_DECISION_REVIEWERS', null, null, null, true, true); if ($send && !$email->hasErrors() && !$inhibitExistingEmail) { HookRegistry::call('SectionEditorAction::blindCcReviewsToReviewers', array(&$article, &$reviewAssignments, &$email)); $email->send(); return true; } else { if ($inhibitExistingEmail || !Request::getUserVar('continued')) { $email->clearRecipients(); foreach ($reviewAssignments as $reviewAssignment) { if ($reviewAssignment->getDateCompleted() != null && !$reviewAssignment->getCancelled()) { $reviewer =& $userDao->getUser($reviewAssignment->getReviewerId()); if (isset($reviewer)) { $email->addBcc($reviewer->getEmail(), $reviewer->getFullName()); } } } $paramArray = array('comments' => $commentsText, 'editorialContactSignature' => $user->getContactSignature()); $email->assignParams($paramArray); } $email->displayEditForm(Request::url(null, null, 'blindCcReviewsToReviewers'), array('articleId' => $article->getId())); return false; } }
/** * Blind CC the editor decision email to reviewers. * @param $article object * @param $send boolean * @return boolean true iff ready for redirect */ function bccEditorDecisionCommentToReviewers($article, $send, $request) { import('classes.mail.ArticleMailTemplate'); $email = new ArticleMailTemplate($article, 'SUBMISSION_DECISION_REVIEWERS'); if ($send && !$email->hasErrors()) { HookRegistry::call('SectionEditorAction::bccEditorDecisionCommentToReviewers', array(&$article, &$reviewAssignments, &$email)); $email->send($request); return true; } else { if (!$request->getUserVar('continued')) { $userDao =& DAORegistry::getDAO('UserDAO'); $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO'); $reviewAssignments =& $reviewAssignmentDao->getBySubmissionId($article->getId(), $article->getCurrentRound()); $email->clearRecipients(); foreach ($reviewAssignments as $reviewAssignment) { if ($reviewAssignment->getDateCompleted() != null && !$reviewAssignment->getCancelled()) { $reviewer =& $userDao->getUser($reviewAssignment->getReviewerId()); if (isset($reviewer)) { $email->addBcc($reviewer->getEmail(), $reviewer->getFullName()); } } } $commentsText = ""; if ($article->getMostRecentEditorDecisionComment()) { $comment = $article->getMostRecentEditorDecisionComment(); $commentsText = String::html2text($comment->getComments()) . "\n\n"; } $user =& $request->getUser(); $paramArray = array('comments' => $commentsText, 'editorialContactSignature' => $user->getContactSignature()); $email->assignParams($paramArray); } $email->displayEditForm($request->url(null, null, 'bccEditorDecisionCommentToReviewers', 'send'), array('articleId' => $article->getId())); return false; } }
/** * Create deposit package of article metadata. * @param $article Article * @return DataversePackager */ function createMetadataPackage($article) { $journalDao =& DAORegistry::getDAO('JournalDAO'); $journal =& $journalDao->getById($article->getJournalId()); $package = new DataversePackager(); // Add article metadata, in language of article locale $package->addMetadata('title', $article->getTitle($article->getLocale())); // If study description not provided, use article abstract $package->addMetadata('description', $article->getData('studyDescription', $article->getLocale()) ? $article->getData('studyDescription', $article->getLocale()) : String::html2text($article->getAbstract($article->getLocale()))); foreach ($article->getAuthors() as $author) { $package->addMetadata('creator', $author->getFullName(true), array('affiliation' => $this->_formatAffiliation($author, $article->getLocale()))); } // Article metadata: fields with multiple values $pattern = '/\\s*' . DATAVERSE_PLUGIN_SUBJECT_SEPARATOR . '\\s*/'; foreach (String::regexp_split($pattern, $article->getCoverageGeo($article->getLocale())) as $coverage) { if ($coverage) { $package->addMetadata('coverage', $coverage); } } // Article metadata: filter subject(s) to prevent repeated values in dataset subject field $subjects = array(); foreach (String::regexp_split($pattern, $article->getDiscipline($article->getLocale())) as $subject) { if ($subject) { $subjects[String::strtolower($subject)] = $subject; } } foreach (String::regexp_split($pattern, $article->getSubjectClass($article->getLocale())) as $subject) { if ($subject) { $subjects[String::strtolower($subject)] = $subject; } } foreach (String::regexp_split($pattern, $article->getSubject($article->getLocale())) as $subject) { if ($subject) { $subjects[String::strtolower($subject)] = $subject; } } // Article metadata: filter contributors(s) to prevent repeated values in dataset contributor field $contributors = array(); foreach (String::regexp_split($pattern, $article->getSponsor($article->getLocale())) as $contributor) { if ($contributor) { $contributors[String::strtolower($contributor)] = $contributor; } } // Published article metadata $pubIdAttributes = array(); if ($article->getStatus() == STATUS_PUBLISHED) { // publication date $publishedArticleDao = DAORegistry::getDAO('PublishedArticleDAO'); $publishedArticle =& $publishedArticleDao->getPublishedArticleByArticleId($article->getId(), $article->getJournalId()); $datePublished = $publishedArticle->getDatePublished(); if (!$datePublished) { // If article has no pub date, use issue pub date $issueDao =& DAORegistry::getDAO('IssueDAO'); $issue =& $issueDao->getIssueByArticleId($article->getId(), $article->getJournalId()); $datePublished = $issue->getDatePublished(); } $package->addMetadata('date', strftime('%Y-%m-%d', strtotime($datePublished))); // isReferencedBy: add persistent URL to citation using specified pubid plugin $pubIdPlugin =& PluginRegistry::getPlugin('pubIds', $this->getSetting($article->getJournalId(), 'pubIdPlugin')); if ($pubIdPlugin && $pubIdPlugin->getEnabled()) { $pubIdAttributes['agency'] = $pubIdPlugin->getDisplayName(); $pubIdAttributes['IDNo'] = $article->getPubId($pubIdPlugin->getPubIdType()); $pubIdAttributes['holdingsURI'] = $pubIdPlugin->getResolvingUrl($article->getJournalId(), $pubIdAttributes['IDNo']); } // If no pubIdP plugin selected or enabled, provide OJS URL if (!array_key_exists('holdingsURI', $pubIdAttributes)) { $pubIdAttributes['holdingsURI'] = Request::url($journal->getPath(), 'article', 'view', array($article->getId())); } // Add copyright notice. if ($article->getCopyrightYear() && $article->getCopyrightHolder($article->getLocale())) { AppLocale::requireComponents(LOCALE_COMPONENT_APPLICATION_COMMON); $package->addMetadata('rights', __('submission.copyrightStatement', array('copyrightYear' => $article->getCopyrightYear(), 'copyrightHolder' => $article->getCopyrightHolder($article->getLocale())))); } } // Journal metadata $package->addMetadata('publisher', $journal->getSetting('publisherInstitution')); $package->addMetadata('isReferencedBy', String::html2text($this->getCitation($article)), $pubIdAttributes); // Suppfile metadata $suppFileDao =& DAORegistry::getDAO('SuppFileDAO'); $dvFileDao =& DAORegistry::getDAO('DataverseFileDAO'); $dvFiles =& $dvFileDao->getDataverseFilesBySubmissionId($article->getId()); // Filter type field to prevent repeated values in dataset 'Kind of data' field $suppFileTypes = array(); foreach ($dvFiles as $dvFile) { $suppFile =& $suppFileDao->getSuppFile($dvFile->getSuppFileId(), $article->getId()); if ($suppFile) { // Split & filter subjects and/or contributors that may be repeated in article metadata foreach (String::regexp_split($pattern, $suppFile->getSubject($article->getLocale())) as $subject) { $subjects[String::strtolower($subject)] = $subject; } foreach (String::regexp_split($pattern, $suppFile->getSponsor($article->getLocale())) as $contributor) { if ($contributor) { $contributors[String::strtolower($contributor)] = $contributor; } } // File type has single value but possibly repeated across suppfiles if ($suppFile->getType()) { $suppFileTypes[String::strtolower($suppFile->getType())] = $suppFile->getType(); } if ($suppFile->getTypeOther($article->getLocale())) { $suppFileTypes[String::strtolower($suppFile->getTypeOther($article->getLocale()))] = $suppFile->getTypeOther($article->getLocale()); } } } // Add subjects, contributors & types to entry foreach (array_values($subjects) as $subject) { $package->addMetadata('subject', $subject); } foreach (array_values($contributors) as $contributor) { $package->addMetadata('contributor', $contributor, array('type' => 'funder')); } foreach (array_values($suppFileTypes) as $type) { $package->addMetadata('type', $type); } // Write metadata as Atom entry $package->createAtomEntry(); // Return package for deposit return $package; }
/** * @see DOIExportDom::generate() */ function &generate(&$object) { $falseVar = false; // Declare variables that will contain publication objects. $journal = $this->getJournal(); $issue = null; /* @var $issue Issue */ $article = null; /* @var $article PublishedArticle */ $galley = null; /* @var $galley ArticleGalley */ $articlesByIssue = null; $galleysByArticle = null; // Retrieve required publication objects (depends on the object to be exported). $pubObjects =& $this->retrievePublicationObjects($object); extract($pubObjects); // Identify an object implementing a SubmissionFile (if any). $submissionFile = $galley; // Identify the object locale. $objectLocalePrecedence = $this->getObjectLocalePrecedence($article, $galley); // The publisher is required. $publisher = $this->getPublisher($objectLocalePrecedence); // The publication date is required. $publicationDate = is_a($article, 'PublishedArticle') ? $article->getDatePublished() : null; if (empty($publicationDate)) { $publicationDate = $issue->getDatePublished(); } assert(!empty($publicationDate)); // Create the XML document and its root element. $doc =& $this->getDoc(); $rootElement =& $this->rootElement(); XMLCustomWriter::appendChild($doc, $rootElement); // DOI (mandatory) if (($identifierElement =& $this->_identifierElement($object)) === false) { return false; } XMLCustomWriter::appendChild($rootElement, $identifierElement); // Creators (mandatory) XMLCustomWriter::appendChild($rootElement, $this->_creatorsElement($object, $objectLocalePrecedence, $publisher)); // Title (mandatory) XMLCustomWriter::appendChild($rootElement, $this->_titlesElement($object, $objectLocalePrecedence)); // Publisher (mandatory) XMLCustomWriter::createChildWithText($this->getDoc(), $rootElement, 'publisher', $publisher); // Publication Year (mandatory) XMLCustomWriter::createChildWithText($this->getDoc(), $rootElement, 'publicationYear', date('Y', strtotime($publicationDate))); // Subjects if (!empty($article)) { $this->_appendNonMandatoryChild($rootElement, $this->_subjectsElement($article, $objectLocalePrecedence)); } // Dates XMLCustomWriter::appendChild($rootElement, $this->_datesElement($issue, $article, $submissionFile, $publicationDate)); // Language XMLCustomWriter::createChildWithText($this->getDoc(), $rootElement, 'language', AppLocale::get3LetterIsoFromLocale($objectLocalePrecedence[0])); // Resource Type $resourceTypeElement =& $this->_resourceTypeElement($object); XMLCustomWriter::appendChild($rootElement, $resourceTypeElement); // Alternate Identifiers $this->_appendNonMandatoryChild($rootElement, $this->_alternateIdentifiersElement($object, $issue, $article, $submissionFile)); // Related Identifiers $this->_appendNonMandatoryChild($rootElement, $this->_relatedIdentifiersElement($object, $articlesByIssue, $galleysByArticle, $issue, $article)); // Sizes $sizesElement =& $this->_sizesElement($object, $article); if ($sizesElement) { XMLCustomWriter::appendChild($rootElement, $sizesElement); } // Formats if (!empty($submissionFile)) { XMLCustomWriter::appendChild($rootElement, $this->_formatsElement($submissionFile)); } // Rights $rights = $this->getPrimaryTranslation($journal->getSetting('copyrightNotice', null), $objectLocalePrecedence); if (!empty($rights)) { XMLCustomWriter::createChildWithText($this->getDoc(), $rootElement, 'rights', String::html2text($rights)); } // Descriptions $descriptionsElement =& $this->_descriptionsElement($issue, $article, $objectLocalePrecedence, $articlesByIssue); if ($descriptionsElement) { XMLCustomWriter::appendChild($rootElement, $descriptionsElement); } return $doc; }
/** * Auto-fill the DOAJ form. * @param $journal object */ function contact($journal, $send = false) { $request = $this->getRequest(); $user = $request->getUser(); $issn = $journal->getSetting('printIssn'); $paramArray = array('name' => $user->getFullName(), 'email' => $user->getEmail(), 'title' => $journal->getLocalizedName(), 'description' => String::html2text($journal->getLocalizedSetting('focusScopeDesc')), 'url' => $request->url($journal->getPath()), 'charging' => $journal->getSetting('submissionFee') > 0 ? 'Y' : 'N', 'issn' => $issn, 'eissn' => $journal->getSetting('onlineIssn'), 'pub' => $journal->getSetting('publisherInstitution'), 'language' => AppLocale::getLocale(), 'keywords' => $journal->getLocalizedSetting('searchKeywords'), 'contact_person' => $journal->getSetting('contactName'), 'contact_email' => $journal->getSetting('contactEmail')); $url = 'http://www.doaj.org/doaj?func=suggest&owner=1'; foreach ($paramArray as $name => $value) { $url .= '&' . urlencode($name) . '=' . urlencode($value); } $request->redirectUrl($url); }
/** * Email the comment. * @param $recipients array of recipients (email address => name) */ function email($recipients, $request) { $article = $this->article; $articleCommentDao =& DAORegistry::getDAO('ArticleCommentDAO'); $journal =& Request::getJournal(); import('classes.mail.ArticleMailTemplate'); $email = new ArticleMailTemplate($article, 'SUBMISSION_COMMENT'); $email->setReplyTo($this->user->getEmail(), $this->user->getFullName()); $commentText = $this->getData('comments'); // Individually send an email to each of the recipients. foreach ($recipients as $emailAddress => $name) { $email->addRecipient($emailAddress, $name); $paramArray = array('name' => $name, 'commentName' => $this->user->getFullName(), 'comments' => String::html2text($commentText)); $email->sendWithParams($paramArray, $request); $email->clearRecipients(); } }
/** * Import all free-text/review form reviews to paste into message * @param $args array * @param $request PKPRequest * @return JSONMessage JSON object */ function importPeerReviews($args, $request) { // Retrieve the authorized submission. $submission = $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION); // Retrieve the current review round. $reviewRound = $this->getAuthorizedContextObject(ASSOC_TYPE_REVIEW_ROUND); // Retrieve peer reviews. $reviewAssignmentDao = DAORegistry::getDAO('ReviewAssignmentDAO'); $submissionCommentDao = DAORegistry::getDAO('SubmissionCommentDAO'); $reviewFormResponseDao = DAORegistry::getDAO('ReviewFormResponseDAO'); $reviewFormElementDao = DAORegistry::getDAO('ReviewFormElementDAO'); $reviewAssignments = $reviewAssignmentDao->getBySubmissionId($submission->getId(), $reviewRound->getId()); $reviewIndexes = $reviewAssignmentDao->getReviewIndexesForRound($submission->getId(), $reviewRound->getId()); AppLocale::requireComponents(LOCALE_COMPONENT_PKP_SUBMISSION); $body = ''; $textSeparator = '------------------------------------------------------'; foreach ($reviewAssignments as $reviewAssignment) { // If the reviewer has completed the assignment, then import the review. if ($reviewAssignment->getDateCompleted() != null && !$reviewAssignment->getCancelled()) { // Get the comments associated with this review assignment $submissionComments = $submissionCommentDao->getSubmissionComments($submission->getId(), COMMENT_TYPE_PEER_REVIEW, $reviewAssignment->getId()); $body .= "\n\n{$textSeparator}\n"; // If it is not a double blind review, show reviewer's name. if ($reviewAssignment->getReviewMethod() != SUBMISSION_REVIEW_METHOD_DOUBLEBLIND) { $body .= $reviewAssignment->getReviewerFullName() . "\n"; } else { $body .= __('submission.comments.importPeerReviews.reviewerLetter', array('reviewerLetter' => String::enumerateAlphabetically($reviewIndexes[$reviewAssignment->getId()]))) . "\n"; } while ($comment = $submissionComments->next()) { // If the comment is viewable by the author, then add the comment. if ($comment->getViewable()) { $body .= String::html2text($comment->getComments()) . "\n\n"; } } $body .= "{$textSeparator}\n\n"; if ($reviewFormId = $reviewAssignment->getReviewFormId()) { $reviewId = $reviewAssignment->getId(); $reviewFormElements = $reviewFormElementDao->getByReviewFormId($reviewFormId); if (!$submissionComments) { $body .= "{$textSeparator}\n"; $body .= __('submission.comments.importPeerReviews.reviewerLetter', array('reviewerLetter' => String::enumerateAlphabetically($reviewIndexes[$reviewAssignment->getId()]))) . "\n\n"; } while ($reviewFormElement = $reviewFormElements->next()) { $body .= String::html2text($reviewFormElement->getLocalizedQuestion()) . ": \n"; $reviewFormResponse = $reviewFormResponseDao->getReviewFormResponse($reviewId, $reviewFormElement->getId()); if ($reviewFormResponse) { $possibleResponses = $reviewFormElement->getLocalizedPossibleResponses(); if (in_array($reviewFormElement->getElementType(), $reviewFormElement->getMultipleResponsesElementTypes())) { if ($reviewFormElement->getElementType() == REVIEW_FORM_ELEMENT_TYPE_CHECKBOXES) { foreach ($reviewFormResponse->getValue() as $value) { $body .= "\t" . String::html2text($possibleResponses[$value]) . "\n"; } } else { $body .= "\t" . String::html2text($possibleResponses[$reviewFormResponse->getValue()]) . "\n"; } $body .= "\n"; } else { $body .= "\t" . String::html2text($reviewFormResponse->getValue()) . "\n\n"; } } } $body .= "{$textSeparator}\n\n"; } } } if (empty($body)) { return new JSONMessage(false, __('editor.review.noReviews')); } else { return new JSONMessage(true, $body); } }
/** * Display email form for the author * @param $email MailTemplate * @param $objectForReview ObjectForReview * @param $user User * @param $returnUrl string * @param $action string * @param $request PKPRequest */ function _displayEmailForm($email, $objectForReview, $user, $returnUrl, $action, $request) { if (!$request->getUserVar('continued')) { $editor =& $objectForReview->getEditor(); $editorFullName = $editor->getFullName(); $editorEmail = $editor->getEmail(); if ($action = 'OFR_OBJECT_REQUESTED') { $paramArray = array('editorName' => strip_tags($editorFullName), 'objectForReviewTitle' => '"' . strip_tags($objectForReview->getTitle()) . '"', 'authorContactSignature' => String::html2text($user->getContactSignature())); } $email->addRecipient($editorEmail, $editorFullName); $email->assignParams($paramArray); } $email->displayEditForm($returnUrl); }
/** * Remove book reviewer and reset book for review. */ function removeBookForReviewAuthor($args = array(), &$request) { $this->setupTemplate(); if (empty($args)) { $request->redirect(null, 'editor'); } $bfrPlugin =& PluginRegistry::getPlugin('generic', BOOKS_FOR_REVIEW_PLUGIN_NAME); $returnPage = $request->getUserVar('returnPage'); if ($returnPage != null) { $validPages =& $this->getValidReturnPages(); if (!in_array($returnPage, $validPages)) { $returnPage = null; } } $journal =& $request->getJournal(); $journalId = $journal->getId(); $bookId = (int) $args[0]; $bfrDao =& DAORegistry::getDAO('BookForReviewDAO'); // Ensure book for review is for this journal if ($bfrDao->getBookForReviewJournalId($bookId) == $journalId) { import('classes.mail.MailTemplate'); $email = new MailTemplate('BFR_REVIEWER_REMOVED'); $send = $request->getUserVar('send'); // Editor has filled out mail form or skipped mail if ($send && !$email->hasErrors()) { // Update book for review $book =& $bfrDao->getBookForReview($bookId); $book->setStatus(BFR_STATUS_AVAILABLE); $book->setUserId(null); $book->setDateRequested(null); $book->setDateAssigned(null); $book->setDateDue(null); $book->setDateMailed(null); $book->setDateSubmitted(null); $book->setArticleId(null); $bfrDao->updateObject($book); $email->send(); $user =& $request->getUser(); import('classes.notification.NotificationManager'); $notificationManager = new NotificationManager(); $notificationManager->createTrivialNotification($user->getId(), NOTIFICATION_TYPE_BOOK_AUTHOR_REMOVED); $request->redirect(null, 'editor', 'booksForReview', $returnPage); // Display mail form for editor } else { if (!$request->getUserVar('continued')) { $book =& $bfrDao->getBookForReview($bookId); $userFullName = $book->getUserFullName(); $userEmail = $book->getUserEmail(); $paramArray = array('authorName' => strip_tags($userFullName), 'bookForReviewTitle' => '"' . strip_tags($book->getLocalizedTitle()) . '"', 'editorialContactSignature' => String::html2text($book->getEditorContactSignature())); $email->addRecipient($userEmail, $userFullName); $email->setReplyTo($book->getEditorEmail(), $book->getEditorFullName()); $email->assignParams($paramArray); } $returnUrl = $request->url(null, 'editor', 'removeBookForReviewAuthor', $bookId, array('returnPage' => $returnPage)); $email->displayEditForm($returnUrl); } } $request->redirect(null, 'editor', 'booksForReview', $returnPage); }
/** * Send the email. * @return boolean */ function send() { if (HookRegistry::call('Mail::send', array($this))) { return; } // Replace all the private parameters for this message. $mailBody = $this->getBody(); if (is_array($this->privateParams)) { foreach ($this->privateParams as $name => $value) { $mailBody = str_replace($name, $value, $mailBody); } } require_once 'lib/pkp/lib/vendor/phpmailer/phpmailer/class.phpmailer.php'; $mailer = new PHPMailer(); $mailer->IsHTML(true); if (Config::getVar('email', 'smtp')) { $mailer->IsSMTP(); $mailer->Port = Config::getVar('email', 'smtp_port'); if (($s = Config::getVar('email', 'smtp_auth')) != '') { $mailer->SMTPSecure = $s; $mailer->SMTPAuth = true; } $mailer->Host = Config::getVar('email', 'smtp_server'); $mailer->Username = Config::getVar('email', 'smtp_username'); $mailer->Password = Config::getVar('email', 'smtp_password'); } $mailer->CharSet = Config::getVar('i18n', 'client_charset'); if (($t = $this->getContentType()) != null) { $mailer->ContentType = $t; } $mailer->XMailer = 'Public Knowledge Project Suite v2'; $mailer->WordWrap = MAIL_WRAP; foreach ((array) $this->getHeaders() as $header) { $mailer->AddCustomHeader($header['key'], $mailer->SecureHeader($header['content'])); } if (($s = $this->getEnvelopeSender()) != null) { $mailer->Sender = $s; } if (($f = $this->getFrom()) != null) { $mailer->SetFrom($f['email'], $f['name']); } if (($r = $this->getReplyTo()) != null) { $mailer->AddReplyTo($r['email'], $r['name']); } foreach ((array) $this->getRecipients() as $recipientInfo) { $mailer->AddAddress($recipientInfo['email'], $recipientInfo['name']); } foreach ((array) $this->getCcs() as $ccInfo) { $mailer->AddCC($ccInfo['email'], $ccInfo['name']); } foreach ((array) $this->getBccs() as $bccInfo) { $mailer->AddBCC($bccInfo['email'], $bccInfo['name']); } $mailer->Subject = $this->getSubject(); $mailer->Body = $mailBody; $mailer->AltBody = String::html2text($mailBody); $remoteAddr = $mailer->SecureHeader(Request::getRemoteAddr()); if ($remoteAddr != '') { $mailer->AddCustomHeader("X-Originating-IP: {$remoteAddr}"); } foreach ((array) $this->getAttachments() as $attachmentInfo) { $mailer->AddAttachment($attachmentInfo['path'], $attachmentInfo['filename'], 'base64', $attachmentInfo['content-type']); } if (!$mailer->Send()) { if (Config::getVar('debug', 'display_errors')) { fatalError($mailer->ErrorInfo); } return false; } return true; }
/** * Email the comment. * @param $recipients array of recipients (email address => name) */ function email($recipients) { import('classes.mail.ArticleMailTemplate'); $email = new ArticleMailTemplate($this->article, 'SUBMISSION_COMMENT'); $journal =& Request::getJournal(); if ($journal) { $email->setFrom($journal->getSetting('contactEmail'), $journal->getSetting('contactName')); } foreach ($recipients as $emailAddress => $name) { $email->addRecipient($emailAddress, $name); $email->setSubject(strip_tags($this->article->getLocalizedTitle())); $paramArray = array('name' => $name, 'commentName' => $this->user->getFullName(), 'comments' => String::html2text($this->getData('comments'))); $email->assignParams($paramArray); $email->send(); $email->clearRecipients(); } }
/** * Generate the DOM tree for a given article. * @param $doc object DOM object * @param $journal object Journal * @param $issue object Issue * @param $section object Section * @param $article object Article */ function generateArticleDom($doc, $journal, $issue, $section, $article) { $root = XMLCustomWriter::createElement($doc, 'record'); /* --- Article Language --- */ XMLCustomWriter::createChildWithText($doc, $root, 'language', DOAJExportDom::mapLang($article->getLanguage()), false); /* --- Publisher name (i.e. institution name) --- */ XMLCustomWriter::createChildWithText($doc, $root, 'publisher', $journal->getSetting('publisherInstitution'), false); /* --- Journal's title --- */ XMLCustomWriter::createChildWithText($doc, $root, 'journalTitle', $journal->getTitle($journal->getPrimaryLocale()), false); /* --- Identification Numbers --- */ XMLCustomWriter::createChildWithText($doc, $root, 'issn', $journal->getSetting('printIssn'), false); XMLCustomWriter::createChildWithText($doc, $root, 'eissn', $journal->getSetting('onlineIssn'), false); /* --- Article's publication date, volume, issue, DOI --- */ if ($article->getDatePublished()) { XMLCustomWriter::createChildWithText($doc, $root, 'publicationDate', DOAJExportDom::formatDate($article->getDatePublished()), false); } else { XMLCustomWriter::createChildWithText($doc, $root, 'publicationDate', DOAJExportDom::formatDate($issue->getDatePublished()), false); } XMLCustomWriter::createChildWithText($doc, $root, 'volume', $issue->getVolume(), false); XMLCustomWriter::createChildWithText($doc, $root, 'issue', $issue->getNumber(), false); /** --- FirstPage / LastPage (from PubMed plugin)--- * there is some ambiguity for online journals as to what * "page numbers" are; for example, some journals (eg. JMIR) * use the "e-location ID" as the "page numbers" in PubMed */ $pages = $article->getPages(); if (preg_match("/([0-9]+)\\s*-\\s*([0-9]+)/i", $pages, $matches)) { // simple pagination (eg. "pp. 3-8") XMLCustomWriter::createChildWithText($doc, $root, 'startPage', $matches[1]); XMLCustomWriter::createChildWithText($doc, $root, 'endPage', $matches[2]); } elseif (preg_match("/(e[0-9]+)/i", $pages, $matches)) { // elocation-id (eg. "e12") XMLCustomWriter::createChildWithText($doc, $root, 'startPage', $matches[1]); XMLCustomWriter::createChildWithText($doc, $root, 'endPage', $matches[1]); } XMLCustomWriter::createChildWithText($doc, $root, 'doi', $article->getPubId('doi'), false); /* --- Article's publication date, volume, issue, DOI --- */ XMLCustomWriter::createChildWithText($doc, $root, 'publisherRecordId', $article->getPublishedArticleId(), false); XMLCustomWriter::createChildWithText($doc, $root, 'documentType', $article->getType($article->getLocale()), false); /* --- Article title --- */ foreach ((array) $article->getTitle(null) as $locale => $title) { if (empty($title)) { continue; } $titleNode = XMLCustomWriter::createChildWithText($doc, $root, 'title', $title); if (strlen($locale) == 5) { XMLCustomWriter::setAttribute($titleNode, 'language', DOAJExportDom::mapLang(String::substr($locale, 0, 2))); } } /* --- Authors and affiliations --- */ $authors = XMLCustomWriter::createElement($doc, 'authors'); XMLCustomWriter::appendChild($root, $authors); $affilList = DOAJExportDom::generateAffiliationsList($article->getAuthors(), $article); foreach ($article->getAuthors() as $author) { $authorNode = DOAJExportDom::generateAuthorDom($doc, $root, $issue, $article, $author, $affilList); XMLCustomWriter::appendChild($authors, $authorNode); unset($authorNode); } if (!empty($affilList[0])) { $affils = XMLCustomWriter::createElement($doc, 'affiliationsList'); XMLCustomWriter::appendChild($root, $affils); for ($i = 0; $i < count($affilList); $i++) { $affilNode = XMLCustomWriter::createChildWithText($doc, $affils, 'affiliationName', $affilList[$i]); XMLCustomWriter::setAttribute($affilNode, 'affiliationId', $i); unset($affilNode); } } /* --- Abstract --- */ foreach ((array) $article->getAbstract(null) as $locale => $abstract) { if (empty($abstract)) { continue; } $abstractNode = XMLCustomWriter::createChildWithText($doc, $root, 'abstract', String::html2text($abstract)); if (strlen($locale) == 5) { XMLCustomWriter::setAttribute($abstractNode, 'language', DOAJExportDom::mapLang(String::substr($locale, 0, 2))); } } /* --- FullText URL --- */ $fullTextUrl = XMLCustomWriter::createChildWithText($doc, $root, 'fullTextUrl', Request::url(null, 'article', 'view', $article->getId())); XMLCustomWriter::setAttribute($fullTextUrl, 'format', 'html'); /* --- Keywords --- */ $keywords = XMLCustomWriter::createElement($doc, 'keywords'); XMLCustomWriter::appendChild($root, $keywords); $subjects = array_map('trim', explode(';', $article->getSubject($article->getLocale()))); foreach ($subjects as $keyword) { XMLCustomWriter::createChildWithText($doc, $keywords, 'keyword', $keyword, false); } return $root; }
/** * Create an XML element with a text node. * * FIXME: Move this to XMLCustomWriter? I leave the decision up to PKP... * * @param $name string * @param $value string * @param $attributes array An array with the attribute names as array * keys and attribute values as array values. * * @return XMLNode|DOMImplementation */ function &createElementWithText($name, $value, $attributes = array()) { $element =& XMLCustomWriter::createElement($this->getDoc(), $name); $elementContent =& XMLCustomWriter::createTextNode($this->getDoc(), String::html2text($value)); XMLCustomWriter::appendChild($element, $elementContent); foreach ($attributes as $attributeName => $attributeValue) { XMLCustomWriter::setAttribute($element, $attributeName, $attributeValue); } return $element; }
/** * Generate the subscription report and write CSV contents to file * @param $args array Request arguments */ function display(&$args) { $request = $this->getRequest(); $journal = $request->getJournal(); $journalId = $journal->getId(); $userDao = DAORegistry::getDAO('UserDAO'); $countryDao = DAORegistry::getDAO('CountryDAO'); $subscriptionTypeDao = DAORegistry::getDAO('SubscriptionTypeDAO'); $individualSubscriptionDao = DAORegistry::getDAO('IndividualSubscriptionDAO'); $institutionalSubscriptionDao = DAORegistry::getDAO('InstitutionalSubscriptionDAO'); header('content-type: text/comma-separated-values'); header('content-disposition: attachment; filename=subscriptions-' . date('Ymd') . '.csv'); $fp = fopen('php://output', 'wt'); // Columns for individual subscriptions $columns = array(__('subscriptionManager.individualSubscriptions')); fputcsv($fp, array_values($columns)); $columnsCommon = array('subscription_id' => __('common.id'), 'status' => __('subscriptions.status'), 'type' => __('common.type'), 'format' => __('subscriptionTypes.format'), 'date_start' => __('manager.subscriptions.dateStart'), 'date_end' => __('manager.subscriptions.dateEnd'), 'membership' => __('manager.subscriptions.membership'), 'reference_number' => __('manager.subscriptions.referenceNumber'), 'notes' => __('common.notes')); $columnsIndividual = array('name' => __('user.name'), 'mailing_address' => __('common.mailingAddress'), 'country' => __('common.country'), 'email' => __('user.email'), 'phone' => __('user.phone'), 'fax' => __('user.fax')); $columns = array_merge($columnsCommon, $columnsIndividual); // Write out individual subscription column headings to file fputcsv($fp, array_values($columns)); // Iterate over individual subscriptions and write out each to file $individualSubscriptions = $individualSubscriptionDao->getSubscriptionsByJournalId($journalId); while ($subscription = $individualSubscriptions->next()) { $user = $userDao->getById($subscription->getUserId()); $subscriptionType = $subscriptionTypeDao->getSubscriptionType($subscription->getTypeId()); foreach ($columns as $index => $junk) { switch ($index) { case 'subscription_id': $columns[$index] = $subscription->getId(); break; case 'status': $columns[$index] = $subscription->getStatusString(); break; case 'type': $columns[$index] = $subscription->getSubscriptionTypeSummaryString(); break; case 'format': $columns[$index] = __($subscriptionType->getFormatString()); break; case 'date_start': $columns[$index] = $subscription->getDateStart(); break; case 'date_end': $columns[$index] = $subscription->getDateEnd(); break; case 'membership': $columns[$index] = $subscription->getMembership(); break; case 'reference_number': $columns[$index] = $subscription->getReferenceNumber(); break; case 'notes': $columns[$index] = String::html2text($subscription->getNotes()); break; case 'name': $columns[$index] = $user->getFullName(); break; case 'mailing_address': $columns[$index] = String::html2text($user->getMailingAddress()); break; case 'country': $columns[$index] = $countryDao->getCountry($user->getCountry()); break; case 'email': $columns[$index] = $user->getEmail(); break; case 'phone': $columns[$index] = $user->getPhone(); break; case 'fax': $columns[$index] = $user->getFax(); break; default: $columns[$index] = ''; } } fputcsv($fp, $columns); } // Columns for institutional subscriptions $columns = array(''); fputcsv($fp, array_values($columns)); $columns = array(__('subscriptionManager.institutionalSubscriptions')); fputcsv($fp, array_values($columns)); $columnsInstitution = array('institution_name' => __('manager.subscriptions.institutionName'), 'institution_mailing_address' => __('plugins.reports.subscriptions.institutionMailingAddress'), 'domain' => __('manager.subscriptions.domain'), 'ip_ranges' => __('plugins.reports.subscriptions.ipRanges'), 'contact' => __('manager.subscriptions.contact'), 'mailing_address' => __('common.mailingAddress'), 'country' => __('common.country'), 'email' => __('user.email'), 'phone' => __('user.phone'), 'fax' => __('user.fax')); $columns = array_merge($columnsCommon, $columnsInstitution); // Write out institutional subscription column headings to file fputcsv($fp, array_values($columns)); // Iterate over institutional subscriptions and write out each to file $institutionalSubscriptions =& $institutionalSubscriptionDao->getSubscriptionsByJournalId($journalId); while ($subscription = $institutionalSubscriptions->next()) { $user = $userDao->getById($subscription->getUserId()); $subscriptionType = $subscriptionTypeDao->getSubscriptionType($subscription->getTypeId()); foreach ($columns as $index => $junk) { switch ($index) { case 'subscription_id': $columns[$index] = $subscription->getId(); break; case 'status': $columns[$index] = $subscription->getStatusString(); break; case 'type': $columns[$index] = $subscription->getSubscriptionTypeSummaryString(); break; case 'format': $columns[$index] = __($subscriptionType->getFormatString()); break; case 'date_start': $columns[$index] = $subscription->getDateStart(); break; case 'date_end': $columns[$index] = $subscription->getDateEnd(); break; case 'membership': $columns[$index] = $subscription->getMembership(); break; case 'reference_number': $columns[$index] = $subscription->getReferenceNumber(); break; case 'notes': $columns[$index] = String::html2text($subscription->getNotes()); break; case 'institution_name': $columns[$index] = $subscription->getInstitutionName(); break; case 'institution_mailing_address': $columns[$index] = String::html2text($subscription->getInstitutionMailingAddress()); break; case 'domain': $columns[$index] = $subscription->getDomain(); break; case 'ip_ranges': $columns[$index] = $this->_formatIPRanges($subscription->getIPRanges()); break; case 'contact': $columns[$index] = $user->getFullName(); break; case 'mailing_address': $columns[$index] = String::html2text($user->getMailingAddress()); break; case 'country': $columns[$index] = $countryDao->getCountry($user->getCountry()); break; case 'email': $columns[$index] = $user->getEmail(); break; case 'phone': $columns[$index] = $user->getPhone(); break; case 'fax': $columns[$index] = $user->getFax(); break; default: $columns[$index] = ''; } } fputcsv($fp, $columns); } fclose($fp); }
/** * Get the text of all peer reviews for a submission * @param $seriesEditorSubmission SeriesEditorSubmission * @return string */ function getPeerReviews($seriesEditorSubmission) { $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO'); $monographCommentDao =& DAORegistry::getDAO('MonographCommentDAO'); $reviewFormResponseDao =& DAORegistry::getDAO('ReviewFormResponseDAO'); $reviewFormElementDao =& DAORegistry::getDAO('ReviewFormElementDAO'); $reviewAssignments =& $reviewAssignmentDao->getBySubmissionId($seriesEditorSubmission->getId(), $seriesEditorSubmission->getCurrentRound()); $reviewIndexes =& $reviewAssignmentDao->getReviewIndexesForRound($seriesEditorSubmission->getId(), $seriesEditorSubmission->getCurrentRound()); Locale::requireComponents(array(LOCALE_COMPONENT_PKP_SUBMISSION)); $body = ''; $textSeparator = "------------------------------------------------------"; foreach ($reviewAssignments as $reviewAssignment) { // If the reviewer has completed the assignment, then import the review. if ($reviewAssignment->getDateCompleted() != null && !$reviewAssignment->getCancelled()) { // Get the comments associated with this review assignment $monographComments =& $monographCommentDao->getMonographComments($seriesEditorSubmission->getId(), COMMENT_TYPE_PEER_REVIEW, $reviewAssignment->getId()); if ($monographComments) { $body .= "\n\n{$textSeparator}\n"; $body .= Locale::translate('submission.comments.importPeerReviews.reviewerLetter', array('reviewerLetter' => String::enumerateAlphabetically($reviewIndexes[$reviewAssignment->getId()]))) . "\n"; if (is_array($monographComments)) { foreach ($monographComments as $comment) { // If the comment is viewable by the author, then add the comment. if ($comment->getViewable()) { $body .= String::html2text($comment->getComments()) . "\n\n"; } } } $body .= "{$textSeparator}\n\n"; } if ($reviewFormId = $reviewAssignment->getReviewFormId()) { $reviewId = $reviewAssignment->getId(); $reviewFormElements =& $reviewFormElementDao->getReviewFormElements($reviewFormId); if (!$monographComments) { $body .= "{$textSeparator}\n"; $body .= Locale::translate('submission.comments.importPeerReviews.reviewerLetter', array('reviewerLetter' => String::enumerateAlphabetically($reviewIndexes[$reviewAssignment->getId()]))) . "\n\n"; } foreach ($reviewFormElements as $reviewFormElement) { $body .= String::html2text($reviewFormElement->getLocalizedQuestion()) . ": \n"; $reviewFormResponse = $reviewFormResponseDao->getReviewFormResponse($reviewId, $reviewFormElement->getId()); if ($reviewFormResponse) { $possibleResponses = $reviewFormElement->getLocalizedPossibleResponses(); if (in_array($reviewFormElement->getElementType(), $reviewFormElement->getMultipleResponsesElementTypes())) { if ($reviewFormElement->getElementType() == REVIEW_FORM_ELEMENT_TYPE_CHECKBOXES) { foreach ($reviewFormResponse->getValue() as $value) { $body .= "\t" . String::htmltext($possibleResponses[$value - 1]['content']) . "\n"; } } else { $body .= "\t" . String::html2text($possibleResponses[$reviewFormResponse->getValue() - 1]['content']) . "\n"; } $body .= "\n"; } else { $body .= "\t" . String::html2text($reviewFormResponse->getValue()) . "\n\n"; } } } $body .= "{$textSeparator}\n\n"; } } } return $body; }
/** * Email the comment. * @param $recipients array of recipients (email address => name) */ function email($recipients) { $paper = $this->paper; $paperCommentDao =& DAORegistry::getDAO('PaperCommentDAO'); $schedConf =& Request::getSchedConf(); import('mail.PaperMailTemplate'); $email = new PaperMailTemplate($paper, 'SUBMISSION_COMMENT'); $email->setFrom($this->user->getEmail(), $this->user->getFullName()); $commentText = $this->getData('comments'); // Individually send an email to each of the recipients. foreach ($recipients as $emailAddress => $name) { $email->addRecipient($emailAddress, $name); $paramArray = array('name' => $name, 'commentName' => $this->user->getFullName(), 'comments' => String::html2text($commentText)); $email->sendWithParams($paramArray); $email->clearRecipients(); } }