You are here

views_handler_filter_heartbeat_perms.inc in Heartbeat 6.4

Same filename and directory in other branches
  1. 6.3 views/handlers/views_handler_filter_heartbeat_perms.inc

Implementation of equality filter to match the permission configuration with the message permission.

File

views/handlers/views_handler_filter_heartbeat_perms.inc
View source
<?php

/**
 * @file
 *   Implementation of equality filter to match the permission
 *   configuration with the message permission.
 */

/**
 * Class views_handler_filter_heartbeat_perms
 */
class views_handler_filter_heartbeat_perms extends views_handler_filter_equality {
  function construct() {
    parent::construct();
    $this->definition['numeric'] = TRUE;
  }

  /**
   * Display the filter on the administrative summary.
   */
  function admin_summary() {
    $options = _heartbeat_perms_options();
    return !empty($this->value) ? $options[$this->value] : $options[1];
  }

  /**
   * Child classes should override this function to set the 'value options'.
   * This can use a guard to be used to reduce database hits as much as
   * possible.
   */
  function value_form(&$form, &$form_state) {
    $form['value'] = array(
      '#type' => 'radios',
      '#options' => _heartbeat_perms_options(),
      '#title' => t('Restrict activity stream to message permissions'),
      '#default_value' => $this->value,
    );
  }
  function query() {
    $this
      ->ensure_my_table();
    $sql = "{$this->table_alias}.{$this->real_field} = '%s' ";
    $this->query
      ->add_where($this->options['group'], $sql, $this->value);
  }

}

Classes

Namesort descending Description
views_handler_filter_heartbeat_perms Class views_handler_filter_heartbeat_perms