-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsearch_ensemble.php
47 lines (41 loc) · 1.23 KB
/
search_ensemble.php
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
<?php
require_once("web.inc");
require_once("imslp_db.inc");
require_once("imslp_web.inc");
function ensemble_search_action() {
$type = get_str('type');
$period_id = get_str('period_id');
$nationality_id = get_str('nationality_id');
$name = strtolower(trim(get_str('name')));
$wheres = [];
if ($name && $name != 'any') {
$wheres[] = sprintf("name like '%%%s%%'", DB::escape($name));
}
if ($type != 'any') {
$wheres[] = sprintf("type='%s'", DB::escape($type));
}
if ($period_id) {
$wheres[] = "period_id=$period_id";
}
if ($nationality_id) {
$wheres[] = "nationality_id=$nationality_id";
}
$where = implode(' and ', $wheres);
$es = DB_ensemble::enum($where);
page_head("Ensembles");
start_table();
row_heading_array(['Name', 'Type', 'Nationality', 'Period', 'Founded']);
foreach ($es as $e) {
row_array([
"<a href=ensemble.php?id=$e->id>$e->name</a>",
$e->type,
$e->nationality_id?nationality_name($e->nationality_id):'',
$e->period_id?period_name($e->period_id):'',
$e->born_year?$e->born_year:''
]);
}
end_table();
page_tail();
}
ensemble_search_action();
?>