<?php
//recibidos
if($r == ""){
?>
<td width="100%">
<tr>
<td colspan="2"><div class="heading1">No es posible acceder a este recurso directamente.</div></td>
</tr>
<tr>
<td width="1"><img src="imagenes/pixel.gif" width="1" height="0" border="0"></td>
<td width="100%" valign="top">
<?php
include ("pie.php");
exit();
}
?>
<script language="JavaScript">
function popupwin(url,x,y,title,resize,scroll){
var left = Math.floor( (screen.width-x) / 2);
var top = Math.floor( (screen.height-y) / 2);
var winParms = "top=" + top + ",left=" + left + ",height="+y+",width="+x+",scrollbars="+scroll+",toolbar=no,menubar=no,resizable="+resize+",location=no,directories=no,status=no";
mywin=open(url,title,winParms);
}
</script>
<table width="100%" cellpadding="5" cellspacing="0">
<tr class="g_header ">
<td width="2%">Nº</td>
<td width="15%">Nº Oficio</td>
<td width="8%">Fecha</td>
<td width="27%">Origen</td>
<td width="27%">Destinatario</td>
<td width="3%"></td><!--filtrar destino-->
<td width="3%">Acuse</td>
<td width="3%">leido</td>
<td width="3%">Asignar</td>
<td width="3%">Validar</td>
<td width="3%">PDF</td>
<td width="3%">Anexo</td>
<td width="3%">Detalles</td>
</tr>
<?php
$i = 0;
$bc=$pag;
while($row = mysql_fetch_array($r))
{
$num_user = $row['id_usr_para'];
$usuario1 = (datosUsuario($num_user,"nombre"));
$usuario2 = (datosUsuario($num_user,"apellido_paterno"));
$usuario_destino= "$usuario1"." "."$usuario2";
$num_de = $row['id_usr_de'];
$usuario21 = (datosUsuario($num_de,"nombre"));
$usuario22 = (datosUsuario($num_de,"apellido_paterno"));
$usuario_origen= "$usuario21"." "."$usuario22";
/*********************************/
/*********** acuse *************1*/
$acusado = datosDigitalrec($row[id_digital],"acuse");
if($acusado == 0){
$img11 = '<img align="right" title="el acuse no ha sido firmado" src="imagenes/inactivo.png" border=\"0\"/>';
}elseif($acusado == 1){
$img11 = '<img align="right" title="el acuse ya se firmó" src="imagenes/archivado.png" border=\"0\"/>';
}
$imagen11 = "$img11";
/*********** leido *************1*/
$leido = datosDigitalrec($row[id_digital],"leido");
if($leido == 0){
$img12 = '<img align="right" title="el documento no ha sido leido" src="imagenes/inactivo.png" border=\"0\"/>';
}elseif($leido == 1){
$img12 = '<img align="right" title="el documento ya fué leido" src="imagenes/archivado.png" border=\"0\"/>';
}
$imagen12 = "$img12";
/*******************************1*/
/*********** asignar ************2*/
if($acusado == 0){
$img2 = '<img align="right" title="el destinatario aún no ha acusado de recibido" src="imagenes/can_3.png" border=\"0\"/>';
$olk = "";
$clk = "";
}elseif($acusado == 1){
$img2 = '<img align="right" title="el acuse no ha sido firmado" src="imagenes/seg.png" border=\"0\"/>';
$olk = "<a href=\"asignar_dig2.php?id={$row[no_oficio]}&type=digital&idd={$row[id_digital]}\" target=\"_parent\">";
$clk = "</a>";
}
$imagen2 = "$olk$img2$clk";
/*******************************2*/
/************validar*************3*/
$hash = datosDigitalrec($row[id_digital],"hash");
$contenido = datosDigitalrec($row[id_digital],"contenido");
if($hash == md5($contenido)){
$valid = "true";
}else{
$valid = "false";
}
$hash2 = datosDigitalenvof($row[no_oficio],"hash");
$contenido2 = datosDigitalenvof($row[no_oficio],"contenido");
if($hash2 == md5($contenido2)){
$valid2 = "true";
}else{
$valid2 = "false";
}
if($valid == "true" && $valid2 == "true" && $hash == $hash2){
$img3 = '<img align="right" title="el oficio ha superado la validación de autenticidad" src="imagenes/archivado.png" border=\"0\"/>';
}else{
$img3 = '<img align="right" title="el oficio no ha superado la validación de autenticidad" src="imagenes/cancelar.png" border=\"0\"/>';
}
$imagen3 = "$img3";
/*******************************3*/
/**************PDF**************5*/
if($acusado == 0){
$img5 = '<img align="right" title="el acuse no ha sido firmado" src="imagenes/can_3.png" border=\"0\"/>';
$olk = "";
$clk = "";
}elseif($acusado == 1){
$img5 = '<img align="right" src="imagenes/acrobat.png" border=\"0\"/>';
$olk = "<A Href='#' onClick=\"popupwin('pdf_2.php?id={$row[id_digital]}&db={$relacion}',720 ,500,'','yes','yes')\" title=\"Ver PDF\">";
$clk = "</a>";
}
$imagen5 = "$olk$img5$clk";
/*******************************5*/
/**************Anexos**************7*/
$anexo = datosDigitalrecof($row[no_oficio],"doc_anexo");
if($anexo !== "0"){
$identificacion = datosDigitalrecof($row[no_oficio],"id_digital");
$code = datosDigitalrecof($row[no_oficio],"hash"); //disfrazando la identificacion :)S
$img7 = '<img align="right" src="imagenes/archivo.png" border=\"0\"/>';
$imagen7 = "<a href=\"descarga.php?ubicacion=$code\" title=\"descargar archivo\" target=\"_self\">$img7</a>";
}elseif($anexo == "0"){
$img7 ='';
$imagen7 = "";
}
/*******************************7*/
/*************Detalles*************6*/
if(1 == 1){
$img6 = '<img align="right" title="ver detalles" src="imagenes/detalles.png" border=\"0\"/>';
}elseif(1 != 1){
$img6 ='';
}
$imagen6 = "<a href=\"detalle_oficios2.php?id={$row[no_oficio]}&type=digital\" title=\"mostrar detalles\" target=\"_parent\">$img6</a>";
/*******************************6*/
/***********filtrar usuario destino************/
$filtrado = '<img align="left" title="filtrar este usuario" src="imagenes/filtrar.png" border=\"0\"/>';
$fil_2 = "<a href=\"digital_doc2.php?que={$row['id_usr_para']}&busqueda=Buscar&qr=BQR&fil=FIL\" target=\"_parent\">$filtrado</a>";
/*********************************/
$classrow = sprintf( "class=\"row%d\"", (($i++)%2)+1 );
++$bc;
?>
<tr <?php echo $classrow?>>
<td><?php echo $bc?></td><!--consecutivo -->
<td><?php echo $row[no_oficio] ?></td><!-- -->
<td><?php echo $row[fecha_oficio] ?></td><!-- -->
<td><?php echo $usuario_origen?></td><!-- -->
<td><?php echo $usuario_destino?></td><!-- -->
<td><?php echo $fil_2?></td><!--filtrar destino -->
<td><?php echo $imagen11 ?></td><!--acuse -->
<td><?php echo $imagen12 ?></td><!--leido -->
<td><?php echo $imagen2 ?></td><!--asignar -->
<td><?php echo $imagen3 ?></td><!--validar -->
<td><?php echo $imagen5 ?></td><!--pdf -->
<td><?php echo $imagen7 ?></td><!--anexo -->
<td><?php echo $imagen6 ?></td><!--detalles -->
</tr>
<?php
}
echo "</table>";
/*************************************************/