function output_compilation_titles_and_authors($record, $output_type = "detail", $show_pages = TRUE, $search_words = array()) { global $db; $author_list = array(); $main_author_records = lookup_author($record->ID, FALSE, TRUE); //$hide_main_author_ID = (count($main_author_records) == 1 ? $main_author_records[0]->ID : 0); $hide_main_author_ID = $main_author_records[0]->ID; if (count($author_records = lookup_author($record->ID, TRUE, TRUE))) { $last_section_title = ""; $last_section_start = -1; $last_author_type = 0; $hold_section_start = -1; $output_title = FALSE; $delayed_author_html = ""; foreach ($author_records as $author_record) { $this_section_title = $author_record->section_title; $this_section_start = $author_record->section_start; $this_by_text = $author_record->by_text; if ($hold_section_start == -1) { $last_section_title = $this_section_title; $hold_section_title = $this_section_title; $hold_section_start = $this_section_start; } // end if $this_author_type = $author_record->type; if ($output_title) { $output_pages = $last_section_start - $hold_section_start; ?> <div class="<?php echo $output_type; ?> _compilation_title"><?php echo highlight_search_query($output_title_text, $search_words); if ($show_pages && $author_record->section_start > 0) { ?> <span class="<?php echo $output_type; ?> _compilation_pages">(<?php echo $output_pages == 0 ? "1" : $output_pages; ?> page<?php echo $output_pages > 1 ? "s" : ""; ?> )</span><?php } // end if ?> </div> <?php if ($delayed_author_html != "") { echo $delayed_author_html; $delayed_author_html = ""; } // end if $output_title = FALSE; $hold_section_start = $last_section_start; } // end if if ($this_section_title != $last_section_title) { if (count($author_list) > 0) { $delayed_author_html .= '<div class="' . $output_type . '_compilation_author">' . $last_by_text . ' ' . implode("; ", $author_list) . '</div>'; } // end if $author_list = array(); if ($author_record->ID != $hide_main_author_ID) { $author_list[] = '<a href="' . $db->url_root . '/search.php/author/' . $author_record->ID . '">' . highlight_search_query(build_author_name($author_record), $search_words) . '</a>'; } // end if $output_title_text = $last_section_title; $output_title = TRUE; } else { if ($this_author_type != $last_author_type && $last_author_type != 0) { if (count($author_list) > 0) { $delayed_author_html .= '<div class="' . $output_type . '_compilation_author">' . $last_by_text . ' ' . implode("; ", $author_list) . '</div>'; } // end if $author_list = array(); } // end if if ($author_record->ID != $hide_main_author_ID) { $author_list[] = '<a href="' . $db->url_root . '/search.php/author/' . $author_record->ID . '">' . highlight_search_query(build_author_name($author_record), $search_words) . '</a>'; } // end if } // end if $last_section_start = $this_section_start; $last_section_title = $this_section_title; $last_by_text = $this_by_text; $last_author_type = $this_author_type; } // end foreach if ($output_title) { $output_pages = $last_section_start - $hold_section_start; ?> <div class="<?php echo $output_type; ?> _compilation_title"><?php echo highlight_search_query($output_title_text, $search_words); if ($show_pages && $author_record->section_start > 0) { ?> <span class="<?php echo $output_type; ?> _compilation_pages">(<?php echo $output_pages == 0 ? "1" : $output_pages; ?> page<?php echo $output_pages > 1 ? "s" : ""; ?> )</span><?php } // end if ?> </div> <?php if ($delayed_author_html != "") { echo $delayed_author_html; $delayed_author_html = ""; } // end if $output_title = FALSE; $hold_section_start = $last_section_start; } // end if $output_pages = $record->length - $last_section_start + 1; ?> <div class="<?php echo $output_type; ?> _compilation_title"><?php echo highlight_search_query($this_section_title, $search_words); if ($show_pages && $author_record->section_start > 0) { ?> <span class="<?php echo $output_type; ?> _compilation_pages">(<?php echo $output_pages == 0 ? "1" : $output_pages; ?> page<?php echo $output_pages > 1 ? "s" : ""; ?> )</span><?php } // end if ?> </div> <?php if (count($author_list) > 0) { if ($delayed_author_html != "") { echo $delayed_author_html; } // end if ?> <div class="<?php echo $output_type; ?> _compilation_author"><?php echo $author_record->by_text; ?> <?php echo implode("; ", $author_list); ?> </div> <?php } // end if } // end if }
<?php include_once dirname(__FILE__) . "/first.php"; $item_ID = $query[0]; $item_barcode = $query[1]; if (strlen(trim($item_barcode)) != $db->barcode_length || substr(trim($item_barcode), 0, 1) != $db->barcode_item_prefix) { exit_error("Invalid Barcode: " . $item_barcode, "The barcode you entered is not valid."); } // end if $barcode_sql = "\n\tSELECT\n\t\t*\n\tFROM\n\t\t`" . $db->table_library_item . "`\n\tWHERE\n\t\t`barcode`='" . mysql_escape_string(trim($item_barcode)) . "'\n\t\tAND `ID`!='" . $item_ID . "'\n"; $barcode_result = mysql_query($barcode_sql, $mysql->link); if (mysql_num_rows($barcode_result) > 0) { exit_error("Duplicate Barcode: " . $item_barcode, "The barcode you entered is already in use."); } // end if $sql = "\n\tSELECT\n\t\t*\n\tFROM\n\t\t`" . $db->table_library_item . "`\n\tWHERE\n\t\t`ID`='" . $item_ID . "'\n"; $result = mysql_query($sql, $mysql->link); $record = mysql_fetch_object($result); if ($record->{$db->field_category_ID} == 16 || $record->{$db->field_category_ID} == 7 || $record->call_number == "E" || substr($record->call_number, 0, 2) == "E,") { $authors = lookup_author($record->ID); $new_call_number = "E," . strtoupper(substr($authors[0]->last_name, 0, 3)); } else { $new_call_number = $record->call_number; } // end if $sql = "\n\tUPDATE\n\t\t`" . $db->table_library_item . "`\n\tSET\n\t\t`barcode`='" . mysql_escape_string($item_barcode) . "',\n\t\t`call_number`='" . $new_call_number . "'\n\tWHERE\n\t\t`ID`='" . $item_ID . "'\n"; //exit($sql); mysql_query($sql, $mysql->link); header("location:" . $db->url_root . "/item_details.php/barcode/" . $item_barcode); exit;
// end if ?> </div> <?php if ($record->parallel_title != "") { ?> <div class="detail_parallel_title"><?php echo $record->parallel_title; ?> </div> <?php } // end if //////////////////////////////////////////////////////////////////////////////////////////////////////////////// // NON-COMPILATION AUTHORS if (count($author_records = lookup_author($record->ID, FALSE, TRUE))) { $author_list = array(); $last_author_type = 0; foreach ($author_records as $author_record) { $this_by_text = $author_record->by_text; $this_author_type = $author_record->type; if ($this_author_type != $last_author_type && $last_author_type != 0) { ?> <div class="detail_authors"><?php echo $last_by_text; ?> <?php echo implode("; ", $author_list); ?> </div> <?php