2011-05-06 11:33:27 +00:00
< ? 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 > ocasion </ 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 " ;
}
$ocasion_categoria = " " ;
$ocasion_nombre = " " ;
$ocasion_descripcion = " " ;
$ocasion_estado = " " ;
$ocasion_pvp = " " ;
$ocasion_precio = " " ;
$ocasion_unidades = " " ;
2011-06-06 14:29:53 +00:00
$ocasion_fab_id = " " ;
2011-05-06 11:33:27 +00:00
switch ( $operacion )
{
case " add " ;
break ;
case " edit " ;
$conn = db_connect ();
if ( $conn ) {
2011-06-06 14:29:53 +00:00
$query = " SELECT ocasion_id, ocasion_fab_id, ocasion_categoria, ocasion_nombre, ocasion_descripcion, ocasion_estado, ocasion_pvp, ocasion_precio, ocasion_unidades FROM shoop_ocasion WHERE ocasion_id = " . $id ;
2011-05-06 11:33:27 +00:00
$result = mysql_query ( $query , $conn );
if ( mysql_num_rows ( $result )) {
$row = mysql_fetch_array ( $result );
$ocasion_categoria = $row [ 'ocasion_categoria' ];
$ocasion_nombre = $row [ 'ocasion_nombre' ];
$ocasion_descripcion = $row [ 'ocasion_descripcion' ];
$ocasion_estado = $row [ 'ocasion_estado' ];
$ocasion_pvp = $row [ 'ocasion_pvp' ];
$ocasion_precio = $row [ 'ocasion_precio' ];
$ocasion_unidades = $row [ 'ocasion_unidades' ];
2011-06-06 14:29:53 +00:00
$ocasion_fab_id = $row [ 'ocasion_fab_id' ];
2011-05-06 11:33:27 +00:00
}
}
break ;
}
2011-05-09 15:07:48 +00:00
$max_size = 1024 * 1536 ; // the max. size for uploading
define ( " MAX_SIZE " , $max_size );
2011-05-06 11:33:27 +00:00
?>
< form method = " post " action = " ocasion_db.php " name = " formulario " enctype = " multipart/form-data " >
< input name = " op " type = " hidden " value = " <?= $operacion ; ?> " >
< input name = " id " type = " hidden " value = " <?= $id ; ?> " >
2011-05-09 15:07:48 +00:00
< table border = " 0 " cellspacing = " 0 " cellpadding = " 0 " width = " 100% " >
< tr >< td class = " lbl12 " > Detalles del producto de ocasi & oacute ; n </ td ></ tr >
< tr >< td bgcolor = " #777777 " >< img src = " ../../_imgs/d.gif " width = " 100 " height = " 1 " ></ td ></ tr >
</ table >
2011-05-06 11:33:27 +00:00
< table border = " 0 " cellspacing = " 0 " cellpadding = " 0 " >
2011-05-09 15:07:48 +00:00
< tr >
< td class = " lbl " > Categor & iacute ; a </ td >
< td class = " lbl " >& nbsp ; Imagen </ td >
</ tr >
< tr >
< td >
< select name = " ocasion_categoria " id = " ocasion_categoria " style = " width:250px " >
< option value = " 1 " > Altavoces </ option >
2011-05-06 11:33:27 +00:00
< option value = " 2 " > Electr & oacute ; nicas </ option >
< option value = " 3 " > Reproductores de CD , convertidores D / A , etc .</ option >
< option value = " 4 " > Varios </ option >
2011-05-09 15:07:48 +00:00
</ select >
< script language = " JavaScript " type = " text/JavaScript " > selectOption ( 'ocasion_categoria' , '<?= $ocasion_categoria; ?>' ); </ script >
</ td >
< td rowspan = " 16 " valign = " top " >
< table width = " 250 " border = " 0 " cellspacing = " 0 " cellpadding = " 0 " >
< tr >
< td >< input name = " prod_imagen " type = " file " style = " width:250px " class = " data " ></ td >
</ tr >
< tr >
< td >
< ? php
if ( file_exists ( '../../_ocs/' . $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 = " ../../_ocs/<?php echo $id ; ?>_247.jpg " ></ td >
</ tr >
</ table >
< ? php
}
?>
< ? php
if ( file_exists ( '../../_ocs/' . $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 = " ../../_ocs/<?php echo $id ; ?>_168.jpg " ></ td >
</ tr >
</ table >
< ? php
}
?>
</ td >
</ tr >
</ table >
</ td >
</ tr >
< tr >
< td ></ td >
< td >
</ td >
</ tr >
2011-06-06 14:29:53 +00:00
< tr >
< td width = " 200 " class = " lbl " > Marca </ td >
< td ></ td >
</ tr >
< tr >
< td class = " data " >< select name = " ocasion_fab_id " id = " ocasion_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 ( 'ocasion_fab_id' , '<?php echo $ocasion_fab_id; ?>' ); </ script >
</ td >
</ tr >
2011-05-06 11:33:27 +00:00
< tr >
< td width = " 200 " class = " lbl " > Nombre </ td >
2011-05-09 15:07:48 +00:00
< td ></ td >
2011-05-06 11:33:27 +00:00
</ tr >
2011-05-09 15:07:48 +00:00
2011-05-06 11:33:27 +00:00
< tr >< td width = " " class = " data " >< input name = " ocasion_nombre " id = " ocasion_nombre " type = " text " size = " 50 " maxlength = " 100 " value = " <?= $ocasion_nombre ; ?> " ></ td ></ tr >
2011-05-09 15:07:48 +00:00
2011-05-06 11:33:27 +00:00
< tr >< td width = " 200 " class = " lbl " > Descripci<EFBFBD> n </ td ></ tr >
< tr >< td width = " " class = " data " >< textarea name = " ocasion_descripcion " cols = " 50 " >< ? = $ocasion_descripcion ; ?> </textarea></td></tr>
2011-05-09 15:07:48 +00:00
2011-05-06 11:33:27 +00:00
< tr >< td width = " 200 " class = " lbl " > Estado </ td ></ tr >
< tr >< td width = " " class = " data " >< input name = " ocasion_estado " style = " width:px " value = " <?= $ocasion_estado ; ?> " >
2011-05-09 15:07:48 +00:00
2011-05-06 11:33:27 +00:00
< tr >< td width = " 200 " class = " lbl " > PVP </ td ></ tr >
< tr >< td width = " " class = " data " >< input name = " ocasion_pvp " type = " text " value = " <?= $ocasion_pvp ; ?> " size = " 10 " maxlength = " 10 " ></ td ></ tr >
2011-05-09 15:07:48 +00:00
2011-05-06 11:33:27 +00:00
< tr >< td width = " 200 " class = " lbl " > Precio </ td ></ tr >
< tr >< td width = " " class = " data " >< input name = " ocasion_precio " type = " text " value = " <?= $ocasion_precio ; ?> " size = " 10 " maxlength = " 10 " ></ td ></ tr >
2011-05-09 15:07:48 +00:00
2011-05-06 11:33:27 +00:00
< tr >< td width = " 200 " class = " lbl " > Unidades </ td ></ tr >
< tr >< td width = " " class = " data " >< input name = " ocasion_unidades " type = " text " value = " <?= $ocasion_unidades ; ?> " size = " 3 " maxlength = " 3 " ></ td ></ tr >
2011-05-09 15:07:48 +00:00
2011-05-06 11:33:27 +00:00
</ table >
< table border = " 0 " cellspacing = " 0 " cellpadding = " 0 " >
< tr >
< td >
< a href = " ocasion.php " class = " button " > [ atr & aacute ; s ] </ a >& nbsp ; & nbsp ;
2011-05-09 15:07:48 +00:00
< a href = " javascript:doSubmit(); " class = " button " > [ Ok ] </ a >
2011-05-06 11:33:27 +00:00
</ td >
< ? php
if ( $operacion == 'edit' ) {
?>
< td >
2011-05-09 15:07:48 +00:00
< a href = " ocasion_db.php?op=del&id=<?= $id ; ?> " onClick = " return confirm('Estás seguro de querer borrar este artículo?') " class = " button " > [ borrar ] </ a >
2011-05-06 11:33:27 +00:00
</ td >
< ? php
}
?>
</ tr >
</ table >
</ form >
</ body >
</ html >