You are here

function filelog_ui_top in File Log 6.2

Menu callback; generic function to display a page of the most frequent filelog entries of a specified type.

1 string reference to 'filelog_ui_top'
filelog_ui_menu in ./filelog_ui.module
Implementation of hook_menu()

File

./filelog_ui.pages.inc, line 88
Log viewer page callbacks for the filelog_ui module.

Code

function filelog_ui_top($type) {
  $header = array(
    array(
      'data' => t('Count'),
      'field' => 'count',
      'sort' => 'desc',
    ),
    array(
      'data' => t('Message'),
      'field' => 'message',
    ),
  );
  $result = pager_query("SELECT COUNT(wid) AS count, message, variables FROM {filelog} WHERE type = '%s' GROUP BY message, variables " . tablesort_sql($header), 30, 0, "SELECT COUNT(DISTINCT(message)) FROM {watchdog} WHERE type = '%s'", $type);
  $rows = array();
  while ($flog = db_fetch_object($result)) {
    $rows[] = array(
      $flog->count,
      truncate_utf8(_filelog_ui_format_message($flog), 56, TRUE, TRUE),
    );
  }
  if (empty($rows)) {
    $rows[] = array(
      array(
        'data' => t('No log messages available.'),
        'colspan' => 2,
      ),
    );
  }
  $output = theme('table', $header, $rows);
  $output .= theme('pager', NULL, 30, 0);
  return $output;
}