function tripal_get_analysis_select_options
2.x tripal_analysis.api.inc | tripal_get_analysis_select_options($syncd_only = TRUE) |
3.x tripal_chado.module.DEPRECATED.api.inc | tripal_get_analysis_select_options($syncd_only = true) |
Returns a list of analyses that are currently synced with Drupal to use in select lists
Parameters
$syncd_only: Whether or not to return all chado analyses or just those sync'd with drupal. Defaults to TRUE (only sync'd analyses)
Return value
An array of analyses sync'd with Drupal where each value is the analysis scientific name and the keys are analysis_id's
Related topics
1 call to tripal_get_analysis_select_options()
- tripal_feature_delete_form in tripal_feature/
includes/ tripal_feature.delete.inc - A form for indicating the features to delete
File
- tripal_analysis/
api/ tripal_analysis.api.inc, line 170 - Provides functions for managing analysis'.
Code
function tripal_get_analysis_select_options($syncd_only = TRUE) {
$analysis_list = array();
$analysis_list[] = 'Select an analysis';
if ($syncd_only) {
// @todo: Re-write to support external chado databases.
$sql = "
SELECT *
FROM [chado_analysis] CA
INNER JOIN {analysis} A ON A.analysis_id = CO.analysis_id
ORDER BY A.name
";
$orgs = chado_query($sql);
// iterate through the analyses and build an array of those that are synced
foreach ($analyses as $analysis) {
$analysis_list[$analysis->analysis_id] = $analysis->name;
}
}
else {
// use this SQL statement for getting the analyses
$csql = "SELECT * FROM {analysis} ORDER BY name";
$analyses = chado_query($csql);
// iterate through the analyses and build an array of those that are synced
foreach ($analyses as $analysis) {
$analysis_list[$analysis->analysis_id] = $analysis->name;
}
}
return $analysis_list;
}