diff -N plugins/reports/reviews/ReviewReportDAO.inc.php --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ plugins/reports/reviews/ReviewReportDAO.inc.php 15 May 2009 20:56:44 -0000 @@ -0,0 +1,83 @@ +retrieve( + 'SELECT article_id, + comments, + author_id + FROM article_comments + WHERE comment_type = ?', + array( + COMMENT_TYPE_PEER_REVIEW + ) + ); + import('db.DBRowIterator'); + $commentsReturner = new DBRowIterator($result); + + $result =& $this->retrieve( + 'SELECT r.round AS round, + COALESCE(asl.setting_value, aspl.setting_value) AS article, + a.article_id AS articleId, + u.user_id AS reviewerId, + u.username AS reviewer, + u.first_name AS firstName, + u.middle_name AS middleName, + u.last_name AS lastName, + r.date_assigned AS dateAssigned, + r.date_notified AS dateNotified, + r.date_confirmed AS dateConfirmed, + r.date_completed AS dateCompleted, + r.date_reminded AS dateReminded, + (r.declined=1) AS declined, + (r.cancelled=1) AS cancelled, + r.recommendation AS recommendation + FROM review_assignments r + LEFT JOIN articles a ON r.article_id = a.article_id + LEFT JOIN article_settings asl ON (a.article_id=asl.article_id AND asl.locale=? AND asl.setting_name=?) + LEFT JOIN article_settings aspl ON (a.article_id=aspl.article_id AND aspl.locale=? AND aspl.setting_name=?), + users u + WHERE u.user_id=r.reviewer_id AND a.journal_id= ? + ORDER BY article', + array( + $locale, + 'title', + $primaryLocale, + 'title', + $journalId + ) + ); + $reviewsReturner = new DBRowIterator($result); + + return array($commentsReturner, $reviewsReturner); + } +} + +?> Index: plugins/reports/reviews/ReviewReportPlugin.inc.php =================================================================== RCS file: plugins/reports/reviews/ReviewReportPlugin.inc.php diff -N plugins/reports/reviews/ReviewReportPlugin.inc.php --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ plugins/reports/reviews/ReviewReportPlugin.inc.php 15 May 2009 20:56:44 -0000 @@ -0,0 +1,125 @@ +import('ReviewReportDAO'); + $reviewReportDAO = new ReviewReportDAO(); + DAORegistry::registerDAO('ReviewReportDAO', $reviewReportDAO); + } + $this->addLocaleData(); + return $success; + } + + /** + * Get the name of this plugin. The name must be unique within + * its category. + * @return String name of plugin + */ + function getName() { + return 'ReviewReportPlugin'; + } + + function getDisplayName() { + return Locale::translate('plugins.reports.reviews.displayName'); + } + + function getDescription() { + return Locale::translate('plugins.reports.reviews.description'); + } + + function display(&$args) { + $journal =& Request::getJournal(); + + header('content-type: text/comma-separated-values'); + header('content-disposition: attachment; filename=report.csv'); + + $reviewReportDao =& DAORegistry::getDAO('ReviewReportDAO'); + list($commentsIterator, $reviewsIterator) = $reviewReportDao->getReviewReport($journal->getJournalId()); + + $comments = array(); + while ($row =& $commentsIterator->next()) { + if (isset($comments[$row['article_id']][$row['author_id']])) { + $comments[$row['article_id']][$row['author_id']] .= "; " . $row['comments']; + } else { + $comments[$row['article_id']][$row['author_id']] = $row['comments']; + } + } + + $yesnoMessages = array( 0 => Locale::translate('common.no'), 1 => Locale::translate('common.yes')); + + import('submission.reviewAssignment.ReviewAssignment'); + $recommendations = ReviewAssignment::getReviewerRecommendationOptions(); + + $columns = array( + 'round' => Locale::translate('plugins.reports.reviews.round'), + 'article' => Locale::translate('article.articles'), + 'articleid' => Locale::translate('article.submissionId'), + 'reviewerid' => Locale::translate('plugins.reports.reviews.reviewerId'), + 'reviewer' => Locale::translate('plugins.reports.reviews.reviewer'), + 'firstname' => Locale::translate('user.firstName'), + 'middlename' => Locale::translate('user.middleName'), + 'lastname' => Locale::translate('user.lastName'), + 'dateassigned' => Locale::translate('plugins.reports.reviews.dateAssigned'), + 'datenotified' => Locale::translate('plugins.reports.reviews.dateNotified'), + 'dateconfirmed' => Locale::translate('plugins.reports.reviews.dateConfirmed'), + 'datecompleted' => Locale::translate('plugins.reports.reviews.dateCompleted'), + 'datereminded' => Locale::translate('plugins.reports.reviews.dateReminded'), + 'declined' => Locale::translate('submissions.declined'), + 'cancelled' => Locale::translate('common.cancelled'), + 'recommendation' => Locale::translate('reviewer.article.recommendation'), + 'comments' => Locale::translate('comments.commentsOnArticle') + ); + $yesNoArray = array('declined', 'cancelled'); + + $fp = fopen('php://output', 'wt'); + String::fputcsv($fp, array_values($columns)); + + while ($row =& $reviewsIterator->next()) { + foreach ($columns as $index => $junk) { + if (in_array($index, $yesNoArray)) { + $columns[$index] = $yesnoMessages[$row[$index]]; + } elseif ($index == "recommendation") { + $columns[$index] = (!isset($row[$index])) ? Locale::translate('common.none') : Locale::translate($recommendations[$row[$index]]); + } elseif ($index == "comments") { + if (isset($comments[$row['articleid']][$row['reviewerid']])) { + $columns[$index] = $comments[$row['articleid']][$row['reviewerid']]; + } else { + $columns[$index] = ""; + } + } else { + $columns[$index] = $row[$index]; + } + } + String::fputcsv($fp, $columns); + unset($row); + } + fclose($fp); + } +} + +?> Index: plugins/reports/reviews/index.php =================================================================== RCS file: plugins/reports/reviews/index.php diff -N plugins/reports/reviews/index.php --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ plugins/reports/reviews/index.php 15 May 2009 20:56:44 -0000 @@ -0,0 +1,24 @@ + Index: plugins/reports/reviews/locale/en_US/locale.xml =================================================================== RCS file: plugins/reports/reviews/locale/en_US/locale.xml diff -N plugins/reports/reviews/locale/en_US/locale.xml --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ plugins/reports/reviews/locale/en_US/locale.xml 15 May 2009 20:56:44 -0000 @@ -0,0 +1,27 @@ + + + + + + + Review Report + This plugin implements a CSV report containing a list of review assignments for a journal. + Round + Reviewer ID + Reviewer + Date Assigned + Date Notified + Date Confirmed + Date Completed + Date Reminded + +