You are here

function spaces_casetracker_project_options in Spaces 5.2

Same name and namespace in other branches
  1. 5 spaces_casetracker/spaces_casetracker.module \spaces_casetracker_project_options()

Build option array of project id's for the current group.

1 call to spaces_casetracker_project_options()
spaces_casetracker_form_alter in spaces_casetracker/spaces_casetracker.module
Implementation of hook_form_alter()

File

spaces_casetracker/spaces_casetracker.module, line 271

Code

function spaces_casetracker_project_options() {
  if ($space = spaces_get_space()) {
    $return = array();
    $results = db_query(db_rewrite_sql("SELECT ct.project_number, n.title FROM {node} n INNER JOIN {casetracker_project} ct ON n.nid = ct.nid INNER JOIN {og_ancestry} og ON n.nid = og.nid WHERE n.type IN (" . str_pad('', count(array_filter(variable_get('casetracker_project_node_types', array(
      'casetracker_basic_project',
    )))) * 5 - 1, "'%s',") . ") AND og.group_nid = %d AND n.status = 1 ORDER BY n.title"), array_merge(array_filter(variable_get('casetracker_project_node_types', array(
      'casetracker_basic_project',
    ))), array(
      $space->sid,
    )));
    while ($row = db_fetch_object($results)) {
      $return[$row->project_number] = $row->project_number . " - " . $row->title;
    }
    return $return;
  }
}