Skip to content
Snippets Groups Projects
Commit 0a0fb20f authored by Tomasz Wolniewicz's avatar Tomasz Wolniewicz
Browse files

Merge branch 'master' into 'master'

Updates by twoln

See merge request !31
parents e360817a 20ef0ac8
Branches
Tags
1 merge request!31Updates by twoln
......@@ -530,7 +530,7 @@ class API {
'header' => "Show federation detils.",
'supportedFormats' => ['json', 'print_r'],
'arguments' => [
$this->addStdArgument('fed_id', TRUE),
$this->addStdArgument('fed_id'),
$this->addStdArgument('reg_auth'),
$this->addStdArgument('format'),
],
......@@ -555,6 +555,7 @@ class API {
$show_email = 1;
}
$edugain->load_federation_details('sha1', $show_email);
$edugain->load_federation_stats();
$out = $edugain->FEDS[$this->fed_id];
return $out;
}
......
......@@ -143,29 +143,64 @@ function dateMissingCheck($federation, $fieldName) {
return !isset($federation[$fieldName]) || $federation[$fieldName] == '0000-00-00 00:00:00';
}
foreach ($edugain->FEDS as $countryCode => $federation) {
$status = $federation['status'];
$processedFederation = processFederation($federation);
$processedFederation['status'] = $status;
if ($status) { // This will exclude federations with a status of 0 (lib/Status.php ln 124)
if ($status < 4 && $status != 2) {
$candidates[] = $processedFederation;
} else if ($status > 3 && $status < 5) {
$votingOnly[] = $processedFederation;
} else if ($status == 6 || $status == 5) {
$participants[] = $processedFederation;
}
$data = [];
$singleFed = false;
$reg_auth_safe = '';
if (!empty($_REQUEST['fed_id'])) {
$code = $_REQUEST['fed_id'];
if (!preg_match('/^:?([a-zA-Z]*-?[a-zA-Z]*)(:[a-aA-Z]*-?[a-zA-Z]*)*$/', $code)) {
exit;
}
$singleFed = true;
}
if (!empty($_REQUEST['reg_auth'])) {
$reg_auth = $_REQUEST['reg_auth'];
$reg_auth_safe = $edugain->cleanInput($reg_auth);
$singleFed = true;
// print $reg_auth_safe;
}
$data = [];
$data['participants'] = $participants;
$data['votingOnly'] = $votingOnly;
$data['candidates'] = $candidates;
if (isset($_GET['issues'])) {
$data['problem_switch'] = 1;
if ($singleFed) {
$my_federation = '';
foreach ($edugain->FEDS as $countryCode => $federation) {
if ($code !== $countryCode && ($reg_auth_safe === '' || $reg_auth_safe !== $federation['reg_auth'])) {
continue;
}
$status = $federation['status'];
if ($status === 0) {
exit;
}
$processedFederation['status'] = $status;
$my_federation = processFederation($federation);
}
if ($my_federation === '') {
exit;
}
$data['federation'] = $my_federation;
echo $twig->render('status/status-members-details.html', $data);
} else {
$data['problem_switch'] = 0;
foreach ($edugain->FEDS as $countryCode => $federation) {
$status = $federation['status'];
$processedFederation = processFederation($federation);
$processedFederation['status'] = $status;
if ($status) { // This will exclude federations with a status of 0 (lib/Status.php ln 124)
if ($status < 4 && $status != 2) {
$candidates[] = $processedFederation;
} else if ($status > 3 && $status < 5) {
$votingOnly[] = $processedFederation;
} else if ($status == 6 || $status == 5) {
$participants[] = $processedFederation;
}
}
}
$data['participants'] = $participants;
$data['votingOnly'] = $votingOnly;
$data['candidates'] = $candidates;
if (isset($_GET['issues'])) {
$data['problem_switch'] = 1;
} else {
$data['problem_switch'] = 0;
}
echo $twig->render('status.html', $data);
}
echo $twig->render('status.html', $data);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment