function display(&$args) { $request = $this->getRequest(); $journal = $request->getJournal(); header('content-type: text/comma-separated-values'); header('content-disposition: attachment; filename=articles-' . date('Ymd') . '.csv'); $articleReportDao = DAORegistry::getDAO('ArticleReportDAO'); list($articlesIterator, $authorsIterator, $decisionsIteratorsArray) = $articleReportDao->getArticleReport($journal->getId()); $maxAuthors = $this->getMaxAuthorCount($authorsIterator); $decisions = array(); foreach ($decisionsIteratorsArray as $decisionsIterator) { while ($row = $decisionsIterator->next()) { $decisions[$row['submission_id']] = $row['decision']; } } AppLocale::requireComponents(LOCALE_COMPONENT_APP_EDITOR, LOCALE_COMPONENT_PKP_SUBMISSION); import('classes.article.Article'); $decisionMessages = array(SUBMISSION_EDITOR_DECISION_ACCEPT => __('editor.article.decision.accept'), SUBMISSION_EDITOR_DECISION_PENDING_REVISIONS => __('editor.article.decision.pendingRevisions'), SUBMISSION_EDITOR_DECISION_RESUBMIT => __('editor.article.decision.resubmit'), SUBMISSION_EDITOR_DECISION_DECLINE => __('editor.article.decision.decline'), null => __('plugins.reports.articles.nodecision')); $columns = array('submission_id' => __('article.submissionId'), 'title' => __('article.title'), 'abstract' => __('article.abstract')); for ($a = 1; $a <= $maxAuthors; $a++) { $columns = array_merge($columns, array('fname' . $a => __('user.firstName') . " (" . __('user.role.author') . " {$a})", 'mname' . $a => __('user.middleName') . " (" . __('user.role.author') . " {$a})", 'lname' . $a => __('user.lastName') . " (" . __('user.role.author') . " {$a})", 'country' . $a => __('common.country') . " (" . __('user.role.author') . " {$a})", 'affiliation' . $a => __('user.affiliation') . " (" . __('user.role.author') . " {$a})", 'email' . $a => __('user.email') . " (" . __('user.role.author') . " {$a})", 'url' . $a => __('user.url') . " (" . __('user.role.author') . " {$a})", 'biography' . $a => __('user.biography') . " (" . __('user.role.author') . " {$a})")); } $columns = array_merge($columns, array('section_title' => __('section.title'), 'language' => __('common.language'), 'editor_decision' => __('submission.editorDecision'), 'status' => __('common.status'))); $fp = fopen('php://output', 'wt'); fputcsv($fp, array_values($columns)); import('classes.article.Article'); // Bring in getStatusMap function $statusMap =& Article::getStatusMap(); $authorIndex = 0; while ($row = $articlesIterator->next()) { $authors = $this->mergeAuthors($authorsIterator[$row['submission_id']]->toArray()); foreach ($columns as $index => $junk) { if ($index == 'editor_decision') { if (isset($decisions[$row['submission_id']])) { $columns[$index] = $decisionMessages[$decisions[$row['submission_id']]]; } else { $columns[$index] = $decisionMessages[null]; } } elseif ($index == 'status') { $columns[$index] = __($statusMap[$row[$index]]); } elseif ($index == 'abstract') { $columns[$index] = html_entity_decode(strip_tags($row[$index])); } elseif (strstr($index, 'biography') !== false) { // "Convert" HTML to text for export $columns[$index] = isset($authors[$index]) ? html_entity_decode(strip_tags($authors[$index])) : ''; } else { if (isset($row[$index])) { $columns[$index] = $row[$index]; } else { if (isset($authors[$index])) { $columns[$index] = $authors[$index]; } else { $columns[$index] = ''; } } } } fputcsv($fp, $columns); $authorIndex++; } fclose($fp); }