-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpublisher.php
More file actions
65 lines (56 loc) · 1.46 KB
/
Copy pathpublisher.php
File metadata and controls
65 lines (56 loc) · 1.46 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
<?php
require_once("imslp_db.inc");
require_once("imslp_web.inc");
require_once("web.inc");
define('RESULTS_PER_PAGE', 50);
function limit_clause($offset) {
return sprintf('limit %d, %d', $offset, RESULTS_PER_PAGE);
}
function next_link($offset) {
echo sprintf("<p><a href=publisher.php?offset=%d>Next %d</a>",
$offset+RESULTS_PER_PAGE, RESULTS_PER_PAGE
);
}
function publisher_list($offset) {
$pubs = DB_publisher::enum('', 'order by name '.limit_clause($offset));
page_head("Publishers");
start_table();
row_heading_array([
'Name<br><small>Click to view scores</small>',
'Imprint', 'Location'
]);
foreach ($pubs as $pub) {
row_array([
"<a href=publisher.php?id=$pub->id>$pub->name</a>",
$pub->imprint, $pub->location
]);
}
end_table();
if (count($pubs)==RESULTS_PER_PAGE) {
next_link($offset);
}
page_tail();
}
// show list of scores by a publisher
//
function scores_by_publisher($id) {
$pub = DB_publisher::lookup_id($id);
page_head("Scores published by $pub->name");
$sets = DB_score_file_set::enum("publisher_id=$id");
start_table();
score_table_header();
foreach ($sets as $set) {
score_table_row($set);
}
end_table();
page_tail();
}
$offset = get_int('offset', true);
if (!$offset) $offset = 0;
$id = get_int('id', true);
if ($id) {
scores_by_publisher($id);
} else {
publisher_list($offset);
}
?>