Beispiel #1
0
					<?php 
echo Lang::txt('PLG_MEMBERS_CITATIONS_IMPORT_STEP3');
?>
<span><?php 
echo Lang::txt('PLG_MEMBERS_CITATIONS_IMPORT_STEP3_NAME');
?>
</span>
				</a>
			</li>
		</ul><!-- / #steps -->

		<?php 
if (count($this->citations) > 0) {
    ?>
			<?php 
    $formatter = new \Components\Citations\Helpers\Format();
    $formatter->setTemplate($template);
    $counter = 1;
    ?>

			<h3><?php 
    echo Lang::txt('PLG_MEMBERS_CITATIONS_IMPORT_SUCCESS');
    ?>
</h3>

			<table class="citations">
				<tbody>
					<?php 
    foreach ($this->citations as $cite) {
        ?>
						<tr>
Beispiel #2
0
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 *
 */
// No direct access
defined('_HZEXEC_') or die;
$numaff = 0;
$numnon = 0;
// Did we get any results back?
if ($this->citations) {
    // Get a needed library
    include_once PATH_CORE . DS . 'components' . DS . 'com_citations' . DS . 'helpers' . DS . 'format.php';
    // Set some vars
    $affiliated = '';
    $nonaffiliated = '';
    $formatter = new \Components\Citations\Helpers\Format();
    $formatter->setTemplate($this->format);
    // Loop through the citations and build the HTML
    foreach ($this->citations as $cite) {
        $showLinks = $cite->title && $cite->author && $cite->publisher ? true : false;
        $item = "\t" . '<li>' . "\n";
        $formatted = $cite->formatted ? $cite->formatted : \Components\Citations\Helpers\Format::formatReference($cite, '');
        if ($cite->doi && $cite->url) {
            $formatted = str_replace('doi:' . $cite->doi, '<a href="' . $cite->url . '" rel="external">' . 'doi:' . $cite->doi . '</a>', $formatted);
        }
        $item .= $formatted;
        $item .= "\t\t" . '<p class="details">' . "\n";
        if ($showLinks) {
            $item .= "\t\t\t" . '<a href="' . Route::url('index.php?option=com_citations&task=download&id=' . $cite->id . '&format=bibtex&no_html=1') . '" title="' . Lang::txt('PLG_PUBLICATION_CITATIONS_DOWNLOAD_BIBTEX') . '">BibTex</a> <span>|</span> ' . "\n";
            $item .= "\t\t\t" . '<a href="' . Route::url('index.php?option=com_citations&task=download&id=' . $cite->id . '&format=endnote&no_html=1') . '" title="' . Lang::txt('PLG_PUBLICATION_CITATIONS_DOWNLOAD_ENDNOTE') . '">EndNote</a>' . "\n";
        }
Beispiel #3
0
        echo '<a id="show-more-button" href="javascript:void(0);">show more</a>';
        echo '<span class="show-more-text hide">' . substr($abstract, $max) . '</span>';
    } 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 
Beispiel #4
0
$citationFormat = $this->pub->config('citation_format', 'apa');
?>

<!-- Load content selection browser //-->
<div id="<?php 
echo $elName;
?>
" class="blockelement<?php 
echo $required ? ' el-required' : ' el-optional';
echo $complete ? ' el-complete' : ' el-incomplete';
?>
 freezeblock">
<?php 
if (count($this->pub->_citations) > 0) {
    $i = 1;
    $formatter = new \Components\Citations\Helpers\Format();
    $formatter->setTemplate($citationFormat);
    ?>
	<div class="list-wrapper">
		<ul class="itemlist" id="citations-list">
		<?php 
    foreach ($this->pub->_citations as $cite) {
        $citeText = $cite->formatted ? '<p>' . $cite->formatted . '</p>' : \Components\Citations\Helpers\Format::formatReference($cite, '');
        ?>
			<li>
				<span class="item-title citation-formatted"><?php 
        echo $citeText;
        ?>
</span>
			</li>
	<?php 
Beispiel #5
0
 /**
  * Process a single record
  *
  * @param   integer  $id
  * @return  object
  */
 public function record($id)
 {
     if (strstr($id, ':')) {
         list($id, $revision) = explode(':', $id);
     }
     $id = intval($id);
     if (!isset($revision)) {
         $revision = 0;
     }
     $this->database->setQuery("SELECT r.id, r.id AS identifier, r.title, r.introtext AS description, r.fulltxt, r.created, r.publish_up, r.alias, rt.alias AS type\n\t\t\tFROM `#__resources` AS r\n\t\t\tINNER JOIN `#__resource_types` AS rt ON r.type = rt.id\n\t\t\tWHERE r.id = " . $this->database->quote($id));
     $record = $this->database->loadObject();
     $record->base = $this->name();
     $record->type = $record->base . ':' . $record->type;
     if ($revision) {
         $this->database->setQuery("SELECT *\n\t\t\t\tFROM `#__tool_version`\n\t\t\t\tWHERE toolname=" . $this->database->quote($record->alias) . " AND revision=" . $this->database->quote($revision) . "\n\t\t\t\tLIMIT 1");
         $tool = $this->database->loadObject();
         if ($tool->id) {
             $record->title .= ' [version ' . $tool->version . ']';
             $record->fulltxt = $tool->fulltxt;
             $record->publish_up = $tool->released;
         }
     }
     $record->date = $record->created;
     if ($record->publish_up && $record->publish_up != $this->database->getNullDate()) {
         $record->date = $record->publish_up;
     }
     if (!$record->description) {
         $record->description = $record->fulltxt;
         $record->description = preg_replace("#<nb:(.*?)>(.*?)</nb:(.*?)>#s", '', $record->description);
     }
     $record->description = strip_tags($record->description);
     $record->description = trim($record->description);
     unset($record->publish_up);
     unset($record->created);
     unset($record->fulltxt);
     $isTool = 0;
     if ($record->alias) {
         $this->database->setQuery("SELECT id\n\t\t\t\tFROM `#__tool`\n\t\t\t\tWHERE toolname=" . $this->database->quote($record->alias) . "\n\t\t\t\tLIMIT 1");
         $isTool = $this->database->loadResult();
     }
     if ($revision) {
         /*"SELECT a.`doi`
         		FROM `#__doi_mapping` AS a
         		LEFT JOIN `#__tool_version` AS v ON v.id=a.versionid
         		WHERE a.rid=" . $this->database->quote($id) . " AND v.revision=" . $this->database->quote($revision) . "
         		LIMIT 1"*/
         $this->database->setQuery("SELECT a.`doi`\n\t\t\t\tFROM `#__doi_mapping` AS a\n\t\t\t\tWHERE a.rid=" . $this->database->quote($id) . " AND a.local_revision=" . $this->database->quote($revision) . "\n\t\t\t\tLIMIT 1");
     } else {
         $this->database->setQuery("SELECT a.`doi`\n\t\t\t\tFROM `#__doi_mapping` AS a\n\t\t\t\tWHERE a.rid=" . $this->database->quote($id) . "\n\t\t\t\tORDER BY `versionid` DESC LIMIT 1");
     }
     $record->identifier = $this->identifier($id, $this->database->loadResult(), $revision);
     $this->database->setQuery("SELECT DISTINCT t.raw_tag\n\t\t\tFROM `#__tags` t, `#__tags_object` tos\n\t\t\tWHERE t.id = tos.tagid AND tos.objectid=" . $this->database->quote($id) . " AND tos.tbl='resources' AND t.admin=0\n\t\t\tORDER BY t.raw_tag");
     $record->subject = $this->database->loadColumn();
     $record->relation = array();
     $this->database->setQuery("SELECT r.id, r.title, r.type, r.logical_type AS logicaltype, r.created, r.created_by,\n\t\t\tr.published, r.publish_up, r.path, r.access, t.type AS logicaltitle, rt.type AS typetitle, r.standalone\n\t\t\tFROM `#__resources` AS r\n\t\t\tINNER JOIN `#__resource_types` AS rt ON r.type=rt.id\n\t\t\tINNER JOIN `#__resource_assoc` AS a ON r.id=a.child_id\n\t\t\tLEFT JOIN `#__resource_types` AS t ON r.logical_type=t.id\n\t\t\tWHERE r.published=1 AND a.parent_id=" . $this->database->quote($id) . "\n\t\t\tORDER BY a.ordering, a.grouping");
     if ($children = $this->database->loadObjectList()) {
         require_once PATH_CORE . DS . 'components' . DS . 'com_resources' . DS . 'helpers' . DS . 'html.php';
         require_once PATH_CORE . DS . 'components' . DS . 'com_resources' . DS . 'tables' . DS . 'type.php';
         foreach ($children as $child) {
             $uri = \Components\Resources\Helpers\Html::processPath('com_resources', $child, $id, 3);
             if (substr($uri, 0, 4) != 'http') {
                 $uri = self::$base . '/' . ltrim($uri, '/');
             }
             $record->relation[] = array('type' => 'hasPart', 'value' => $uri);
         }
     }
     $this->database->setQuery("SELECT DISTINCT r.id\n\t\t\tFROM `#__resources` AS r\n\t\t\tINNER JOIN `#__resource_assoc` AS a ON r.id=a.parent_id\n\t\t\tWHERE r.published=1 AND a.child_id=" . $this->database->quote($id) . "\n\t\t\tORDER BY a.ordering, a.grouping");
     if ($parents = $this->database->loadObjectList()) {
         foreach ($parents as $parent) {
             $record->relation[] = array('type' => 'isPartOf', 'value' => $this->identifier($parent->id, 0));
         }
     }
     if ($isTool) {
         if ($revision) {
             $this->database->setQuery("SELECT n.uidNumber AS id,\n\t\t\t\t\t\tCASE WHEN t.name!='' AND t.name IS NOT NULL THEN t.name\n\t\t\t\t\t\tELSE n.name\n\t\t\t\t\t\tEND AS `name`\n\t\t\t\t\tFROM `#__tool_authors` AS t, `#__xprofiles` AS n, `#__tool_version` AS v\n\t\t\t\t\tWHERE n.uidNumber=t.uid AND t.toolname=" . $this->database->quote($record->alias) . " AND v.id=t.version_id and v.state<>3\n\t\t\t\t\tAND t.revision=" . $this->database->quote($revision) . "\n\t\t\t\t\tORDER BY t.ordering");
             $record->creator = $this->database->loadColumn();
             /*$record->relation[] = array(
             			'type'  => 'isVersionOf',
             			'value' => $this->identifier($id, '', 0)
             		);*/
         }
         $this->database->setQuery("SELECT v.id, v.revision, d.*\n\t\t\t\tFROM `#__tool_version` as v\n\t\t\t\tLEFT JOIN `#__doi_mapping` as d\n\t\t\t\tON d.alias = v.toolname\n\t\t\t\tAND d.local_revision=v.revision\n\t\t\t\tWHERE v.toolname = " . $this->database->quote($record->alias) . "\n\t\t\t\tORDER BY v.state DESC, v.revision DESC");
         $versions = $this->database->loadObjectList();
         foreach ($versions as $i => $v) {
             if (!$v->revision || $v->revision == $revision) {
                 continue;
             }
             $record->relation[] = array('type' => 'hasVersion', 'value' => $this->identifier($id, $v->doi, $v->revision));
         }
     }
     if (!isset($record->creator)) {
         $this->database->setQuery("SELECT \n\t\t\t\t\tCASE WHEN a.name!='' AND a.name IS NOT NULL THEN a.name\n\t\t\t\t\tELSE n.name\n\t\t\t\t\tEND AS `name`\n\t\t\t\tFROM `#__author_assoc` AS a\n\t\t\t\tLEFT JOIN `#__xprofiles` AS n ON n.uidNumber=a.authorid\n\t\t\t\tWHERE a.subtable='resources' AND a.subid=" . $this->database->quote($id) . " AND a.role!='submitter'\n\t\t\t\tORDER BY a.ordering, a.name");
         $record->creator = $this->database->loadColumn();
     }
     $this->database->setQuery("SELECT *\n\t\t\tFROM `#__citations` AS a\n\t\t\tINNER JOIN `#__citations_assoc` AS n ON n.`cid`=a.`id`\n\t\t\tWHERE n.`tbl`='resource' AND n.`oid`=" . $this->database->quote($id) . " AND a.`published`=1\n\t\t\tORDER BY `year` DESC");
     $references = $this->database->loadObjectList();
     if (count($references) && file_exists(PATH_CORE . DS . 'components' . DS . 'com_citations' . DS . 'helpers' . DS . 'format.php')) {
         include_once PATH_CORE . DS . 'components' . DS . 'com_citations' . DS . 'helpers' . DS . 'format.php';
         $formatter = new \Components\Citations\Helpers\Format();
         $formatter->setTemplate('apa');
         foreach ($references as $reference) {
             //<dcterms:isReferencedBy>uytruytry</dcterms:isReferencedBy>
             //<dcterms:isVersionOf>jgkhfjf</dcterms:isVersionOf>
             $cite = strip_tags(html_entity_decode($reference->formatted ? $reference->formatted : \Components\Citations\Helpers\Format::formatReference($reference, '')));
             $cite = str_replace('&quot;', '"', $cite);
             $record->relation[] = array('type' => 'references', 'value' => trim($cite));
         }
     }
     return $record;
 }
Beispiel #6
0
 /**
  * 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;
 }
Beispiel #7
0
 * HUBzero is a registered trademark of Purdue University.
 *
 * @package   hubzero-cms
 * @copyright Copyright 2005-2015 HUBzero Foundation, LLC.
 * @license   http://opensource.org/licenses/MIT MIT
 */
// No direct access
defined('_HZEXEC_') or die;
//add title and save button to toolbar
Toolbar::title(Lang::txt('CITATIONS') . ': ' . Lang::txt('CITATION_FORMAT'), 'citation.png');
Toolbar::save();
Toolbar::spacer();
Toolbar::help('format');
// include citations format class
// new citations format object
$cf = new \Components\Citations\Helpers\Format();
?>

<script type="text/javascript">
var $jQ = jQuery.noConflict();

function submitbutton(pressbutton)
{
	var form = $jQ('adminForm');
	if (pressbutton == 'cancel') {
		submitform(pressbutton);
		return;
	}
	// do field validation
	submitform(pressbutton);
}
Beispiel #8
0
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 *
 * HUBzero is a registered trademark of Purdue University.
 *
 * @package   hubzero-cms
 * @author	Shawn Rice <*****@*****.**>, Kevin Wojkovich <*****@*****.**>
 * @copyright Copyright 2005-2015 HUBzero Foundation, LLC.
 * @license   http://opensource.org/licenses/MIT MIT
 */
// No direct access
defined('_HZEXEC_') or die;
if (count($this->citations) > 0) {
    $this->css('citations.css')->js();
    $formatter = new \Components\Citations\Helpers\Format();
    $formatter->setTemplate($this->citationTemplate);
    $base = 'index.php?option=com_groups&cn=' . $this->group->get('cn') . '&active=citations';
    ?>
	<div class="frm" id="browsebox">
		<table class="citations entries">
			<thead>
				<tr>
					<th class="batch">
						<input type="checkbox" class="checkall-download" />
					</th>
					<th colspan="5"><?php 
    echo Lang::txt('PLG_GROUPS_CITATIONS');
    ?>
</th>
				</tr>
Beispiel #9
0
 /**
  * Process a single record
  *
  * @param   integer  $id
  * @return  object
  */
 public function record($id)
 {
     if (strstr($id, ':')) {
         list($id, $revision) = explode(':', $id);
     }
     $id = intval($id);
     if (!isset($revision)) {
         $revision = 0;
     }
     $this->database->setQuery("SELECT pv.*, pv.doi AS identifier, rt.alias AS type\n\t\t\tFROM `#__publication_versions` AS pv\n\t\t\tINNER JOIN `#__publications` AS p ON p.id = pv.publication_id\n\t\t\tINNER JOIN `#__publication_categories` AS rt ON rt.id = p.category\n\t\t\tWHERE p.id = " . $this->database->quote($id) . ($revision ? " AND pv.version_number=" . $this->database->quote($revision) : ""));
     $record = $this->database->loadObject();
     $record->version_id = $record->id;
     $record->id = $id;
     $record->base = $this->name();
     $record->type = $record->base . ':' . $record->type;
     $record->title .= ' [version ' . $record->version_label . ']';
     $record->description = strip_tags($record->description);
     $record->description = trim($record->description);
     $record->identifier = $this->identifier($id, $record->identifier, $revision);
     $this->database->setQuery("SELECT pv.created, pv.submitted, pv.published_up, pv.accepted\n\t\t\tFROM `#__publication_versions` AS pv\n\t\t\tWHERE pv.id = " . $this->database->quote($record->version_id) . "\n\t\t\tORDER BY pv.submitted DESC LIMIT 1");
     $dates = $this->database->loadObject();
     $record->date = $dates->created;
     if ($dates->submitted && $dates->submitted != '0000-00-00 00:00:00') {
         $record->date = $dates->submitted;
     }
     if ($dates->accepted && $dates->accepted != '0000-00-00 00:00:00') {
         $record->date = $dates->accepted;
     }
     if ($dates->published_up && $dates->published_up != '0000-00-00 00:00:00' && $dates->published_up > $record->date) {
         $record->date = $dates->published_up;
     }
     $this->database->setQuery("SELECT pa.name\n\t\t\tFROM `#__publication_authors` AS pa\n\t\t\tWHERE pa.role != 'submitter' AND pa.publication_version_id=" . $this->database->quote($record->version_id) . "\n\t\t\tORDER BY pa.name");
     $record->creator = $this->database->loadColumn();
     $this->database->setQuery("SELECT DISTINCT t.raw_tag\n\t\t\tFROM `#__tags` t, `#__tags_object` tos\n\t\t\tWHERE t.id = tos.tagid AND tos.objectid=" . $this->database->quote($id) . " AND tos.tbl='publications' AND t.admin=0\n\t\t\tORDER BY t.raw_tag");
     $record->subject = $this->database->loadColumn();
     // Relations
     $record->relation = array();
     $this->database->setQuery("SELECT v.id, v.publication_id, v.version_number, v.doi\n\t\t\tFROM `#__publication_versions` as v\n\t\t\tWHERE v.state=1 AND v.publication_id = " . $this->database->quote($record->id) . "\n\t\t\tORDER BY v.version_number DESC");
     $versions = $this->database->loadObjectList();
     foreach ($versions as $i => $v) {
         if (!$v->version_number || $v->version_number == $revision) {
             continue;
         }
         $record->relation[] = array('type' => 'hasVersion', 'value' => $this->identifier($id, $v->doi, $v->version_number));
     }
     $this->database->setQuery("SELECT *\n\t\t\tFROM `#__citations` AS a\n\t\t\tLEFT JOIN `#__citations_assoc` AS n ON n.`cid`=a.`id`\n\t\t\tWHERE n.`tbl`='publication' AND n.`oid`=" . $this->database->quote($id) . " AND n.`type`='owner' AND a.`published`=1\n\t\t\tORDER BY `year` DESC");
     $references = $this->database->loadObjectList();
     if (count($references) && file_exists(PATH_CORE . DS . 'components' . DS . 'com_citations' . DS . 'helpers' . DS . 'format.php')) {
         include_once PATH_CORE . DS . 'components' . DS . 'com_citations' . DS . 'helpers' . DS . 'format.php';
         $formatter = new \Components\Citations\Helpers\Format();
         $formatter->setTemplate('apa');
         foreach ($references as $reference) {
             $cite = strip_tags(html_entity_decode($reference->formatted ? $reference->formatted : \Components\Citations\Helpers\Format::formatReference($reference, '')));
             $cite = str_replace('&quot;', '"', $cite);
             $record->relation[] = array('type' => 'isReferencedBy', 'value' => trim($cite));
         }
     }
     $this->database->setQuery("SELECT *\n\t\t\tFROM `#__citations` AS a\n\t\t\tLEFT JOIN `#__citations_assoc` AS n ON n.`cid`=a.`id`\n\t\t\tWHERE n.`tbl`='publication' AND n.`oid`=" . $this->database->quote($id) . " AND n.`type`!='owner' AND a.`published`=1\n\t\t\tORDER BY `year` DESC");
     $references = $this->database->loadObjectList();
     if (count($references) && file_exists(PATH_CORE . DS . 'components' . DS . 'com_citations' . DS . 'helpers' . DS . 'format.php')) {
         include_once PATH_CORE . DS . 'components' . DS . 'com_citations' . DS . 'helpers' . DS . 'format.php';
         $formatter = new \Components\Citations\Helpers\Format();
         $formatter->setTemplate('apa');
         foreach ($references as $reference) {
             $cite = strip_tags(html_entity_decode($reference->formatted ? $reference->formatted : \Components\Citations\Helpers\Format::formatReference($reference, '')));
             $cite = str_replace('&quot;', '"', $cite);
             $record->relation[] = array('type' => 'references', 'value' => trim($cite));
         }
     }
     return $record;
 }
Beispiel #10
0
 /**
  * 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;
 }
Beispiel #11
0
 /**
  * Process a single record
  *
  * @param   integer  $id
  * @return  object
  */
 public function record($id)
 {
     if (strstr($id, ':')) {
         list($id, $revision) = explode(':', $id);
     }
     $id = intval($id);
     if (!isset($revision)) {
         $revision = 0;
     }
     $this->database->setQuery("SELECT pv.*, pv.doi AS identifier, rt.alias AS type, pv.publication_id\n\t\t\tFROM `#__publication_versions` AS pv\n\t\t\tINNER JOIN `#__publications` AS p ON p.id = pv.publication_id\n\t\t\tINNER JOIN `#__publication_categories` AS rt ON rt.id = p.category\n\t\t\tWHERE pv.id = " . $this->database->quote($id));
     $record = $this->database->loadObject();
     $record->version_id = $record->id;
     $id = $record->publication_id;
     $record->id = $id;
     if (!$record->identifier) {
         $record->identifier = self::$base . '/' . ltrim(\Route::url('index.php?option=com_publications&id=' . $id . ($record->version_id ? '&v=' . $record->version_id : '')), '/');
     }
     $record->base = $this->name();
     $record->type = $record->base . ':' . $record->type;
     $record->description = strip_tags($record->description);
     $record->description = trim($record->description);
     $this->database->setQuery("SELECT pv.submitted\n\t\t\tFROM `#__publication_versions` pv, `#__publications` p\n\t\t\tWHERE p.id = pv.publication_id AND p.id = " . $this->database->quote($id) . "\n\t\t\tORDER BY pv.submitted DESC LIMIT 1");
     $record->date = $this->database->loadResult();
     $this->database->setQuery("SELECT pa.name\n\t\t\tFROM `#__publication_authors` pa, `#__publication_versions` pv, `#__publications` p\n\t\t\tWHERE pa.publication_version_id = pv.id AND pa.role != 'submitter' AND pv.publication_id = p.id AND p.id=" . $this->database->quote($id) . "\n\t\t\tORDER BY pa.name");
     $record->creator = $this->database->loadColumn();
     $this->database->setQuery("SELECT DISTINCT t.raw_tag\n\t\t\tFROM `#__tags` t, `#__tags_object` tos\n\t\t\tWHERE t.id = tos.tagid AND tos.objectid=" . $this->database->quote($id) . " AND tos.tbl='publications' AND t.admin=0\n\t\t\tORDER BY t.raw_tag");
     $record->subject = $this->database->loadColumn();
     // Relations
     $record->relation = array();
     $this->database->setQuery("SELECT *\n\t\t\tFROM `#__citations` AS a\n\t\t\tLEFT JOIN `#__citations_assoc` AS n ON n.`cid`=a.`id`\n\t\t\tWHERE n.`tbl`='publication' AND n.`oid`=" . $this->database->quote($id) . " AND n.`type`='owner' AND a.`published`=1\n\t\t\tORDER BY `year` DESC");
     $references = $this->database->loadObjectList();
     if (count($references) && file_exists(PATH_CORE . DS . 'components' . DS . 'com_citations' . DS . 'helpers' . DS . 'format.php')) {
         include_once PATH_CORE . DS . 'components' . DS . 'com_citations' . DS . 'helpers' . DS . 'format.php';
         $formatter = new \Components\Citations\Helpers\Format();
         $formatter->setTemplate('apa');
         foreach ($references as $reference) {
             $cite = strip_tags(html_entity_decode($reference->formatted ? $reference->formatted : \Components\Citations\Helpers\Format::formatReference($reference, '')));
             $cite = str_replace('&quot;', '"', $cite);
             $record->relation[] = array('type' => 'isReferencedBy', 'value' => trim($cite));
         }
     }
     $this->database->setQuery("SELECT *\n\t\t\tFROM `#__citations` AS a\n\t\t\tLEFT JOIN `#__citations_assoc` AS n ON n.`cid`=a.`id`\n\t\t\tWHERE n.`tbl`='publication' AND n.`oid`=" . $this->database->quote($id) . " AND n.`type`!='owner' AND a.`published`=1\n\t\t\tORDER BY `year` DESC");
     $references = $this->database->loadObjectList();
     if (count($references) && file_exists(PATH_CORE . DS . 'components' . DS . 'com_citations' . DS . 'helpers' . DS . 'format.php')) {
         include_once PATH_CORE . DS . 'components' . DS . 'com_citations' . DS . 'helpers' . DS . 'format.php';
         $formatter = new \Components\Citations\Helpers\Format();
         $formatter->setTemplate('apa');
         foreach ($references as $reference) {
             $cite = strip_tags(html_entity_decode($reference->formatted ? $reference->formatted : \Components\Citations\Helpers\Format::formatReference($reference, '')));
             $cite = str_replace('&quot;', '"', $cite);
             $record->relation[] = array('type' => 'references', 'value' => trim($cite));
         }
     }
     return $record;
 }