SwentelLines and paragraphs break automatically.Lines and paragraphs break automatically.Lines and paragraphs break automatically.Lines and paragraphs break automatically.Lines and paragraphs break automatically.Lines and paragraphs break automatically.Lines and paragraphs break automatically.Lines and paragraphs break automatically.Lines and paragraphs break automatically.Lines and paragraphs break automatically.Lines and paragraphs break automatically.Lines and paragraphs break automatically.Lines and paragraphs break automatically.Lines and paragraphs break automatically.Lines and paragraphs break automatically.Lines and paragraphs break automatically.Lines and paragraphs break automatically.Lines and paragraphs break automatically.Lines and paragraphs break automatically. 14 weeks ago
Site activity is a custom stream from the heartbeat_example submodule. This module fungates as testcase for site and module developers.
How to create your own stream?
By implementating hook_heartbeat_register_access_types, it is possible to add stream, derivated from an existing one or the base heartbeatAccess stream type.
E.g.:
<?php/** * Implementation of hook_heartbeat_register_access_types(). */ function heartbeat_example_heartbeat_register_access_types() { return array( // Site activity stream is kind of a copy of HeartbeatPublic. // It is only to show you how it's done. 0 => array( 'name' => 'Site activity', 'class' => 'SiteActivity', 'path' => 'siteactivity.inc', 'module' => 'heartbeat_example' ), ); }?>
Put SiteActivity.inc in your module folder and add the class-include it extends on above the class definition (by invoking heartbeat_include). From now it is possible to "hook" into each of the protected methods. You could for instance a bit of a sql or even end up rewriting the whole sql yourself.
<?php/** * Class SiteActivity * Concrete class to prepare messages for whole site, * to be customized UI wise * */ class SiteActivity extends HeartbeatAccess {
protected function hasAccess() { return TRUE; }
/** * Implementation of dressUpMessages(). * * @param object HeartbeatParser $heartbeat * The heartbeat parser object * @return object HeartbeatParser $heartbeat */ public function dressUpMessages(HeartbeatParser $heartbeat) { $sql = " AND ua.access > 0 "; $heartbeat->raw_messages = $this->resultSql($sql); return $heartbeat; }
/** * Function to add a part of a sql to a query built by views * * @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->add_where('andgroup', "$field > %d AND $view->table_alias.access > 0", 0); } }?>
A good example is to join over user and node tables to obtain a big performance improvement.
See heartbeat_example submodule for the full example.
A heartbeat activity stream
A heartbeat stream is a set of activity messages for a set of parameters. These parameters are bundled into a configuration or parameter object. A stream object is instantiated with the parameter object to perform a query to the activity logs table. Each of the streams are available as block and page. Streams are configured at location admin/build/heartbeat/streams.