-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathensemble_search.php
More file actions
100 lines (92 loc) · 3.06 KB
/
ensemble_search.php
File metadata and controls
100 lines (92 loc) · 3.06 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
89
90
91
92
93
94
95
96
97
98
99
100
<?php
// This file is part of Music Match.
// Copyright (C) 2022 David P. Anderson
//
// Music Match is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// Music Match 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 Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with Music Match. If not, see <http://www.gnu.org/licenses/>.
// --------------------------------------------------------------------
// ensemble search
//
// If you add any search parameters, add them in search.inc too
require_once("../inc/util.inc");
require_once("../inc/mm.inc");
require_once("../inc/ensemble.inc");
require_once("../inc/search.inc");
function ens_search_form() {
page_head("Search for ensembles");
form_start("ensemble_search.php", "POST");
form_checkboxes("Ensemble type",
items_list(ENSEMBLE_TYPE_LIST, array(), "type")
);
form_checkboxes("Instruments",
items_list(INST_LIST_FINE, array(), "inst")
);
form_checkboxes("Styles",
items_list(STYLE_LIST, array(), "style")
);
form_checkboxes("Level",
items_list(LEVEL_LIST, array(), "level")
);
radio_bool("Seeking new members", 'seeking_members');
radio_bool("Perform regularly", 'perf_reg');
radio_bool("Paid to perform", 'perf_paid');
form_checkboxes(
"Close to me", array(array('close', '', false))
);
form_input_text(
'Description includes', 'writing'
);
form_submit("Search", 'name=submit value=on');
form_end();
page_tail();
}
function get_form_args() {
$x = new StdClass;
$x->type = parse_list(ENSEMBLE_TYPE_LIST, "type");
$x->inst = parse_list(INST_LIST_FINE, "inst");
$x->style = parse_list(STYLE_LIST, "style");
$x->level = parse_list(LEVEL_LIST, "level");
$x->seeking_members = post_str('seeking_members');
$x->perf_reg = post_str('perf_reg');
$x->perf_paid = post_str('perf_paid');
$x->close = post_str('close', true)=='on';
$x->writing = post_str('writing');
return $x;
}
function ens_search_action($req_user) {
page_head("Ensemble search results");
$form_args = get_form_args();
$ensembles = ens_search($form_args, $req_user);
if (!$ensembles) {
echo "No results found. Try changing your criteria.";
page_tail();
return;
}
start_table('table-striped');
ens_profile_summary_header();
foreach ($ensembles as $e) {
ens_profile_summary_row($e);
}
end_table();
page_tail();
record_search($req_user, ENSEMBLE, $form_args, $ensembles);
}
$action = post_str("submit", true);
$user = get_logged_in_user();
update_visit_time($user);
if ($action) {
ens_search_action($user);
} else {
ens_search_form();
}
?>