-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathedit_work.php
51 lines (43 loc) · 939 Bytes
/
edit_work.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
48
49
50
51
<?php
// create or edit a work
require_once("web.inc");
require_once("imslp_db.inc");
require_once("imslp_util.inc");
function form($work) {
if ($work) {
page_head("Edit work $work->title");
[$title, $first, $last] = parse_title($work->title);
$opus = $work->opus_catalogue;
} else {
page_head("Create work");
$title = '';
$first = '';
$last = '';
$opus = '';
}
form_start("edit_work.php");
form_input_text('Title', 'title', $title);
form_input_text('Opus/Catalogue', 'opus', $opus);
if ($work) {
form_submit('Update');
} else {
form_submit('Create');
}
form_end();
page_tail();
}
function create() {
}
function update() {
}
$id = get_int('id', true);
if ($id) {
$work = DB_work::lookup_id($id);
if (!$work) {
error_page('no such work');
}
form($work);
} else {
form(null);
}
?>