Regional Mexican chain Del Taco earned the highest accuracy ratings of the benchmark group.
Question: Was the drive-thru order accurate?
Click the header rows to sort the data.
'Chain', 'total' => 'Total', 'accurate_count' => 'Count', 'accurate_percent' => 'Percent', 'not_accurate_count' => 'Count', 'not_accurate_percent' => 'Percent', ); $sort_whitelist = array( 'Chain', 'accurate_percent', 'not_accurate_percent' ); $header = json_decode( $header_json ); $data = json_decode( $data_json, TRUE ); $sort_field = 'Chain'; if ( isset( $_GET['sort'] ) && in_array( $_GET['sort'], $sort_whitelist ) ) { $sort_field = $_GET['sort']; } $sort_dir = 'asc'; if ( isset( $_GET['dir'] ) && in_array( $_GET['dir'], array( 'desc', 'asc' ) ) ) { $sort_dir = $_GET['dir']; } $header_row_data = array(); foreach ( $header as $field ) { $sort_indicator = ''; $dest_dir = 'asc'; if ( $sort_field == $field ) { $sort_indicator = theme_tablesort_indicator( array( 'style' => $sort_dir ) ); if ( $sort_dir == 'asc' ) { $dest_dir = 'desc'; } } if ( in_array( $field, $sort_whitelist ) ) { $header_row_data[] = array( 'data' => l( $full_headers[$field], $_GET['q'], array( 'query' => array( 'sort' => $field, 'dir' => $dest_dir), 'html' => TRUE ) ) . $sort_indicator, 'class' => 'top-header', ); } else { $header_row_data[] = array( 'data' => $full_headers[$field],'class' => 'top-header', ); } } $table_rows = array(); $table_rows[] = array( array( 'data' => ' ', 'colspan' => 2, 'class' => 'top-header' ), array( 'data' => 'Accurate', 'colspan' => 2, 'class' => 'top-header' ), array( 'data' => 'Not Accurate', 'colspan' => 2, 'class' => 'top-header' ), ); $table_rows[] = $header_row_data; $sorted_rows = array(); $values = array(); foreach ( $data as $id => $value ) { $values[$id] = $value[$sort_field]; } if ( $sort_dir == 'asc' ) { asort( $values ); } else { arsort( $values ); } foreach ( $values as $key => $value ) { $row_cells = array(); foreach ( $header as $sort_field ) { $class = 'data'; if ( $sort_field == 'Chain' ) { $class = 'company'; } $row_cells[] = array( 'data' => $data[$key][$sort_field], 'class' => $class ); } $sorted_rows[] = $row_cells; } foreach ( $sorted_rows as $data_row ) { $table_rows[] = $data_row; } $table_rows[] = array( array('data' => 'Summary','class' => 'total-row',), array('data' => '2,002','class' => 'total-row',), array('data' => '1,807','class' => 'total-row',), array('data' => '90.3%','class' => 'total-row',), array('data' => '195','class' => 'total-row',), array('data' => '9.7%','class' => 'total-row',), ); // {"Chain":"Summary","not_accurate_count":"195","accurate_count":"1807","not_accurate_percent":"0.097","accurate_percent":"0.903","total":"2002"} print theme( 'table', array( 'header' => NULL, 'rows' => $table_rows, 'attributes' => array( 'id' => 'datatable' ) ) ); /* * this is a support function to sort the data based on the field & direction. * it returns an array that's used for the table row function get_2011_dt_oa_chart_sorted_rows( $data, $field, $dir, $header ) { $sorted_rows = array(); $values = array(); foreach ( $data as $id => $value ) { $values[$id] = $value[$field]; } if ( $dir == 'asc' ) { asort( $values ); } else { arsort( $values ); } foreach ( $values as $key => $value ) { $row_cells = array(); foreach ( $header as $field ) { $class = 'data'; $cell_data = $data[$key][$field]; if ( $field == 'Chain' ) { $class = 'company'; } if ( preg_match( '/percent/', $field ) ) { $cell_data .= '%'; } $row_cells[] = array( 'data' => $cell_data, 'class' => $class ); } $sorted_rows[] = $row_cells; } return $sorted_rows; } */ ?>Drive-Thru Benchmarks