Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

[r231]: wordpress-plugins / KohaCatalogSearch.php Maximize Restore History

Download this file

KohaCatalogSearch.php    88 lines (78 with data), 3.5 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<?php
/*
Plugin Name: KohaCatalogSearch
Plugin URI: http://kylehall.info/index.php/projects/koha-tools/koha-tools-wordpress-plugins/
Description: Allows one to add a search box to a Koha catalog on a WordPress site..
Version: 0.1
Author: Kyle Hall (c) 2007
Author URI: http://www.kylehall.info
*/
/* Copyright 2007 Kyle Hall (email : kyle@kylahall.info)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
function kcs_display_search_form() {
$kohaUrl = get_option('kcs_url');
$kohaBranchcode = get_option('kcs_branchcode');
$kohaLabel = get_option('kcs_label');
$kohaButton = get_option('kcs_button');
echo "
<form name='searchform' method='get' action='$kohaUrl/search' id='searchform'>
<h3><nobr>$kohaLabel</nobr></h3>
<ul>";
if ( $kohaBranchcode ) { echo "<input type='hidden' name='limit' value='branch:$kohaBranchcode' />"; }
echo "<input type='text' id='q' name='q' size='5' />
<input type='submit' name='kcs_submit' id='kcs_submit' value='$kohaButton' class='submit' />
</ul>
</form>
";
}
function add_kcs_options_page() {
if ( function_exists('add_options_page') ) {
add_options_page('KohaCatalogSearch', 'KohaCatalogSearch', 8, basename(__FILE__), 'kcs_options_page');
}
}
// kcs_options_page() displays the options page for the KohaCatalogSearch submenu
function kcs_options_page() {
echo "<h2>Koha Catalog Search</h2>";
if ( isset($_POST['info_update']) ) {
$kohaUrl = $_POST['kohaUrl'];
$kohaBranchcode = $_POST['kohaBranchcode'];
$kohaLabel = $_POST['kohaLabel'];
$kohaButton = $_POST['kohaButton'];
update_option('kcs_url', $kohaUrl);
update_option('kcs_branchcode', $kohaBranchcode);
update_option('kcs_label', $kohaLabel);
update_option('kcs_button', $kohaButton);
echo "<h3>Your Options Have Been Updated</h3>";
} else {
$kohaUrl = get_option('kcs_url');
$kohaBranchcode = get_option('kcs_branchcode');
$kohaLabel = get_option('kcs_label');
$kohaButton = get_option('kcs_button');
}
?>
<div class="wrap">
<h2>Enter Your Koha Information</h2>
<form method="post">
Catalog URL: <input type="text" name="kohaUrl" length="40" value="<?=$kohaUrl?>"> <i>The catalog URL up to but not including the final '/'.<br/>
Library Branchcode: <input type="text" name="kohaBranchcode" maxlength="4" value="<?=$kohaBranchcode?>"> <i>The branch to search on. Leave empty for all branches.</i> <br/>
Label Text: <input type="text" name="kohaLabel" value="<?=$kohaLabel?>"> <i>This text will appear before the search field.</i> <br/>
Submit Button Text: <input type="text" name="kohaButton" value="<?=$kohaButton?>"> <i>The text for the submit button.</i> <br/>
<div style="float: none;" class="submit">
<input type="submit" name="info_update" value="<?php _e('Update Options', 'UpdateOptions')?> ��" />
</div>
</form>
</div>
<?php
}
add_action('admin_menu', 'add_kcs_options_page');