git-svn-id: https://192.168.0.254/svn/Proyectos.ClaveAudio_Web/trunk@15 44ade383-bb54-5b4f-835b-923f7702b206
189 lines
6.5 KiB
PHP
189 lines
6.5 KiB
PHP
<?php
|
||
session_start();
|
||
|
||
if (!session_is_registered("clave_audio")) {
|
||
include("../login.php");
|
||
if (!$continuar) exit;
|
||
}
|
||
|
||
include('../db.php');
|
||
include("../../_incl/code.php");
|
||
?>
|
||
<html>
|
||
<head>
|
||
<title>oferta</title>
|
||
<link href="../sformi.css" rel="stylesheet" type="text/css">
|
||
<script type="text/javascript" src="../../_incl/code.js"></script>
|
||
<script language="JavaScript" type="text/JavaScript">function doSubmit() { document.formulario.submit(); }</script>
|
||
</head>
|
||
<body>
|
||
<?php
|
||
|
||
if(isset($_REQUEST['op'])) {
|
||
$operacion = $_REQUEST['op'];
|
||
$id = $_REQUEST['id'];
|
||
} else {
|
||
$operacion = "add";
|
||
}
|
||
|
||
$oferta_categoria = "";
|
||
$oferta_nombre = "";
|
||
$oferta_descripcion = "";
|
||
$oferta_estado = "";
|
||
$oferta_pvp = "";
|
||
$oferta_fab_id = "";
|
||
$oferta_unidades = "";
|
||
|
||
switch($operacion)
|
||
{
|
||
case "add";
|
||
break;
|
||
|
||
case "edit";
|
||
$conn = db_connect();
|
||
if($conn) {
|
||
$query = "SELECT oferta_id, oferta_categoria, oferta_nombre, oferta_descripcion, oferta_estado, oferta_pvp, oferta_fab_id, oferta_unidades FROM shoop_oferta WHERE oferta_id = " . $id;
|
||
$result = mysql_query($query, $conn);
|
||
if (mysql_num_rows($result)) {
|
||
$row = mysql_fetch_array($result);
|
||
$oferta_categoria = $row['oferta_categoria'];
|
||
$oferta_nombre = $row['oferta_nombre'];
|
||
$oferta_descripcion = $row['oferta_descripcion'];
|
||
$oferta_estado = $row['oferta_estado'];
|
||
$oferta_pvp = $row['oferta_pvp'];
|
||
$oferta_fab_id = $row['oferta_fab_id'];
|
||
$oferta_unidades = $row['oferta_unidades'];
|
||
}
|
||
}
|
||
break;
|
||
}
|
||
|
||
$max_size = 1024 * 1536; // the max. size for uploading
|
||
define("MAX_SIZE", $max_size);
|
||
?>
|
||
<form method="post" action="oferta_db.php" name="formulario" enctype="multipart/form-data">
|
||
<input name="op" type="hidden" value="<?= $operacion; ?>">
|
||
<input name="id" type="hidden" value="<?= $id; ?>">
|
||
<table border="0" cellspacing="0" cellpadding="0" width="100%">
|
||
<tr><td class="lbl12">Detalles del producto de oferta</td></tr>
|
||
<tr><td bgcolor="#777777"><img src="../../_imgs/d.gif" width="100" height="1"></td></tr>
|
||
</table>
|
||
<table border="0" cellspacing="0" cellpadding="0">
|
||
<tr>
|
||
<td><span class="lbl">Categoría</span><br/>
|
||
<select name="oferta_categoria" id="oferta_categoria" style="width:250px">
|
||
<option value="1">Altavoces</option>
|
||
<option value="2">Electrónicas</option>
|
||
<option value="3">Reproductores de CD, convertidores D/A, etc.</option>
|
||
<option value="4">Varios</option>
|
||
</select>
|
||
<script language="JavaScript" type="text/JavaScript"> selectOption('oferta_categoria', '<?= $oferta_categoria; ?>'); </script>
|
||
</td>
|
||
|
||
<td rowspan="16" valign="top">
|
||
<table width="250" border="0" cellspacing="0" cellpadding="0">
|
||
<tr>
|
||
<td><span class="lbl">Folleto PDF</span><br/><input name="ofr_pdf" type="file" style="width:250px" class="data"><br/>
|
||
<?php
|
||
if(file_exists('../../_ofr/' . $id . '.pdf')) {
|
||
echo "<a href='../../_ofr/". $id .".pdf' >Folleto PDF </a>";
|
||
}
|
||
?>
|
||
<br/><br/>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td><span class="lbl">Imagen</span><br/><input name="ofr_imagen" type="file" style="width:250px" class="data"></td>
|
||
</tr>
|
||
<tr>
|
||
<td>
|
||
<?php
|
||
if(file_exists('../../_ofr/' . $id . '_247.jpg')) {
|
||
?>
|
||
<table width="247" border="1" cellspacing="0" cellpadding="0" bordercolor="#333333" style="margin-top:10px; border-style:solid; border-color:#444444; border:1px; border-padding:1px;">
|
||
<tr>
|
||
<td align="center"><img src="../../_ofr/<?php echo $id; ?>_247.jpg"></td>
|
||
</tr>
|
||
</table>
|
||
<?php
|
||
}
|
||
?>
|
||
|
||
<?php
|
||
if(file_exists('../../_ofr/' . $id . '_168.jpg')) {
|
||
?>
|
||
<table width="168" border="1" cellspacing="0" cellpadding="0" bordercolor="#333333" style="margin-top:10px; border-style:solid; border-color:#444444; border:1px; border-padding:1px;">
|
||
<tr>
|
||
<td align="center"><img src="../../_ofr/<?php echo $id; ?>_168.jpg"></td>
|
||
</tr>
|
||
</table>
|
||
<?php
|
||
}
|
||
?>
|
||
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td></td>
|
||
<td>
|
||
</td>
|
||
</tr>
|
||
|
||
|
||
<tr>
|
||
<td width="200" class= "lbl">Marca</td>
|
||
<td></td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td class="data"><select name="oferta_fab_id" id="oferta_fab_id" style="width:200px" class="data">
|
||
<option value="" selected>Marcas</option>
|
||
<?php include("menu_marcas.php"); ?>
|
||
</select>
|
||
<script language="JavaScript" type="text/JavaScript"> selectOption('oferta_fab_id', '<?php echo $oferta_fab_id; ?>'); </script>
|
||
</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td width="200" class= "lbl">Nombre</td>
|
||
<td></td>
|
||
</tr>
|
||
|
||
<tr><td width="" class="data"><input name="oferta_nombre" id="oferta_nombre" type="text" size="50" maxlength="100" value="<?= $oferta_nombre; ?>"></td></tr>
|
||
|
||
<tr><td width="200" class= "lbl">Descripci<63>n</td></tr>
|
||
<tr><td width="" class="data"><textarea name="oferta_descripcion" cols="50"><?= $oferta_descripcion; ?></textarea></td></tr>
|
||
|
||
<tr><td width="200" class= "lbl">Estado</td></tr>
|
||
<tr><td width="" class="data"><input name="oferta_estado" style="width:px" value="<?= $oferta_estado; ?>">
|
||
|
||
<tr><td width="200" class= "lbl">PVP</td></tr>
|
||
<tr><td width="" class="data"><input name="oferta_pvp" type="text" value="<?= $oferta_pvp; ?>" size="10" maxlength="10"></td></tr>
|
||
|
||
<tr><td width="200" class= "lbl">Unidades</td></tr>
|
||
<tr><td width="" class="data"><input name="oferta_unidades" type="text" value="<?= $oferta_unidades; ?>" size="3" maxlength="3"></td></tr>
|
||
|
||
</table>
|
||
<table border="0" cellspacing="0" cellpadding="0">
|
||
<tr>
|
||
<td>
|
||
<a href="oferta.php" class="button">[ atrás ]</a>
|
||
<a href="javascript:doSubmit();" class="button">[ Ok ]</a>
|
||
</td>
|
||
<?php
|
||
if($operacion == 'edit') {
|
||
?>
|
||
<td>
|
||
<a href="oferta_db.php?op=del&id=<?= $id; ?>" onClick="return confirm('Estás seguro de querer borrar este artículo?')" class="button">[ borrar ]</a>
|
||
</td>
|
||
<?php
|
||
}
|
||
?>
|
||
</tr>
|
||
</table>
|
||
</form>
|
||
</body>
|
||
</html>
|