You are here

protected function StatsPro::get_calc_fields in Statistics Pro 6.2

Same name and namespace in other branches
  1. 6 statspro.inc \statspro::get_calc_fields()
1 call to StatsPro::get_calc_fields()
StatsPro::get_stats in ./statspro.inc
Get statistics for output.

File

./statspro.inc, line 92
statspro class for Statistics Pro module.

Class

StatsPro
Manages the data saving and retrieval according to the user defined parameters.

Code

protected function get_calc_fields($whitelist, $blacklist) {
  if (is_array($whitelist) && is_array($blacklist)) {
    die('whitelist and blacklist cannot be used togther.');
  }
  elseif (is_array($whitelist)) {
    $fields = array();
    foreach ($this->fields as $field => $desc) {
      if (in_array($field, $whitelist)) {
        $fields[$field] = $desc;
      }
    }
  }
  elseif (is_array($blacklist)) {
    $fields = array();
    foreach ($this->fields as $field => $desc) {
      if (!in_array($field, $blacklist)) {
        $fields[$field] = $desc;
      }
    }
  }
  else {

    // all fields
    $fields = $this->fields;
  }
  return $fields;
}