Incam_Intranet/gestion_empresa.php

85 lines
2.2 KiB
PHP
Raw Permalink Normal View 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/Empresa.php");
$html = new HTML($locale);
if($_POST['oid']!=""){
$oid=$_POST['oid'];
} elseif ($_GET['oid']!="") {
$oid=$_GET['oid'];
}
try{
$empresa=new Empresa($usuario,$oid,$locale);
}catch (Exception $e){
$msg=$e->getMessage();
include_once("showError.php");
exit();
}
switch ($_POST['action']) {
case "editar":$id=$_POST['id'];
$gerente=$_POST['gerente'];
$privado=$_POST['privado'];
$valores = array("gerente" => $gerente,
"id" => $id,
"privado" => $privado);
try{
$empresa->setCampos($valores);
$msg=$locale['2300'].$locale['2303'].$locale['2306'];
$tipo="ok";
} catch (Exception $e){
$msg=$e->getMessage();
$tipo="error";
}
break;
default:
break;
}
echo $html->menuEmpresas($oid,"");
?>
<h2><?php echo $empresa->getValor("id"); ?></h2>
<?php if($msg!=""){
echo "<div class=\"aviso ".$tipo."\">".$msg."</div>";
} ?>
<div id="ContTabul">
<form action="gestion_empresa.php" method="post" >
<input type="hidden" name="oid" value="<?php echo $empresa->getValor("oid"); ?>" />
<input type="hidden" name="action" value="editar" />
<table>
<tr>
<td><?php echo $locale['1803']; ?></td>
<td><input type="text" name="id" value="<?php echo $empresa->getValor("id"); ?>" /></td>
</tr>
<tr>
<td><?php echo $locale['2214']; ?></td>
<td>
<?php echo rellena_personal_permiso("gerente","GP",$auxiliar,$empresa->getValor("gerente")); ?>
</td>
</tr>
<tr>
<td><?php echo $locale['2215']; ?></td>
<td>
<select name="privado">
<option value="0" <?php if($empresa->getValor("privado")=="0") echo "selected"; ?>><?php echo $locale['2213']; ?></option>
<option value="1" <?php if($empresa->getValor("privado")=="1") echo "selected"; ?>><?php echo $locale['2212']; ?></option>
</select>
</td>
</tr>
</table>
<input type="submit" class="button" value="Editar" />
</form>
</div>
<?php
include_once("html/pie.php");
?>