You are here

useractivity.inc in Heartbeat 7

Personal/private heartbeat activity access object

File

modules/heartbeat_defaults/streams/useractivity.inc
View source
<?php

/**
 * @file
 *   Personal/private heartbeat activity access object
 */

/**
 * Class PrivateHeartbeat
 * Concrete class to prepare messages for the
 * current user only
 */
class UserActivity extends HeartbeatStream {

  /**
   * Implementation of queryAlter().
   */
  protected function queryAlter() {
    $this->query
      ->condition(db_or()
      ->condition('ha.uid', $this->viewed->uid)
      ->condition(db_and()
      ->condition('ha.uid_target', $this->viewed->uid)
      ->condition('ha.access', HEARTBEAT_PRIVATE, '>')));
  }

  /**
   * Function to add a part of a sql to a query built by views UI
   *
   * @param object $view The view handler object by reference to add our part to the query
   */
  public function viewsQueryAlter(&$view) {
    $views->query
      ->condition(db_or()
      ->condition('ha.uid', $this->viewed->uid)
      ->condition(db_and()
      ->condition('ha.uid_target', $this->viewed->uid)
      ->condition('ha.access', HEARTBEAT_PRIVATE, '>')));
  }

}

Classes

Namesort descending Description
UserActivity Class PrivateHeartbeat Concrete class to prepare messages for the current user only