class quiz_views_handler_field_score_aggregate in Quiz 6.5
Same name and namespace in other branches
- 8.4 includes/views/handlers/quiz_views_handler_field_score_aggregate.inc \quiz_views_handler_field_score_aggregate
- 6.6 includes/views/handlers/quiz_views_handler_field_score_aggregate.inc \quiz_views_handler_field_score_aggregate
- 6.3 includes/views/handlers/quiz_views_handler_field_score_aggregate.inc \quiz_views_handler_field_score_aggregate
- 6.4 includes/views/handlers/quiz_views_handler_field_score_aggregate.inc \quiz_views_handler_field_score_aggregate
- 7.6 includes/views/handlers/quiz_views_handler_field_score_aggregate.inc \quiz_views_handler_field_score_aggregate
- 7 includes/views/handlers/quiz_views_handler_field_score_aggregate.inc \quiz_views_handler_field_score_aggregate
- 7.4 includes/views/handlers/quiz_views_handler_field_score_aggregate.inc \quiz_views_handler_field_score_aggregate
Hierarchy
- class \quiz_views_handler_field_score_aggregate extends \views_handler_field_numeric
Expanded class hierarchy of quiz_views_handler_field_score_aggregate
1 string reference to 'quiz_views_handler_field_score_aggregate'
- quiz_views_data in includes/
views/ quiz.views.inc - Implementation of hook_views_data().
File
- includes/
views/ handlers/ quiz_views_handler_field_score_aggregate.inc, line 8
View source
class quiz_views_handler_field_score_aggregate extends views_handler_field_numeric {
function construct() {
parent::construct();
// This will have to change to be set by options if the methods are ever expanded
$this->group_field = $this->definition['group field'];
}
function option_definition() {
$options = parent::option_definition();
return $options;
}
function query() {
$this
->ensure_my_table();
$this->query
->add_field($this->table_alias, $this->group_field);
$this->field_alias = $this->query
->add_field(NULL, "AVG({$this->table_alias}.{$this->real_field})", $this->table_alias . '__average', array(
'aggregate' => TRUE,
));
$this->query
->add_groupby("{$this->table_alias}.{$this->group_field}");
// nid is OK for average. Others maybe not so much
}
}