You are here

function workflow_get_workflow_node_history_by_nid in Workflow 7

Same name and namespace in other branches
  1. 7.2 workflow.deprecated.inc \workflow_get_workflow_node_history_by_nid()

Get all recorded history for a node id.

Since this may return a lot of data, a limit is included to allow for only one result.

2 calls to workflow_get_workflow_node_history_by_nid()
workflow_insert_workflow_node_history in ./workflow.module
Given data, insert a new history. Always insert.
workflow_tab_page in ./workflow.pages.inc
Menu callback. Display workflow summary of a node.

File

./workflow.module, line 879
Support workflows made up of arbitrary states.

Code

function workflow_get_workflow_node_history_by_nid($nid, $limit = NULL) {
  if (empty($limit)) {
    $limit = variable_get('workflow_states_per_page', 20);
  }
  $results = db_query_range('SELECT h.hid, h.nid, h.old_sid, h.sid, h.uid, h.stamp, h.comment ' . 'FROM {workflow_node_history} h ' . 'LEFT JOIN {users} u ON h.uid = u.uid ' . 'WHERE nid = :nid ' . 'ORDER BY h.stamp DESC, h.hid DESC ', 0, $limit, array(
    ':nid' => $nid,
  ));
  if ($limit == 1) {
    return $results
      ->fetchObject();
  }
  return $results
    ->fetchAll();
}