Beispiel #1
0
 public function exportCsv(App_Grid_Filter $filter, $exportFileName)
 {
     $filter->setup();
     $list = $filter->getList();
     $this->render($list, $filter->getheaderTitles(), $filter->getFields(), $exportFileName);
 }
Beispiel #2
0
 public function renderSimpleTable(App_Grid_Filter $filter, array $list = null)
 {
     $columnConfig = $this->_columnConfig;
     $table = '';
     if ($list == null) {
         $list = $filter->getList();
     }
     $widths = $filter->getCalibateCellWidths();
     $titles = $filter->getheaderTitles();
     //print_r($titles);
     $tWidth = $filter->getTableWidth();
     $view = $this->view;
     $gridwidth = $filter->getGridWidth();
     $table .= '<table  id="' . $this->_gridid . '" width="100%" style="width:100%"  cellspacing="3" cellpadding="4" class="extensions" >';
     $table .= "<thead><tr>";
     $i = 0;
     foreach ($titles as $index => $title) {
         $width = $widths[$i];
         $table .= '<th  style=" width:' . $width . ';" >';
         $table .= ucfirst(App_Util::splitByCaps($this->_translate($title)));
         $table .= '</th>';
         ++$i;
     }
     $table .= "</tr></thead><tbody>";
     if (is_array($list)) {
         foreach ($list as $id => $row) {
             $table .= "<tr>";
             $fileds = $filter->getFields();
             foreach ($fileds as $filed) {
                 $align = in_array($columnConfig->fields[$filed]->align, App_Model_Config::$alignList) ? $columnConfig->fields[$filed]->align : 'left';
                 $filedValue = $this->filter()->fieldTranform($row, $filed);
                 $table .= '<td style="text-align:' . $align . '" >' . $filedValue . '</td>';
             }
             $table .= "</tr>";
         }
     } else {
         $table .= $this->_getBlankRows(count($titles));
     }
     $table .= '</tbody></table>';
     return $table;
 }