_t = $table; } protected function html_content() { $this->renderTitle(); foreach ($this->_subtemplates as $template) $template->html_main(); // Showing an inline form? $pager = $this->_t->getPageIndex(); if (!empty($pager) || isset($this->_t->form_above)) $this->renderPaginationForm($pager, $this->_t->form_above); $tableClass = $this->_t->getTableClass(); if ($tableClass) echo '
'; // Build the table! echo ' '; $this->renderTableHead($this->_t->getHeader()); $this->renderTableBody($this->_t->getBody()); echo '
'; if ($tableClass) echo '
'; // Showing an inline form? if (!empty($pager) || isset($this->_t->form_below)) $this->renderPaginationForm($pager, $this->_t->form_below); $title = $this->_t->getTitle(); if (!empty($title)) echo ' '; } protected function renderTitle() { $title = $this->_t->getTitle(); if (!empty($title)) { $titleclass = $this->_t->getTitleClass(); echo '

', htmlspecialchars($title), '

'; } } protected function renderPaginationForm($pager, $form, $class='row') { echo '
'; // Page index? if (!empty($pager)) PageIndexWidget::paginate($pager); // Form controls? if (isset($form)) $this->renderInlineForm($form); echo '
'; } protected function renderTableHead(array $headers) { echo ' '; foreach ($headers as $th) { echo ' 1 ? ' colspan="' . $th['colspan'] . '"' : ''), ' scope="', $th['scope'], '">', $th['href'] ? '' . $th['label'] . '' : $th['label']; if ($th['sort_mode']) echo ' '; echo ''; } echo ' '; } protected function renderTableBody($body) { echo ' '; if (is_array($body)) { foreach ($body as $tr) { echo ' '; foreach ($tr['cells'] as $td) { echo ' ', $td['value'], ''; } echo ' '; } } else { $header = $this->_t->getHeader(); echo ' ', $body, ' '; } echo ' '; } protected function renderInlineForm($form) { if (!isset($form['is_embed'])) echo '
'; else echo '
'; if (!empty($form['is_group'])) echo '
'; if (!empty($form['fields'])) { foreach ($form['fields'] as $name => $field) { if ($field['type'] === 'select') { echo ' '; } else echo ' '; if (isset($field['html_after'])) echo $field['html_after']; } } echo ' '; if (!empty($form['buttons'])) foreach ($form['buttons'] as $name => $button) { echo ' '; if (isset($button['html_after'])) echo $button['html_after']; } if (!empty($form['is_group'])) echo '
'; if (!isset($form['is_embed'])) echo ' '; else echo '
'; } }