hosting_package_handler_field_site_count.inc

Classes

Namesort descending Description
hosting_package_handler_field_site_count A handler to provide a count of sites using a given package.

File

package/includes/views/handlers/hosting_package_handler_field_site_count.inc
View source
  1. <?php
  2. /**
  3. * A handler to provide a count of sites using a given package.
  4. *
  5. * @ingroup views_field_handlers
  6. */
  7. class hosting_package_handler_field_site_count extends views_handler_field {
  8. function query() {
  9. parent::query();
  10. $this->query->add_field(NULL, '(SELECT count(iid) FROM {hosting_package_instance} pi WHERE pi.package_id = node_hosting_package_instance_nid AND pi.platform = ' . $this->view->args[0] . ' AND pi.status = 1)', 'site_count');
  11. }
  12. function render($values) {
  13. return $values->site_count;
  14. }
  15. function click_sort($order) {
  16. $this->query->add_orderby(NULL, NULL, $order, $this->field);
  17. }
  18. }