You are here

function insight_reports_load_by_page in Insight 7

File

./insight.module, line 231

Code

function insight_reports_load_by_page($nid = NULL, $path = NULL) {
  $query = db_select('insight_report', 'r', array(
    'fetch' => PDO::FETCH_ASSOC,
  ))
    ->fields('r');
  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);
  if (!is_array($reports)) {
    return FALSE;
  }

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