Sorted member lists
This commit is contained in:
@@ -537,4 +537,52 @@ class Renderer {
|
||||
return $decoded;
|
||||
}
|
||||
|
||||
protected function getMemberList(): array {
|
||||
$query = <<<queryend
|
||||
SELECT c.first_name, c.last_name , c.street , c.zip , c.town, c.birthdate, c.phone, c.email, c.child_name,
|
||||
c.child_street, c.subscription, c.bank_name, c.iban, c.bic, c.account_member_name, c.membership_status, c.salt, c.membership_start,
|
||||
cs.`status_text`, (SELECT ph.`payment_date` FROM `paying_history` ph WHERE ph.`clubmember_id` = c.`id` ORDER BY `payment_date` DESC LIMIT 1) as last_payment,
|
||||
cp.description
|
||||
FROM `clubmember` c
|
||||
JOIN `clubmember_status` cs
|
||||
ON cs.`id` = c.`membership_status`
|
||||
LEFT JOIN `clubmember_position` cp
|
||||
ON cp.id = c.position_id
|
||||
WHERE cs.`status_text` NOT IN ("Mitgliedschaft abgelehnt", "Mitgliedschaft gekündigt")
|
||||
queryend;
|
||||
$result = mysqli_query($this->dbConnection, $query);
|
||||
$entries = [];
|
||||
while ($row = mysqli_fetch_assoc($result)) {
|
||||
$entries[] = [
|
||||
'last_name' => $this->decode($row['last_name'], $row['salt']),
|
||||
'first_name' => $this->decode($row['first_name'], $row['salt']),
|
||||
'street' => $this->decode($row['street'], $row['salt']),
|
||||
'zip' => $this->decode($row['zip'], $row['salt']),
|
||||
'town' => $this->decode($row['town'], $row['salt']),
|
||||
'birthdate' => $this->decode($row['birthdate'], $row['salt']),
|
||||
'phone' => $this->decode($row['phone'], $row['salt']),
|
||||
'email' => $this->decode($row['email'], $row['salt']),
|
||||
// 'child_name' => $this->decode($row['child_name'], $row['salt']),
|
||||
// 'child_street' => $this->decode($row['child_street'], $row['salt']),
|
||||
'subscription' => $this->decode($row['subscription'], $row['salt']),
|
||||
'bank_name' => $this->decode($row['bank_name'], $row['salt']),
|
||||
'iban' => $this->decode($row['iban'], $row['salt']),
|
||||
'bic' => $this->decode($row['bic'], $row['salt']),
|
||||
'account_member_name' => $this->decode($row['account_member_name'], $row['salt']),
|
||||
'status_text' => $row['status_text'],
|
||||
'membership_start' => $row['membership_start'],
|
||||
'last_payment' => $row['last_payment'],
|
||||
'description' => $row['description'],
|
||||
];
|
||||
}
|
||||
return $this->sortUserList($entries);
|
||||
}
|
||||
|
||||
protected function sortUserList($userList): array {
|
||||
usort($userList, function($a, $b) {
|
||||
$nameComparison = strcmp($a['last_name'], $b['last_name']);
|
||||
return ($nameComparison !== 0) ? $nameComparison : strcmp($a['first_name'], $b['first_name']);
|
||||
});
|
||||
return $userList;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user