function get_tripal_pub_admin_form_default_type
1.x tripal_pub.admin.inc | get_tripal_pub_admin_form_default_type(&$form) |
Parameters
$form:
1 call to get_tripal_pub_admin_form_default_type()
- tripal_pub_admin in tripal_pub/
includes/ tripal_pub.admin.inc - Administrative settings form
File
- tripal_pub/
includes/ tripal_pub.admin.inc, line 43
Code
function get_tripal_pub_admin_form_default_type(&$form) {
// get the list of publication types. In the Tripal publication
// ontologies these are all grouped under the term 'Publication Type'
// we want the default to be 'Journal Article'
$sql = "
SELECT CVTS.cvterm_id, CVTS.name
FROM {cvtermpath} CVTP
INNER JOIN {cvterm} CVTS ON CVTP.subject_id = CVTS.cvterm_id
INNER JOIN {cvterm} CVTO ON CVTP.object_id = CVTO.cvterm_id
INNER JOIN {cv} ON CVTO.cv_id = CV.cv_id
WHERE CV.name = 'tripal_pub' and CVTO.name = 'Publication Type' and
NOT CVTS.is_obsolete = 1
ORDER BY CVTS.name ASC
";
$results = chado_query($sql);
$pub_types = array();
while ($pub_type = db_fetch_object($results)) {
$pub_types[$pub_type->cvterm_id] = $pub_type->name;
if (strcmp($pub_type->name, "Journal Article") == 0) {
$d_type_id = $pub_type->cvterm_id;
}
}
// override the default by using the stored variable
$d_type_id = variable_get('tripal_pub_default_type', $d_type_id);
$form['default_type'] = array(
'#type' => 'fieldset',
'#title' => t('Default Publication Type'),
);
$form['default_type']['type_id'] = array(
'#type' => 'select',
'#title' => t('Publication Type'),
'#options' => $pub_types,
'#description' => t('Please set a default publiation type used for manual entry of a new publication. This is useful in the event that someone is manually adding the same
publication repetitively'),
'#default_value' => $d_type_id
);
}