You are here

class PrivateHeartbeat in Heartbeat 6.4

Same name and namespace in other branches
  1. 6.3 includes/privateheartbeat.inc \PrivateHeartbeat

Class PrivateHeartbeat Concrete class to prepare messages for the current user only

Hierarchy

Expanded class hierarchy of PrivateHeartbeat

1 string reference to 'PrivateHeartbeat'
heartbeat_heartbeat_register_access_types in ./heartbeat.module
Implementation of hook_heartbeat_register_access_types().

File

includes/privateheartbeat.inc, line 16

View source
class PrivateHeartbeat extends HeartbeatAccess {

  /**
   * Skip active user.
   * We never want to skip the active user. not for
   * logged-in user and not for displayed user (profile).
   * This is ofcourse because private stream is intended to
   * show own activity.
   */
  public function skipActiveUser() {
    return FALSE;
  }
  public function dressUpMessages(HeartbeatParser $heartbeat) {
    $sql = " AND ((ua.uid = %d  AND hm.perms > %d ) OR (ua.uid_target = %d AND ua.access > %d) )";
    $heartbeat->raw_messages = $this
      ->resultSql($sql, array(
      $this->stream->uid,
      HEARTBEAT_PRIVATE,
      $this->stream->uid,
      HEARTBEAT_PUBLIC_TO_ADDRESSEE,
    ));
    return $heartbeat;
  }

  /**
   * 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 addViewQuery(&$view) {

    // Make the sql limited to the access
    $field = "{$view->table_alias}.{$view->real_field}";
    $view->query
      ->set_where_group('OR', 'orgroup');
    $sql = "{$field} = %d  AND {$view->table_alias}.access > %d ";
    $view->query
      ->add_where('orgroup', $sql, $this->_uid, HEARTBEAT_PRIVATE);
    $sql = "({$view->table_alias}.uid_target = %d AND {$view->table_alias}.access > %d)";
    $view->query
      ->add_where('orgroup', $sql, $this->_uid, HEARTBEAT_PUBLIC_TO_ADDRESSEE);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
HeartbeatAccess::$stream public property
HeartbeatAccess::$_actor protected property
HeartbeatAccess::$_errors protected property
HeartbeatAccess::$_has_errors protected property
HeartbeatAccess::$_offset_sql protected property
HeartbeatAccess::$_page protected property
HeartbeatAccess::$_uid protected property
HeartbeatAccess::$_whoisuser_type protected property
HeartbeatAccess::$_whoisuser_types protected property
HeartbeatAccess::checkDeniedMessages protected function Check denied messages
HeartbeatAccess::configurationForm public function ConfigurationForm Basic configuration form for streams.
HeartbeatAccess::construct public function Fake constructor to hook this method instead of the constructor. 2
HeartbeatAccess::createHeartbeatParser protected function createHeartbeatParser
HeartbeatAccess::fetchMessages public function
HeartbeatAccess::finishMessages protected function finishMessages
HeartbeatAccess::getAccess final public function getAccess
HeartbeatAccess::getActiveUser public function Function to retrieve the active user.
HeartbeatAccess::getErrors public function
HeartbeatAccess::getOffsetSql final public function getOffsetSql
HeartbeatAccess::getStream public function Get HeartbeatStream object with all configurations
HeartbeatAccess::hasAccess protected function hasAccess 4
HeartbeatAccess::hasErrors public function hasErrors
HeartbeatAccess::isPage public function Getter function for heartbeat page/blocks
HeartbeatAccess::prepareStream protected function prepareStream 2
HeartbeatAccess::resultSql protected function resultSql 1
HeartbeatAccess::setError protected function setError
HeartbeatAccess::setOffsetSql final public function setOffsetSql
HeartbeatAccess::TYPE_ACTOR constant
HeartbeatAccess::TYPE_USER_PROFILE constant
HeartbeatAccess::whoIsActor protected function proctected fuinction whoIsActor Calculate the user of whom we want to see activity for. Set the actor of the stream. 1
HeartbeatAccess::__construct public function Constructor
PrivateHeartbeat::addViewQuery public function Function to add a part of a sql to a query built by views UI Overrides HeartbeatAccess::addViewQuery
PrivateHeartbeat::dressUpMessages public function Overrides HeartbeatAccess::dressUpMessages
PrivateHeartbeat::skipActiveUser public function Skip active user. We never want to skip the active user. not for logged-in user and not for displayed user (profile). This is ofcourse because private stream is intended to show own activity. Overrides HeartbeatAccess::skipActiveUser