require 'nav_elements.php'; require '/scripts/php/termin_planen_get.php'; $userid = $_SESSION['userid']; $tid = isset($_GET['id']) ? $_GET['id'] : null; $_SESSION['tid'] = $tid; $participants = ''; $datesCoord = null; if ($tid != null) { $datesCoord = loadDatesCoordination($tid); $editRights = determineEditRights($datesCoord); $_SESSION['editRights'] = $editRights; $participants = implode(",", $datesCoord->getParticipants()); $dbc = new DBConnect(); $dbc->markDatesCoordAsViewed_db($userid, $tid); } $tableBody = getTableBody($tid, $datesCoord); $title = isset($datesCoord) ? $datesCoord->getTitle() : ''; $description = isset($datesCoord) ? $datesCoord->getDescription() : ''; $place = isset($datesCoord) ? $datesCoord->getPlace() : ''; $deadline = isset($datesCoord) ? $datesCoord->getDeadline() : ''; ?> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="description" content=""> <meta name="author" content="Dashboard"> <meta name="keyword" content="Dashboard, Bootstrap, Admin, Template, Theme, Responsive, Fluid, Retina"> <title>Maturitas</title>
$sth->execute($params); $results = $sth->fetchAll(); return $results; } /** returns the table rows as html string. * * @param array the list of the customers * @return string the html representation of the table rows. */ function getTableBody($results) { $ret = ""; foreach ($results as $row) { $ret .= sprintf("<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><tr>", $row["customer_id"], $row["first_name"], $row["last_name"], $row["occupation_name"] === NULL ? "un-employed" : $row["occupation_name"]); } return $ret; } try { $dbh = connectDb(); $results = fetchCustomers($dbh, $sql); $tbody = getTableBody($results); print $tbody; } catch (\Exception $e) { print "<pre>"; print "Fatal error: " . $e->getMessage(); die; } ?> </table> <?php
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; }
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; }