diff --git a/dokuwiki/syntax.php b/dokuwiki/syntax.php index 36db935..44c32fc 100644 --- a/dokuwiki/syntax.php +++ b/dokuwiki/syntax.php @@ -29,8 +29,33 @@ class syntax_plugin_brmburo extends DokuWiki_Syntax_Plugin { public function render($mode, Doku_Renderer $renderer, $data) { // $data is what the function handle return'ed. if($mode == 'xhtml'){ + $spaceapi_status_json = '/home/brmdoor-web/spaceapi-status/brmstatus.json'; + $str = file_get_contents($spaceapi_status_json); /** @var Doku_Renderer_xhtml $renderer */ - $renderer->doc .= "BrmBuro: " . date('r'); + $status = "UNKNOWN"; + if ($str == FALSE) { + $status = "ERROR:FILE"; + } else { + $json = json_decode($str, true); + if ($json == NULL) { + $status = "ERROR:JSON"; + } else { + $opened = $json['state']['open']; + $lastchange = $json['state']['lastchange']; + if ($opened == TRUE) { + $status = + '