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 __('plugins.reports.reviews.displayName'); } function getDescription() { return __('plugins.reports.reviews.description'); } function display($args, $request) { $journal =& Request::getJournal(); header('content-type: text/comma-separated-values'); header('content-disposition: attachment; filename=reviews-' . date('Ymd') . '.csv'); AppLocale::requireComponents(LOCALE_COMPONENT_PKP_SUBMISSION); $reviewReportDao =& DAORegistry::getDAO('ReviewReportDAO'); list($commentsIterator, $reviewsIterator) = $reviewReportDao->getReviewReport($journal->getId()); $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 => __('common.no'), 1 => __('common.yes')); import('classes.submission.reviewAssignment.ReviewAssignment'); $recommendations = ReviewAssignment::getReviewerRecommendationOptions(); $columns = array( 'round' => __('plugins.reports.reviews.round'), 'article' => __('article.articles'), 'articleid' => __('article.submissionId'), 'reviewerid' => __('plugins.reports.reviews.reviewerId'), 'reviewer' => __('plugins.reports.reviews.reviewer'), 'firstname' => __('user.firstName'), 'middlename' => __('user.middleName'), 'lastname' => __('user.lastName'), 'dateassigned' => __('plugins.reports.reviews.dateAssigned'), 'datenotified' => __('plugins.reports.reviews.dateNotified'), 'dateconfirmed' => __('plugins.reports.reviews.dateConfirmed'), 'datecompleted' => __('plugins.reports.reviews.dateCompleted'), 'datereminded' => __('plugins.reports.reviews.dateReminded'), 'declined' => __('submissions.declined'), 'cancelled' => __('common.cancelled'), 'recommendation' => __('reviewer.article.recommendation'), 'comments' => __('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])) ? __('common.none') : __($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); } } ?>