Exemplo n.º 1
0
/*
 * Hitlist Page RSS template
 */
print '<?xml version="1.0" encoding="utf-8"?>' . "\n";
?>
  <feed xmlns="http://www.w3.org/2005/Atom">
    <title type="text">Search for <?php 
print $search_term;
?>
</title>
    <updated><?php 
print date('Y-m-d') . 'T00:00:00-05:00';
?>
</updated>
    <id>http://<?php 
print $_SERVER['SERVER_NAME'];
?>
/</id>
    <link rel="alternate" type="text/html" hreflang="en" href="<?php 
print url($base_path, array('absolute' => TRUE));
?>
"/>
    <link rel="self" type="application/atom+xml" href="<?php 
print url($_GET['q'], array('query' => sopac_make_pagevars(sopac_parse_get_vars($getvars_tmp)), 'absolute' => TRUE));
?>
"/>
    <?php 
print $hitlist_content;
?>
  </feed>
Exemplo n.º 2
0
    }
    print ' | ';
    if ($perpage == $default_perpage * 3) {
        print "<strong>" . $default_perpage * 3 . "</strong>";
    } else {
        $getvars['perpage'] = $default_perpage * 3;
        $getvars['page'] = '';
        print l($default_perpage * 3, $uri, array('query' => sopac_make_pagevars(sopac_parse_get_vars($getvars))));
    }
    print ' | ';
    if ($perpage == $default_perpage * 6) {
        print "<strong>" . $default_perpage * 6 . "</strong>";
    } else {
        $getvars['perpage'] = $default_perpage * 6;
        $getvars['page'] = '';
        print l($default_perpage * 6, $uri, array('query' => sopac_make_pagevars(sopac_parse_get_vars($getvars))));
    }
    ?>
    </span>
  </div>

</div>
<br />
<div class="hitlist-pager">
<?php 
    print $hitlist_pager;
    ?>
</div>
<?php 
}
?>
Exemplo n.º 3
0
/**
 * Formulates the advanced search form array
 *
 * @return array Drupal search form array
 */
function sopac_search_form_adv()
{
    $locum = sopac_get_locum();
    $locum_cfg = $locum->locum_config;
    $getvars = sopac_parse_get_vars();
    $actions = sopac_parse_uri();
    if ($actions[0] == "search") {
        if ($actions[3]) {
            $actions[2] = $actions[2] . "/" . $actions[3];
            urlencode($actions[2]);
        }
        $search_query = $actions[2];
        $stype_selected = $actions[1] ? 'cat_' . $actions[1] : 'cat_keyword';
    }
    $sformats = array('' => 'Everything');
    foreach ($locum_cfg[format_groups] as $sfmt => $sfmt_codes) {
        $sformats[preg_replace('/,[ ]*/', '|', trim($sfmt_codes))] = ucfirst($sfmt);
    }
    $stypes = array('cat_keyword' => 'Keyword', 'cat_title' => 'Title', 'cat_author' => 'Author', 'cat_series' => 'Series', 'cat_tags' => 'Tags', 'cat_reviews' => 'Reviews', 'cat_subject' => 'Subject', 'cat_callnum' => 'Call Number', 'cat_isn' => 'ISBN or ISSN');
    $sortopts = array('' => 'Relevance', 'atoz' => 'Alphabetical A to Z', 'ztoa' => 'Alphabetical Z to A', 'catalog_newest' => 'Just Added', 'newest' => 'Pub date: Newest', 'oldest' => 'Pub date: Oldest', 'author' => 'Alphabetically by Author', 'top_rated' => 'Top Rated Items', 'popular_week' => 'Most Popular this Week', 'popular_month' => 'Most Popular this Month', 'popular_year' => 'Most Popular this Year', 'popular_total' => 'All Time Most Popular');
    // Initialize the form
    $form = array('#attributes' => array('class' => 'search-form'), '#validate' => array('sopac_search_catalog_validate'), '#submit' => array('sopac_search_catalog_submit'));
    $form['search_query'] = array('#type' => 'textfield', '#title' => t('Search term or phrase'), '#default_value' => $search_query, '#size' => 50, '#maxlength' => 255);
    $form['search_type'] = array('#type' => 'select', '#title' => t('Search by'), '#default_value' => $stype_selected, '#options' => $stypes);
    $form['sort'] = array('#type' => 'select', '#title' => t('Sorted by'), '#default_value' => '', '#options' => $sortopts);
    $form['age_group'] = array('#type' => 'select', '#title' => 'in age group', '#options' => array('' => "Any Age Group", 'adult' => "Adult", 'teen' => "Teen", 'youth' => "Youth"));
    $form['limit_avail'] = array('#type' => 'select', '#title' => 'limit to items on shelf at', '#options' => array_merge(array('' => '--', 'any' => "Any Location"), $locum_cfg['branches']), '#default_value' => $getvars['limit_avail'], '#suffix' => "</div>");
    if (count($locum_cfg[collections])) {
        foreach ($locum_cfg[collections] as $loc_collect_key => $loc_collect_var) {
            $loc_collect[$loc_collect_key] = $loc_collect_key;
        }
        $form['collection'] = array('#type' => 'select', '#title' => t('In these collections'), '#size' => 5, '#default_value' => $getvars[collection], '#options' => $loc_collect, '#multiple' => TRUE);
    }
    asort($locum_cfg[formats]);
    $form['search_format'] = array('#type' => 'select', '#title' => t('In these formats'), '#size' => 5, '#default_value' => $getvars[search_format], '#options' => $locum_cfg[formats], '#multiple' => TRUE);
    $form['publisher'] = array('#type' => 'textfield', '#title' => t('Publisher'), '#size' => 20, '#maxlength' => 255);
    $form['pub_year_start'] = array('#type' => 'textfield', '#title' => t('Published year between'), '#size' => 20, '#maxlength' => 255);
    $form['pub_year_end'] = array('#type' => 'textfield', '#title' => t('and'), '#size' => 20, '#maxlength' => 255);
    $form['submit'] = array('#type' => 'submit', '#value' => t('Search'));
    $form['clear'] = array('#name' => 'clear', '#type' => 'button', '#value' => t('Reset'), '#attributes' => array('onclick' => 'this.form.reset(); return false;'));
    return $form;
}
Exemplo n.º 4
0
    }
    print implode('<br />', $year_arr);
    print '</div>';
}
?>

