function tripal_pub_get_pubs_by_title_type_pyear_series
2.x tripal_pub.DEPRECATED.inc | tripal_pub_get_pubs_by_title_type_pyear_series($title, $type = NULL, $pyear = NULL, $series_name = NULL) |
3.x tripal_pub.DEPRECATED.inc | tripal_pub_get_pubs_by_title_type_pyear_series($title, $type = NULL, $pyear = NULL, $series_name = NULL) |
1.x tripal_pub.api.inc | tripal_pub_get_pubs_by_title_type_pyear_series($title, $type = NULL, $pyear = NULL, $series_name = NULL) |
Returns the list of publications that match a given title, type and year
Parameters
title: The title of the publication to look for
type: Optional. The publication type. The value of this field should come from the Tripal Pub vocabulary. This should be the type name (e.g. cvterm.name)
year: Optional. The year the publication was published.
series_name: Optional. The name of the series (e.g. Journal name)
Return value
Returns an array of all the publications that have the provided cross reference. If no publications match, then an empty array is returned.
Related topics
2 calls to tripal_pub_get_pubs_by_title_type_pyear_series()
- chado_pub_validate in tripal_pub/
includes/ pub_form.inc - tripal_pub_add_publication in tripal_pub/
api/ tripal_pub.api.inc - Adds a new publication to the Chado, along with all properties and database cross-references. If the publication does not already exist in Chado then it is added. If it does exist nothing is done. If the $update parameter is TRUE then theā¦
File
- tripal_pub/
api/ tripal_pub.api.inc, line 536 - The Tripal Pub API
Code
function tripal_pub_get_pubs_by_title_type_pyear_series($title, $type = NULL, $pyear = NULL, $series_name = NULL) {
$return = array();
// build the values array for the query.
$values = array(
'title' => $title,
);
$stmnt_suffix = 'ti';
if ($type) {
$values['type_id'] = array(
'name' => $type,
'cv_id' => array(
'name' => 'tripal_pub'
)
);
$stmnt_suffix .= 'ty';
}
if ($pyear) {
$values['pyear'] = $pyear;
$stmnt_suffix .= 'py';
}
if ($series_name) {
$values['series_name'] = strtolower($series_name);
$stmnt_suffix .= 'se';
}
$options = array(
'statement_name' => 'sel_pub_' . $stmnt_suffix,
'case_insensitive_columns' => array('title', 'series_name'),
);
$results = tripal_core_chado_select('pub', array('pub_id'), $values, $options);
// iterate through any matches and pull out the pub_id
foreach ($results as $index => $pub) {
$return[] = $pub->pub_id;
}
return $return;
}