case 'type': echo "<span class=\"type\">{$type}</span>"; break; case 'both': echo "<span class=\"number\">{$counter}.</span>"; echo "<span class=\"type\">{$type}</span>"; break; } ?> </td> <?php } ?> <td class="citation-container"> <?php echo $formatter->formatCitation($cite, $this->filters['search'], false, $this->config); ?> <?php if ($rollover == 'yes' && $cite->abstract != '') { ?> <div class="citation-notes"> <p><?php echo nl2br($cite->abstract); ?> </p> </div> <?php } ?>
case "type": echo "<span class=\"type\">{$type}</span>"; break; case "both": echo "<span class=\"number\">{$counter}.</span>"; echo "<span class=\"type\">{$type}</span>"; break; } ?> </td> <?php } ?> <td class="citation-container"> <?php $formatted = $cite->formatted ? $cite->formatted : $formatter->formatCitation($cite, $this->filters['search'], $coins, $this->config); if ($cite->doi) { $formatted = str_replace('doi:' . $cite->doi, '<a href="' . $cite->url . '" rel="external">' . 'doi:' . $cite->doi . '</a>', $formatted); } echo $formatted; ?> <?php //get this citations rollover param $params = new \Hubzero\Config\Registry($cite->params); $citation_rollover = $params->get('rollover', $rollover); ?> <?php if ($citation_rollover && $cite->abstract != "") { ?> <div class="citation-notes"> <?php
/** * Generate a citation for a publication * * @param object $cite Citation data * @param object $pub Publication model * @param string $citations Citations to prepend * @return string HTML */ public static function citation($cite, $pub, $citations) { include_once PATH_CORE . DS . 'components' . DS . 'com_citations' . DS . 'helpers' . DS . 'format.php'; include_once PATH_CORE . DS . 'components' . DS . 'com_citations' . DS . 'tables' . DS . 'type.php'; $cconfig = Component::params('com_citations'); $template = "{AUTHORS} ({YEAR}). <b>{TITLE/CHAPTER}</b>. <i>{JOURNAL}</i>, <i>{BOOK TITLE}</i>, {EDITION}, {CHAPTER}, {SERIES}, {ADDRESS}, <b>{VOLUME}</b>, <b>{ISSUE/NUMBER}</b> {PAGES}, {ORGANIZATION}, {INSTITUTION}, {SCHOOL}, {LOCATION}, {MONTH}, {ISBN/ISSN}. {VERSION}. {PUBLISHER}. doi:{DOI}"; $formatter = new \Components\Citations\Helpers\Format(); $formatter->setTemplate($template); $html = '<p>' . Lang::txt('COM_PUBLICATIONS_CITATION_INSTRUCTIONS') . '</p>' . "\n"; $html .= $citations; if ($cite) { $html .= '<ul class="citations results">' . "\n"; $html .= "\t" . '<li>' . "\n"; $formatted = $formatter->formatCitation($cite, false, true, $cconfig); $formatted = str_replace('"', '', $formatted); if ($cite->doi && $cite->url) { $formatted = str_replace('doi:' . $cite->doi, '<a href="' . $cite->url . '" rel="external">' . 'doi:' . $cite->doi . '</a>', $formatted); } else { $formatted = str_replace('doi:', '', $formatted); } $html .= $formatted; if (!$pub->isDev()) { $html .= "\t\t" . '<p class="details">' . "\n"; $html .= "\t\t\t" . '<a href="' . Route::url($pub->link('citation') . '&task=citation&type=bibtex&no_html=1') . '" title="' . Lang::txt('COM_PUBLICATIONS_DOWNLOAD_BIBTEX_FORMAT') . '">BibTex</a> <span>|</span> ' . "\n"; $html .= "\t\t\t" . '<a href="' . Route::url($pub->link('citation') . '&task=citation&type=endnote&no_html=1') . '" title="' . Lang::txt('COM_PUBLICATIONS_DOWNLOAD_ENDNOTE_FORMAT') . '">EndNote</a>' . "\n"; $html .= "\t\t" . '</p>' . "\n"; } $html .= "\t" . '</li>' . "\n"; $html .= '</ul>' . "\n"; } return $html; }
} else { echo $abstract; } ?> </div> <?php } ?> <div class="citation-citation"> <?php $citationsFormat = new \Components\Citations\Tables\Format($this->database); $template = $citationsFormat->getDefaultFormat() ? $citationsFormat->getDefaultFormat()->format : null; $cf = new \Components\Citations\Helpers\Format(); $cf->setTemplate($template); echo strip_tags($cf->formatCitation($citation, null, false, $config)); ?> <div class="download"> <a class="" href="<?php echo Route::url('index.php?option=com_citations&task=download&citationFormat=bibtex&id=' . $citation->id . '&no_html=1'); ?> " title="Download in BibTex Format"><?php echo Lang::txt('COM_CITATIONS_DOWNLOAD_BIBTEX'); ?> </a> | <a class="" href="<?php echo Route::url('index.php?option=com_citations&task=download&citationFormat=endnote&id=' . $citation->id . '&no_html=1'); ?> " title="Download in Endnote Format"><?php echo Lang::txt('COM_CITATIONS_DOWNLOAD_ENDNOTE'); ?>
/** * Static method for formatting results * * @param object $row Database row * @return string HTML */ public static function out($row) { $row->author = isset($row->alias) ? $row->alias : ''; $row->booktitle = isset($row->itext) ? $row->itext : ''; $row->doi = isset($row->ftext) ? $row->ftext : ''; $row->published = isset($row->state) ? $row->state : ''; $row->year = isset($row->created_by) ? $row->created_by : ''; $row->month = isset($row->modified) ? $row->modified : ''; $row->isbn = isset($row->publish_up) ? $row->publish_up : ''; $row->journal = isset($row->publish_down) ? $row->publish_down : ''; $row->url = isset($row->href) ? $row->href : ''; $row->volume = isset($row->params) ? $row->params : ''; $row->number = isset($row->rcount) ? $row->rcount : ''; $row->type = isset($row->data1) ? $row->data1 : ''; $row->pages = isset($row->data2) ? $row->data2 : ''; $row->publisher = isset($row->data3) ? $row->data3 : ''; require_once PATH_CORE . DS . 'components' . DS . 'com_citations' . DS . 'tables' . DS . 'type.php'; require_once PATH_CORE . DS . 'components' . DS . 'com_citations' . DS . 'tables' . DS . 'association.php'; require_once PATH_CORE . DS . 'components' . DS . 'com_citations' . DS . 'tables' . DS . 'format.php'; require_once PATH_CORE . DS . 'components' . DS . 'com_citations' . DS . 'helpers' . DS . 'format.php'; $config = \Component::params('com_citations'); switch ($config->get("citation_label", "number")) { case 'none': $citations_label_class = 'no-label'; break; case 'number': $citations_label_class = 'number-label'; break; case 'type': $citations_label_class = 'type-label'; break; case 'both': $citations_label_class = 'both-label'; break; } $database = \App::get('db'); $citationsFormat = new \Components\Citations\Tables\Format($database); $template = $citationsFormat->getDefaultFormat() ? $citationsFormat->getDefaultFormat()->format : null; $formatter = new \Components\Citations\Helpers\Format(); $formatter->setTemplate($template); // Start building the HTML $html = "\t" . '<li class="citation-entry">' . "\n"; $html .= "\t\t" . '<p class="title">'; //are we trying wanting to direct to single citaiton view $citationSingleView = $config->get('citation_single_view', 1); if ($citationSingleView) { $html .= '<a href="' . \Route::url('index.php?option=com_citations&task=view&id=' . $row->id) . '">'; } else { $html .= '<a href="' . \Route::url('index.php?option=com_citations&task=browse&type=' . $row->type . '&year=' . $row->year . '&search=' . \Hubzero\Utility\String::truncate(\Hubzero\Utility\Sanitize::stripAll(stripslashes($row->title)), 50)) . '">'; } $html .= \Hubzero\Utility\String::truncate(\Hubzero\Utility\Sanitize::stripAll(stripslashes($row->title)), 200); $html .= '</a></p>' . "\n"; $html .= '<p class="details ' . $citations_label_class . '">' . \Lang::txt('PLG_TAGS_CITATION'); if ($config->get('citation_label', 'number') != 'none') { $types = self::getTypes(); $type = ''; foreach ($types as $t) { if ($t['id'] == $row->type) { $type = $t['type_title']; } } $type = $type != '' ? $type : 'Generic'; $html .= ' <span>|</span> ' . $type; } $html .= '</p>'; require_once PATH_CORE . DS . 'components' . DS . 'com_citations' . DS . 'tables' . DS . 'citation.php'; $db = \App::get('db'); $cc = new \Components\Citations\Tables\Citation($db); $cc->load($row->id); $html .= '<p>' . $formatter->formatCitation($cc, null, $config->get("citation_coins", 1), $config) . '</p>'; $html .= "\t" . '</li>' . "\n"; // Return output return $html; }