You are here

publicheartbeat.inc in Heartbeat 6.3

Same filename and directory in other branches
  1. 6.4 includes/publicheartbeat.inc

File

includes/publicheartbeat.inc
View source
<?php

/**
 * Class PublicHeartbeat
 * Concrete class to prepare messages for all
 * users in the site of whom the heartbeat is
 * set to public
 *
 */
class PublicHeartbeat extends HeartbeatAccess {

  /**
   * Implementation of dressUpMessages().
   *
   * @param object HeartbeatParser $heartbeat
   *   The state of the viewed message sets
   * @return object HeartbeatParser $heartbeat
   */
  public function dressUpMessages(HeartbeatParser $heartbeat) {
    $heartbeatInfo = $heartbeat
      ->get_info();
    $heartbeatInfo->uid = 0;
    $heartbeatInfo->limit_view = variable_get('heartbeat_block_public_items_max', 25);
    $heartbeatInfo->user_relations = $heartbeatInfo->uid;
    $heartbeat
      ->set_info($heartbeatInfo);
    $sql = $heartbeatInfo->sql_start;

    // logic to fetch messages public to all
    $sql .= " AND ua.uid > 0  AND ua.access > 0 ";
    $sql .= $heartbeatInfo->sql_end;
    $result = db_query_range($sql, $heartbeatInfo->language, $heartbeatInfo->start_time, 0, $heartbeatInfo->limit_sql);
    while ($heartbeat_row = db_fetch_object($result)) {
      $heartbeat->raw_messages[$heartbeat_row->uaid] = $heartbeat_row;
    }
    return $heartbeat;
  }

}

Classes

Namesort descending Description
PublicHeartbeat Class PublicHeartbeat Concrete class to prepare messages for all users in the site of whom the heartbeat is set to public