function printSingleArrayAsDatatable($datos, $cabeceras = false, $table_head = '', $alinear = false, $id, $params = array(), $sbModName = "") { $arIgnoFie = array('nuConsAcu' => 'right', 'boCotApro' => 'left', 'boAprobad' => 'left', 'sbModuTyp' => 'left', 'sbSolTota' => 'right', 'sbSolApro' => 'right', 'sbSolNoAp' => 'right'); if (count($datos) <= 0) { return "No data"; } require_once 'custom/opalo/params/includesForJS.php'; //echo"<pre>",print_r($arIncluJs),"</pre>"; $includesPorFuera = $arIncluJs['includeDatatable']; $estilo = "<style>\n tr td .ff {\n background-color: #F2F2F2;\n border: thin;\n }\n tr td .fo {\n /* background-color: #; */\n border: thin;\n }\n </style>"; $llaves = array(); if (!$cabeceras) { $cabeceras = array_keys($datos[0]); $llaves = array_keys($datos[0]); } else { $llaves = array_keys($cabeceras); } $odd = false; $color_tr = " class='ff' "; $tabla = "<table id='{$id}' {$table_head} class='table' style='width:100%' >\n <thead>"; $tabla .= "<tr class='info'>\n <th>"; $tabla .= implode("</th><th>", $cabeceras); $tabla .= "</th>\n </tr>\n </thead>\n <tbody>"; foreach ($datos as $fila) { if ($odd = !$odd) { $color_tr = " class='fo' "; } else { $color_tr = " class='ff' "; } $tabla .= "<tr>"; foreach ($llaves as $key) { $textoTd = htmlentities(utf8_encode($fila[$key])); $sbAligTyp = "right"; if ($sbModName != "" && !isset($arIgnoFie[$key])) { $sbAligTyp = FnCrm::AlignType($key, $sbModName); } else { if (isset($arIgnoFie[$key])) { $sbAligTyp = $arIgnoFie[$key]; } } $style = "style='text-align: {$sbAligTyp};'"; $tabla .= "<td {$color_tr} {$style}>{$textoTd}</td>"; } $tabla .= "</tr>"; } $tabla .= "</tbody>\n </table>"; return $includesPorFuera . $tabla; }