views_handler_filter_upload_fid.inc

File

modules/upload/views_handler_filter_upload_fid.inc
View source
  1. <?php
  2. /**
  3. * Filter by whether or not a node has attached files from the upload module
  4. */
  5. class views_handler_filter_upload_fid extends views_handler_filter_boolean_operator {
  6. function construct() {
  7. parent::construct();
  8. $this->value_value = t('Has attached files');
  9. }
  10. function query() {
  11. $this->ensure_my_table();
  12. $this->query->add_where($this->options['group'], "(SELECT COUNT(*) FROM {upload} u WHERE u.vid = $this->table_alias.$this->real_field) " . (empty($this->value) ? '=' : '<>') . " 0");
  13. }
  14. }