public function getHtml() { $id = DisplayManager::getUniqueHTMLId('collapsible'); $html = '<div class="collapsible" id="' . $id . '"' . "\n"; $html .= '<div class="collapsibleheader togglevisibility" onclick=\'toggleVisibility("' . $id . '");\' >'; $html .= $this->title->getHtml() . '</div>' . "\n"; $html .= '<div class="collapsiblecontent">'; $html .= $this->content->getHtml(); $html .= '</div>'; $html .= "</div>\n\n\n"; if ($this->collapsed) { $html .= '<script type="text/javascript"> toggleVisibility("'; $html .= $id . "\") </script>\n"; } return $html; }
/** * Pomocou nastavených atribútov vygeneruje tabuľku v HTML formáte aj s linkami. * @return string Vygenerovaná tabuľka v HTML formáte. */ public function getHtml() { $id = DisplayManager::getUniqueHTMLId('table'); $table = "\n<!-- ******* Table ****** -->\n"; if (!is_array($this->data) || empty($this->data[0])) { $table .= '<font color="red"> Dáta pre túto tabuľku neboli nájdené.</font><hr class="space" />'; return $table; } $table .= "<table id=\"" . $id . "\"class='colstyle-sorting'>\n<thead>\n<tr>\n"; $columns = $this->getColumns(); foreach ($columns as $key => $value) { $table .= ' <th class="sortable">' . $value['title'] . "</th>\n"; } $table .= "</tr>\n"; $table .= "\n</thead>\n"; // Tu by mal byt TFOOT, vid nizsie $table .= "<tbody>\n"; foreach ($this->data as $row) { $table .= $row->getHtml(); } $table .= "</tbody>"; // FIXME: Tento TFOOT by mal byt podla specifikacie pred TBODY, // ale ked je tu, je mozne css-kom vypnut opakovanie // footer riadkov pri tlaci (inak by boli na vrchu tabulky). // Ak chceme mat vystup 100% validny, treba upravit sorter skript, // aby bral do uvahy nejaky class a zmenit tento TFOOT na TBODY. if ($this->footer !== null) { $table .= '<tfoot>'; foreach ($this->footer as $row) { $table .= $row->getHtml(); } $table .= "</tfoot>\n"; } $table .= "</table>\n"; return $table; }