title, $dataset -> accessMode, $dataset -> id, $dataset -> source, $dataset -> url, $itemId, isset($dataset -> inferred)?$dataset -> inferred:false, isset($dataset -> inferred)?$dataset -> trust:"", isset($dataset -> inferred)?$dataset -> provenance:"") . DatasetHelper :: _formatData($dataset, $itemId) . DatasetHelper :: _formatDescription($dataset -> description);
return ($dataset == NULL) ? '' : ('
' . $dataset . '
');
}
public static function _formatTitle($title, $accessMode, $id, $source, $url, $itemId, $inferred = false, $trust = "", $provenance = "") {
switch ($accessMode) {
case DatasetHelper :: OPEN_ACCESS:
$accessModeClass = 'openAccess';
$accessModeTitle = JText :: _('OPEN_ACCESS');
break;
case DatasetHelper :: EMBARGO_ACCESS:
$accessModeClass = 'embargoAccess';
$accessModeTitle = JText :: _('EMBARGO_ACCESS');
break;
case DatasetHelper :: RESTRICTED_ACCESS:
$accessModeClass = 'restrictedAccess';
$accessModeTitle = JText :: _('RESTRICTED_ACCESS');
break;
case DatasetHelper :: CLOSED_ACCESS:
$accessModeClass = 'closedAccess';
$accessModeTitle = JText :: _('CLOSED_ACCESS');
break;
default:
$accessModeClass = NULL;
$accessModeTitle = NULL;
}
//return ($title == NULL) ? '' : ('');
return ($title == NULL) ? '' : ('');
}
public static function _formatData($dataset, $itemId) {
if ($dataset == NULL)
return '';
$info = array();
$info[] = DatasetHelper :: _formatAuthors($dataset -> authors, $itemId);
$info[] = DatasetHelper :: _formatYear($dataset -> year);
$data = array();
$data[] = implode(' ', array_filter($info));
$data[] = DatasetHelper :: _formatPublisher(isset($dataset -> publisher)?$dataset -> publisher:"");
$data[] = DatasetHelper :: _formatProjects($dataset -> projects, $itemId);
$data[] = DatasetHelper :: _formatEmbargoEndDate($dataset -> 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 DatasetHelper :: _formatAuthor($author, $itemId);}, $authors));
return ($authors == NULL) ? '' : (implode('; ', array_slice($authors, 0, DatasetHelper :: MAX_AUTHORS)) . ((count($authors) > DatasetHelper :: MAX_AUTHORS) ? ';...' : ''));
}
public static function _formatAuthor($author, $itemId) {
return (($author == NULL) || ((($author -> lastName == NULL) || ($author -> firstName == NULL)) && ($author -> fullName == NULL))) ? '' : ('' . (($author -> id == NULL) ? '' : ('')) . ((($author -> lastName == NULL) || ($author -> firstName == NULL)) ? $author -> fullName : ($author -> lastName . ', ' . $author -> firstName)) . (($author -> id == NULL) ? '' : '') . '');
}
public static function _formatYear($year) {
return ($year == NULL) ? '' : ('(' . $year . ')');
}
public static function _formatPublisher($publisher) {
return ($publisher == NULL) ? '' : (JText :: _('PUBLISHER_') . ' ' . $publisher);
}
public static function _formatProjects($projects, $itemId) {
$projects = ($projects == NULL) ? NULL : array_filter(array_map(function ($project) use ($itemId) {return DatasetHelper :: _formatProject($project, $itemId);}, $projects));
return ($projects == NULL) ? '' : (JText :: _('PROJECTS_') . ' ' . implode(', ', array_slice($projects, 0, DatasetHelper :: MAX_PROJECTS)) . ((count($projects) > DatasetHelper :: MAX_PROJECTS) ? ',...' : ''));
}
public static function _formatProject($project, $itemId) {
return (($project -> acronym == NULL) && ($project -> title == NULL)) ? '' : ('' . (($project -> id == NULL) ? '' : ('')) . (($project -> acronym == NULL) ? $project -> title : $project -> acronym) . (($project -> code == NULL) ? '' : (' (' . $project -> code . ')')) . (($project -> id == NULL) ? '' : '') . '');
}
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);
return ($description == NULL) ? '' : ('' . ((strlen($description) > DatasetHelper :: MAX_DESCRIPTION) ? (substr($description, 0, DatasetHelper :: MAX_DESCRIPTION - strlen(DatasetHelper :: SUFFIX)) . DatasetHelper :: SUFFIX) : $description) . '
');
}
}