Changeset 28355
- Timestamp:
- 03/03/10 02:49:26 (3 years ago)
- Files:
-
- plugins/dcPropelReportsPlugin/trunk/lib/dcPropelReportColumnWrapper.class.php (added)
- plugins/dcPropelReportsPlugin/trunk/modules/dc_report_list/actions/actions.class.php (modified) (7 diffs)
- plugins/dcPropelReportsPlugin/trunk/modules/dc_report_list/templates/_result.php (modified) (1 diff)
- plugins/dcPropelReportsPlugin/trunk/modules/dc_report_list/templates/_result_row.php (modified) (1 diff)
- plugins/dcPropelReportsPlugin/trunk/modules/dc_report_list/templates/indexSuccess.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
plugins/dcPropelReportsPlugin/trunk/modules/dc_report_list/actions/actions.class.php
r26307 r28355 109 109 } 110 110 111 $this->pager = $this->getPager();111 $this->pager = $this->getPager(); 112 112 113 113 $this->export_pager= $this->getExportPager(); … … 116 116 $this->filters->setDefaults($this->getFilters()); 117 117 $this->sort = $this->getTestSort(); 118 119 $this->column_wrappers = $this->buildColumnsWrappers(); 120 121 } 122 123 protected function buildColumnsWrappers() 124 { 125 $ret = array(); 126 foreach ($this->report_query->getdcReportFields() as $field) 127 { 128 $ret[] = new dcPropelReportColumnWrapper($field); 129 } 130 return $ret; 118 131 } 119 132 … … 196 209 197 210 $this->sort = $this->getTestSort(); 211 212 $this->column_wrappers = $this->buildColumnsWrappers(); 198 213 199 214 $this->setTemplate('index'); … … 256 271 } 257 272 258 $objWriter = new PHPExcel_Writer_Excel5($this->buildExcel($this->report_query, $results ));273 $objWriter = new PHPExcel_Writer_Excel5($this->buildExcel($this->report_query, $results, $this->column_wrappers = $this->buildColumnsWrappers())); 259 274 260 275 $tmp_dir = '/tmp/'; … … 262 277 $objWriter->save($file_name); 263 278 $this->file = $file_name; 279 280 264 281 265 282 … … 271 288 } 272 289 273 private function buildExcel($report_query, $results )290 private function buildExcel($report_query, $results, $column_wrappers) 274 291 { 275 292 $objPHPExcel = new sfPhpExcel(); 276 293 $objPHPExcel->setActiveSheetIndex(0); 277 294 $this->writeHeader($report_query, $objPHPExcel); 278 $this->writeRows($report_query,$results, $objPHPExcel );295 $this->writeRows($report_query,$results, $objPHPExcel, $column_wrappers); 279 296 return $objPHPExcel; 280 297 } … … 291 308 } 292 309 293 private function writeRows($report_query, $results, $objPHPExcel )310 private function writeRows($report_query, $results, $objPHPExcel, $column_wrappers) 294 311 { 295 312 $row = 2; 296 313 foreach ($results as $data_row) { 297 314 $column = 0; 298 foreach($data_row as $key=>$value) { 299 $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($column, $row,$value); 315 foreach($data_row as $key=>$value) { 316 $wrapper = $column_wrappers[$column]; 317 $wrapper->setValue($value); 318 $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($column, $row,$wrapper->getValue(true)); 300 319 $column++; 301 320 } plugins/dcPropelReportsPlugin/trunk/modules/dc_report_list/templates/_result.php
r26307 r28355 27 27 <?php foreach ($pager->getResults() as $key => $row): $odd = fmod(++$i, 2) ? 'odd' : 'even' ?> 28 28 <tr class="sf_admin_row <?php echo $odd ?>"> 29 <?php include_partial('dc_report_list/result_row', array('row' => $row )) ?>29 <?php include_partial('dc_report_list/result_row', array('row' => $row,'column_wrappers'=> $column_wrappers)) ?> 30 30 </tr> 31 31 <?php endforeach; ?> plugins/dcPropelReportsPlugin/trunk/modules/dc_report_list/templates/_result_row.php
r26307 r28355 1 <?php $i=0; ?> 1 2 <?php foreach($row as $key=>$field): ?> 3 <?php $wrapper = $column_wrappers[$i]; ?> 4 <?php $wrapper->setValue($field); ?> 2 5 <td class="sf_admin_text"> 3 <?php echo $ field?>6 <?php echo $wrapper->getValue(true); ?> 4 7 </td> 8 <?php $i++; ?> 5 9 <?php endforeach ?> plugins/dcPropelReportsPlugin/trunk/modules/dc_report_list/templates/indexSuccess.php
r26307 r28355 17 17 'export_pager' => $export_pager, 18 18 'dc_report_query'=>$report_query, 19 'sort' => $sort)) ?> 19 'sort' => $sort, 20 'column_wrappers' => $column_wrappers)) ?> 20 21 </div> 21 22