You are here

function monitoring_preprocess_views_view_table in Monitoring 7

Same name and namespace in other branches
  1. 8 monitoring.module \monitoring_preprocess_views_view_table()

Implements hook_preprocess_HOOK().

Display a view as a table style.

File

./monitoring.module, line 178
Monitoring bootstrap file.

Code

function monitoring_preprocess_views_view_table(&$vars) {

  // We want to alter only the monitoring sensor results view.
  if ($vars['view']->name != 'monitoring_sensor_results') {
    return;
  }
  $vars['classes_array'][] = 'monitoring-severity-colors';
  foreach ($vars['rows'] as $num => $row) {
    if (isset($vars['result'][$num]->monitoring_sensor_result_sensor_status)) {
      $vars['row_classes'][$num][] = 'monitoring-' . strtolower($vars['result'][$num]->monitoring_sensor_result_sensor_status);
    }
  }
  drupal_add_css(drupal_get_path('module', 'monitoring') . '/monitoring.css');
}