0, 'error' => 'Token fehlt' ] ) ); } require_once 'lib/pas_access_tokens.class.php'; $Tokens = new PAS_Access_Tokens( $StorageDir ); $token = $Tokens->get( $_REQUEST['token'] ); if ( ! $token ){ die( json_encode( [ 'status' => 0, 'error' => 'Token ungültig' ] ) ); } if ( $token['object_class'] == 'event' ){ $msg = new ParTCP_Outgoing_Message( $token['server'], $token['identity'], 'event-details-request' ); $msg->set( 'Event-Id', $token['object_id'] ); $response = pas_check_response( $msg->send() ); if ( is_string( $response ) ){ die( json_encode( [ 'status' => 0, 'error' => 'Veranstaltungsdaten konnten nicht gelesen werden' ] ) ); } $event = $response->get('Event-Data'); $votings = $response->get('Votings'); $participants = $response->get('Participants'); $result['status'] = 1; $result['event'] = array_intersect_key( $event, [ 'name' => 0, 'short_description' => 0 ] ); $result['event']['participants'] = $participants['keys_submitted']; if ( ! empty( $votings ) ){ foreach ( $votings as $voting ){ if ( in_array( $voting['status'], [ 'open', 'closed', 'finished' ] ) ){ $currentVoting = $voting; if ( $voting['status'] == 'open' ){ break; } } } if ( ! empty( $currentVoting ) ){ $result['voting'] = array_intersect_key( $voting, array_flip( [ 'id', 'title', 'status', 'short_description', 'ballots_count', 'voting_result' ] ) ); } } die( json_encode( $result ) ); } echo json_encode( [ 'status' => 0, 'error' => 'Unbekannte Objektklasse' ] ); // end of file ajax/load_monitor_data.php