protected function formatSimpleTableResultsCount($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[0] == 'Total') {
continue;
}
// below 0 are errors
if ($v[1] >= 0) {
$v[0] = $this->makeLink($v[0]);
}
$v[1] = $this->reportStatus($v[1]);
$text .= "<tr><td>{$v[0]}</td><td>{$v[1]}</td>";
if (isset($v[2])) {
$text .= "<td>{$v[2]}</td>";
}
$text .= "</tr>\n";
}
if (isset($v)) {
$text .= "<tfoot><tr><td>{$v[0]}</td><td>{$v[1]}</td>";
}
if (isset($v[2])) {
$text .= "<td>{$v[2]}</td>";
}
$text .= "</tr></tfoot>\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;
}