<?php
// $Id: $


/*
 * We are extending views sort handler to accept ordering by a formula for 
 * download_count table. (20100912 - wundo)
 */
class views_handler_sort_by_download_counter extends views_handler_sort {
  function admin_summary() { }
  function operator_form() { }

  function query() {
    $table = $this->ensure_my_table();
    $this->query->ensure_table("download_count");
    $this->query->add_orderby(NULL, "", $this->options['order'], "COUNT(download_count.fid)");
    $this->query->add_groupby("download_count.fid");
  }
}

