Exakat\Reports\Devoops::formatSectionedTable PHP Метод

formatSectionedTable() защищенный Метод

protected formatSectionedTable ( $data, $css )
    protected function formatSectionedTable($data, $css)
    {
        static $counter;
        if (!isset($counter)) {
            $counter = 1;
        } else {
            ++$counter;
        }
        $text = <<<HTML
<table id="sectionedhashtable-{$counter}" class="table">
\t\t\t\t\t\t\t\t\t\t<thead>
HTML;
        if ($css->displayTitles === true) {
            $text .= '<tr>';
            foreach ($css->titles as $title) {
                $text .= <<<HTML
\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<th>
\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{$title}
\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</th>

HTML;
            }
            $text .= '</tr>';
        }
        $text .= <<<HTML
\t\t\t\t\t\t\t\t\t\t</thead>

\t\t\t\t\t\t\t\t\t\t<tbody>
HTML;
        $readOrder = $css->readOrder;
        if (empty($readOrder)) {
            $readOrder = range(0, count($css->titles) - 1);
        }
        foreach ($data as $k => $v) {
            $text .= '<tr><td style="background-color: ' . $css->backgroundColor . '">' . $k . '</td>' . str_repeat('<td style="background-color: ' . $css->backgroundColor . '">&nbsp;</td>', count($css->titles) - 1) . "</tr>\n";
            if (empty($v)) {
                continue;
            }
            foreach ($v as $v2) {
                $v2 = (array) $v2;
                $text .= '<tr>';
                foreach ($readOrder as $id) {
                    $text .= "<td>{$v2[$id]}</td>\n";
                }
                $text .= "</tr>\n";
            }
        }
        $text .= <<<HTML
\t\t\t\t\t\t\t\t\t\t</tbody>
\t\t\t\t\t\t\t\t\t</table>
HTML;
        return $text;
    }