You are here

views_watchdog.views.inc in Views Watchdog 6

Views callbacks for the "Views watchdog" module.

File

views/views_watchdog.views.inc
View source
<?php

/**
 * @file
 *   Views callbacks for the "Views watchdog" module.
 */

/**
 * Implementation of hook_views_data().
 */
function views_watchdog_views_data() {
  $data = array();
  $data['watchdog']['table'] = array(
    'base' => array(
      'title' => t('Watchdog entry'),
      'help' => t('Watchdog entries are a list of recorded system events.'),
      'field' => 'wid',
      'weight' => 25,
    ),
    'group' => t('Watchdog'),
    'join' => array(
      'users' => array(
        'field' => 'uid',
        'left_field' => 'uid',
      ),
    ),
  );
  $data['watchdog']['wid'] = array(
    'title' => t('Wid'),
    'help' => t('The watchdog ID of the watchdog entry.'),
    'field' => array(
      'handler' => 'views_handler_field_watchdog',
      'click sortable' => TRUE,
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_numeric',
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
  );
  $data['watchdog']['uid'] = array(
    'title' => t('User'),
    'help' => t('The uid of the user who triggered the event.'),
    'relationship' => array(
      'handler' => 'views_handler_relationship',
      'base' => 'users',
      'field' => 'uid',
    ),
  );
  $data['watchdog']['type'] = array(
    'title' => t('Type'),
    'help' => t('Type of log message.'),
    'field' => array(
      'handler' => 'views_handler_field',
      'click sortable' => TRUE,
    ),
    'argument' => array(
      'handler' => 'views_handler_argument_string',
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_watchdog_type',
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
  );
  $data['watchdog']['message'] = array(
    'title' => t('Message'),
    'help' => t('Text of log message.'),
    'field' => array(
      'handler' => 'views_handler_field_watchdog_message',
      'click sortable' => TRUE,
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_string',
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
  );
  $data['watchdog']['severity'] = array(
    'title' => t('Severity'),
    'help' => t('The severity level of the event.'),
    'field' => array(
      'handler' => 'views_handler_field_watchdog_severity',
      'click sortable' => TRUE,
    ),
    'argument' => array(
      'handler' => 'views_handler_argument_numeric',
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_watchdog_severity',
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
  );
  $data['watchdog']['link'] = array(
    'title' => t('Link'),
    'help' => t('Link to view the result of the event.'),
    'field' => array(
      'handler' => 'views_handler_field',
      'click sortable' => TRUE,
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_string',
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
  );
  $data['watchdog']['location'] = array(
    'title' => t('Location'),
    'help' => t('URL of the origin of the event.'),
    'field' => array(
      'handler' => 'views_handler_field_url',
      'click sortable' => TRUE,
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_string',
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
  );
  $data['watchdog']['referer'] = array(
    'title' => t('Referrer'),
    'help' => t('URL of referring page.'),
    'field' => array(
      'handler' => 'views_handler_field_url',
      'click sortable' => TRUE,
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_string',
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
  );
  $data['watchdog']['hostname'] = array(
    'title' => t('Hostname'),
    'help' => t('Hostname of the user who triggered the event.'),
    'field' => array(
      'handler' => 'views_handler_field',
      'click sortable' => TRUE,
    ),
    'argument' => array(
      'handler' => 'views_handler_argument_string',
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_string',
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
  );
  $data['watchdog']['timestamp'] = array(
    'title' => t('Timestamp'),
    'help' => t('Unix timestamp of when event occurred.'),
    'field' => array(
      'handler' => 'views_handler_field_date',
      'click sortable' => TRUE,
    ),
    'argument' => array(
      'handler' => 'views_handler_argument_numeric',
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_date',
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
  );
  return $data;
}

/**
 * Implementation of hook_views_handlers().
 */
function views_watchdog_views_handlers() {
  $handlers = array(
    'info' => array(
      'path' => drupal_get_path('module', 'views_watchdog') . '/views/handlers',
    ),
    'handlers' => array(
      'views_handler_field_watchdog' => array(
        'parent' => 'views_handler_field',
      ),
      'views_handler_field_watchdog_message' => array(
        'parent' => 'views_handler_field_watchdog',
      ),
      'views_handler_field_watchdog_severity' => array(
        'parent' => 'views_handler_field_watchdog',
      ),
      'views_handler_filter_watchdog_type' => array(
        'parent' => 'views_handler_filter_in_operator',
      ),
      'views_handler_filter_watchdog_severity' => array(
        'parent' => 'views_handler_filter_in_operator',
      ),
    ),
  );
  return $handlers;
}

/**
 * Implementation of hook_views_plugins
 */
function views_watchdog_views_plugins() {
  $plugins = array(
    'module' => 'views_watchdog',
    'row' => array(
      'watchdog_rss' => array(
        'title' => t('Watchdog entry'),
        'help' => t('Display the watchdog entry.'),
        'handler' => 'views_plugin_row_watchdog_rss',
        'path' => drupal_get_path('module', 'views_watchdog') . '/views/plugins',
        'theme' => 'views_view_row_rss',
        'theme file' => 'theme.inc',
        'theme path' => drupal_get_path('module', 'views') . '/theme',
        'uses options' => TRUE,
        'type' => 'feed',
        'base' => array(
          'watchdog',
        ),
        'help topic' => 'style-watchdog-rss',
      ),
    ),
    'style' => array(
      'watchdog_table' => array(
        'title' => t('Watchdog table'),
        'help' => t('Displays watchdog entries as highlighted rows in a table.'),
        'handler' => 'views_plugin_style_watchdog_table',
        'path' => drupal_get_path('module', 'views_watchdog') . '/views/plugins',
        'theme' => 'views_view_watchdog_table',
        'theme file' => 'theme.inc',
        'theme path' => drupal_get_path('module', 'views_watchdog') . '/views/theme',
        'uses row plugin' => FALSE,
        'uses fields' => TRUE,
        'uses options' => TRUE,
        'type' => 'normal',
        'parent' => 'table',
        'base' => array(
          'watchdog',
        ),
        'help topic' => 'style-watchdog-table',
      ),
    ),
  );
  return $plugins;
}

Functions

Namesort descending Description
views_watchdog_views_data Implementation of hook_views_data().
views_watchdog_views_handlers Implementation of hook_views_handlers().
views_watchdog_views_plugins Implementation of hook_views_plugins