Same name and namespace in other branches
  1. 6.x-3.x modules/node/views_handler_field_history_user_timestamp.inc \views_handler_field_history_user_timestamp::render()

Render the field.

Parameters

array $values: The values retrieved from the database.

Overrides views_handler_field_node::render

File

modules/node/views_handler_field_history_user_timestamp.inc, line 74
Definition of views_handler_field_history_user_timestamp.

Class

views_handler_field_history_user_timestamp
Field handler to display the marker for new content.

Code

public function render($values) {

  // Let's default to 'read' state.
  // This code shadows node_mark, but it reads from the db directly and
  // we already have that info.
  $mark = MARK_READ;
  global $user;
  if ($user->uid) {
    $last_read = $this
      ->get_value($values);
    $changed = $this
      ->get_value($values, 'changed');
    $last_comment = module_exists('comment') && !empty($this->options['comments']) ? $this
      ->get_value($values, 'last_comment') : 0;
    if (!$last_read && $changed > NODE_NEW_LIMIT) {
      $mark = MARK_NEW;
    }
    elseif ($changed > $last_read && $changed > NODE_NEW_LIMIT) {
      $mark = MARK_UPDATED;
    }
    elseif ($last_comment > $last_read && $last_comment > NODE_NEW_LIMIT) {
      $mark = MARK_UPDATED;
    }
    return $this
      ->render_link(theme('mark', array(
      'type' => $mark,
    )), $values);
  }
}