<?php 
if (is_array($getvars['facet_decade']) && count($getvars['facet_decade'])) {
    print '<br />Refined by Decade:';
    print '<div class="search-block-attr">';
    $decade_flipped = array_flip($getvars['facet_decade']);
    foreach ($search['decade'] as $decade) {
        $getvars_tmp = $getvars;
        unset($getvars_tmp['facet_decade'][$decade_flipped[$decade]]);
        $getvars_tmp['page'] = '';
        $decade_arr[trim($decade)] = $decade . '-' . ($decade + 9) . ' [' . l('x', $uri, array('query' => sopac_make_pagevars(sopac_parse_get_vars($getvars_tmp)))) . ']';
    }
    print implode('<br />', $decade_arr);
    print '</div>';
}
?>

<?php 
/* Uncomment for subjects facet
if (is_array($getvars['facet_subject']) && count($getvars['facet_subject'])) {
  print '<br />Refined by Subject:';
  print '<div class="search-block-attr">';
  $subject_flipped = array_flip($getvars['facet_subject']);
  foreach ($search['subject'] as $subject) {
    $getvars_tmp = $getvars;
    unset($getvars_tmp['facet_subject'][$subject_flipped[$subject]]);
Exemplo n.º 5
0
/**
 * Returns the form array for saving searches
 *
 * @return array Drupal form array.
 */
function sopac_savesearch_form()
{
    global $user;
    $search_path = str_replace('/savesearch/', '/search/', $_GET['q']);
    $search_query = sopac_make_pagevars(sopac_parse_get_vars());
    $uri_arr = sopac_parse_uri();
    $form_desc = 'How would you like to label your ' . $uri_arr[1] . ' search for "' . l($uri_arr[2], $search_path, array('query' => $search_query)) . '" ?';
    $form['#redirect'] = 'user/library/searches';
    $form['sopac_savesearch_form'] = array('#type' => 'fieldset', '#title' => t($form_desc), '#collapsible' => FALSE);
    $form['sopac_savesearch_form']['searchname'] = array('#type' => 'textfield', '#title' => t('Search Label'), '#size' => 48, '#maxlength' => 128, '#required' => TRUE, '#default_value' => 'My custom ' . $uri_arr[1] . ' search for "' . $uri_arr[2] . '"');
    $form['sopac_savesearch_form']['uri'] = array('#type' => 'hidden', '#value' => $search_path . '?' . $search_query);
    $form['sopac_savesearch_form']['submit'] = array('#type' => 'submit', '#value' => t('Save'));
    return $form;
}
Exemplo n.º 6
0
    if (!is_array($getvars['facet_lexile'])) {
        $li_prop = ' class="closed"';
    } else {
        $li_prop = NULL;
    }
    print "<li{$li_prop}><span class=\"folder\">by Lexile</span> <small>({$lexile_count})</small><ul>\n";
    foreach ($locum_result['facets']['lexile'] as $lexile => $bib_lexile_count) {
        if (in_array($lexile, $facet_lexile)) {
            print '<li id="tree-kid" class="facet-item-selected"><strong>» ' . $lexile . "-" . ($lexile + 99) . "</strong></li>\n";
        } elseif ($lexile >= 100) {
            $getvars_tmp = $getvars;
            $getvars_tmp['facet_lexile'][] = urlencode($lexile);
            if (isset($getvars_tmp['page'])) {
                $getvars_tmp['page'] = '';
            }
            $link = l($lexile . '-' . ($lexile + 99), $uri, array('query' => sopac_make_pagevars(sopac_parse_get_vars($getvars_tmp))));
            print '<li id="tree-kid">» ' . $link . ' <small>(' . $bib_lexile_count . ")</small></li>\n";
            unset($getvars_tmp);
        }
    }
    print "</ul></li>\n";
}
/* Uncomment for subjects facet
$facet_subject = is_array($getvars['facet_subject']) ? $getvars['facet_subject'] : array();
$subject_count = count($locum_result['facets']['subject']);
if ($subject_count) {
  if (!is_array($getvars['facet_subject'])) {
    $li_prop = ' class="closed"';
  }
  else {
    $li_prop = NULL;