function chado_get_analysis_select_options

3.x tripal_chado.analysis.api.inc chado_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 chado_get_analysis_select_options()
tripal_get_analysis_select_options in tripal_chado/api/modules/tripal_chado.module.DEPRECATED.api.inc
Returns a list of analyses that are currently synced with Drupal to use in select lists.

File

tripal_chado/api/modules/tripal_chado.analysis.api.inc, line 145
Provides API functions specificially for managing analysis records in Chado.

Code

function chado_get_analysis_select_options($syncd_only = TRUE) {
  $analysis_list = array();
  $analysis_list[] = 'Select an analysis';

  if ($syncd_only) {
    $sql = "
      SELECT *
      FROM [chado_analysis] CA
        INNER JOIN {analysis} A ON A.analysis_id = CO.analysis_id
      ORDER BY A.name
    ";
    $analyses = 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;
}