/** * @param Publication $publication * * @return array */ private function createFields(Publication $publication) { // NOTE: dc.citation.* are non standard tags recommended by Google Scholar $fields = array(); foreach ($publication->getAuthors() as $author) { if ($author->getLastName() && $author->getFirstName()) { $fields[] = array('dc.creator', $author->getFirstName() . ' ' . $author->getLastName()); } } $fields[] = array('dc.title', $publication->getTitle()); // TODO: not dcterms.issued and YYYY-MM-DD according to https://wiki.whatwg.org/wiki/MetaExtensions? $fields[] = array('dc.issued', $publication->getDatePublished('Y/m/d')); $fields[] = array('dc.relation.ispartof', $publication->getJournal()); $fields[] = array('dc.relation.ispartof', $publication->getBooktitle()); $fields[] = array('dc.citation.volume', $publication->getVolume()); $fields[] = array('dc.citation.issue', $publication->getNumber()); $fields[] = array('dc.citation.spage', $publication->getFirstPage()); $fields[] = array('dc.citation.epage', $publication->getLastPage()); $file = $publication->getFullTextFile(); if ($file) { $fields[] = array('dc.identifier', Request::createUrl(array('p' => 'publication', 'id' => $publication->getId(), 'file_id' => $file->getId()), true)); } $fields[] = array('dc.publisher', $publication->getInstitution()); // used for institution, too $fields[] = array('dc.publisher', $publication->getPublisher()); $fields[] = array('dc.identifier', $publication->getDoi()); return $fields; }
/** * @param Publication $publication * * @return array */ private function createFields(Publication $publication) { $fields = array(); $fields[] = array('prism.title', $publication->getTitle()); // TODO: valid? Isn't it part of the dc subset of prism? $fields[] = array('prism.publicationDate', $publication->getDatePublished('Y-m-d')); $fields[] = array('prism.publicationYear', $publication->getDatePublished('Y')); $fields[] = array('prism.publicationName', $publication->getJournal()); $fields[] = array('prism.publicationName', $publication->getBooktitle()); $fields[] = array('prism.volume', $publication->getVolume()); $fields[] = array('prism.number', $publication->getNumber()); $fields[] = array('prism.edition', $publication->getEdition()); $fields[] = array('prism.startingPage', $publication->getFirstPage()); $fields[] = array('prism.endingPage', $publication->getLastPage()); $file = $publication->getFullTextFile(); if ($file) { $fields[] = array('prism.url', Request::createUrl(array('p' => 'publication', 'id' => $publication->getId(), 'file_id' => $file->getId()), true)); } //$fields[] = array('prism.issn', false); // TODO $fields[] = array('prism.isbn', $publication->getIsbn()); $fields[] = array('prism.copyright', $publication->getCopyright()); $fields[] = array('prism.organization', $publication->getInstitution()); // TODO: check if valid usage $fields[] = array('prism.doi', $publication->getDoi()); return $fields; }
/** * @return string */ public function showEditFiles() { $files = $this->publication->getFiles(); $string = ''; foreach ($files as $file) { $url = Request::createUrl(array('p' => 'publication', 'id' => $this->publication->getId(), 'file_id' => $file->getId())); $full_text = $file->isFullText() ? ' (full text)' : ''; $hidden = $file->isHidden() ? ' (hidden)' : ''; $restricted = $file->isRestricted() ? ' (restricted)' : ''; $string .= '<li> <form action="#" method="post" accept-charset="utf-8"> <a href="' . $this->html($url) . '" target="_blank">' . $this->html($file->getTitle() . $file->getExtension()) . '</a>' . $this->html($full_text . $hidden . $restricted) . ' <input type="hidden" name="file_id" value="' . $this->html($file->getId()) . '"/> <input type="hidden" name="action" value="removeFile"/> <input type="submit" value="x" onclick="return confirm(\'Do you really want to delete the file ' . $this->html($file->getTitle() . $file->getExtension()) . '?\')"/> </form> </li>'; } $string .= '<li><form action="#" method="post" enctype="multipart/form-data"> <label for="file">File:</label> <input type="file" name="file" id="file"><br/> <label for="title">Description:</label> <input type="text" name="title" id="title"><br/> <input type="checkbox" name="full_text" id="full_text" value="yes"> <label for="full_text">Full Text</label> <input type="checkbox" name="restricted" id="restricted" value="yes"/> <label for="restricted">Access Restricted</label> <input type="checkbox" name="hidden" id="hidden" value="yes"/> <label for="hidden">Hidden</label><br/> <input type="hidden" name="action" value="addFile"/> <input type="submit" value="Upload File"/> </form></li>'; return $string; }
/** * @param Publication $publication * * @return array * @throws Exception */ private function createFields(Publication $publication) { $fields = array(); $fields[] = array('TY', $this->encodeType($publication->getTypeName())); foreach ($publication->getAuthors() as $keyword) { if ($keyword->getLastName() && $keyword->getFirstName()) { $fields[] = array('AU', $keyword->getLastName() . ', ' . $keyword->getFirstName()); } } $fields[] = array('T1', $publication->getTitle()); // TODO: check if valid $fields[] = array('JA', $publication->getJournal()); // TODO: check if valid $fields[] = array('TI', $publication->getBooktitle()); // TODO: check if valid $fields[] = array('VL', $publication->getVolume()); $fields[] = array('IS', $publication->getNumber()); $fields[] = array('SP', $publication->getFirstPage()); $fields[] = array('EP', $publication->getLastPage()); $fields[] = array('PY', $publication->getDatePublished('Y/m/d')); $fields[] = array('PB', $publication->getPublisher()); $fields[] = array('N1', $publication->getNote()); $file = $publication->getFullTextFile(); if ($file) { $fields[] = array('L1', Request::createUrl(array('p' => 'publication', 'id' => $publication->getId(), 'file_id' => $file->getId()), true)); } $fields[] = array('UR', $publication->getDoi()); $fields[] = array('SN', $publication->getIsbn()); $fields[] = array('AB', $publication->getAbstract()); foreach ($publication->getKeywords() as $keyword) { $fields[] = array('KW', $keyword->getName()); } return $fields; }
/** * @param Publication $publication * * @return array */ private function createFields(Publication $publication) { $fields = array(); foreach ($publication->getAuthors() as $author) { if ($author->getFirstName() && $author->getLastName()) { $fields[] = array('author', $author->getFirstName() . ' ' . $author->getLastName()); } } $fields[] = array('title', $publication->getTitle()); $fields[] = array('journal', $publication->getJournal()); $fields[] = array('booktitle', $publication->getBooktitle()); $fields[] = array('volume', $publication->getVolume()); $fields[] = array('number', $publication->getNumber()); $fields[] = array('series', $publication->getSeries()); $fields[] = array('edition', $publication->getEdition()); $fields[] = array('pages', $publication->getPages('--')); $fields[] = array('month', $publication->getDatePublished('F')); $fields[] = array('year', $publication->getDatePublished('Y')); $file = $publication->getFullTextFile(); if ($file) { $fields[] = array('url', Request::createUrl(array('p' => 'publication', 'id' => $publication->getId(), 'file_id' => $file->getId()), true)); } //$fields[] = array('issn', false); // TODO $fields[] = array('isbn', $publication->getIsbn()); $fields[] = array('institution', $publication->getInstitution()); $fields[] = array('school', $publication->getSchool()); $fields[] = array('publisher', $publication->getPublisher()); $fields[] = array('ee', $publication->getDoi()); $fields[] = array('address', $publication->getAddress()); $fields[] = array('howpublished', $publication->getHowpublished()); $fields[] = array('note', $publication->getNote()); $fields[] = array('abstract', $publication->getAbstract()); $fields[] = array('biburl', Request::createUrl(array('p' => 'publication', 'id' => $publication->getId()), true)); return $fields; }
/** * @param Publication $publication * * @return array * @throws Exception */ private function createFields(Publication $publication) { $fields = array(); $fields['type'] = $this->encodeTypes($publication->getTypeName()); $fields['id'] = 'TODO_' . $publication->getId(); // TODO $fields['title'] = $publication->getTitle(); foreach ($publication->getAuthors() as $author) { if ($author->getFirstName() && $author->getLastName()) { $fields['author'][] = array('family' => $author->getLastName(), 'given' => $author->getFirstName()); } } $fields['issued'] = array('date-parts' => array($publication->getDatePublished('Y'), $publication->getDatePublished('m'), $publication->getDatePublished('d'))); $fields['container-title'] = $publication->getJournal(); // TODO $fields['container-title'] = $publication->getBooktitle(); $fields['citation-number'] = $publication->getNumber(); $fields['volume'] = $publication->getVolume(); $fields['number'] = ''; // TODO $fields['issue'] = ''; // TODO $fields['page'] = ''; $fields['page-first'] = $publication->getFirstPage(); $fields['edition'] = $publication->getEdition(); $fields['abstract'] = $publication->getAbstract(); $fields['DOI'] = $publication->getDoi(); $fields['ISBN'] = $publication->getIsbn(); $fields['ISSN'] = ''; // TODO $file = $publication->getFullTextFile(); if ($file) { $fields['URL'] = Request::createUrl(array('p' => 'publication', 'id' => $publication->getId(), 'file_id' => $file->getId()), true); } $fields['note'] = $publication->getNote(); $fields['publisher'] = $publication->getPublisher(); return $fields; }
/** * @param Publication $publication * * @return array */ private function createFields(Publication $publication) { $fields = array(); $fields[] = array('citation_title', $publication->getTitle()); foreach ($publication->getAuthors() as $author) { if ($author->getLastName() && $author->getFirstName()) { $fields[] = array('citation_author', $author->getLastName() . ', ' . $author->getFirstName()); } } $fields[] = array('citation_publication_date', $publication->getDatePublished('Y/m/d')); $fields[] = array('citation_journal_title', $publication->getJournal()); $fields[] = array('citation_conference_title', $publication->getBooktitle()); $fields[] = array('citation_volume', $publication->getVolume()); if ($publication->getTypeName() == 'techreport') { $fields[] = array('citation_technical_report_number', $publication->getNumber()); } else { $fields[] = array('citation_issue', $publication->getNumber()); } $fields[] = array('citation_firstpage', $publication->getFirstPage()); $fields[] = array('citation_lastpage', $publication->getLastPage()); $file = $publication->getFullTextFile(); if ($file) { $fields[] = array('citation_pdf_url', Request::createUrl(array('p' => 'publication', 'id' => $publication->getId(), 'file_id' => $file->getId()), true)); } //$fields[] = array('citation_issn', false); // TODO $fields[] = array('citation_isbn', $publication->getIsbn()); $fields[] = array('citation_publisher', $publication->getPublisher()); if ($publication->getTypeName() == 'techreport') { $fields[] = array('citation_technical_report_institution', $publication->getInstitution()); } else { if (in_array($publication->getTypeName(), array('phdthesis', 'mastersthesis'))) { $fields[] = array('citation_dissertation_institution', $publication->getInstitution()); } } $fields[] = array('citation_doi', $publication->getDoi()); $keywords = ''; foreach ($publication->getKeywords() as $keyword) { if ($keyword->getName()) { $keywords .= $keyword->getName() . '; '; } } $keywords = substr($keywords, 0, -2); $fields[] = array('citation_keywords', $keywords); return $fields; }
/** * @param Publication $publication * @param int $max_authors * * @return string */ public function showCitation(Publication $publication, $max_authors = 6) { $citation = '<div class="citation">'; /* shows the title and links to the publication page */ $url = Request::createUrl(array('p' => 'publication', 'id' => $publication->getId())); $citation .= '<a href="' . $this->html($url) . '" class="title">' . $this->html($publication->getTitle()) . '</a><br/>'; /* creates list of authors */ $authors = $publication->getAuthors(); $num = count($authors); $authors_string = ''; if ($num > 0) { $i = 1; foreach ($authors as $author) { if ($i == 1) { /* first author */ $authors_string .= $author->getFirstName(true) . ' ' . $author->getLastName(); } else { if ($i > $max_authors) { /* break with "et al." if too many authors */ $authors_string .= ' et al.'; break; } else { if ($i == $num) { /* last author */ $authors_string .= ' and ' . $author->getFirstName(true) . ' ' . $author->getLastName(); } else { /* all other authors */ $authors_string .= ', ' . $author->getFirstName(true) . ' ' . $author->getLastName(); } } } $i++; } } /* shows list of authors */ $citation .= '<span class="authors">' . $this->html($authors_string) . '</span>'; /* appends publish date behind the authors */ $citation .= ' <span class="year">(' . $this->html($publication->getDatePublished('Y')) . ')</span>'; /* shows journal or booktitle and additional data*/ if ($publication->getJournal()) { $citation .= '<br/><span class="journal">' . $this->html($publication->getJournal()) . '</span>'; if ($publication->getVolume()) { $citation .= ', <span class="volume">' . $this->html($publication->getVolume()) . '</span>'; if ($publication->getNumber()) { $citation .= ' <span class="number">(' . $this->html($publication->getNumber()) . ')</span>'; } } if ($publication->getPages('-')) { $citation .= ', <span class="pages">' . $this->html($publication->getPages('-')) . '</span>'; } } else { if ($publication->getBooktitle()) { $citation .= '<br/>In: <span class="booktitle">' . $this->html($publication->getBooktitle()) . '</span>'; if ($publication->getPages('-')) { $citation .= ', <span class="pages">' . $this->html($publication->getPages('-')) . '</span>'; } } } $links = array(); /* shows full text link */ $file = $publication->getFullTextFile(); if ($file) { $title = $file->getExtension() == '.pdf' ? 'PDF' : 'FULLTEXT'; $url = Request::createUrl(array('p' => 'publication', 'id' => $publication->getId(), 'file_id' => $file->getId())); $links[] = '<a href="' . $this->html($url) . '" target="_blank">' . $this->html($title) . '</a>'; } /* shows DOI link */ if ($publication->getDoi()) { $links[] = '<a href="http://dx.doi.org/' . $this->html($publication->getDoi()) . '" target="_blank">DOI</a>'; } /* shows URLs */ if ($publication->getUrls()) { foreach ($publication->getUrls() as $url) { $links[] = '<a href="' . $this->html($url->getUrl()) . '" target="_blank">' . $this->html($url->getName()) . '</a>'; } } /* shows links if there are any */ if (!empty($links)) { $citation .= '<br/><span class="links">' . implode(' - ', $links) . '</span>'; } return $citation . '</div>'; }
/** * @param Publication $publication * * @return string */ private function generateCiteKey(Publication $publication) { // TODO implement return 'cite_key_' . $publication->getId(); }
/** * @param Publication $publication * @param $metadataPrefix * * @return array */ private function createRecordMetadataFields(Publication $publication, $metadataPrefix) { if ($metadataPrefix == 'oai_dc') { $fields = array(); $fields[] = array('dc:title', $publication->getTitle()); foreach ($publication->getAuthors() as $author) { if ($author->getLastName() && $author->getFirstName()) { $fields[] = array('dc:creator', $author->getLastName() . ', ' . $author->getFirstName()); } } $fields[] = array('dc:description', $publication->getAbstract()); $fields[] = array('dc:date', $publication->getDatePublished('Y')); $fields[] = array('dc:publisher', $publication->getPublisher()); $fields[] = array('dc:type', 'Text'); $fields[] = array('dc:rights', $publication->getCopyright()); $fields[] = array('dc:identifier', $publication->getDoi()); $fields[] = array('dc:identifier', Request::createUrl(array('p' => 'publication', 'id' => $publication->getId()))); return $fields; } else { throw new UnexpectedValueException('Implementation for ' . $metadataPrefix . ' missing!'); } }