Order Confirmation Board by Menu Category

    While more sandwich units have OCBs than last year, the percentage of burger restaurants with the boards fell 12 points

    array( 'sort_dir' => 'asc', 'indicator' => '', 'label' => 'Menu Category', ), 'percent_in_place' => array( 'sort_dir' => 'asc', 'indicator' => '', 'label' => 'Percent in Place', ), 'count_in_place' => array( 'sort_dir' => 'asc', 'indicator' => '', 'label' => 'Count in Place', ), ); if ( isset( $_GET['sort'] ) && in_array( $_GET['sort'], array_keys( $headers ) ) ) { $sort_field = $_GET['sort']; } else { $sort_field = 'menu_category'; } if ( isset( $_GET['dir'] ) && in_array( $_GET['dir'], array( 'asc', 'desc' ) ) ) { $sort_dir = $_GET['dir']; } else { $sort_dir = 'asc'; } $opposite_dir = ( $sort_dir == 'asc' ) ? 'desc' : 'asc'; $headers[$sort_field]['sort_dir'] = $opposite_dir; $headers[$sort_field]['indicator'] = theme_tablesort_indicator( array( 'style' => $sort_dir ) ); $header_cols = array(); foreach ( $headers as $field => $field_data ) { $header_cols[] = array( 'data' => l( $field_data['label'], $_GET['q'], array( 'query' => array( 'sort' => $field, 'dir' => $field_data['sort_dir'] ) ) ) . $field_data['indicator'], 'class' => 'header', ); } $table_rows = array(); $table_rows[] = $header_cols; /* begin of function area */ $sorted_data = array(); $values = array(); foreach ( $the_data as $id => $value ) { $values[$id] = $value->$sort_field; } if ( $sort_dir == 'asc' ) { asort( $values ); } else { arsort( $values ); } $sum = array(); foreach ( $values as $key => $value ) { $data_cells = array(); foreach ( $headers as $field => $field_data ) { $cell_data = $the_data[$key]->$field; if ( $field == 'percent_in_place' ) { $cell_data = number_format( $cell_data, 1 ) . '%'; } if ( $field == 'count_in_place' ) { $cell_data = number_format( $cell_data); } $classes = $field; if ( $field == $sort_field ) { $classes .= ' sorted'; } if( $key == 3 ) { $classes .= ' total-row'; } $data_cells[] = array( 'data' => $cell_data, 'class' => $classes ); } if($key != 3) { $table_rows[] = $data_cells; } else { $sum = $data_cells; } } $table_rows[] = $sum; /* end of functional area */ print theme( 'table', array( 'header' => array(), 'rows' => $table_rows, 'attributes' => array( 'id' => 'datatable' ) ) ); ?>
    SPONSORED BY