Beispiel #1
0
 function get_document($uuid)
 {
     $json = $this->fetch_details($uuid);
     $res = json_decode($json, true);
     $paper = new Paper($uuid);
     if (isset($res["authors"])) {
         $paper->authors = $res["authors"];
     }
     if (isset($res["title"])) {
         $paper->title = htmlentities($res["title"]);
     }
     if (isset($res["year"])) {
         $paper->year = htmlentities($res["year"]);
     }
     if (isset($res["publication_outlet"])) {
         $paper->journal = htmlentities($res["publication_outlet"]);
     }
     if (isset($res['mendeley_url']) && is_mendeley_url($res['mendeley_url'])) {
         $paper->mendeley_url = $res['mendeley_url'];
     }
     if (isset($res['identifiers'])) {
         if (isset($res['identifiers']['pmid']) && is_pmid($res['identifiers']['pmid'])) {
             $paper->pmid = $res['identifiers']['pmid'];
         }
     }
     return $paper;
 }
Beispiel #2
0
 function format_html()
 {
     echo '<table class="paper">';
     echo '<tr><td class="authors">' . $this->format_authors(true), '</td></tr>';
     echo '<tr><td class="title">' . (isset($this->title) ? '' . $this->title . '' : 'Unknown title') . '</td></tr>';
     echo '<tr><td class="journal">';
     echo isset($this->journal) ? $this->journal : "";
     echo isset($this->year) ? ' (' . $this->year . ')' : "";
     echo '</td></tr>';
     echo '<tr><td><div class="paper_actions">';
     if (isset($this->mendeley_url) && is_mendeley_url($this->mendeley_url)) {
         echo '<a class="button" href="', $this->mendeley_url, '"><span>View in Mendeley</span></a> ';
     }
     if (isset($this->pmid) && is_pmid($this->pmid)) {
         echo '<a class="button" href="http://www.ncbi.nlm.nih.gov/pubmed/', $this->pmid, '"><span>View in PubMed</span></a> ';
     }
     echo '<a class="button" href="related.php?uuid=', $this->uuid, '"><span>Related</span></a> ';
     echo '<a class="button" href="details.php?uuid=', $this->uuid, '"><span>Add to database</span></a>';
     echo '</div></td></tr>';
     echo '</table>';
 }