/** * Returns an object representing the summary row * * @param array $fields Associative array mapping columns to SQL queries * * @return mixed An object containing the necessary fields, or NULL * if no summary row is defined */ function get_row_object($fields) { global $DB; $found = false; $result = new stdClass; foreach ($fields as $field) { $effective_field = table_report::get_object_index($field); if (array_key_exists($field, $this->mapping)) { $result->$effective_field = $DB->get_field_sql($this->mapping[$field][0], $this->mapping[$field][1]); $found = true; } else { //empty field value $result->$effective_field = ''; } } if ($found) { return $result; } else { //no columns have summaries return NULL; } }