title), $publication -> accessMode, $publication -> id, $publication -> source, $publication -> url, $itemId, isset($publication -> inferred)?$publication -> inferred:false, isset($publication -> trust)?$publication -> trust:"", isset($publication -> provenance)?$publication -> provenance:"") . PublicationHelper :: _formatData($publication, $itemId). PublicationHelper :: _formatDescription($publication -> description); return ($publication == NULL) ? '' : ('
' . $publication . '
'); } public static function _formatTitle($title, $accessMode, $id, $source, $url, $itemId, $inferred = false, $trust = "", $provenance = "") { switch ($accessMode) { case PublicationHelper :: OPEN_ACCESS: $accessModeClass = 'openAccess'; $accessModeTitle = JText :: _('OPEN_ACCESS'); break; case PublicationHelper :: EMBARGO_ACCESS: $accessModeClass = 'embargoAccess'; $accessModeTitle = JText :: _('EMBARGO_ACCESS'); break; case PublicationHelper :: RESTRICTED_ACCESS: $accessModeClass = 'restrictedAccess'; $accessModeTitle = JText :: _('RESTRICTED_ACCESS'); break; case PublicationHelper :: CLOSED_ACCESS: $accessModeClass = 'closedAccess'; $accessModeTitle = JText :: _('CLOSED_ACCESS'); break; default: $accessModeClass = NULL; $accessModeTitle = NULL; } //return ($title == NULL) ? '' : ('' . (($source == self :: OPENAIRE) ? (($id == NULL) ? '' : ('')) : (($url == NULL) ? '' : (''))) . $title . (($source == self :: OPENAIRE) ? (($id == NULL) ? '' : ('')) : (($url == NULL) ? '' : (''))) . ($inferred == true?" getTemplate().'/styles/openaire/images/box_info_ok.png' />
" :"") . ''); return ($title == NULL) ? '' : ('' . (($source == self :: OPENAIRE) ? (($id == NULL) ? '' : ('')) : (($url == NULL) ? '' : (''))) . $title . (($source == self :: OPENAIRE) ? (($id == NULL) ? '' : ('')) : (($url == NULL) ? '' : (''))) . ''); } public static function _formatTitleinSpan($title, $accessMode, $id, $source, $url, $itemId, $inferred = false, $trust = "", $provenance = "") { switch ($accessMode) { case PublicationHelper :: OPEN_ACCESS: $accessModeClass = 'openAccess'; $accessModeTitle = JText :: _('OPEN_ACCESS'); break; case PublicationHelper :: EMBARGO_ACCESS: $accessModeClass = 'embargoAccess'; $accessModeTitle = JText :: _('EMBARGO_ACCESS'); break; case PublicationHelper :: RESTRICTED_ACCESS: $accessModeClass = 'restrictedAccess'; $accessModeTitle = JText :: _('RESTRICTED_ACCESS'); break; case PublicationHelper :: CLOSED_ACCESS: $accessModeClass = 'closedAccess'; $accessModeTitle = JText :: _('CLOSED_ACCESS'); break; default: $accessModeClass = NULL; $accessModeTitle = NULL; } return ($title == NULL) ? '' : ('' . (($source == self :: OPENAIRE) ? (($id == NULL) ? '' : ('')) : (($url == NULL) ? '' : (''))) . $title . (($source == self :: OPENAIRE) ? (($id == NULL) ? '' : ('')) : (($url == NULL) ? '' : (''))) . ''); } public static function formatTrustMeter($publication) { if ($publication == NULL) return ''; if ( property_exists($publication,'similarity')){ if ( $publication->similarity!=null){ $similarity=$publication -> similarity*100; return '' .($similarity<10?'0':'').$similarity.'
'.($publication -> similarity*100).'%
'; } } return ''; } public static function _formatData($publication, $itemId) { if ($publication == NULL) return ''; $authors = PublicationHelper :: _formatAuthors($publication -> authors, $itemId); $year = PublicationHelper :: _formatYear($publication -> year); $data = array(); $data[] = $authors . ((($authors == NULL) || ($year == NULL)) ? '' : ' ') . $year; $data[] = PublicationHelper :: _formatProjects($publication -> projects, $itemId); $data[] = PublicationHelper :: _formatEmbargoEndDate($publication -> embargoEndDate); $data = array_filter($data); return ($data == NULL) ? '' : ('
' . implode('
', $data) . '
'); } public static function _formatAuthors($authors, $itemId) { $authors = ($authors == NULL) ? NULL : array_filter(array_map(function ($author) use ($itemId) {return PublicationHelper :: _formatAuthor($author, $itemId);}, $authors)); return ($authors == NULL) ? '' : (implode('; ', array_slice($authors, 0, PublicationHelper :: MAX_AUTHORS)) . ((count($authors) > PublicationHelper :: MAX_AUTHORS) ? ';...' : '')); } public static function _formatAuthor($author, $itemId) { return (($author == NULL) || ((($author -> lastName == NULL) || ($author -> firstName == NULL)) && ($author -> fullName == NULL))) ? '' : ('' . ((($author -> lastName == NULL) || ($author -> firstName == NULL)) ? $author -> fullName : ($author -> lastName . ', ' . $author -> firstName)) .''); } public static function _formatYear($year) { return ($year == NULL) ? '' : ('(' . $year . ')'); } public static function _formatProjects($projects, $itemId) { $projects = ($projects == NULL) ? NULL : array_filter(array_map(function ($project) use ($itemId) {return PublicationHelper :: _formatProject($project, $itemId);}, $projects)); return ($projects == NULL) ? '' : (JText :: _('PROJECTS_') . ' ' . implode(', ', array_slice($projects, 0, PublicationHelper :: MAX_PROJECTS)) . ((count($projects) > PublicationHelper :: MAX_PROJECTS) ? ',...' : '')); } public static function _formatProject($project, $itemId) { if ($project -> title != null && $project -> title != "unidentified" ){ return (($project -> acronym == NULL) && ($project -> title == NULL)) ? '' : ('' . (($project -> id == NULL) ? '' : ('')) .((($project -> funderShortName!==null)? $project -> funderShortName. JText :: _('FUNDER_SEPARATOR'):(($project -> funder !==null)? $project -> funder. JText :: _('FUNDER_SEPARATOR') :''))). (($project -> acronym == NULL) ? $project -> title : $project -> acronym) . (($project -> code == NULL) ? '' : (' (' . $project -> code . ')')) . (($project -> id == NULL) ? '' : '') . ''); }else{ return (($project -> funderShortName!==null)? $project -> funderShortName:'') ; } } public static function _formatEmbargoEndDate($embargoEndDate) { return ($embargoEndDate == NULL) ? '' : (''.JText :: _('EMBARGO_END_DATE_') . ' ' . date(JText :: _('DATE_FORMAT'), $embargoEndDate) . ''); } public static function _formatDescription($description) { $description= ($description == NULL) ? '' : strip_tags($description); mb_internal_encoding('UTF-8'); return ($description == NULL) ? '' : ('
' . ((strlen($description) > PublicationHelper :: MAX_DESCRIPTION) ? (mb_substr($description, 0, PublicationHelper :: MAX_DESCRIPTION - strlen(PublicationHelper :: SUFFIX)) . PublicationHelper :: SUFFIX) : $description) . '
'); } public static function formatCitationLinks($citation) { if(sizeof($citation -> ids)==0){ return '
  • '.$citation -> title.'
  • '; }else{ $citationId=$citation -> ids[0]; if (sizeof($citation -> ids)>1){ usort($citation -> ids, function ($a, $b) {if ($a->confidenceLevel == $b->confidenceLevel) {return 0;}return ($a->confidenceLevel > $b->confidenceLevel) ? -1 : 1;}); $citationId=$citation -> ids[0]; } $link = '
  • '.$citation -> title.'
  • '; if(strcmp($citationId -> type,'openaire')==0){ $link ='
  • '.$citation -> title.'
  • '; }else if(strcmp($citationId -> type,"pmid")==0){ $link ='
  • '.$citation -> title.'
  • '; }else if(strcmp($citationId -> type,"pmcid")==0){ $link ='
  • '.$citation -> title.'
  • '; }else if(strcmp($citationId -> type,"arxiv")==0){ $link ='
  • '.$citation -> title.'
  • '; }else if(strcmp($citationId -> type,"doi")==0){ $link ='
  • '.$citation -> title.'
  • '; } /*pmid 15558770 doi 4821630 other 380750 medline 22244 pii 8982 publisher-id 8382 pmcid 5107 coden 335 rrn 19 art-access-id 2 doaj 1 arxiv*/ //TODO add the rest id types return $link; } } }