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

unifying the options naming

parent bc77e1b4
No related branches found
No related tags found
1 merge request!29Master
...@@ -91,6 +91,7 @@ class API { ...@@ -91,6 +91,7 @@ class API {
'show_list', 'show_list',
'new_entities', 'new_entities',
'only_errors', 'only_errors',
'only_issues',
'url_type', 'url_type',
'mod_time', 'mod_time',
'lang', 'lang',
...@@ -301,6 +302,11 @@ class API { ...@@ -301,6 +302,11 @@ class API {
$optValue = 0; $optValue = 0;
} }
break; break;
case 'only_issues':
if ($optValue != 1 && $optValue != 2) {
$optValue = 0;
}
break;
case 'details': case 'details':
if ($optValue != 1) { if ($optValue != 1) {
$optValue = 0; $optValue = 0;
...@@ -577,11 +583,11 @@ class API { ...@@ -577,11 +583,11 @@ class API {
$this->addStdArgument('fed_id'), $this->addStdArgument('fed_id'),
$this->addStdArgument('reg_auth'), $this->addStdArgument('reg_auth'),
[ [
'arg' => 'only_errors', 'arg' => 'only_issues',
'required' => FALSE, 'required' => FALSE,
'default' => '0', 'default' => '0',
'values' => '0, 1, 2', 'values' => '0, 1, 2',
'description' => '0 - show all; 1 - only federations with feed problems and these with feeds close to expiry; 2 - show only federations with expiry time below the set valid_sec value'], 'description' => '0 - show all; 1 - only federations with feed issues and these with feeds close to expiry; 2 - show only federations with expiry time below the set valid_sec value'],
[ [
'arg' => 'valid_sec', 'arg' => 'valid_sec',
'required' => FALSE, 'required' => FALSE,
...@@ -603,7 +609,7 @@ class API { ...@@ -603,7 +609,7 @@ class API {
when no federation code is present an array of code-indexed participating federations with details as described above' when no federation code is present an array of code-indexed participating federations with details as described above'
], ],
'examples' => [ 'examples' => [
['opt' => ['only_errors'=>1,], 'title' => 'only fedrations with problems',], ['opt' => ['only_issues'=>1,], 'title' => 'only fedrations with issues',],
['opt' => ['fed_id' => 'PIONIER-ID',],'title' => 'show status of PIONIER.Id',], ['opt' => ['fed_id' => 'PIONIER-ID',],'title' => 'show status of PIONIER.Id',],
['opt' => ['fed_id' => 'PIONIER-ID',], 'format' => 'json', 'title' => 'show status of PIONIER.Id in JSON',] ['opt' => ['fed_id' => 'PIONIER-ID',], 'format' => 'json', 'title' => 'show status of PIONIER.Id in JSON',]
] ]
...@@ -613,7 +619,7 @@ class API { ...@@ -613,7 +619,7 @@ class API {
} }
$edugain = new eduGAIN(5, $this->fed_id, true); $edugain = new eduGAIN(5, $this->fed_id, true);
$edugain->load_federations_state(); $edugain->load_federations_state();
if ($this->opts['only_errors'] > 0) { if ($this->opts['only_issues'] > 0) {
$out = []; $out = [];
if ($this->opts['valid_sec'] > 0) { if ($this->opts['valid_sec'] > 0) {
$sec = $this->opts['valid_sec']; $sec = $this->opts['valid_sec'];
...@@ -621,12 +627,12 @@ class API { ...@@ -621,12 +627,12 @@ class API {
$sec = VALIDITY_WARNING_THRESHOLD; $sec = VALIDITY_WARNING_THRESHOLD;
} }
foreach ($edugain->FEDS as $fed) { foreach ($edugain->FEDS as $fed) {
if ($this->opts['only_errors'] == 2) { if ($this->opts['only_issues'] == 2) {
if ($fed['valid_sec'] < $sec) { if ($fed['valid_sec'] < $sec) {
$out[$fed['code']] = $fed; $out[$fed['code']] = $fed;
} }
} }
if ($this->opts['only_errors'] == 1) { if ($this->opts['only_issues'] == 1) {
if ($fed['valid_sec'] < $sec || $fed['feed_problem'] > 0 ) { if ($fed['valid_sec'] < $sec || $fed['feed_problem'] > 0 ) {
$out[$fed['code']] = $fed; $out[$fed['code']] = $fed;
} }
......
...@@ -163,7 +163,7 @@ $data = []; ...@@ -163,7 +163,7 @@ $data = [];
$data['participants'] = $participants; $data['participants'] = $participants;
$data['votingOnly'] = $votingOnly; $data['votingOnly'] = $votingOnly;
$data['candidates'] = $candidates; $data['candidates'] = $candidates;
if (isset($_GET['problems'])) { if (isset($_GET['issues'])) {
$data['problem_switch'] = 1; $data['problem_switch'] = 1;
} else { } else {
$data['problem_switch'] = 0; $data['problem_switch'] = 0;
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
</div> </div>
<div> <div>
<input type="checkbox" id="problem_filter" /> <input type="checkbox" id="problem_filter" />
<label for="include_problems">Limit to current feed problems</label> <label for="include_issues">Limit to current feed issues</label>
</div> </div>
</div> </div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment