1 views_handler_field_history_user_timestamp.inc views_handler_field_history_user_timestamp::render($values)

Render the field.

Parameters

$values: The values retrieved from the database.

Overrides views_handler_field_node::render

File

core/modules/node/views/views_handler_field_history_user_timestamp.inc, line 58
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

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);
  }
}