function library_transaction_view in Library 7
Same name and namespace in other branches
- 5.2 library.pages.inc \library_transaction_view()
- 6.2 library.pages.inc \library_transaction_view()
- 6 library.pages.inc \library_transaction_view()
View an individual transaction.
Parameters
int $tid: Transaction id.
Return value
string Returns a themed transaction.
1 string reference to 'library_transaction_view'
- library_menu in ./
library.module - Implements hook_menu().
File
- ./
library.pages.inc, line 337 - Functions for generating page displays related to the library module.
Code
function library_transaction_view($tid) {
global $user;
$gettransactions = library_get_transaction_by_tid($tid);
if (isset($gettransactions[0])) {
$transaction = $gettransactions[0];
$list[] = t('Date: @action_date', array(
'@action_date' => format_date($transaction->created, 'custom', 'M j, Y'),
));
$list[] = t('Item: !item', array(
'!item' => l($transaction->item_name, 'node/' . $transaction->nid),
));
$list[] = t('Action: @action', array(
'@action' => $transaction->action_name,
));
if (user_access('access user profiles', $user)) {
$list[] = t('Patron: !patron', array(
'!patron' => l($transaction->username, 'user/' . $transaction->uid),
));
}
else {
$list[] = t("Patron: N/A");
}
if (!empty($transaction->duedate)) {
$list[] = t('Due Date: @due_date', array(
'@due_date' => format_date($transaction->duedate, 'custom', 'M j, Y'),
));
}
if (!empty($transaction->notes)) {
$list[] = $transaction->notes;
}
return theme('item_list', array(
'items' => $list,
));
}
else {
drupal_set_message(t('No transaction found.'), array());
}
}