This repository has been archived by the owner on Aug 10, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathbuscarPersona.php
100 lines (92 loc) · 3.08 KB
/
buscarPersona.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<?php
// vim: set expandtab tabstop=4 shiftwidth=4 foldmethod=marker fileencoding=utf-8:
/**
* Permite elegir una persona
*
* PHP version 5
*
* @category SIVeL
* @package SIVeL
* @author Vladimir Támara <[email protected]>
* @copyright 2007 Dominio público. Sin garantías.
* @license https://www.pasosdejesus.org/dominio_publico_colombia.html Dominio Público. Sin garantías.
* @link http://sivel.sf.net
*/
/**
* Elegir una persona
*/
require_once 'aut.php';
require_once $_SESSION['dirsitio'] . "/conf.php";
require_once "DataObjects/Persona.php";
require_once 'misc.php';
require_once 'misc_importa.php';
/**
* Muestra lista de personas en base
*
* @return void
*/
function muestra()
{
global $dsn, $accno;
$aut_usuario = "";
$db = autentica_usuario($dsn, $aut_usuario, 0);
$nombres = trim(utf8_decode(var_req_escapa('nombres', $db, 100)));
$apellidos = trim(utf8_decode(var_req_escapa('apellidos', $db, 100)));
$rol = var_req_escapa('rol', $db, 32);
$pNomvic = trim($nombres . " " . $apellidos);
//echo "OJO nombres=$nombres, apellidos=$apellidos";
$x =& objeto_tabla('persona');
$consNomVic = trim(a_minusculas(sin_tildes($pNomvic)));
$consNomvic = preg_replace("/ +/", " & ", $consNomVic);
$where = " to_tsvector('spanish', unaccent(persona.nombres) "
. " || ' ' || unaccent(persona.apellidos)) @@ "
. "to_tsquery('spanish', '$consNomvic')";
$q = "SELECT id, nombres, apellidos, anionac, mesnac, dianac, "
. "sexo, id_departamento, id_municipio, id_clase, "
. "tipodocumento, numerodocumento "
. " FROM persona "
. " WHERE " . $where
. " ORDER by nombres, apellidos ";
//echo "OJO q=\"$q\"<br>";
$result = hace_consulta($db, $q);
$row = array();
echo "<html><head>";
echo " <title>Personas</title>";
echo " <meta charset=\utf-8\">";
echo "</head>";
echo "<body>";
echo '<script language="JavaScript" src="sivel.js" type="text/javascript">'
. '</script>';
echo_esc("Coincidencias: " . $result->numRows());
echo "<hr>";
//echo "rol=$rol";
echo "<table>";
echo "<tr>" .
"<th>Nombres y apellidos</th><th>Víctima en</th>" .
"<th>Familiar en</th>" .
"</tr>";
while ($result->fetchInto($row)) {
echo "<tr>";
echo '<td><a href="#" onClick="enviarPersona(\''
. htmlentities($rol, ENT_COMPAT, 'UTF-8') . '\'';
$html_sep = ", ";
foreach ($row as $v) {
echo $html_sep . "'" . htmlentities($v, ENT_COMPAT, 'UTF-8') . "'";
$html_sep = ", ";
}
echo ')">';
echo htmlentities($row[1] . " ".$row[2], ENT_COMPAT, 'UTF-8') . "</a></td>";
$html_comovic = "";
$html_comofam = "";
enlaces_casos_persona_html(
$db, 0, $row[0], $html_comovic, $html_comofam
);
echo "<td align='center'>" . $html_comovic . "</td>";
echo "<td align='center'>" . $html_comofam . "</td>";
echo "</tr>\n";
}
echo "</table>";
echo "</body></html>";
}
muestra();
?>