Пример #1
0
function getTableBody($result, stdClass $fieldsFilter, array $atributos, $totalRegistros)
{
    $return = $footer = $html = '';
    $groupId = 0;
    $subgroupId = 0;
    if (isResult($result) && !empty($fieldsFilter->head['campos'])) {
        $total = 0;
        while ($row = mysql_fetch_array($result)) {
            if ($groupId != $row['groupId'] && $subgroupId != $row['subgroupId']) {
                $colspans = getColspanRow(count($fieldsFilter->head['campos']), count($fieldsFilter->body['campos']));
                if ($groupId > 0 && $subgroupId > 0) {
                    $footer = getTableFooter($fieldsFilter->body['campos'], $atributos['fieldTotal'], $total, '', '');
                }
                $groupId = $row['groupId'];
                $subgroupId = $row['subgroupId'];
                $dataRowHead = getDataRow($row, $fieldsFilter->head['campos'], $fieldsFilter->head['args'], $colspans['head']);
                $dataRowBody = getDataRow($row, $fieldsFilter->body['campos'], $fieldsFilter->body['args'], $colspans['body'], $atributos['fieldTotal']);
                $eventHead = !empty($dataRowHead['args']) && !empty($fieldsFilter->head['url']) ? "ondblclick=sendRow(this,\"{$fieldsFilter->head['url']}&{$dataRowHead['args']}\",\"{$fieldsFilter->head['panel']}\");" : '';
                $html .= "{$footer}<tr {$eventHead} >{$dataRowHead['html']}</tr>";
                $total = $dataRowBody['value'];
                $eventBody = !empty($dataRowBody['args']) && !empty($fieldsFilter->body['url']) ? "ondblclick=sendRow(this,\"{$fieldsFilter->body['url']}&{$dataRowBody['args']}\",\"{$fieldsFilter->body['panel']}\");" : '';
                $html .= "<tr {$eventBody} >{$dataRowBody['html']}</tr>";
            } else {
                $colspans = getColspanRow(count($fieldsFilter->head['campos']), count($fieldsFilter->body['campos']));
                $dataRowBody = getDataRow($row, $fieldsFilter->body['campos'], $fieldsFilter->body['args'], $colspans['body'], $atributos['fieldTotal']);
                $total += $dataRowBody['value'];
                $eventBody = !empty($dataRowBody['args']) ? "ondblclick=sendRow(this,\"{$fieldsFilter->body['url']}&{$dataRowBody['args']}\",\"{$fieldsFilter->body['panel']}\");" : '';
                $html .= "<tr {$eventBody} >{$dataRowBody['html']}</tr>";
            }
        }
        $footer = getTableFooter($fieldsFilter->body['campos'], $atributos['fieldTotal'], $total, '', '');
        $return = '<tbody>' . $html . $footer . '</tbody>';
    } elseif (isResult($result) && !empty($fieldsFilter->body['campos'])) {
        $total = 0;
        while ($row = mysql_fetch_array($result)) {
            $i .= '1';
            $checked = getChecked($row, $atributos['checked']);
            $colspans = getColspanRow(count($fieldsFilter->head['campos']), count($fieldsFilter->body['campos']));
            $dataRowBody = getDataRow($row, $fieldsFilter->body['campos'], $fieldsFilter->body['args'], $colspans['body'], $atributos['fieldTotal']);
            $eventBody = !empty($dataRowBody['args']) && !empty($fieldsFilter->body['url']) ? "ondblclick=sendRow(this,\"{$fieldsFilter->body['url']}&{$dataRowBody['args']}\",\"{$fieldsFilter->body['panel']}\");" : '';
            $html .= "<tr {$eventBody} >{$checked}{$dataRowBody['html']}</tr>";
            $total += $dataRowBody['value'];
        }
        $footer = getTableFooter($fieldsFilter->body['campos'], $atributos['fieldTotal'], $total, $atributos['checked'], 'tfoot', $totalRegistros);
        $return = '<tbody>' . $html . '</tbody>' . $footer;
    }
    return $return;
}
Пример #2
0
function getTableBody($result, stdClass $fieldsFilter, array $atributos, $totalRegistros, $SUMMARY_COLS_CSS = null)
{
    ## DEFINIENDO la variable GET pagina-start para la url de los registros
    $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;
    ## FIN DEFINICIÓN la variable GET pagina-start para la url de los registros
    $return = $footer = $html = '';
    $groupId = 0;
    if (isResult($result) && !empty($fieldsFilter->head['campos'])) {
        $total = 0;
        while ($row = mysql_fetch_array($result)) {
            if ($groupId != $row['groupId']) {
                $colspans = getColspanRow(count($fieldsFilter->head['campos']), count($fieldsFilter->body['campos']));
                if ($groupId > 0) {
                    $footer = getTableFooter($fieldsFilter->body['campos'], $atributos['fieldTotal'], $total, '', '');
                }
                $groupId = $row['groupId'];
                $dataRowHead = getDataRow($row, $fieldsFilter->head['campos'], $fieldsFilter->head['args'], $colspans['head']);
                $dataRowBody = getDataRow($row, $fieldsFilter->body['campos'], $fieldsFilter->body['args'], $colspans['body'], $atributos['fieldTotal'], $SUMMARY_COLS_CSS);
                $eventHead = !empty($dataRowHead['args']) && !empty($fieldsFilter->head['url']) ? "onclick=sendRow(this,\"{$fieldsFilter->head['url']}&{$dataRowHead['args']}\",\"{$fieldsFilter->head['panel']}\");" : '';
                $html .= "{$footer}<tr {$eventHead} >{$dataRowHead['html']}</tr>";
                $total = $dataRowBody['value'];
                $eventBody = !empty($dataRowBody['args']) && !empty($fieldsFilter->body['url']) ? "onclick=sendRow(this,\"{$fieldsFilter->body['url']}&pagina-start={$paginaStart}&{$dataRowBody['args']}\",\"{$fieldsFilter->body['panel']}\");" : '';
                $html .= "<tr {$eventBody} >{$dataRowBody['html']}</tr>";
            } else {
                $colspans = getColspanRow(count($fieldsFilter->head['campos']), count($fieldsFilter->body['campos']));
                $dataRowBody = getDataRow($row, $fieldsFilter->body['campos'], $fieldsFilter->body['args'], $colspans['body'], $atributos['fieldTotal'], $SUMMARY_COLS_CSS);
                $total += $dataRowBody['value'];
                $eventBody = !empty($dataRowBody['args']) ? "onclick=sendRow(this,\"{$fieldsFilter->body['url']}&pagina-start={$paginaStart}&{$dataRowBody['args']}\",\"{$fieldsFilter->body['panel']}\");" : '';
                $html .= "<tr {$eventBody} >{$dataRowBody['html']}</tr>";
            }
        }
        $footer = getTableFooter($fieldsFilter->body['campos'], $atributos['fieldTotal'], $total, '', '');
        //            var_dump($total);
        $return = '<tbody>' . $html . $footer . '</tbody>';
    } elseif (isResult($result) && !empty($fieldsFilter->body['campos'])) {
        $total = 0;
        while ($row = mysql_fetch_array($result)) {
            $checked = getChecked($row, $atributos['checked']);
            $colspans = getColspanRow(count($fieldsFilter->head['campos']), count($fieldsFilter->body['campos']));
            $dataRowBody = getDataRow($row, $fieldsFilter->body['campos'], $fieldsFilter->body['args'], $colspans['body'], $atributos['fieldTotal'], $SUMMARY_COLS_CSS);
            $eventBody = !empty($dataRowBody['args']) && !empty($fieldsFilter->body['url']) ? "onclick=sendRow(this,\"{$fieldsFilter->body['url']}&pagina-start={$paginaStart}&{$dataRowBody['args']}\",\"{$fieldsFilter->body['panel']}\");" : '';
            $html .= "<tr {$eventBody} >{$checked}{$dataRowBody['html']}</tr>";
            $total += $dataRowBody['value'];
        }
        $footer = getTableFooter($fieldsFilter->body['campos'], $atributos['fieldTotal'], $total, $atributos['checked'], 'tfoot', $totalRegistros);
        $return = '<tbody>' . $html . '</tbody>' . $footer;
    }
    return $return;
}