* HUBzero is a registered trademark of Purdue University. * * @package hubzero-cms * @author Shawn Rice <*****@*****.**> * @copyright Copyright 2005-2015 HUBzero Foundation, LLC. * @license http://opensource.org/licenses/MIT MIT */ // No direct access defined('_HZEXEC_') or die; $this->css()->js(); //citation params $label = $this->config->get('citation_label', 'number'); $rollover = $this->config->get('citation_rollover', 'no'); $rollover = $rollover == 'yes' ? 1 : 0; $citationsFormat = new \Components\Citations\Tables\Format($this->database); $template = $citationsFormat->getDefaultFormat() ? $citationsFormat->getDefaultFormat()->format : null; //batch downloads $batch_download = $this->config->get("citation_batch_download", 1); //Include COinS $coins = $this->config->get("citation_coins", 1); //do we want to number li items if ($label == 'none') { $citations_label_class = 'no-label'; } elseif ($label == 'number') { $citations_label_class = 'number-label'; } elseif ($label == 'type') { $citations_label_class = 'type-label'; } elseif ($label == 'both') { $citations_label_class = 'both-label'; } ?>
/** * 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; }