-
Notifications
You must be signed in to change notification settings - Fork 0
/
ensemble.php
128 lines (115 loc) · 4.03 KB
/
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
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
<?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 page
require_once("../inc/util.inc");
require_once("../inc/mm.inc");
require_once("../inc/ensemble.inc");
require_once("../inc/mm_db.inc");
function show_ensemble($ens_id, $user) {
$profile = read_profile($ens_id, ENSEMBLE);
$ens = Ensemble::lookup_id($ens_id);
if (!$ens) error_page("no such ensemble");
page_head(sprintf("Ensemble: %s", $ens->name));
start_table();
row2("Ensemble type", ensemble_type_str($profile->type));
row2("Instruments",
lists_to_string(
INST_LIST_FINE, $profile->inst, $profile->inst_custom
)
);
row2("Styles",
lists_to_string(
STYLE_LIST, $profile->style, $profile->style_custom
)
);
row2("Levels",
lists_to_string(LEVEL_LIST, $profile->level)
);
if ($profile->link) {
row2("Links", links_to_string($profile->link));
}
$founder = BoincUser::lookup_id($ens->user_id);
row2("Founder",
"<a href=user.php?user_id=$founder->id>$founder->name</a>"
);
$other_members = ens_members_string($ens->id);
if ($other_members) {
row2("Other members", $other_members);
}
row2("Description", $profile->description);
if ($profile->signature_filename) {
row2('Audio signature',
sprintf('<a href=%s/%d.mp3>%s</a>',
role_dir(ENSEMBLE), $ens_id, $profile->signature_filename
)
);
}
row2('Performing',
sprintf('Regularly: %s. Usually paid: %s',
$profile->perf_reg?"yes":"no",
$profile->perf_paid?"yes":"no"
)
);
if ($ens->user_id == $user->id) {
// founder
$x = $profile->seeking_members?"Seeking new members":"Not seeking new members";
$ems = EnsembleMember::enum(
sprintf("ensemble_id=%d and status=%d", $ens->id, EM_PENDING)
);
if ($ems) {
$x .= "<br>There are outstanding membership requests.
<a href=ensemble_join.php?action=review&ens_id=$ens->id>Review</a>.
";
}
} else {
$em = EnsembleMember::lookup("user_id=$user->id and ensemble_id=$ens_id");
if ($em) {
if ($em->status == EM_APPROVED) {
$x = "You are a member.
<br><a href=ensemble_join.php?action=resign&ens_id=$ens->id>Resign</a>
";
} else {
$x = em_status_string($em->status);
}
} else {
if ($profile->seeking_members) {
$x = mm_button_text(
"ensemble_join.php?ens_id=$ens_id",
"Request membership",
BUTTON_SMALL
);
} else {
$x = "Not seeking new members";
}
}
}
row2("Membership", $x);
if ($user->id == $ens->user_id) {
row2('', mm_button_text("ensemble_edit.php?ens_id=$ens_id", "Edit ensemble"));
if ($other_members) {
row2('', mm_button_text("ensemble_join.php?ens_id=$ens_id&action=remove_list", "Remove members", BUTTON_SMALL));
}
}
end_table();
page_tail();
}
$user = get_logged_in_user();
update_visit_time($user);
$id = get_int('ens_id');
show_ensemble($id, $user);
?>