Incam_Intranet/lista_empresas.php
2011-04-04 15:16:10 +00:00

114 lines
3.3 KiB
PHP
Raw Blame History

<?php
include("seguridad.php");
include("functions.php");
if(!$usuario->tieneRol("3")){
header("Location: aplicacion.php?e=permiso");
exit;
}
include_once("html/cabecera.php");
include_once("Objects/HTML.php");
include_once("Objects/ListaEmpresas.php");
$html = new HTML($locale);
$listaEmpresas = new ListaEmpresas($usuario,$locale);
echo $html->menuEmpresas("","");
$destinoURL="lista_empresas.php";
// Comprobamos mensajes que pueden llegar hasta aqui
switch ($_GET['msg']) {
case "1":$msg=$locale['2301'].$locale['2303'].$locale['2306'];
$tipo="ok";
break;
case "2":$msg=$locale['2307'].$locale['2308'].$locale['2306'];
$tipo="error";
break;
default: $msg="";
break;
}
?>
<h2><?php echo $locale['2200']; ?></h2>
<?php if($msg!=""){
echo "<div class=\"aviso ".$tipo."\">".$msg."</div>";
} ?>
<div id="ContTabul">
<table width="100%" border="1">
<tr class="encabezado" align="center">
<td><?php echo $locale['1521'];
$orderView="nombre" ?><br />
</td>
<td><?php echo $locale['2214'];
$orderView="gerente" ?><br />
</td>
<td><?php echo $locale['2215'];
$orderView="privacidad" ?><br />
</td>
<td colspan="3"><?php echo $locale['2014']; ?></td>
</tr>
<?php
if($_GET['pagLista']>0){
$pagLista=$_GET['pagLista'];
}else{
$pagLista="1";
}
// Vemos si hay empresas
$lista=$listaEmpresas->getEmpresas();
if(count($lista)==0){
?>
<tr><td colspan="6" align="center"><?php echo $locale['2216']; ?></td></tr></table>
<?php
}else{
$inicio=($pagLista-1)*constante("lista");
if(count($lista)>($inicio+constante("lista"))){
$final=$inicio+constante("lista");
}else{
$final=count($lista);
}
for($i=$inicio;$i<$final;$i++){
$pedidoAct=$lista[$i];
?>
<tr>
<td align="center"><?php echo $pedidoAct->getValor("id"); ?></td>
<td align="center"><?php echo $pedidoAct->getValor("nombre_gerente"); ?></td>
<td align="center"><?php echo $pedidoAct->getValor("nombre_privacidad"); ?></td>
<td align="center">
<?php if($pedidoAct->puedeGestionar()){?>
<a href="gestion_empresa.php?oid=<?php echo $pedidoAct->getValor("oid"); ?>"><img src="css/edit.png" title="<?php echo $locale['2310']; ?>"/></a>
<?php }?>
</td>
<td align="center">
<?php if($pedidoAct->puedeGestionar()){?>
<a href="#" onclick="eliminarEmpresa('eliminar_empresa.php?oid=<?php echo $pedidoAct->getValor("oid"); ?>')" ><img src="css/eliminar.png" title="<?php echo $locale['el']." ".$locale['2311']; ?>"/></a>
<?php }?>
</td>
<td align="center">
<a href="cliente.php?oid=<?php echo $pedidoAct->getValor("oid"); ?>"><img src="css/brick_go.png" title="<?php echo $locale['2309']; ?>"/></a>
</td>
</tr>
<?php
}
}
?>
</table>
<div id="cronopaginacion">
<?php
// Comprobamos si tenemos que mostar una paginaci<63>n
$numPaginas=ceil(count($lista)/constante("lista"));
if(stripinput($_GET["order"])!=""){
if($variablesExtra!=""){
$variablesExtra="&".$variablesExtra;
}
$variables="order=".stripinput($_GET["order"]).$variablesExtra;
echo $html->paginacion($numPaginas,$pagLista,$destinoURL,$variables,"pagLista");
} else {
$variables=$variablesExtra;
echo $html->paginacion($numPaginas,$pagLista,$destinoURL,$variables,"pagLista");
}
?>
</div>
</div>
<?php
include_once("html/pie.php");
?>