Advertisement
hungaudi

tabular report v

Dec 28th, 2014
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.32 KB | None | 0 0
  1. <?php
  2. if($export_excel == 1)
  3. {
  4.     $rows = array();
  5.     $row = array();
  6.     foreach ($headers as $header)
  7.     {
  8.         $row[] = strip_tags($header['data']);
  9.     }
  10.    
  11.     $rows[] = $row;
  12.    
  13.     foreach($data as $datarow)
  14.     {
  15.         $row = array();
  16.         foreach($datarow as $cell)
  17.         {
  18.             $row[] = strip_tags($cell['data']);
  19.         }
  20.         $rows[] = $row;
  21.     }
  22.    
  23.     $content = array_to_csv($rows);
  24.    
  25.     force_download(strip_tags($title) . '.csv', $content);
  26.     exit;
  27. }
  28. ?>
  29. <?php $this->load->view("partial/header"); ?>
  30. <div id="content_area_wrapper">
  31. <div id="content_area">
  32. <table id="title_bar_new">
  33.     <tr>
  34.         <td id="title_icon">
  35.             <img src='<?php echo base_url()?>images/menubar/reports.png' alt='<?php echo lang('reports_reports'); ?> - <?php echo lang('reports_welcome_message'); ?>' />
  36.         </td>
  37.         <td id="title"><?php echo lang('reports_reports'); ?> - <?php echo $title ?></td>
  38.     </tr>
  39.     <tr>
  40.         <td>&nbsp;</td>
  41.         <td><small><?php echo $subtitle ?></small></td>
  42.     </tr>
  43.  
  44. </table>
  45.  
  46. <br /><div style="color:#000">
  47. <table id="contents">
  48.     <tr>
  49.         <td id="item_table">
  50.             <div id="table_holder" style="width: 960px;">
  51.                 <table class="tablesorter report" id="sortable_table">
  52.                     <thead>
  53.                         <tr>
  54.                             <?php foreach ($headers as $header) { ?>
  55.                             <th align="<?php echo $header['align'];?>"><?php echo $header['data']; ?></th>
  56.                             <?php } ?>
  57.                         </tr>
  58.                     </thead>
  59.                     <tbody>
  60.                         <?php foreach ($data as $row) { ?>
  61.                         <tr>
  62.                             <?php foreach ($row as $cell) { ?>
  63.                             <td align="<?php echo $cell['align'];?>"><?php echo $cell['data']; ?></td>
  64.                             <?php } ?>
  65.                         </tr>
  66.                         <?php } ?>
  67.                     </tbody>
  68.                 </table>
  69.             </div> 
  70.        
  71.             <div id="report_summary" class="tablesorter report" style="margin-right: 10px;">
  72.             <?php foreach($summary_data as $name=>$value) { ?>
  73.                 <div class="summary_row"><?php echo "<strong>".lang('reports_'.$name). '</strong>: '.to_currency($value); ?></div>
  74.             <?php } ?>
  75.             </div>
  76.         </td>
  77.     </tr>
  78. </table>
  79. <div id="feedback_bar"></div>
  80. </div></div></div>
  81. <?php $this->load->view("partial/footer"); ?>
  82.  
  83. <script type="text/javascript" language="javascript">
  84. function init_table_sorting()
  85. {
  86.     //Only init if there is more than one row
  87.     if($('.tablesorter tbody tr').length >1)
  88.     {
  89.         $("#sortable_table").tablesorter();
  90.     }
  91. }
  92. $(document).ready(function()
  93. {
  94.     init_table_sorting();
  95. });
  96. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement