function library_overdue_items in Library 7
Same name and namespace in other branches
- 5.2 library.pages.inc \library_overdue_items()
- 6.2 library.pages.inc \library_overdue_items()
- 6 library.pages.inc \library_overdue_items()
Computes all overdue items.
Return value
string The themed results of overdue items.
1 string reference to 'library_overdue_items'
- library_menu in ./
library.module - Implements hook_menu().
File
- ./
library.pages.inc, line 589 - Functions for generating page displays related to the library module.
Code
function library_overdue_items() {
if (library_duedates_enabled()) {
$records = library_get_overdue_items();
if (empty($records)) {
return "<p>No overdue items at this time.</p>";
}
else {
$header = array(
t('Title'),
t('Patron'),
t('Due Date'),
t('Actions'),
);
$rows = array();
foreach ($records as $patron_id => $record) {
$patron_name = $record['patron']['patron_name'];
$patron_email = $record['patron']['patron_email'];
foreach ($record['items'] as $id => $values) {
$item = array(
'library_status' => LIBRARY_ITEM_UNAVAILABLE,
'id' => $id,
'last_patron_uid' => $patron_id,
'in_circulation' => $values['in_circulation'],
);
$links = implode(" | ", library_get_action_links($item));
$rows[] = array(
$values['item_name'],
$patron_name,
format_date($values['due_date'], 'small'),
l(t('Item Details'), 'node/' . $values['nid']) . ' | ' . $links,
);
$item = array();
}
}
$output = theme('table', array(
'header' => $header,
'rows' => $rows,
));
$output .= theme('pager');
return $output;
}
}
else {
return "<p>Library due dates are not enabled.</p>";
}
}