funder) . " > " . (($project -> acronym == NULL) ? ((strlen($project -> title) > OpenAireViewClaim3 :: MAX_TITLE) ? (substr($project -> title, 0, OpenAireViewClaim3 :: MAX_TITLE - strlen('...')) . '...') : $project -> title) : $project -> acronym) .
'
' . ProjectHelper :: formatProject($project, $itemId) .'
';
}
// Format a project.
// $project the project to format
// $itemId the item ID to use for internal links
// return a string containing the full HTML for the project or an empty string if any errors occur
public static function formatProject($project, $itemId) {
if (($project == NULL) || (($project -> acronym == NULL) && ($project -> title == NULL)))
return '';
return '' . ProjectHelper :: _formatData($project, $itemId) . '
';
}
public static function formatFunder($funder){
switch ($funder){
case "FP7":
return "Eur. Com.";
break;
case "WT":
return "Wel. Trust";
break;
}
}
public static function _formatData($project, $itemId) {
if ($project == NULL)
return '';
$years = ProjectHelper :: _formatYears($project -> startYear, $project -> endYear);
$organizations = ProjectHelper :: _formatOrganizations($project -> organizations, $itemId);
return (($project -> funder == NULL) && ($organizations == NULL) && ($years == NULL)) ? '' : ('' . $project -> funder . ((($project -> funder == NULL) || ($years == NULL)) ? '' : ' ') . $years . (((($project -> funder == NULL) && ($years == NULL)) || ($organizations == NULL)) ? '' : '
') . (($organizations == NULL) ? '' : (JText :: _('PARTICIPANTS_') . ' ' . $organizations)) . '
');
}
public static function _formatYears($startYear, $endYear) {
return (($startYear == NULL) && ($endYear == NULL)) ? '' : ('(' . $startYear . ((($startYear == NULL) || ($endYear == NULL)) ? '' : ' - ') . $endYear . ')');
}
public static function _formatOrganizations($organizations, $itemId) {
$organizations = ($organizations == NULL) ? NULL : array_filter(array_map(function ($organization) use ($itemId) {return ProjectHelper :: _formatOrganization($organization, $itemId);}, $organizations));
return ($organizations == NULL) ? '' : (implode(', ' , array_slice($organizations, 0, ProjectHelper :: MAX_ORGANIZATIONS)) . ((count($organizations) > ProjectHelper :: MAX_ORGANIZATIONS) ? ',...' : ''));
}
public static function _formatOrganization($organization, $itemId) {
return (($organization == NULL) || (($organization -> shortName == NULL) && ($organization -> name == NULL))) ? '' : ('' . (($organization -> id == NULL) ? '' : ('')) . (($organization -> shortName == NULL) ? $organization -> name : $organization -> shortName) . (($organization -> id == NULL) ? '' : '') . '');
}
}