public function generate() { if (sizeof($this->_table) > 0) { foreach ($this->_table as $reg) { $id = NULL; if (is_object($reg)) { $reg = $reg->getFieldList(); } if (is_array($reg)) { if (is_null($this->_grid)) { $this->_grid .= '<table class="' . $this->_tableclass . '">'; $this->_grid .= '<thead>'; $this->_grid .= '<tr>'; if (sizeof($this->_headers) > 0) { foreach ($this->_headers as $header) { $this->_grid .= '<th>'; $this->_grid .= $header; $this->_grid .= '</th>'; } } else { foreach ($reg as $field => $value) { $this->_grid .= '<th>'; $this->_grid .= ucwords($field); $this->_grid .= '</th>'; } } if ($this->_showactions) { $this->_grid .= '<th>'; $this->_grid .= $this->_actionstitle; $this->_grid .= '</th>'; } $this->_grid .= '</tr>'; $this->_grid .= '</thead>'; $this->_grid .= '<tbody>'; } $this->_grid .= '<tr>'; if (sizeof($this->_fields) > 0) { if ($this->_base64id) { $id = base64_encode($reg[$this->_keyfield]); } else { $id = $reg[$this->_keyfield]; } foreach ($this->_fields as $field) { //$id=(is_null($id))?$reg[$field]:$id; $this->_grid .= '<td>'; if (in_array($field, $this->_dtfields)) { if (method_exists('Oraculum_Text', 'data')) { $reg[$field] = Oraculum_Text::datahora($reg[$field]); } } $this->_grid .= $reg[$field]; $this->_grid .= '</td>'; } } else { if ($this->_base64id) { $id = base64_encode($reg[$this->_keyfield]); } else { $id = $reg[$this->_keyfield]; } foreach ($reg as $field => $value) { $id = is_null($id) ? $this->_base64id ? base64_encode($value) : $value : $id; $this->_grid .= '<td>'; $this->_grid .= $value; $this->_grid .= '</td>'; } } if ($this->_showactions) { $this->_grid .= '<td>'; if (in_array('update', $this->_actions)) { $this->_grid .= '<a href="' . str_replace('%id%', $id, $this->_updateurl) . '" class="' . $this->_updateclass . '" ' . $this->_aditionalupdatelink . '>' . $this->_updatelabel . '</a> '; } if (in_array('delete', $this->_actions)) { $this->_grid .= '<a href="' . str_replace('%id%', $id, $this->_deleteurl) . '" class="' . $this->_deleteclass . '" ' . $this->_aditionaldeletelink . '>' . $this->_deletelabel . '</a>'; } $this->_grid .= str_replace('%id%', $id, $this->_adicionalactionhtml); $this->_grid .= '</td>'; } $this->_grid .= '</tr>'; } } $this->_grid .= '</tbody>'; $this->_grid .= '</table>'; } else { $this->_grid = $this->_norecordsfound; } return $this->_grid; }