This repository has been archived by the owner on Sep 18, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
stats.php
42 lines (31 loc) · 1.57 KB
/
stats.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
<?php
require_once(dirname(__FILE__) . "/config.inc.php");
require_once(VPANEL_UI . "/session.class.php");
$session = $config->getSession();
$ui = $session->getTemplate();
if (!$session->isAllowed("stats_show")) {
$ui->viewLogin();
exit;
}
require_once(VPANEL_CORE . "/mitgliedermatcher/logic.class.php");
require_once(VPANEL_CORE . "/mitgliedermatcher/state.class.php");
require_once(VPANEL_CORE . "/mitgliedermatcher/mitgliedschaft.class.php");
require_once(VPANEL_CORE . "/mitgliedermatcher/ausgetreten.class.php");
$storage = $session->getStorage();
$matcher = new AndMitgliederMatcher(new GliederungMitgliederMatcher($session->getAllowedGliederungIDs("mitglieder_show")),
new NotMitgliederMatcher(new AusgetretenMitgliederMatcher()) );
$mitgliedercount = $storage->getMitgliederCount($matcher);
$mitgliedschaften = $storage->getMitgliedschaftList();
$countPerMitgliedschaft = array();
foreach ($storage->getMitgliedschaftList() as $mitgliedschaft) {
$count = $storage->getMitgliederCount(new AndMitgliederMatcher($matcher, new MitgliedschaftMitgliederMatcher($mitgliedschaft->getMitgliedschaftID())));
$countPerMitgliedschaft[$mitgliedschaft->getMitgliedschaftID()] = $count;
}
$states = $storage->getStateList();
$countPerState = array();
foreach ($states as $state) {
$count = $storage->getMitgliederCount(new AndMitgliederMatcher($matcher, new StateMitgliederMatcher($state->getStateID())));
$countPerState[$state->getStateID()] = $count;
}
$ui->viewStats($mitgliedercount, $mitgliedschaften, $countPerMitgliedschaft, $states, $countPerState);
?>