Пример #1
0
            $item_counter = 0;
            while ($publisher_record = mysql_fetch_object($publisher_result)) {
                $item_counter++;
                ?>
									<div class="search_item_<?php 
                echo $item_counter % 2 ? "a" : "b";
                ?>
">
										<a href="<?php 
                echo $db->url_root;
                ?>
/search.php/publisher/<?php 
                echo $publisher_record->ID;
                ?>
"><b><?php 
                echo highlight_search_query($publisher_record->title, $search_words);
                ?>
</b></a>
									</div>
									<?php 
            }
            // end while
            ?>
								</div>
								<?php 
        }
        // end if
        ?>
					</td>
					<?php 
        if ($authors_found > 0 || $subjects_found > 0 || $series_found > 0 || $publishers_found > 0) {
Пример #2
0
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
}