Exemplo n.º 1
0
 function display()
 {
     $Data = $this->getObjData();
     $Display = '<table class="table ifx-table">';
     $Display .= '<thead>';
     foreach ($this->fieldset(isset($Data[0]) ? $Data[0] : $this->Obj) as $Column) {
         if (!isset($this->hiddenColumn[$Column])) {
             if (isset($this->columnTitles[$Column])) {
                 $Title = $this->columnTitles[$Column];
             } else {
                 $Title = ucfirst($Column);
             }
             $Display .= '<th><form method="post"><button type="submit" name="ifxTable[sortBy]" value="' . $Column . '">' . $Title . '</button></form></th>';
         }
     }
     $Display .= '</thead>';
     $Display .= '<tbody>';
     if (count($Data) > 0) {
         foreach ($Data as $Row) {
             $Display .= '<tr>';
             $cols = 0;
             foreach ($this->fieldset($Row) as $Column) {
                 if (!isset($this->hiddenColumn[$Column]) && !isset($this->dynamicColumn[$Column])) {
                     $Display .= '<td>' . $this->_formatField($Column, $Row->{$Column}) . '</td>';
                     $cols++;
                 }
                 if (isset($this->dynamicColumn[$Column])) {
                     $Fn = $this->dynamicColumn[$Column];
                     $Display .= '<td>' . $Fn($Row) . '</td>';
                     $cols++;
                 }
             }
             $Display .= '</tr>';
         }
     } else {
         $Display .= '<tr class="no-data"><td colspan="' . count($this->columnTitles) . '">No data Available</td></tr>';
     }
     $Display .= '</tbody>';
     $Display .= '<tfoot>';
     $Display .= '<tr><td colspan="' . $cols . '">';
     $Display .= '<div class="page-of-page">';
     $Display .= ($this->pageOffset < 1 ? 0 : $this->pageLimit * $this->pageOffset) + 1 . '-' . min($this->pageOffset < 1 ? $this->pageLimit : $this->pageLimit * ($this->pageOffset + 1), $this->Obj->found_rows()) . ' / ' . $this->Obj->found_rows();
     $Display .= '</div>';
     $Display .= '<form class="page-list" method="POST"><ul>';
     for ($page = 0; $page <= $this->Obj->found_rows() / $this->pageLimit; $page++) {
         $Display .= '<li' . ($page == $this->pageOffset ? ' class="active"' : '') . '><button type="submit" name="ifxTable[pageOffset]" value="' . $page . '">' . ($page + 1) . '</button></li>';
     }
     $Display .= '</ul></form>';
     $Display .= '</td></tr>';
     $Display .= '</tfoot>';
     $Display .= '</table>';
     return $Display;
 }
Exemplo n.º 2
0
 function display()
 {
     $Data = $this->getObjData();
     $this->saveSettings();
     echo '<table class="table ifx-table">';
     echo '<thead>';
     foreach ($this->Columns as $Column) {
         echo '<th>';
         if ($Column->sortable === true) {
             echo '<form method="post">';
             echo '<button type="submit" name="ifxTable[sortBy]" value="' . $Column->sortBy . '">';
             if (isset($this->sortedBy[$Column->sortBy]) && $this->sortedBy[$Column->sortBy] === 'ASC') {
                 echo '<i class="fa fa-sort-asc"></i>';
             } elseif (isset($this->sortedBy[$Column->sortBy]) && $this->sortedBy[$Column->sortBy] === 'DESC') {
                 echo '<i class="fa fa-sort-desc"></i>';
             } else {
                 echo '<i class="fa fa-sort"></i>';
             }
         }
         echo $Column->title;
         if ($Column->sortable === true) {
             echo '</form>';
         }
         echo '</th>';
     }
     echo '</thead>';
     echo '<tbody>';
     if (count($Data) > 0) {
         foreach ($Data as $Row) {
             echo '<tr>';
             foreach ($this->Columns as $Column) {
                 echo '<td>';
                 $formatFn = $Column->formatFn;
                 $Reflection = new ReflectionFunction($formatFn);
                 if ($Reflection->getNumberOfParameters() == 2) {
                     echo $formatFn($Row, $Row->{$Column->fieldname});
                 } else {
                     echo $formatFn($Row);
                 }
                 echo '</td>';
             }
             echo '</tr>';
         }
     } else {
         echo '<tr class="no-data"><td colspan="' . count($this->Columns) . '">No data Available</td></tr>';
     }
     echo '</tbody>';
     echo '<tfoot>';
     echo '<tr><td colspan="' . count($this->Columns) . '">';
     echo '<div class="page-of-page">';
     echo ($this->pageOffset < 1 ? 0 : $this->pageLimit * $this->pageOffset) + 1 . '-' . min($this->pageOffset < 1 ? $this->pageLimit : $this->pageLimit * ($this->pageOffset + 1), $this->Obj->found_rows()) . ' / ' . $this->Obj->found_rows();
     echo '</div>';
     echo '<form class="page-list" method="POST"><ul>';
     for ($page = 0; $page <= $this->Obj->found_rows() / $this->pageLimit; $page++) {
         echo '<li' . ($page == $this->pageOffset ? ' class="active"' : '') . '><button type="submit" name="ifxTable[pageOffset]" value="' . $page . '">' . ($page + 1) . '</button></li>';
     }
     echo '</ul></form>';
     echo '</td></tr>';
     echo '</tfoot>';
     echo '</table>';
     return;
 }