Esempio n. 1
0
<?php

include "include/incluir.php";
//$titulo = SQL::filasEnArreglo(SQL::seleccionar("trcPriNombre","bif_terceros"));
$menu = SQL::filasEnArreglo(SQL::seleccionar("mnsId, mnsDescripcion, mnsRuta", "bif_menus", "mnsPadre = 0"));
$css = CSS::estiloHTML();
$js = "";
echo HTML::esquemaHTML(HTML::head($css, $js, "Fila") . HTML::body(HTML::header(HTML::figure("imagenes/logo.jpg") . HTML::nav(HTML::menuPrincipal($menu, 'navbar-nav'))) . HTML::section(HTML::article("") . HTML::aside("")) . HTML::footer("") . HTML::popUp("") . HTML::alert("") . HTML::menuBotones()));
Esempio n. 2
0
 public function tablaDinamica($campos = "'mnsId', 'mnsPadre'", $tabla = "bif_menus", $condicion = "1=1")
 {
     $registros = SQL::filasEnArreglo(SQL::seleccionar("COLUMN_NAME, NUMERIC_PRECISION, CHARACTER_MAXIMUM_LENGTH", "INFORMATION_SCHEMA.COLUMNS", "COLUMN_NAME IN (" . $campos . ")"));
     $codigo = "\n        <script>\n        \$(document).ready(function(){\n            \n            \$('.flexme3').flexigrid({\n                url : 'include/obtenerTabla.php',\n                dataType : 'json',\n                colModel : [ ";
     foreach ($registros as $clave => $valor) {
         $cabecera = self::idiomaTexto($valor[0]);
         $lenCabecera = strlen($cabecera);
         if (!empty($valor[1])) {
             $lenColumna = $valor[1];
         } else {
             $lenColumna = $valor[2];
         }
         if ($lenCabecera > $lenColumna) {
             $lenCampo = $lenCabecera * 10;
         } else {
             $lenCampo = $lenColumna - 100;
         }
         $codigo .= "{ \n                                    display : '" . $cabecera . "'\n                                    , name : '" . $valor[0] . "'\n                                    , width : 200\n                                    , sortable : true,\n                                    align : 'center'\n                                },";
     }
     $codigo = substr($codigo, 0, strlen($codigo) - 1);
     $codigo .= " ],\n                    \n                sortname : '" . $registros[0][0] . "',\n                title : 'Menus',\n                query : '" . str_replace("'", "", $campos) . "/" . $tabla . "/" . $condicion . "',            \n                sortorder : 'asc',\n                usepager : true,\n                useRp : true,\n                rp : 10,\n                showTableToggleBtn : true,\n                width : 'auto',\n                height : 'auto',\n                pagestat: '{from} de {to}, Total: {total} registros',\n                pagetext: 'Pagina',\n                outof: 'de',\n                dblClickResize: true, \n                onDoubleClick: true,\n                singleSelect : true\n            });      \n           \n        });\n        </script>\n\n        <table class='flexme3' style='display: none'></table>\n        ";
     return $codigo;
 }
<?php

include "incluir.php";
$page = isset($_POST['page']) ? $_POST['page'] : 1;
$rp = isset($_POST['rp']) ? $_POST['rp'] : 10;
$sortname = isset($_POST['sortname']) ? $_POST['sortname'] : 'mnsId';
$sortorder = isset($_POST['sortorder']) ? $_POST['sortorder'] : 'desc';
$query = isset($_POST['query']) ? $_POST['query'] : "mnsId, mnsPadre/bif_menus/1=1";
$qtype = isset($_POST['qtype']) ? $_POST['qtype'] : false;
$arreglo = explode("/", $query);
$primerCampo = explode(",", $arreglo[0]);
$sort = "{$sortname} {$sortorder}";
$limit = ($page - 1) * $rp . ", {$rp}";
$rows = SQL::filasEnArreglo1(SQL::seleccionar($arreglo[0], $arreglo[1], $arreglo[2], "", $sort, $limit));
$total = SQL::filasEnArreglo(SQL::seleccionar("COUNT(" . $primerCampo[0] . ")", $arreglo[1], $arreglo[2]));
header("Content-type: application/json");
$jsonData = array('page' => $page, 'total' => $total[0][0], 'rows' => array());
foreach ($rows as $clave => $valor) {
    $entry = array(key($valor) => $valor[key($valor)], 'cell' => $rows[$clave]);
    $jsonData['rows'][] = $entry;
}
echo json_encode($jsonData);