The Drive-Thru Performance Study: Landscaping Condition

    No need to worry about unkempt drive thrus; nearly all of each benchmark chains’ units were in tip-top shape.

    array( 'sort_dir' => 'asc', 'indicator' => '', 'label' => 'Chain', ), 'count' => array( 'sort_dir' => 'asc', 'indicator' => '', 'label' => 'Count', ), 'percent' => array( 'sort_dir' => 'asc', 'indicator' => '', 'label' => 'Percent', ), ); if ( in_array( $_GET['sort'], array_keys( $headers ) ) ) { $sort_field = $_GET['sort']; } else { $sort_field = 'chain'; } if ( 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']), 'html' => TRUE ) ) . $field_data['indicator'], 'class' => 'header' ); } $table_rows = array(); $table_rows[] = array( array( 'data' => ' ', 'class' => 'top-header', ), array( 'data' => 'Good Condition', 'colspan' => 2, 'class' => 'top-header', ), ); $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 ); } foreach ( $values as $key => $value ) { $data_cells = array(); foreach ( $headers as $field => $field_data ) { $cell_data = $the_data[$key]->$field; if ( preg_match( '/percent/', $field ) ) { $cell_data = number_format( $cell_data, 1 ) . '%'; } $classes = $field; if ( $field == $sort_field ) { $classes .= ' sorted'; } $data_cells[] = array( 'data' => $cell_data, 'class' => $classes ); } $sorted_data[] = $data_cells; } /* end of functional area */ foreach ( $sorted_data as $data_row ) { $table_rows[] = $data_row; } // summary $table_rows[] = array( array('data' => 'Summary','class' => 'total-row',), array('data' => '1,296','class' => 'total-row',), array('data' => '96.1%','class' => 'total-row',), ); print theme( 'table', array( 'header' => NULL, 'rows' => $table_rows, 'attributes' => array( 'id' => 'datatable' ) ) ); ?>
    SPONSORED BY