set( 'Event-Id', $eventId ); $msg->set( 'Voting-Id', $votingId ); $msg->set( 'Include-Admin-Info', TRUE ); $msg->set( 'Include-Event-Data', TRUE ); $response = pas_check_response( $msg->send() ); if ( is_string( $response ) ){ eval( '?'.'>' . $tpl->compile( 'error.html' ) ); exit; } $voting = $response->get('Voting-Data'); $event = $response->get('Event-Data'); $path = ''; $eventName = array_pop( $Params ); foreach ( $Params as $part ){ $path .= '/' . $part; $breadcrumb[] = [ 'name' => $part, 'path' => $path ]; } include 'inc/voting_types.php'; $type = $votingTypes[ $voting['type'] ] ?? $voting['type']; if ( ! empty( $voting['voting_result']['options'] ) ){ $options = array_column( $voting['options'], NULL, 'id' ); $results = []; foreach ( $voting['voting_result']['options'] as $option => $votes ){ $optionId = substr( $option, 7 ); $data = $options[ $optionId ]; foreach ( $type['values'] as $key => $name ){ $data['counts'][] = [ 'value' => $key, 'name' => $name, 'count' => $votes[ "vote:{$key}" ] ?? 0 ]; $data['numbers'][] = $votes[ "vote:{$key}" ] ?? 0; } $results[] = $data; } if ( empty( $type['labels'] ) ){ $labels = array_column( $voting['options'], 'name' ); $results[0]['data']['numbers'] = array_fill( 0, count( $labels ), 0 ); $results = array_slice( $results, 0, 1 ); } else { $labels = array_values( $type['labels'] ); } if ( ! empty( $type['colors'] ) ){ $colors = array_values( $type['colors'] ); } } $path = ltrim( $path, '/' ); $parentLink = implode( '/', $Params ); $editable = $voting['status'] == 'idle' && ! empty( $voting['administrable'] ); $status[ $voting['status'] ] = TRUE; $status['has_started'] = $voting['status'] != 'idle'; $status['has_ended'] = in_array( $voting['status'], ['closed','finished'] ); $acceptances = [ '0' => 'nicht erlauben', '1' => 'ein Kommentar je Stimmzettel', '2' => 'ein Kommentar zu jeder Option', '3' => 'ein Kommentar je Stimmzettel und Option', ]; eval( '?'.'>' . $tpl->compile('voting.html') ); // end of file voting.php