You are here

function theme_shoutform_message in Heartbeat 6.3

Same name and namespace in other branches
  1. 6.4 modules/shouts/shouts.module \theme_shoutform_message()

Theme the latest shout of a user.

Parameters

$latest_shout the shout message:

$ownshout is it the users own shout?:

$update is it an ajax update of the shout?:

1 call to theme_shoutform_message()
clear_shout in modules/shouts/shouts.module
Clear the latest shout from a user.
3 theme calls to theme_shoutform_message()
shouts_shout_form in modules/shouts/shouts.module
Show the shoutform
shouts_shout_form_submit in modules/shouts/shouts.module
User submitted the shoutform, save the shout.
shouts_user in modules/shouts/shouts.module
Implementation of hook_user().

File

modules/shouts/shouts.module, line 223
Gives the possibility to the user to shout a message.

Code

function theme_shoutform_message($latest_shout, $ownshout, $update, $time = '') {
  if ($ownshout) {
    $options = array(
      'attributes' => array(
        'onclick' => 'javascript: clearShout(); return false;',
      ),
      'query' => 'destination=' . $_GET['q'],
    );
    $clear = '<span class="shout_clear">' . l(t('Clear'), 'shout/clear', $options) . '</span>';
  }
  if ($time) {
    $ago = t('ago');
    $time_diff = $_SERVER['REQUEST_TIME'] - strtotime($time);

    // don't show minutes if less then 1 minute ago.
    if ($time_diff < 60) {
      $date = t('a moment');
    }
    else {
      $date = format_interval($time_diff, 1, 'nl');
    }
    $shout_time = '<span class="shout_ago">' . $date . ' ' . $ago . '</span>';
  }
  $latest_shout = '<div class="latest_shout">' . $latest_shout . '</div>';
  $output = '<div class="inner">' . $latest_shout . $shout_time . $clear . '</div>';
  if (!$update) {
    $output = '<div id="shout-wrapper">' . $output . '</div>';
  }
  return $output;
}