Ejemplo n.º 1
0
if (!$sysconf['enable_xml_detail']) {
    $biblio_list->xml_detail = false;
}
// if we are in searching mode
if (isset($_GET['search']) and !empty($_GET['search'])) {
    // default vars
    $is_adv = false;
    $keywords = '';
    $criteria = '';
    // simple search
    if (isset($_GET['keywords'])) {
        $keywords = trim(strip_tags(urldecode($_GET['keywords'])));
    }
    if ($keywords && !preg_match('@[a-z0-9_.]+=[^=]+\\s+@i', $keywords . ' ')) {
        $criteria = 'title=' . $keywords . ' OR author=' . $keywords . ' OR subject=' . $keywords;
        $biblio_list->setSQLcriteria($criteria);
    } else {
        $biblio_list->setSQLcriteria($keywords);
    }
    // advanced search
    $is_adv = isset($_GET['title']) || isset($_GET['author']) || isset($_GET['isbn']) || isset($_GET['subject']) || isset($_GET['location']) || isset($_GET['gmd']) || isset($_GET['colltype']);
    if ($is_adv) {
        $title = '';
        if (isset($_GET['title'])) {
            $title = trim(strip_tags(urldecode($_GET['title'])));
        }
        $author = '';
        if (isset($_GET['author'])) {
            $author = trim(strip_tags(urldecode($_GET['author'])));
        }
        $subject = '';
$datagrid->setSQLorder('item.last_update DESC');
// is there any search
if (isset($_GET['keywords']) and $_GET['keywords']) {
    $keywords = $dbs->escape_string(trim($_GET['keywords']));
    $searchable_fields = array('title', 'author', 'subject', 'itemcode');
    $search_str = '';
    // if no qualifier in fields
    if (!preg_match('@[a-z]+\\s*=\\s*@i', $keywords)) {
        foreach ($searchable_fields as $search_field) {
            $search_str .= $search_field . '=' . $keywords . ' OR ';
        }
    } else {
        $search_str = $keywords;
    }
    $biblio_list = new biblio_list($dbs);
    $criteria = $biblio_list->setSQLcriteria($search_str);
}
if (isset($criteria)) {
    $datagrid->setSQLcriteria('(' . $criteria['sql_criteria'] . ')');
}
// set table and table header attributes
$datagrid->table_attr = 'align="center" id="dataList" cellpadding="5" cellspacing="0"';
$datagrid->table_header_attr = 'class="dataListHeader" style="font-weight: bold;"';
// edit and checkbox property
$datagrid->edit_property = false;
$datagrid->chbox_property = array('itemID', __('Add'));
$datagrid->chbox_action_button = __('Add To Print Queue');
$datagrid->chbox_confirm_msg = __('Add to print queue?');
$datagrid->column_width = array('10%', '85%');
// set checkbox action URL
$datagrid->chbox_form_URL = $_SERVER['PHP_SELF'];
Ejemplo n.º 3
0
 if ($sysconf['index']['type'] == 'index') {
     require LIB . 'biblio_list_index.inc.php';
 } else {
     if ($sysconf['index']['type'] == 'sphinx' && file_exists(LIB . 'sphinx/sphinxapi.php')) {
         require LIB . 'sphinx/sphinxapi.php';
         require LIB . 'biblio_list_sphinx.inc.php';
         $sysconf['opac_result_num'] = (int) $sysconf['opac_result_num'];
     }
 }
 // create biblio list object
 try {
     $biblio_list = new biblio_list($dbs, $sysconf['opac_result_num']);
 } catch (Exception $err) {
     die($err->getMessage());
 }
 $sql_criteria = $biblio_list->setSQLcriteria($q);
 // cluster by GMD
 $gmd_cluster_q = $dbs->query('SELECT TRIM(gmd) AS `Cluster Name`, COUNT(biblio_id) AS `Cluster Count` FROM search_biblio AS `index` ' . ($sql_criteria['sql_criteria'] ? ' WHERE ' . $sql_criteria['sql_criteria'] : '') . ' GROUP BY `Cluster Name` LIMIT ' . $cluster_limit);
 if ($gmd_cluster_q->num_rows > 0) {
     echo '<h3 class="cluster-title">' . __('GMD') . '</h3>' . "\n";
     echo '<ul class="cluster-list">' . "\n";
     $i = 0;
     while ($cluster_data = $gmd_cluster_q->fetch_assoc()) {
         if (trim($cluster_data['Cluster Name']) == '') {
             continue;
         }
         $hidden = '';
         if ($i > $cluster_num_show - 1) {
             $hidden = ' cluster-hidden';
         }
         echo '<li class="cluster-item' . $hidden . '"><a href="index.php?keywords=' . urlencode('(' . $q . ') AND gmd="' . $cluster_data['Cluster Name'] . '"') . '&search=Search&fromcluster=1">' . $cluster_data['Cluster Name'] . ' <span class="cluster-item-count">' . $cluster_data['Cluster Count'] . '</span></a></li>' . "\n";