Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.25 KB | None | 0 0
  1. <?php
  2. // $Id: views-view-table.tpl.php,v 1.8.6.3 2010/12/10 08:19:15 dereine Exp $
  3. /**
  4.  * @file views-view-table.tpl.php
  5.  * Template to display a view as a table.
  6.  *
  7.  * - $title : The title of this group of rows.  May be empty.
  8.  * - $header: An array of header labels keyed by field id.
  9.  * - $header_classes: An array of header classes keyed by field id.
  10.  * - $fields: An array of CSS IDs to use for each field id.
  11.  * - $class: A class or classes to apply to the table, based on settings.
  12.  * - $row_classes: An array of classes to apply to each row, indexed by row
  13.  *   number. This matches the index in $rows.
  14.  * - $rows: An array of row items. Each row is an array of content.
  15.  *   $rows are keyed by row number, fields within rows are keyed by field ID.
  16.  * - $field_classes: An array of classes to apply to each field, indexed by
  17.  *   field id, then row number. This matches the index in $rows.
  18.  * @ingroup views_templates
  19.  */
  20. ?>
  21. <table class="<?php print $classes; ?>"<?php print $attributes; ?>>
  22.   <?php if (!empty($title)) : ?>
  23.     <caption><?php print $title; ?></caption>
  24.   <?php endif; ?>
  25.     <?php
  26.         echo '<pre>';
  27.         print_r($rows);
  28.         echo '</pre>';
  29.         $grades = array(
  30.             '1' =>  'entity_id_6',
  31.             '2' =>  'entity_id_10',
  32.             '3' =>  'entity_id_11',
  33.             '4' =>  'entity_id_12',
  34.             '5' =>  'entity_id_13',
  35.             '6' =>  'entity_id_14',
  36.             '7' =>  'entity_id_15',
  37.             '8' =>  'entity_id_16',
  38.             '9' =>  'entity_id_17',
  39.             '10' =>  'entity_id_7',
  40.             '11' =>  'entity_id_8',
  41.             '12' =>  'entity_id_9',
  42.             '13' =>  'entity_id_18',
  43.         );
  44.         $backwards_grades = array_reverse($grades);
  45.     ?>
  46.   <thead>
  47.     <tr>
  48.       <?php foreach ($header as $field => $label): ?>
  49.         <th class="<?php print $header_classes[$field]; ?>">
  50.         <?php
  51.             print_r($label);
  52.         ?>
  53.         </th>
  54.       <?php endforeach; ?>
  55.     </tr>
  56.   </thead>
  57.   <tbody>
  58.     <?php foreach ($rows as $count => $row): ?>
  59.       <tr class="<?php print implode(' ', $row_classes[$count]); ?>">
  60.         <?php foreach ($row as $field => $content): ?>
  61.           <td class="<?php print $field_classes[$field][$count]; ?>">
  62.             <?php
  63.                 print $field;
  64.                 print $content;
  65.             ?>
  66.           </td>
  67.         <?php endforeach; ?>
  68.       </tr>
  69.     <?php endforeach; ?>
  70.   </tbody>
  71. </table>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement