Exemplo n.º 1
0
function ListR3($sql, $attr, $link, $conexion = null)
{
    $atributosDefault = array('id' => '', 'class' => 'reporteA', 'checked' => '', 'paginador' => '', 'fieldTotal' => '');
    $linkDefault = array('campos' => '', 'args' => '', 'panelId' => '', 'url' => '');
    $linksUrl = array('head' => '', 'body' => '');
    $atributos = defaultArrayValues($atributosDefault, $attr);
    $paginador = explode(',', $atributos['paginador']);
    $paginaStart = is_int((int) get('pagina-start')) && (int) get('pagina-start') > 0 ? get('pagina-start') : 1;
    $start = ($paginaStart - 1) * $paginador[0];
    $limit = ' LIMIT ' . $start . ', ' . $paginador[0];
    $sql = filterSql($sql) . $limit;
    $result = getResult($sql, $conexion);
    $count = getResult("SELECT FOUND_ROWS() AS total", $conexion);
    $row = mysql_fetch_object($count);
    $countTotal = $row->total;
    $pagitacionHtml = getPagination($paginaStart, $countTotal, $paginador[0], $paginador[1]);
    if (!empty($link)) {
        $linkArray = explode('}', $link);
        if (isset($linkArray[1])) {
            $linksUrl['body'] = defaultArrayValues($linkDefault, $linkArray[1]);
            $linksUrl['head'] = defaultArrayValues($linkDefault, $linkArray[0]);
        } else {
            $linksUrl['body'] = defaultArrayValues($linkDefault, $linkArray[0]);
        }
    }
    $fieldsName = getFieldsName($result);
    $fieldsFilter = fieldsFilter($fieldsName, $linksUrl);
    $tableHeader = getTableHeader($fieldsFilter, $atributos);
    $tableBody = getTableBody($result, $fieldsFilter, $atributos, $countTotal);
    $tabla .= "<table id=\"{$atributos['id']}\" class=\"{$atributos['class']}\" style=\"width:100%;clear: both;\">" . "{$tableHeader}{$tableBody}" . "</table>" . "</form>" . "{$pagitacionHtml}";
    if ($atributos['checked'] == "checked") {
        $tabla = "<form method=\"post\" id=\"frm-{$atributos['id']}\">" . $tabla;
        $tabla .= "</form>";
    }
    return $tabla;
}
Exemplo n.º 2
0
function ListR4($sql, $attr, $link, $SUMMARY_STYLE, $conexion = null)
{
    ## ARRAYS DEFAULT  DC
    $atributosDefault = array('id' => '', 'class' => 'reporteA', 'checked' => '', 'paginador' => '', 'fieldTotal' => '');
    $linkDefault = array('campos' => '', 'args' => '', 'panelId' => '', 'url' => '');
    $linksUrl = array('head' => '', 'body' => '');
    $SUMMARY_STYLE_DEFAULT = array('columns_index' => '', 'summary_css' => '');
    ## CHANGING ARRAYS VALUES
    $atributos = defaultArrayValues($atributosDefault, $attr);
    $SUMMARY_COLS_CSS = defaultArrayValues($SUMMARY_STYLE_DEFAULT, $SUMMARY_STYLE);
    $paginador = explode(',', $atributos['paginador']);
    ////CONSTRUYE PARTE DE LA URL DEL PAGINADOR
    $urlSeg = explode('?', $paginador[1]);
    $urlSegA = $urlSeg[1];
    $urlSegB = explode('=', $urlSegA);
    $urlSegUrl = $urlSegB[0];
    $paginaStart = is_int((int) get('' . $urlSegUrl . 'pagina-start')) && (int) get('' . $urlSegUrl . 'pagina-start') > 0 ? get('' . $urlSegUrl . 'pagina-start') : 1;
    $start = ($paginaStart - 1) * $paginador[0];
    $limit = ' LIMIT ' . $start . ', ' . $paginador[0];
    $sql = filterSql($sql);
    ## EXTRAYENDO EL TOTAL DE FILAS
    getResult($sql, $conexion);
    $count = getResult("SELECT FOUND_ROWS() AS total", $conexion);
    $row = mysql_fetch_object($count);
    $countTotal = $row->total;
    $sql = $sql . $limit;
    $result = getResult($sql, $conexion);
    $pagitacionHtml = getPagination($paginaStart, $countTotal, $paginador[0], $paginador[1]);
    if (!empty($link)) {
        $linkArray = explode('}', $link);
        if (isset($linkArray[1])) {
            $linksUrl['body'] = defaultArrayValues($linkDefault, $linkArray[1]);
            $linksUrl['head'] = defaultArrayValues($linkDefault, $linkArray[0]);
        } else {
            $linksUrl['body'] = defaultArrayValues($linkDefault, $linkArray[0]);
        }
    }
    $fieldsName = getFieldsName($result);
    $fieldsFilter = fieldsFilter($fieldsName, $linksUrl);
    //vd($fieldsFilter);vd($atributos);
    $tableHeader = getTableHeader($fieldsFilter, $atributos);
    $tableBody = getTableBody($result, $fieldsFilter, $atributos, $countTotal, $SUMMARY_COLS_CSS);
    $tabla .= "<table id=\"{$atributos['id']}\" class=\"{$atributos['class']}\" style=\"width:100%;clear: both;\">" . "{$tableHeader}{$tableBody}" . "</table>" . "</form>" . "{$pagitacionHtml}";
    if ($atributos['checked'] == "checked") {
        $tabla = "<form method=\"post\" id=\"frm-{$atributos['id']}\">" . $tabla;
        $tabla .= "</form>";
    }
    return $tabla;
}