type) ) { $states = workflow_get_states($wid); } $result = db_query_range("SELECT h.* FROM {workflow_node_history} h WHERE nid = %d ORDER BY stamp DESC",$node->nid,0,1); if ($row = db_fetch_object($result)) { $account = user_load( array ('uid' => $row->uid)); $comment = $row->comment; } $values['workflow-current-state-name'] = $states[$row->sid]; $values['workflow-old-state-name'] = $states[$row->old_sid]; $values['workflow-current-state-date-iso'] = date('Ymdhis',$row->stamp); $values['workflow-current-state-date-tstamp'] = $row->stamp; $values['workflow-current-state-date-formatted'] = date('M d, Y h:i:s', $row->stamp); $values['workflow-current-state-user'] = $account->uid ? $account->name : variable_get('anonymous', 'Anonymous'); $values['workflow-current-state-uid'] = $account->uid; $values['workflow-current-state-user-mail'] = $account->uid ? $account->mail : ''; $values['workflow-current-state-log-entry'] = $row->comment; break; } return $values; } /** * Implementation of hook_token_list() */ function workflow_token_list($type = 'all') { if ($type == 'workflow' || $type == 'all') { $tokens['workflow']['workflow-current-state-name'] = 'Current state of content'; $tokens['workflow']['workflow-old-state-name'] = 'Old state of content'; $tokens['workflow']['workflow-current-state-date-iso'] = 'Date of last state change (ISO)'; $tokens['workflow']['workflow-current-state-date-tstamp'] = 'Date of last state change (timestamp)'; $tokens['workflow']['workflow-current-state-date-formatted'] = 'Date of last state change (formated - M d, Y h:i:s)';; $tokens['workflow']['workflow-current-state-user'] = 'Username of last state changer'; $tokens['workflow']['workflow-current-state-uid'] = 'uid of last state changer'; $tokens['workflow']['workflow-current-state-user-mail'] = 'email of last state changer'; $tokens['workflow']['workflow-current-state-log-entry'] = 'Last workflow comment log'; return $tokens; } }