You are here

function heartbeat_messages in Heartbeat 6.4

Same name and namespace in other branches
  1. 6.2 heartbeat.module \heartbeat_messages()
  2. 6.3 heartbeat.module \heartbeat_messages()

get all messages with static cache variable and reset possibility

Parameters

string $module:

boolean $reset:

boolean $objects:

Return value

array messages

11 calls to heartbeat_messages()
heartbeat_activity_stream_configure in ./heartbeat.admin.inc
Callback function to configure a heartbeat stream
heartbeat_admin_settings in ./heartbeat.admin.inc
Function to maintain and administer heartbeat settings.
heartbeat_features_export_render in ./heartbeat.features.inc
Implementation of hook_features_export_render().
heartbeat_messages_export in ./heartbeat.admin.inc
Function to export messages to use as default
heartbeat_messages_export_messages in ./heartbeat.admin.inc
Function to export messages to use as default

... See full list

4 string references to 'heartbeat_messages'
heartbeat_messages_page in ./heartbeat.pages.inc
Page callback function to load an activity stream page.
heartbeat_message_insert in ./heartbeat.module
Inserts a heartbeat message
heartbeat_views_data in views/heartbeat_views.views.inc
Implementation of views hook hook_views_data().
heartbeat_views_views_query_alter in views/heartbeat_views.views.inc
Implementation of hook_views_query_alter().

File

./heartbeat.module, line 1611

Code

function heartbeat_messages($message_id = 'all', $reset = FALSE, $objects = TRUE) {
  static $messages;
  if (empty($messages) || $reset == TRUE) {
    $messages = array();
    if ($message_id == 'all') {
      $result = db_query("SELECT * FROM {heartbeat_messages} ORDER BY hid, message_id, description ");
    }
    else {
      $result = db_query("SELECT * FROM {heartbeat_messages} WHERE message_id = '%s' ", $message_id);
    }
    while ($row = db_fetch_array($result)) {
      if ($objects) {
        $template = new HeartbeatMessageTemplate($row['hid'], $row['message_id'], $row['message'], $row['message_concat'], $row['concat_args']);
        $template->perms = $row['perms'];
        $template->custom = $row['custom'];
        $template->description = $row['description'];
        $template
          ->set_variables($row['variables']);
        $template
          ->set_attachments($row['attachments']);
        $template
          ->set_roles(isset($template->concat_args['roles']) ? $template->concat_args['roles'] : array());
        $messages[] = $template;
      }
      else {
        $messages[] = $row;
      }
    }
  }
  return $messages;
}