You are here

function modr8_get_log_link in modr8 7

Generates the log link for the passed node

Parameters

$node: The node oject

2 calls to modr8_get_log_link()
modr8_form in ./modr8_admin.inc
Content moderation form.
_modr8_build_values in ./modr8.module
Build the values array needed for so many internal functions.

File

./modr8.module, line 510
Easy dedicated content moderation

Code

function modr8_get_log_link($node) {
  $log_link = '';
  $events = db_query("SELECT modid FROM {modr8_log} WHERE nid = :nid", array(
    ':nid' => $node->nid,
  ));
  $count = db_query("SELECT COUNT(modid) FROM {modr8_log} WHERE nid = :nid", array(
    ':nid' => $node->nid,
  ))
    ->fetchField();
  if ($count) {
    if ($count == 1) {
      $url = 'admin/reports/modr8/event/' . $events
        ->fetchField();
    }
    else {
      $url = 'node/' . $node->nid . '/modr8/';
    }
    $message = format_plural($count, 'See the 1 moderation log event for this post', 'Overview of the @count moderation log events for this post');
    $log_link .= l($message, $url);
  }
  return $log_link;
}