本文整理汇总了PHP中String::fputcsv方法的典型用法代码示例。如果您正苦于以下问题:PHP String::fputcsv方法的具体用法?PHP String::fputcsv怎么用?PHP String::fputcsv使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类String
的用法示例。
在下文中一共展示了String::fputcsv方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: endReport
public function endReport()
{
$headers = array();
$this->putHeaders($headers);
String::fputcsv($this->fpointer, array_values($headers));
for ($i = 0; $i < count($this->data); $i++) {
String::fputcsv($this->fpointer, array_values($this->data[$i]));
}
fclose($this->fpointer);
}
示例2: _CSVReport
function _CSVReport($proposals, $criterias)
{
$institutionDao =& DAORegistry::getDAO('InstitutionDAO');
$countryDao =& DAORegistry::getDAO('CountryDAO');
$extraFieldDao =& DAORegistry::getDAO('ExtraFieldDAO');
$proposalDetailsDao =& DAORegistry::getDAO('ProposalDetailsDAO');
$journal =& Request::getJournal();
header('content-type: text/comma-separated-values');
header('content-disposition: attachment; filename=' . $journal->getLocalizedInitials() . '-' . date('YMd') . '-' . Locale::translate('editor.report') . '.csv');
$fp = fopen('php://output', 'wt');
$columns = $this->_getColumnsOfCSV();
//Write into the csv
String::fputcsv($fp, array_values($columns));
foreach ($proposals as $proposal) {
$decisions = $proposal->getDecisions();
$investigators = $proposal->getAuthors();
$abstract = $proposal->getLocalizedAbstract();
$proposalDetails = $proposal->getProposalDetails();
$studentResearch = $proposalDetails->getStudentResearchInfo();
$sources = $proposal->getSources();
$riskAssessment = $proposal->getRiskAssessment();
// Set up the for loops in case of multi entries for one proposal
if (array_key_exists('committee', $columns)) {
$decisionsCount = count($decisions);
} else {
$decisionsCount = 1;
}
if (Request::getUserVar('checkAllInvestigators')) {
$investigatorsCount = count($investigators);
} else {
$investigatorsCount = 1;
}
if (array_key_exists('countries', $columns)) {
$countries = $proposalDetails->getCountries();
if ($countries) {
$countriesArray = explode(",", $countries);
$countriesCount = count($countriesArray);
} else {
$countriesCount = 1;
}
} else {
$countriesCount = 1;
}
if (array_key_exists('nationwide', $columns)) {
$geoAreas = $proposalDetails->getCountries();
if ($geoAreas) {
$geoAreasArray = explode(",", $geoAreas);
$geoAreasCount = count($geoAreasArray);
} else {
$geoAreasCount = 1;
}
} else {
$geoAreasCount = 1;
}
if (array_key_exists('researchDomain', $columns)) {
$researchDomainsArray = $proposalDetails->getResearchDomainsArray();
if ($researchDomainsArray) {
$researchDomainsCount = count($researchDomainsArray);
} else {
$researchDomainsCount = 1;
}
} else {
$researchDomainsCount = 1;
}
if (array_key_exists('researchField', $columns)) {
$researchFields = $proposalDetails->getResearchFields();
if ($researchFields) {
$researchFieldsArray = explode("+", $researchFields);
$researchFieldsCount = count($researchFieldsArray);
} else {
$researchFieldsCount = 1;
}
} else {
$researchFieldsCount = 1;
}
if (array_key_exists('proposalType', $columns)) {
$proposalTypes = $proposalDetails->getProposalTypes();
if ($proposalTypes) {
$proposalTypesArray = explode("+", $proposalTypes);
$proposalTypesCount = count($proposalTypesArray);
} else {
$proposalTypesCount = 1;
}
} else {
$proposalTypesCount = 1;
}
if (array_key_exists('sourceInstitution', $columns)) {
$sourcesCount = count($sources);
} else {
$sourcesCount = 1;
}
// Loop through all the possible mutli entries and write the data
for ($dI = 0; $dI < $decisionsCount; $dI++) {
for ($iI = 0; $iI < $investigatorsCount; $iI++) {
for ($cI = 0; $cI < $countriesCount; $cI++) {
for ($aI = 0; $aI < $geoAreasCount; $aI++) {
for ($rdI = 0; $rdI < $researchDomainsCount; $rdI++) {
for ($fI = 0; $fI < $researchFieldsCount; $fI++) {
for ($tI = 0; $tI < $proposalTypesCount; $tI++) {
for ($sI = 0; $sI < $sourcesCount; $sI++) {
//.........这里部分代码省略.........
示例3: _report
/**
* Generate a report file.
* @param $request PKPRequest
* @param $year string
*/
function _report(&$request, $year, $useLegacyStats)
{
$journal =& $request->getJournal();
list($begin, $end) = $this->_getLimitDates($year);
header('content-type: text/comma-separated-values');
header('content-disposition: attachment; filename=counter-' . date('Ymd') . '.csv');
$fp = fopen('php://output', 'wt');
String::fputcsv($fp, array(__('plugins.reports.counter.1a.title1')));
String::fputcsv($fp, array(__('plugins.reports.counter.1a.title2', array('year' => $year))));
String::fputcsv($fp, array());
// FIXME: Criteria should be here?
String::fputcsv($fp, array(__('plugins.reports.counter.1a.dateRun')));
String::fputcsv($fp, array(strftime("%Y-%m-%d")));
$cols = array('', __('plugins.reports.counter.1a.publisher'), __('plugins.reports.counter.1a.platform'), __('plugins.reports.counter.1a.printIssn'), __('plugins.reports.counter.1a.onlineIssn'));
for ($i = 1; $i <= 12; $i++) {
$time = strtotime($year . '-' . $i . '-01');
strftime('%b', $time);
$cols[] = strftime('%b-%Y', $time);
}
$cols[] = __('plugins.reports.counter.1a.ytdTotal');
$cols[] = __('plugins.reports.counter.1a.ytdHtml');
$cols[] = __('plugins.reports.counter.1a.ytdPdf');
fputcsv($fp, $cols);
// Display the totals first
$totals = $this->_getMonthlyTotalRange($begin, $end, $useLegacyStats);
$cols = array(__('plugins.reports.counter.1a.totalForAllJournals'), '-', '', '-', '-');
$this->_formColumns($cols, $totals);
fputcsv($fp, $cols);
// Get statistics from the log.
$journalDao =& DAORegistry::getDAO('JournalDAO');
$journalIds = $this->_getJournalIds($useLegacyStats);
foreach ($journalIds as $journalId) {
$journal =& $journalDao->getById($journalId);
if (!$journal) {
continue;
}
$entries = $this->_getMonthlyLogRange($journalId, $begin, $end, $useLegacyStats);
$cols = array($journal->getLocalizedTitle(), $journal->getSetting('publisherInstitution'), 'Open Journal Systems', $journal->getSetting('printIssn'), $journal->getSetting('onlineIssn'));
$this->_formColumns($cols, $entries);
fputcsv($fp, $cols);
unset($journal, $entry);
}
fclose($fp);
}
示例4: display
function display(&$args)
{
$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['article_id']] = $row['decision'];
}
}
Locale::requireComponents(array(LOCALE_COMPONENT_OJS_EDITOR, LOCALE_COMPONENT_PKP_SUBMISSION));
import('classes.article.Article');
$decisionMessages = array(SUBMISSION_EDITOR_DECISION_ACCEPT => Locale::translate('editor.article.decision.accept'), SUBMISSION_EDITOR_DECISION_PENDING_REVISIONS => Locale::translate('editor.article.decision.pendingRevisions'), SUBMISSION_EDITOR_DECISION_RESUBMIT => Locale::translate('editor.article.decision.resubmit'), SUBMISSION_EDITOR_DECISION_DECLINE => Locale::translate('editor.article.decision.decline'), null => Locale::translate('plugins.reports.articles.nodecision'));
$columns = array('article_id' => Locale::translate('article.submissionId'), 'title' => Locale::translate('article.title'), 'abstract' => Locale::translate('article.abstract'));
for ($a = 1; $a <= $maxAuthors; $a++) {
$columns = array_merge($columns, array('fname' . $a => Locale::translate('user.firstName') . " (" . Locale::translate('user.role.author') . " {$a})", 'mname' . $a => Locale::translate('user.middleName') . " (" . Locale::translate('user.role.author') . " {$a})", 'lname' . $a => Locale::translate('user.lastName') . " (" . Locale::translate('user.role.author') . " {$a})", 'country' . $a => Locale::translate('common.country') . " (" . Locale::translate('user.role.author') . " {$a})", 'affiliation' . $a => Locale::translate('user.affiliation') . " (" . Locale::translate('user.role.author') . " {$a})", 'email' . $a => Locale::translate('user.email') . " (" . Locale::translate('user.role.author') . " {$a})", 'url' . $a => Locale::translate('user.url') . " (" . Locale::translate('user.role.author') . " {$a})", 'biography' . $a => Locale::translate('user.biography') . " (" . Locale::translate('user.role.author') . " {$a})"));
}
$columns = array_merge($columns, array('section_title' => Locale::translate('section.title'), 'language' => Locale::translate('common.language'), 'editor_decision' => Locale::translate('submission.editorDecision'), 'status' => Locale::translate('common.status')));
$fp = fopen('php://output', 'wt');
String::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['article_id']]->toArray());
foreach ($columns as $index => $junk) {
if ($index == 'editor_decision') {
if (isset($decisions[$row['article_id']])) {
$columns[$index] = $decisionMessages[$decisions[$row['article_id']]];
} else {
$columns[$index] = $decisionMessages[null];
}
} elseif ($index == 'status') {
$columns[$index] = Locale::translate($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] = '';
}
}
}
}
String::fputcsv($fp, $columns);
unset($row);
$authorIndex++;
}
fclose($fp);
}
示例5: generateCustomizedCSV
function generateCustomizedCSV($args)
{
parent::validate();
$this->setupTemplate();
$query = Request::getUserVar('query');
$region = Request::getUserVar('region');
$statusFilter = Request::getUserVar('statusFilter');
$fromDate = Request::getUserVar('dateFrom');
//if ($fromDate != null) $fromDate = date('Y-m-d H:i:s', $fromDate);
$toDate = Request::getUserVar('dateTo');
//if ($toDate != null) $toDate = date('Y-m-d H:i:s', $toDate);
$columns = array();
$investigatorName = false;
if (Request::getUserVar('investigatorName')) {
$columns = $columns + array('investigator' => Locale::translate('search.investigator'));
$investigatorName = true;
}
$investigatorAffiliation = false;
if (Request::getUserVar('investigatorAffiliation')) {
$columns = $columns + array('investigator_affiliation' => Locale::translate('search.investigatorAffiliation'));
$investigatorAffiliation = true;
}
$investigatorEmail = false;
if (Request::getUserVar('investigatorEmail')) {
$columns = $columns + array('investigator_email' => Locale::translate('search.investigatorEmail'));
$investigatorEmail = true;
}
if (Request::getUserVar('scientificTitle')) {
$columns = $columns + array('title' => Locale::translate('article.scientificTitle'));
}
$researchDomain = false;
if (Request::getUserVar('researchDomain')) {
$columns = $columns + array('research_domain' => Locale::translate('proposal.researchDomains'));
$researchDomain = true;
}
$researchField = false;
if (Request::getUserVar('researchField')) {
$columns = $columns + array('research_field' => Locale::translate('search.researchField'));
$researchField = true;
}
$proposalType = false;
if (Request::getUserVar('proposalType')) {
$columns = $columns + array('proposal_type' => Locale::translate('article.proposalType'));
$proposalType = true;
}
$duration = false;
if (Request::getUserVar('duration')) {
$columns = $columns + array('duration' => Locale::translate('search.duration'));
$duration = true;
}
$area = false;
if (Request::getUserVar('area')) {
$columns = $columns + array('area' => Locale::translate('common.area'));
$area = true;
}
$dataCollection = false;
if (Request::getUserVar('dataCollection')) {
$columns = $columns + array('data_collection' => Locale::translate('search.dataCollection'));
$dataCollection = true;
}
$status = false;
if (Request::getUserVar('status')) {
$columns = $columns + array('status' => Locale::translate('search.status'));
$status = true;
}
$studentResearch = false;
if (Request::getUserVar('studentResearch')) {
$columns = $columns + array('student_institution' => Locale::translate('article.studentInstitution'));
$columns = $columns + array('academic_degree' => Locale::translate('article.academicDegree'));
$studentResearch = true;
}
$kii = false;
if (Request::getUserVar('kii')) {
$columns = $columns + array('kii' => Locale::translate('proposal.keyImplInstitution'));
$kii = true;
}
$dateSubmitted = false;
if (Request::getUserVar('dateSubmitted')) {
$columns = $columns + array('date_submitted' => Locale::translate('search.dateSubmitted'));
$dateSubmitted = true;
}
header('content-type: text/comma-separated-values');
header('content-disposition: attachment; filename=searchResults-' . date('Ymd') . '.csv');
$fp = fopen('php://output', 'wt');
String::fputcsv($fp, array_values($columns));
$articleDao =& DAORegistry::getDAO('ArticleDAO');
$results = $articleDao->searchCustomizedProposalsPublic($query, $region, $statusFilter, $fromDate, $toDate, $investigatorName, $investigatorAffiliation, $investigatorEmail, $researchDomain, $researchField, $proposalType, $duration, $area, $dataCollection, $status, $studentResearch, $kii, $dateSubmitted);
foreach ($results as $result) {
$abstract = $result->getLocalizedAbstract();
$proposalDetails = $result->getProposalDetails();
$studentInfo = $proposalDetails->getStudentResearchInfo();
foreach ($columns as $index => $junk) {
if ($index == 'investigator') {
$columns[$index] = $result->getPrimaryAuthor();
} elseif ($index == 'investigator_affiliation') {
$columns[$index] = $result->getInvestigatorAffiliation();
} elseif ($index == 'investigator_email') {
$columns[$index] = $result->getAuthorEmail();
} elseif ($index == 'title') {
$columns[$index] = $abstract->getScientificTitle();
//.........这里部分代码省略.........
示例6: display
function display(&$args)
{
$journal =& Request::getJournal();
header('content-type: text/comma-separated-values');
header('content-disposition: attachment; filename=report.csv');
Locale::requireComponents(array(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 => 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);
}
示例7: display
function display(&$args)
{
$conference =& Request::getConference();
$schedConf =& Request::getSchedConf();
AppLocale::requireComponents(array(LOCALE_COMPONENT_APPLICATION_COMMON, LOCALE_COMPONENT_PKP_SUBMISSION, LOCALE_COMPONENT_PKP_USER, LOCALE_COMPONENT_OCS_MANAGER));
header('content-type: text/comma-separated-values; charset=utf-8');
header('content-disposition: attachment; filename=report.csv');
$paperReportDao =& DAORegistry::getDAO('PaperReportDAO');
list($papersIterator, $authorsIterator, $decisionsIteratorsArray) = $paperReportDao->getPaperReport($conference->getId(), $schedConf->getId());
$maxAuthors = $this->getMaxAuthorCount($authorsIterator);
$decisions = array();
foreach ($decisionsIteratorsArray as $decisionsIterator) {
while ($row =& $decisionsIterator->next()) {
$decisions[$row['paper_id']] = $row['decision'];
}
}
AppLocale::requireComponents(array(LOCALE_COMPONENT_OCS_DIRECTOR));
import('classes.paper.Paper');
$decisionMessages = array(SUBMISSION_DIRECTOR_DECISION_INVITE => __('director.paper.decision.invitePresentation'), SUBMISSION_DIRECTOR_DECISION_ACCEPT => __('director.paper.decision.accept'), SUBMISSION_DIRECTOR_DECISION_PENDING_REVISIONS => __('director.paper.decision.pendingRevisions'), SUBMISSION_DIRECTOR_DECISION_DECLINE => __('director.paper.decision.decline'), null => __('plugins.reports.papers.nodecision'));
$columns = array('paper_id' => __('paper.submissionId'), 'title' => __('paper.title'), 'abstract' => __('paper.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('track_title' => __('track.title'), 'language' => __('common.language'), 'director_decision' => __('submission.directorDecision'), 'start_time' => __('manager.scheduler.startTime'), 'end_time' => __('manager.scheduler.endTime'), 'building' => __('manager.scheduler.building'), 'room' => __('manager.scheduler.room'), 'status' => __('common.status')));
$fp = fopen('php://output', 'wt');
String::fputcsv($fp, array_values($columns));
import('paper.Paper');
// Bring in getStatusMap function
$statusMap =& Paper::getStatusMap();
$controlledVocabDao =& DAORegistry::getDAO('ControlledVocabDAO');
$sessionTypes = $controlledVocabDao->enumerateBySymbolic('paperType', ASSOC_TYPE_SCHED_CONF, $schedConf->getId());
// Load building and room data
$buildingDao =& DAORegistry::getDAO('BuildingDAO');
$roomDao =& DAORegistry::getDAO('RoomDAO');
$buildings = $rooms = array();
$buildingsIterator =& $buildingDao->getBuildingsBySchedConfId($schedConf->getId());
while ($building =& $buildingsIterator->next()) {
$buildingId = $building->getId();
$buildings[$buildingId] =& $building;
$roomsIterator =& $roomDao->getRoomsByBuildingId($buildingId);
while ($room =& $roomsIterator->next()) {
$roomId = $room->getId();
$rooms[$roomId] =& $room;
unset($room);
}
unset($building);
unset($roomsIterator);
}
unset($buildingsIterator);
$authorIndex = 0;
while ($row =& $papersIterator->next()) {
if (isset($authorsIterator[$row['paper_id']])) {
$authorIterator =& $authorsIterator[$row['paper_id']];
$authors = $this->mergeAuthors($authorIterator->toArray());
} else {
// No authors for a submission.
$authors = array();
}
unset($authorIterator);
foreach ($columns as $index => $junk) {
if ($index == 'director_decision') {
if (isset($decisions[$row['paper_id']])) {
$columns[$index] = $decisionMessages[$decisions[$row['paper_id']]];
} else {
$columns[$index] = $decisionMessages[null];
}
} elseif ($index == 'status') {
$columns[$index] = __($statusMap[$row[$index]]);
} elseif ($index == 'abstract' || $index == 'title' || $index == 'affiliation') {
$columns[$index] = html_entity_decode(strip_tags($row[$index]), ENT_QUOTES, 'UTF-8');
} elseif ($index == 'start_time' || $index == 'end_time') {
$columns[$index] = $row[$index];
} elseif ($index == 'building') {
$columns['building'] = '';
$room =& $rooms[$row['room_id']];
if ($room) {
$building =& $buildings[$room->getBuildingId()];
if ($building) {
$columns[$index] = $building->getBuildingName();
}
}
unset($room, $building);
} elseif ($index == 'room') {
$columns['room'] = '';
$room =& $rooms[$row['room_id']];
if ($room) {
$columns[$index] = $room->getRoomName();
}
unset($room);
} elseif (strstr($index, 'biography') !== false) {
// "Convert" HTML to text for export
$columns[$index] = isset($authors[$index]) ? html_entity_decode(strip_tags($authors[$index]), ENT_QUOTES, 'UTF-8') : '';
} else {
if (isset($row[$index])) {
$columns[$index] = $row[$index];
} else {
if (isset($authors[$index])) {
$columns[$index] = $authors[$index];
} else {
$columns[$index] = '';
//.........这里部分代码省略.........
示例8: generateCustomizedCSV
function generateCustomizedCSV($args)
{
parent::validate();
$this->setupTemplate();
$query = Request::getUserVar('query');
$region = Request::getUserVar('region');
$statusFilter = Request::getUserVar('statusFilter');
$fromDate = Request::getUserVar('dateFrom');
//if ($fromDate != null) $fromDate = date('Y-m-d H:i:s', $fromDate);
$toDate = Request::getUserVar('dateTo');
//if ($toDate != null) $toDate = date('Y-m-d H:i:s', $toDate);
$columns = array();
$proposalId = false;
if (Request::getUserVar('proposalId')) {
$columns = $columns + array('proposalId' => Locale::translate('article.submissionId'));
$proposalId = true;
}
$scientificTitle = false;
if (Request::getUserVar('scientificTitle')) {
$columns = $columns + array('scientificTitle' => Locale::translate('article.scientificTitle'));
$scientificTitle = true;
}
$publicTitle = false;
if (Request::getUserVar('publicTitle')) {
$columns = $columns + array('publicTitle' => Locale::translate('article.publicTitle'));
$publicTitle = true;
}
$recruitmentStatus = false;
if (Request::getUserVar('recruitmentStatus')) {
$columns = $columns + array('recruitmentStatus' => Locale::translate('proposal.recruitment') . ' ' . Locale::translate('proposal.recruitment.status'));
$recruitmentStatus = true;
}
$therapeuticArea = false;
if (Request::getUserVar('therapeuticArea')) {
$columns = $columns + array('therapeuticArea' => Locale::translate('proposal.therapeuticArea'));
$therapeuticArea = true;
}
$minAge = false;
if (Request::getUserVar('minAge')) {
$columns = $columns + array('minAge' => Locale::translate('proposal.age.minimum'));
$minAge = true;
}
$maxAge = false;
if (Request::getUserVar('maxAge')) {
$columns = $columns + array('maxAge' => Locale::translate('proposal.age.maximum'));
$maxAge = true;
}
$sex = false;
if (Request::getUserVar('sex')) {
$columns = $columns + array('sex' => Locale::translate('proposal.sex'));
$sex = true;
}
$healthy = false;
if (Request::getUserVar('healthy')) {
$columns = $columns + array('healthy' => Locale::translate('proposal.healthy'));
$healthy = true;
}
$pSponsor = false;
if (Request::getUserVar('pSponsor')) {
$columns = $columns + array('pSponsor' => Locale::translate('proposal.primarySponsor'));
$pSponsor = true;
}
$enrolment = false;
if (Request::getUserVar('enrolment')) {
$columns = $columns + array('enrolment' => Locale::translate('proposal.expectedDate'));
$enrolment = true;
}
header('content-type: text/comma-separated-values');
header('content-disposition: attachment; filename=searchResults-' . date('Ymd') . '.csv');
$fp = fopen('php://output', 'wt');
String::fputcsv($fp, array_values($columns));
$articleDao =& DAORegistry::getDAO('ArticleDAO');
$results = $articleDao->searchCustomizedProposalsPublic($query, $region, $fromDate, $toDate, $statusFilter, $proposalId, $scientificTitle, $publicTitle, $recruitmentStatus, $therapeuticArea, $minAge, $maxAge, $sex, $healthy, $pSponsor, $enrolment);
foreach ($results as $result) {
foreach ($columns as $index => $junk) {
if ($index == 'status') {
if ($result->getStatus() == '11') {
$columns[$index] = 'Complete';
} else {
$columns[$index] = 'Ongoing';
}
} elseif ($index == 'date_submitted') {
$columns[$index] = $result->getDateSubmitted();
}
}
String::fputcsv($fp, $columns);
}
fclose($fp);
unset($columns);
}
示例9: display
/**
* Generate the subscription report and write CSV contents to file
* @param $args array Request arguments
*/
function display(&$args)
{
$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'));
String::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
String::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->getUser($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] = $this->_html2text($subscription->getNotes());
break;
case 'name':
$columns[$index] = $user->getFullName();
break;
case 'mailing_address':
$columns[$index] = $this->_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] = '';
}
}
String::fputcsv($fp, $columns);
}
// Columns for institutional subscriptions
$columns = array('');
String::fputcsv($fp, array_values($columns));
$columns = array(__('subscriptionManager.institutionalSubscriptions'));
String::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
String::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->getUser($subscription->getUserId());
$subscriptionType =& $subscriptionTypeDao->getSubscriptionType($subscription->getTypeId());
foreach ($columns as $index => $junk) {
switch ($index) {
case 'subscription_id':
$columns[$index] = $subscription->getId();
//.........这里部分代码省略.........
示例10: display
function display(&$args)
{
$journal =& Request::getJournal();
header('content-type: text/comma-separated-values');
header('content-disposition: attachment; filename=report.csv');
$articleReportDao =& DAORegistry::getDAO('ArticleReportDAO');
list($articlesIterator, $decisionsIteratorsArray) = $articleReportDao->getArticleReport($journal->getJournalId());
$decisions = array();
foreach ($decisionsIteratorsArray as $decisionsIterator) {
while ($row =& $decisionsIterator->next()) {
$decisions[$row['article_id']] = $row['decision'];
}
}
import('classes.article.Article');
$decisionMessages = array(SUBMISSION_EDITOR_DECISION_ACCEPT => Locale::translate('editor.article.decision.accept'), SUBMISSION_EDITOR_DECISION_PENDING_REVISIONS => Locale::translate('editor.article.decision.pendingRevisions'), SUBMISSION_EDITOR_DECISION_RESUBMIT => Locale::translate('editor.article.decision.resubmit'), SUBMISSION_EDITOR_DECISION_DECLINE => Locale::translate('editor.article.decision.decline'), null => Locale::translate('plugins.reports.articles.nodecision'));
$columns = array('article_id' => Locale::translate('article.submissionId'), 'title' => Locale::translate('article.title'), 'abstract' => Locale::translate('article.abstract'), 'fname' => Locale::translate('user.firstName'), 'mname' => Locale::translate('user.middleName'), 'lname' => Locale::translate('user.lastName'), 'phone' => Locale::translate('user.phone'), 'fax' => Locale::translate('user.fax'), 'address' => Locale::translate('common.mailingAddress'), 'country' => Locale::translate('common.country'), 'affiliation' => Locale::translate('user.affiliation'), 'email' => Locale::translate('user.email'), 'url' => Locale::translate('user.url'), 'biography' => Locale::translate('user.biography'), 'section_title' => Locale::translate('section.title'), 'language' => Locale::translate('common.language'), 'status' => Locale::translate('common.status'));
$fp = fopen('php://output', 'wt');
String::fputcsv($fp, array_values($columns));
while ($row =& $articlesIterator->next()) {
foreach ($columns as $index => $junk) {
if ($index == "article_id") {
$columns[$index] = $row[$index];
if (isset($decisions[$row[$index]])) {
$columns['status'] = $decisionMessages[$decisions[$row[$index]]];
} else {
$columns['status'] = $decisionMessages[NULL];
}
} else {
if ($index == "status") {
continue;
} else {
$columns[$index] = $row[$index];
}
}
}
String::fputcsv($fp, $columns);
unset($row);
}
fclose($fp);
}
示例11: report
/**
* Counter report as CSV
*/
function report()
{
$this->validate();
$plugin =& $this->plugin;
$this->setupTemplate(true);
$journal =& Request::getJournal();
$year = Request::getUserVar('year');
$begin = "{$year}-01-01";
$end = "{$year}-12-01";
$counterReportDao =& DAORegistry::getDAO('CounterReportDAO');
header('content-type: text/comma-separated-values');
header('content-disposition: attachment; filename=counter-' . date('Ymd') . '.csv');
$fp = fopen('php://output', 'wt');
String::fputcsv($fp, array(Locale::translate('plugins.generic.counter.1a.title1')));
String::fputcsv($fp, array(Locale::translate('plugins.generic.counter.1a.title2', array('year' => $year))));
String::fputcsv($fp, array());
// FIXME: Criteria should be here?
String::fputcsv($fp, array(Locale::translate('plugins.generic.counter.1a.dateRun')));
String::fputcsv($fp, array(strftime("%Y-%m-%d")));
$cols = array('', Locale::translate('plugins.generic.counter.1a.publisher'), Locale::translate('plugins.generic.counter.1a.platform'), Locale::translate('plugins.generic.counter.1a.printIssn'), Locale::translate('plugins.generic.counter.1a.onlineIssn'));
for ($i = 1; $i <= 12; $i++) {
$time = strtotime($year . '-' . $i . '-01');
strftime('%b', $time);
$cols[] = strftime('%b-%Y', $time);
}
$cols[] = Locale::translate('plugins.generic.counter.1a.ytdTotal');
$cols[] = Locale::translate('plugins.generic.counter.1a.ytdHtml');
$cols[] = Locale::translate('plugins.generic.counter.1a.ytdPdf');
fputcsv($fp, $cols);
// Display the totals first
$totals = $counterReportDao->getMonthlyTotalRange($begin, $end);
$cols = array(Locale::translate('plugins.generic.counter.1a.totalForAllJournals'), '-', '', '-', '-');
CounterHandler::_formColumns($cols, $totals);
fputcsv($fp, $cols);
// Get statistics from the log.
$journalDao =& DAORegistry::getDAO('JournalDAO');
$journalIds = $counterReportDao->getJournalIds();
foreach ($journalIds as $journalId) {
$journal =& $journalDao->getJournal($journalId);
if (!$journal) {
continue;
}
$entries = $counterReportDao->getMonthlyLogRange($journalId, $begin, $end);
$cols = array($journal->getLocalizedTitle(), $journal->getSetting('publisherInstitution'), 'Open Journal Systems', $journal->getSetting('printIssn'), $journal->getSetting('onlineIssn'));
CounterHandler::_formColumns($cols, $entries);
fputcsv($fp, $cols);
unset($journal, $entry);
}
fclose($fp);
}
示例12: display
function display(&$args)
{
$conference =& Request::getConference();
$schedConf =& Request::getSchedConf();
Locale::requireComponents(array(LOCALE_COMPONENT_APPLICATION_COMMON, LOCALE_COMPONENT_PKP_USER, LOCALE_COMPONENT_PKP_SUBMISSION, LOCALE_COMPONENT_OCS_MANAGER));
header('content-type: text/comma-separated-values');
header('content-disposition: attachment; filename=reviews-' . date('Ymd') . '.csv');
$reviewReportDao =& DAORegistry::getDAO('ReviewReportDAO');
list($commentsIterator, $reviewsIterator) = $reviewReportDao->getReviewReport($schedConf->getId());
$comments = array();
while ($row =& $commentsIterator->next()) {
if (isset($comments[$row['paper_id']][$row['author_id']])) {
$comments[$row['paper_id']][$row['author_id']] .= "; " . $row['comments'];
} else {
$comments[$row['paper_id']][$row['author_id']] = $row['comments'];
}
}
$yesnoMessages = array(0 => Locale::translate('common.no'), 1 => Locale::translate('common.yes'));
import('classes.schedConf.SchedConf');
$reviewTypes = array(REVIEW_MODE_ABSTRACTS_ALONE => Locale::translate('manager.schedConfSetup.submissions.abstractsAlone'), REVIEW_MODE_BOTH_SEQUENTIAL => Locale::translate('manager.schedConfSetup.submissions.bothSequential'), REVIEW_MODE_PRESENTATIONS_ALONE => Locale::translate('manager.schedConfSetup.submissions.presentationsAlone'), REVIEW_MODE_BOTH_SIMULTANEOUS => Locale::translate('manager.schedConfSetup.submissions.bothTogether'));
import('classes.submission.reviewAssignment.ReviewAssignment');
$recommendations = ReviewAssignment::getReviewerRecommendationOptions();
$columns = array('reviewRound' => Locale::translate('submissions.reviewType'), 'paper' => Locale::translate('paper.papers'), 'paperid' => Locale::translate('paper.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.paper.recommendation'), 'comments' => Locale::translate('comments.commentsOnPaper'));
$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, array('declined', 'cancelled'))) {
$yesNoIndex = $row[$index];
if (is_string($yesNoIndex)) {
// Accomodate Postgres boolean casting
$yesNoIndex = $yesNoIndex == "f" ? 0 : 1;
}
$columns[$index] = $yesnoMessages[$yesNoIndex];
} elseif ($index == 'reviewRound') {
$columns[$index] = $reviewTypes[$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['paperid']][$row['reviewerid']])) {
$columns[$index] = html_entity_decode(strip_tags($comments[$row['paperid']][$row['reviewerid']]));
} else {
$columns[$index] = "";
}
} else {
$columns[$index] = $row[$index];
}
}
String::fputcsv($fp, $columns);
unset($row);
}
fclose($fp);
}
示例13: donwloadMinutesTemplate
function donwloadMinutesTemplate($args)
{
$meetingId = isset($args[0]) ? (int) $args[0] : 0;
$this->validate($meetingId);
$meetingDao =& DAORegistry::getDAO('MeetingDAO');
$meetingAttendanceDao =& DAORegistry::getDAO("MeetingAttendanceDAO");
$ercDao =& DAORegistry::getDAO("SectionDAO");
$sectionDecisionDao =& DAORegistry::getDAO("SectionDecisionDAO");
$sectionEditorSubmissionDao =& DAORegistry::getDAO("SectionEditorSubmissionDAO");
$meeting = $meetingDao->getMeetingById($meetingId);
header('content-type: text/comma-separated-values');
header('content-disposition: attachment; filename=' . $meeting->getPublicId() . '-' . date('dMY') . '-minutesTemplate.csv');
Locale::requireComponents(array(LOCALE_COMPONENT_PKP_SUBMISSION, LOCALE_COMPONENT_OJS_EDITOR, LOCALE_COMPONENT_APPLICATION_COMMON));
$fp = fopen('php://output', 'wt');
$erc =& $ercDao->getSection($meeting->getUploader());
String::fputcsv($fp, array($erc->getLocalizedTitle()));
String::fputcsv($fp, array(''));
String::fputcsv($fp, array(Locale::translate('editor.minutes.meetingMinutes'), Locale::translate('editor.meeting.id') . ': ' . $meeting->getPublicId()));
String::fputcsv($fp, array('', Locale::translate('editor.meeting.dateAndTime') . ': ' . date('D, d M Y H:i', strtotime($meeting->getDate()))));
String::fputcsv($fp, array('', Locale::translate('editor.meeting.length') . ': ' . $meeting->getLength() . ' ' . Locale::translate('common.time.minutes')));
String::fputcsv($fp, array('', Locale::translate('editor.meeting.location') . ': ' . $meeting->getLocation()));
$meetingAttendances =& $meetingAttendanceDao->getMeetingAttendancesByMeetingId($meeting->getId());
$presentMembers = (string) '';
$absentMembers = (string) '';
foreach ($meetingAttendances as $meetingAttendance) {
if ($meetingAttendance->getIsAttending() == MEETING_REPLY_ATTENDING) {
$member =& $meetingAttendance->getUser();
if ($presentMembers == '') {
$presentMembers = $member->getFullName();
} else {
$presentMembers = $presentMembers . ', ' . $member->getFullName();
}
} elseif ($meetingAttendance->getIsAttending() == MEETING_REPLY_NOT_ATTENDING) {
$member =& $meetingAttendance->getUser();
if ($absentMembers == '') {
$absentMembers = $member->getFullName();
} else {
$absentMembers = $absentMembers . ', ' . $member->getFullName();
}
}
}
String::fputcsv($fp, array(Locale::translate('editor.meeting.attendees'), $presentMembers));
String::fputcsv($fp, array(Locale::translate('editor.meeting.absent'), $absentMembers));
String::fputcsv($fp, array(Locale::translate('editor.minutes.welcome')));
String::fputcsv($fp, array(Locale::translate('editor.minutes.apologies')));
String::fputcsv($fp, array(Locale::translate('editor.meeting.minutesPrevious')));
$initialReviews = array();
$progressReports = array();
$amendments = array();
$seriousAdverseEvents = array();
$finalReports = array();
$meetingSectionDecisions =& $meeting->getMeetingSectionDecisions();
foreach ($meetingSectionDecisions as $meetingSectionDecision) {
$sDecision =& $sectionDecisionDao->getSectionDecision($meetingSectionDecision->getSectionDecisionId());
$reviewAssignments =& $sDecision->getReviewAssignments();
$reviewAssignmentsString = (string) '';
foreach ($reviewAssignments as $reviewAssignment) {
if ($reviewAssignmentsString == '') {
$reviewAssignmentsString = $reviewAssignment->getReviewerFullName();
} else {
$reviewAssignmentsString = $reviewAssignmentsString . ', ' . $reviewAssignment->getReviewerFullName();
}
}
switch ($sDecision->getReviewType()) {
case REVIEW_TYPE_INITIAL:
array_push($initialReviews, array('decision' => $sDecision, 'proposal' => $sectionEditorSubmissionDao->getSectionEditorSubmission($sDecision->getArticleId()), 'reviewAssignments' => $reviewAssignmentsString));
break;
case REVIEW_TYPE_PR:
array_push($progressReports, array('decision' => $sDecision, 'proposal' => $sectionEditorSubmissionDao->getSectionEditorSubmission($sDecision->getArticleId()), 'reviewAssignments' => $reviewAssignmentsString));
break;
case REVIEW_TYPE_AMENDMENT:
array_push($amendments, array('decision' => $sDecision, 'proposal' => $sectionEditorSubmissionDao->getSectionEditorSubmission($sDecision->getArticleId()), 'reviewAssignments' => $reviewAssignmentsString));
break;
case REVIEW_TYPE_SAE:
array_push($seriousAdverseEvents, array('decision' => $sDecision, 'proposal' => $sectionEditorSubmissionDao->getSectionEditorSubmission($sDecision->getArticleId()), 'reviewAssignments' => $reviewAssignmentsString));
break;
case REVIEW_TYPE_FR:
array_push($finalReports, array('decision' => $sDecision, 'proposal' => $sectionEditorSubmissionDao->getSectionEditorSubmission($sDecision->getArticleId()), 'reviewAssignments' => $reviewAssignmentsString));
break;
}
}
$proposalCategories = array();
array_push($proposalCategories, array('title' => 'submission.initialReview', 'category' => $initialReviews));
array_push($proposalCategories, array('title' => 'submission.progressReport', 'category' => $progressReports));
array_push($proposalCategories, array('title' => 'submission.protocolAmendment', 'category' => $amendments));
array_push($proposalCategories, array('title' => 'submission.seriousAdverseEvents', 'category' => $seriousAdverseEvents));
array_push($proposalCategories, array('title' => 'submission.finalReport', 'category' => $finalReports));
foreach ($proposalCategories as $proposalCategory) {
if (!empty($proposalCategory['category'])) {
String::fputcsv($fp, array(''));
String::fputcsv($fp, array(Locale::translate($proposalCategory['title'])));
String::fputcsv($fp, array(Locale::translate('submissions.reviewRound'), Locale::translate('article.scientificTitle'), Locale::translate('editor.minutes.generalDiscussion'), Locale::translate('submissions.editorDecision'), Locale::translate('editor.minutes.primaryReviewer'), Locale::translate('editor.minutes.timeFrame')));
foreach ($proposalCategory['category'] as $selection) {
String::fputcsv($fp, array($selection['decision']->getRound(), $selection['proposal']->getScientificTitle(), '', '', $selection['reviewAssignments'], ''));
}
}
}
fclose($fp);
}
示例14: _CSVReport
function _CSVReport($proposals, $criterias)
{
$institutionDao =& DAORegistry::getDAO('InstitutionDAO');
$countryDao =& DAORegistry::getDAO('CountryDAO');
$extraFieldDao =& DAORegistry::getDAO('ExtraFieldDAO');
$journal =& Request::getJournal();
header('content-type: text/comma-separated-values');
header('content-disposition: attachment; filename=' . $journal->getLocalizedInitials() . '-' . date('YMd') . '-' . Locale::translate('editor.report') . '.csv');
$fp = fopen('php://output', 'wt');
$columns = $this->_getColumnsOfCSV();
//Write into the csv
String::fputcsv($fp, array_values($columns));
foreach ($proposals as $proposal) {
$decisions = $proposal->getDecisions();
$investigators = $proposal->getAuthors();
// Set up the for loops in case of multi entries for one proposal
if (array_key_exists('committee', $columns)) {
$decisionsCount = count($decisions);
} else {
$decisionsCount = 1;
}
if (Request::getUserVar('checkAllInvestigators')) {
$investigatorsCount = count($investigators);
} else {
$investigatorsCount = 1;
}
if (array_key_exists('sourceInstitution', $columns)) {
$sourcesCount = count($sources);
} else {
$sourcesCount = 1;
}
// Loop through all the possible mutli entries and write the data
for ($dI = 0; $dI < $decisionsCount; $dI++) {
for ($iI = 0; $iI < $investigatorsCount; $iI++) {
foreach ($columns as $index => $junk) {
// General
if ($index == 'proposalId') {
$columns[$index] = $proposal->getProposalId();
} elseif ($index == 'committee') {
$columns[$index] = $decisions[$dI]->getSectionAcronym();
} elseif ($index == 'decisionType') {
$columns[$index] = Locale::translate($decisions[$dI]->getReviewTypeKey());
} elseif ($index == 'decisionStatus') {
$columns[$index] = Locale::translate($decisions[$dI]->getReviewStatusKey());
} elseif ($index == 'decisionDate') {
$columns[$index] = date("d-M-Y", strtotime($decisions[$dI]->getDateDecided()));
} elseif ($index == 'submitDate') {
$columns[$index] = date("d-M-Y", strtotime($proposal->getDateSubmitted()));
} elseif ($index == 'investigator') {
$columns[$index] = $this->_removeCommaForCSV($investigators[$iI]->getFullName(true));
} elseif ($index == 'investigatorAffiliation') {
$columns[$index] = $this->_removeCommaForCSV($investigators[$iI]->getAffiliation());
} elseif ($index == 'investigatorEmail') {
$columns[$index] = $investigators[$iI]->getEmail();
}
}
String::fputcsv($fp, $columns);
}
}
}
// Display or not the search criterias on the bottom of the CSV file
if (Request::getUserVar('checkShowCriterias')) {
String::fputcsv($fp, array(''));
String::fputcsv($fp, array(''));
if (!empty($criterias)) {
$i = 0;
foreach ($criterias as $criteria) {
if ($i != 0) {
$criteria = Locale::translate('common.and') . ' ' . $criteria;
String::fputcsv($fp, array('', $criteria));
} else {
String::fputcsv($fp, array(Locale::translate('editor.reports.criterias'), $criteria));
}
$i++;
}
}
}
fclose($fp);
}
示例15: display
function display(&$args)
{
$conference =& Request::getConference();
$schedConf =& Request::getSchedConf();
Locale::requireComponents(array(LOCALE_COMPONENT_APPLICATION_COMMON, LOCALE_COMPONENT_PKP_USER, LOCALE_COMPONENT_OCS_MANAGER));
header('content-type: text/comma-separated-values');
header('content-disposition: attachment; filename=registrants-' . date('Ymd') . '.csv');
$registrationDao =& DAORegistry::getDAO('RegistrationDAO');
$registrationOptionDao =& DAORegistry::getDAO('RegistrationOptionDAO');
$registrationTypeDao =& DAORegistry::getDAO('RegistrationTypeDAO');
$userDao =& DAORegistry::getDAO('UserDAO');
$columns = array(Locale::translate('plugins.reports.registrants.registrationid'), Locale::translate('plugins.reports.registrants.userid'), Locale::translate('user.username'), Locale::translate('user.firstName'), Locale::translate('user.middleName'), Locale::translate('user.lastName'), Locale::translate('user.affiliation'), Locale::translate('user.url'), Locale::translate('user.email'), Locale::translate('user.phone'), Locale::translate('user.fax'), Locale::translate('common.mailingAddress'), Locale::translate('common.billingAddress'), Locale::translate('common.country'), Locale::translate('manager.registration.registrationType'));
$registrationOptions =& $registrationOptionDao->getRegistrationOptionsBySchedConfId($schedConf->getId());
// 'option' + optionId => name of the registration option
$registrationOptionIds = array();
while ($registrationOption =& $registrationOptions->next()) {
$registrationOptionIds[] = $registrationOption->getOptionId();
$columns = array_merge($columns, array('option' . $registrationOption->getOptionId() => $registrationOption->getRegistrationOptionName()));
unset($registrationOption);
}
$columns = array_merge($columns, array(Locale::translate('manager.registration.dateRegistered'), Locale::translate('manager.registration.datePaid'), Locale::translate('schedConf.registration.specialRequests'), Locale::translate('plugins.reports.registrants.total')));
$fp = fopen('php://output', 'wt');
String::fputcsv($fp, array_values($columns));
$registrationOptionCosts = $registrationTypes = array();
$registrations =& $registrationDao->getRegistrationsBySchedConfId($schedConf->getId());
while ($registration =& $registrations->next()) {
$registrationId = $registration->getId();
$registrationTypeId = $registration->getTypeId();
// Get registration option costs, caching as we go.
if (!isset($registrationOptionCosts[$registrationTypeId])) {
$registrationOptionCosts[$registrationTypeId] = $registrationTypeDao->getRegistrationOptionCosts($registrationTypeId);
}
// Get the registration type, caching as we go.
if (!isset($registrationTypes[$registrationTypeId])) {
$registrationTypes[$registrationTypeId] =& $registrationTypeDao->getRegistrationType($registrationTypeId);
}
$registrationType =& $registrationTypes[$registrationTypeId];
// Get registrant user object
$user =& $userDao->getUser($registration->getUserId());
$columns = array($registrationId, $user->getId(), $user->getUsername(), $user->getFirstName(), $user->getMiddleName(), $user->getLastName(), $user->getLocalizedAffiliation(), $user->getUrl(), $user->getEmail(), $user->getPhone(), $user->getFax(), $user->getMailingAddress(), $user->getBillingAddress(), $user->getCountry(), $registrationType->getRegistrationTypeName());
// Get selected registration options; calculate costs
$totalCost = $registrationType->getCost();
$selectedOptionIds = $registrationOptionDao->getRegistrationOptions($registrationId);
foreach ($registrationOptionIds as $optionId) {
if (in_array($optionId, $selectedOptionIds)) {
$columns[] = Locale::translate('common.yes');
if (isset($registrationOptionCosts[$registrationTypeId][$optionId])) {
$totalCost += $registrationOptionCosts[$registrationTypeId][$optionId];
}
} else {
$columns[] = Locale::translate('common.no');
}
}
$columns[] = $registration->getDateRegistered();
$columns[] = $registration->getDatePaid();
$columns[] = $registration->getSpecialRequests();
$columns[] = sprintf('%.2f', $totalCost);
String::fputcsv($fp, $columns);
unset($registration, $registrationType, $user);
}
fclose($fp);
}