function library_get_table_row in Library 5.2
Same name and namespace in other branches
- 6.2 library.module \library_get_table_row()
- 6 library.module \library_get_table_row()
- 7 library.module \library_get_table_row()
2 calls to library_get_table_row()
- library_display_items in ./
library.pages.inc - library_search in ./
library.module - Implementation of hook_search()
File
- ./
library.module, line 1376
Code
function library_get_table_row($node, $var) {
$node_row = array();
$rows = array();
if (!empty($var['fields'])) {
content_view($node);
}
$node_row[] = l($node->title, 'node/' . $node->nid);
if ($var['display_categories']) {
$categories = array();
foreach (variable_get('library_taxonomy_display', array()) as $vocab) {
$terms = taxonomy_node_get_terms_by_vocabulary($node, $vocab);
foreach ($terms as $term) {
$categories[] = l($term->name, 'taxonomy/term/' . $term->tid);
}
}
$node_row[] = implode(" | ", $categories);
}
if (!empty($var['fields'])) {
foreach ($var['fields'] as $name => $field) {
$return = '';
if (isset($node->content[$field['field_name']])) {
$return = drupal_render($node->content[$field['field_name']]);
}
$node_row[] = $return;
}
}
$items = $node->items;
if (!$var['use_barcodes'] && $var['display_quantity']) {
$node_row[] = count($items);
}
if ($var['use_barcodes']) {
foreach ($items as $item) {
$row = $node_row;
if ($var['use_barcodes']) {
$row[] = $item['barcode'];
}
if ($var['display_status']) {
$status = library_get_status_text($item);
$row[] = $status;
}
if (!empty($var['available_actions'])) {
$row[] = array(
'data' => implode(" | ", library_get_action_links($item)),
'class' => 'library-actions-column',
);
}
$rows[] = $row;
}
}
else {
$action_items = library_get_action_items_by_node($items);
if (isset($action_items['available'])) {
if ($var['display_status']) {
$node_row[]['data'] = library_get_status_text($action_items['available']);
}
if (!empty($var['available_actions'])) {
if (isset($action_items['unavailable'])) {
$node_row[]['data'] = implode(" | ", library_get_action_links($action_items['available'], $action_items['unavailable']));
}
else {
$node_row[] = array(
'data' => implode(" | ", library_get_action_links($action_items['available'])),
'class' => 'library-actions-column',
);
}
}
}
else {
if ($var['display_status']) {
$node_row[]['data'] = library_get_status_text($action_items['unavailable']);
}
if (!empty($var['available_actions'])) {
$node_row[] = array(
'data' => implode(" | ", library_get_action_links($action_items['unavailable'])),
'class' => 'library-actions-column',
);
}
}
$rows[] = $node_row;
}
return $rows;
}