| franck@0 | 1 <?php | 
| franck@0 | 2 // $Id: views-calc-table.tpl.php,v 1.5 2009/04/21 13:09:16 karens Exp $ | 
| franck@0 | 3 /** | 
| franck@0 | 4  * @file views-view-table.tpl.php | 
| franck@0 | 5  * Template to display a view as a table. | 
| franck@0 | 6  * | 
| franck@0 | 7  * - $title : The title of this group of rows.  May be empty. | 
| franck@0 | 8  * - $header: An array of header labels keyed by field id. | 
| franck@0 | 9  * - $fields: An array of CSS IDs to use for each field id. | 
| franck@0 | 10  * - $class: A class or classes to apply to the table, based on settings. | 
| franck@0 | 11  * - $rows: An array of row items. Each row is an array of content | 
| franck@0 | 12  * - $totals: An array of calculated totals. Each row contains the total for one calculation. | 
| franck@0 | 13  *   keyed by field ID. | 
| franck@0 | 14  * @ingroup views_templates | 
| franck@0 | 15  */ | 
| franck@0 | 16 if (empty($rows) && empty($totals)) { | 
| franck@0 | 17   return; | 
| franck@0 | 18 } | 
| franck@0 | 19 ?> | 
| franck@0 | 20 <table class="<?php print $class; ?>"> | 
| franck@0 | 21   <?php if (!empty($title)) : ?> | 
| franck@0 | 22     <caption><?php print $title; ?></caption> | 
| franck@0 | 23   <?php endif; ?> | 
| franck@0 | 24   <thead> | 
| franck@0 | 25     <tr> | 
| franck@0 | 26       <?php foreach ($header as $field => $label): ?> | 
| franck@0 | 27         <th class="views-field views-field-<?php print $fields[$field]; ?> <?php print $options['info'][$field]['justification'] ?>"> | 
| franck@0 | 28           <?php print $label; ?> | 
| franck@0 | 29         </th> | 
| franck@0 | 30       <?php endforeach; ?> | 
| franck@0 | 31     </tr> | 
| franck@0 | 32   </thead> | 
| franck@0 | 33   <tbody> | 
| franck@0 | 34     <?php foreach ($rows as $count => $row): ?> | 
| franck@0 | 35       <tr class="<?php print ($count % 2 == 0) ? 'even' : 'odd';?>"> | 
| franck@0 | 36         <?php foreach ($row as $field => $content): ?> | 
| franck@0 | 37           <td class="views-field views-field-<?php print $fields[$field]; ?>  <?php print $options['info'][$field]['justification'] ?>"> | 
| franck@0 | 38             <?php print $content; ?> | 
| franck@0 | 39           </td> | 
| franck@0 | 40         <?php endforeach; ?> | 
| franck@0 | 41       </tr> | 
| franck@0 | 42     <?php endforeach; ?> | 
| franck@0 | 43   </tbody> | 
| franck@0 | 44   <tfoot> | 
| franck@0 | 45     <?php foreach ($sub_totals as $type => $row): ?> | 
| franck@0 | 46       <tr class="view-subfooter-number"> | 
| franck@0 | 47         <?php foreach ($row as $field => $content): ?> | 
| franck@0 | 48           <td class="view-subfooter views-field views-field-<?php print $fields[$field]; ?>  <?php print $options['info'][$field]['justification'] ?>"> | 
| franck@0 | 49             <?php print $content; ?> | 
| franck@0 | 50           </td> | 
| franck@0 | 51         <?php endforeach; ?> | 
| franck@0 | 52       </tr> | 
| franck@0 | 53     <?php endforeach; ?> | 
| franck@0 | 54     <?php foreach ($totals as $type => $row): ?> | 
| franck@0 | 55       <tr class="view-footer-number"> | 
| franck@0 | 56         <?php foreach ($row as $field => $content): ?> | 
| franck@0 | 57           <td class="view-footer views-field views-field-<?php print $fields[$field]; ?>  <?php print $options['info'][$field]['justification'] ?>"> | 
| franck@0 | 58             <?php print $content; ?> | 
| franck@0 | 59           </td> | 
| franck@0 | 60         <?php endforeach; ?> | 
| franck@0 | 61       </tr> | 
| franck@0 | 62     <?php endforeach; ?> | 
| franck@0 | 63   </tfoot> | 
| franck@0 | 64 | 
| franck@0 | 65 </table> |