All pastes #605219 Raw Edit

Bdragon

public php v1 · immutable
·published 2007-07-06 01:07 UTC
rendered paste body
function chicagoancestors_views_query_alter(&$query, &$view, &$summary, &$level) {  if ($view->vid=='21') { // @@@ Generalize    foreach($view->field as $field) {      if ($field['tablename'] != 'counthack') {        $query->add_groupby($field['tablename'].'.'.$field['field']);      }    }  }}function chicagoancestors_views_tables() {  $tables['counthack'] = array(    'fields' => array(      'countgroups' => array(        'notafield' => TRUE,        'name' => t('Hack: Count it all'),        'help' => t('I need it more than you... *sigh*'),        'handler' => 'chicagoancestors_handler1',        'query_handler' => 'chicagoancestors_query_handler1',      ),    ),  );  return $tables;}function chicagoancestors_query_handler1($fielddata, $fieldinfo, &$query) {  $query->add_field('COUNT(*) AS counthack','');}function chicagoancestors_handler1($fieldinfo, $fielddata, $value, $data) {  return $data->counthack;}