Exakat\Reports\Devoops::formatHashTableLinked PHP Method

formatHashTableLinked() protected method

protected formatHashTableLinked ( $data, $css )
    protected function formatHashTableLinked($data, $css)
    {
        static $counter;
        if (!isset($counter)) {
            $counter = 1;
        } else {
            ++$counter;
        }
        $text = <<<HTML
<table class="table table-bordered table-striped table-hover table-heading table-datatable" id="hashtable-{$counter}">
\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>{$title}</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;
        foreach ($data as $k => $v) {
            if ($v['result'] == Analyzer::VERSION_INCOMPATIBLE) {
                $v['result'] = '';
                $icon = '<i class="fa fa-stethoscope"></i>';
            } elseif ($v['result'] == Analyzer::CONFIGURATION_INCOMPATIBLE) {
                $v['result'] = '';
                $icon = '<i class="fa fa-stethoscope"></i>';
            } elseif ($v['result'] === 0) {
                $v['result'] = '';
                $icon = '<i class="fa fa-check-square-o green"></i>';
            } else {
                $k = $this->makeLink($k);
                $v['result'] .= ' warnings';
                $icon = '<i class="fa fa-exclamation red"></i>';
            }
            $text .= '<tr><td>' . $k . '</td><td>' . $icon . ' ' . $v['result'] . "</td></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>

<script type="text/javascript">
// Run Datables plugin and create 3 variants of settings
function AllTables(){
\t\$('#hashtable-{$counter}').dataTable( {
\t\t"aaSorting": [[ 0, "asc" ]],
\t\t"sDom": "<'box-content'<'col-sm-6'f><'col-sm-6 text-right'l><'clearfix'>>rt<'box-content'<'col-sm-6'i><'col-sm-6 text-right'p><'clearfix'>>",
\t\t"sPaginationType": "bootstrap",
\t\t"oLanguage": {
\t\t\t"sSearch": "",
\t\t\t"sLengthMenu": '_MENU_'
\t\t}
\t});
}

\$(document).ready(function() {
\t// Load Datatables and run plugin on tables 
\tLoadDataTablesScripts(AllTables);
\t// Add Drag-n-Drop feature
\tWinMove();
});
</script>

HTML;
        return $text;
    }