You are here

function insight_reports_load_by_params in Insight 7

2 calls to insight_reports_load_by_params()
insight_reports_delete_by_params in ./insight.module
insight_report_load_by_params in ./insight.module

File

./insight.module, line 205

Code

function insight_reports_load_by_params($name = NULL, $nid = NULL, $path = NULL) {
  $query = db_select('insight_report', 'r', array(
    'fetch' => PDO::FETCH_ASSOC,
  ))
    ->fields('r');
  if (isset($name)) {
    $query
      ->condition('r.name', $name);
  }
  else {
    $query
      ->orderBy('r.name');
  }
  if (isset($nid)) {
    $query
      ->condition('r.nid', $nid);
  }
  elseif (isset($path)) {
    $query
      ->condition('r.path', $path);
  }
  else {
    return FALSE;
  }
  $reports = $query
    ->execute()
    ->fetchAllAssoc('name', PDO::FETCH_ASSOC);

  // Otherwise the set was not found.
  return $reports;
}