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

an innitial implementation of the CSV dump of federations - to be polished

parent 72abd159
Branches
Tags
3 merge requests!3Align master branch with twoln-dev,!2Synchronising towards version 2.5,!1Twoln dev
...@@ -454,7 +454,7 @@ class API { ...@@ -454,7 +454,7 @@ class API {
private function action_list_feds() { private function action_list_feds() {
$this->description([ $this->description([
'header' => "List federation details (code, name, contact email, registration authority string, status).", 'header' => "List federation details (code, name, contact email, registration authority string, status).",
'supportedFormats' => ['json', 'print_r'], 'supportedFormats' => ['json', 'csv', 'print_r'],
'arguments' => [ 'arguments' => [
[ [
'arg' => 'opt', 'arg' => 'opt',
...@@ -487,6 +487,17 @@ class API { ...@@ -487,6 +487,17 @@ class API {
$edugain = new eduGAIN($this->opts['opt']); $edugain = new eduGAIN($this->opts['opt']);
$F = $edugain->FEDS; $F = $edugain->FEDS;
ksort($F, SORT_STRING | SORT_FLAG_CASE); ksort($F, SORT_STRING | SORT_FLAG_CASE);
if ($this->format == 'csv') {
$out = '';
foreach ($F as $fed => $A) {
$ln = $fed . "\t" . implode("\t", $A) . "\n";
$out .= $ln;
}
return($out);
}
foreach ($F as $fed => $A) { foreach ($F as $fed => $A) {
$out[$fed] = ['name' => $A['name'], $out[$fed] = ['name' => $A['name'],
'email' => $A['contact_email'], 'email' => $A['contact_email'],
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment