pipes_admin

Definition

pipes_admin($pid = NULL)
pipes/pipes.module, line 37

Code

function pipes_admin($pid = NULL) {
  $header = array('pid', 'name', 'url', 'path');
  $rows = array();
  $get_form = 0;
  // run the right query
  if (is_null($pid)) {
    $sql = "SELECT pid, name, url, path FROM {pipes}";
  }
  elseif (is_numeric($pid)) {
    $sql = "SELECT pid, name, url, path FROM {pipes} WHERE pid = %d";
    $get_form = 1;
  } 
    $result = db_query($sql, $pid);
  
    // make a table
  while ($data = db_fetch_object($result)) {
    $edit = $data;
    $rows[] = array($data->pid, l($data->name, 'admin/content/pipes/' . $data->pid), l($data->url, $data->url, array(), NULL, NULL, TRUE), l($data->path, 'pipes/' . $data->path));
  }

  if (count($rows) > 0) {
    $output = theme_table($header, $rows);
  }
  else {
    $output = t('No data found');
  }
  
    // if we're on an edit page, get the form
  if ($get_form) {
    $output .= drupal_get_form('pipes_configure_form', $edit->pid, $edit);
  }
  return $output;
}