You are here

private function HeartbeatActivity::log_message in Heartbeat 6.4

Same name and namespace in other branches
  1. 6.3 includes/heartbeatactivity.inc \HeartbeatActivity::log_message()
  2. 7 includes/heartbeatactivity.inc \HeartbeatActivity::log_message()

Logs a heartbeat message

Parameters

string language optional:

2 calls to HeartbeatActivity::log_message()
HeartbeatActivity::save_locale in includes/heartbeatactivity.inc
Save activity log with multilingual content and multilingual parts to pre-translate
HeartbeatActivity::_save in includes/heartbeatactivity.inc
Save activity log

File

includes/heartbeatactivity.inc, line 415
HeartbeatActivity object Defines one heartbeat activity object.

Class

HeartbeatActivity
Class defines an activity message object

Code

private function log_message($args, $lang = '') {
  if (empty($lang)) {
    global $language;
    $lang = $language->language;
  }
  $message = t($this->message, $args, $lang);
  $message_concat = t($this->message_concat, $args, $lang);

  // Checks if there should be logging what so ever
  if (empty($message)) {
    watchdog('heartbeat', 'Error in logging user activity: it is not possible to log empty message', array(), WATCHDOG_ERROR);
    return FALSE;
  }

  // Log relational message to user activity
  $logged = db_query("INSERT INTO {heartbeat_activity}\n      SET uid=%d, uid_target=%d, nid=%d, nid_target=%d, message_id='%s', language='%s',\n      access = %d, message ='%s',message_concat ='%s', timestamp=%d\n      , nid_info='%s', nid_target_info='%s', uaid_comments=%d, variables='%s'", $this->uid, $this->uid_target, $this->nid, $this->nid_target, $this->message_id, $lang, $this->access, $message, $message_concat, $this->timestamp, serialize($this->nid_info), serialize($this->nid_target_info), 0, heartbeat_encode_message_variables($this->variables));
  if (!$logged) {
    return 0;
  }
  $uaid = db_last_insert_id('heartbeat_activity', 'uaid');
  $this->uaids[] = $uaid;
  return $uaid;
}