Se adapta la web para que el home crezca hacia abajo

git-svn-id: https://192.168.0.254/svn/Proyectos.ClaveAudio_Web/trunk@15 44ade383-bb54-5b4f-835b-923f7702b206
This commit is contained in:
roberto 2011-06-15 08:43:54 +00:00
parent 9b70b1e4c4
commit 75bd9cca22
11 changed files with 228 additions and 57 deletions

View File

@ -77,17 +77,14 @@ var $curTipo;
$this->contador = 0;
$this->result = false;
$this->curTipo = $tipo;
$cuantos = $cuantos * 4;
$conn = db_connect();
if($conn) {
$query = 'SELECT oferta_id, oferta_fab_id, fab_nombre, oferta_categoria, oferta_nombre, oferta_estado, oferta_pvp, oferta_descripcion
FROM shoop_oferta
LEFT JOIN shoop_fabricantes on (oferta_fab_id=fab_id)
WHERE oferta_unidades > 0
ORDER BY RAND()';
// LIMIT ' . $cuantos;
ORDER BY RAND() LIMIT '. $cuantos;
$this->result = mysql_query($query, $conn);
$this->numOfertas = mysql_num_rows($this->result);
@ -104,7 +101,7 @@ var $curTipo;
if($this->contador < $this->numOfertas) {
$row = mysql_fetch_array($this->result);
$this->contador ++;
if(file_exists('_ofr/' . $row['oferta_id'] . ($this->curTipo != 2 ? '_168.jpg' : '_247.jpg'))) {
// if(file_exists('_ofr/' . $row['oferta_id'] . ($this->curTipo != 2 ? '_168.jpg' : '_247.jpg'))) {
$oferta = array ( 'categoria_id' => $row['oferta_categoria'],
'nombre' => $row['oferta_nombre'],
'id' => $row['oferta_id'],
@ -113,9 +110,9 @@ var $curTipo;
'fab_nombre' => $row['fab_nombre'],
'pvp' => $row['oferta_pvp'],
'descripcion' => $row['oferta_descripcion']);
} else {
$oferta = $this->getNextOferta();
}
// } else {
// $oferta = $this->getNextOferta();
// }
}
return $oferta; // es un array
}
@ -133,17 +130,15 @@ var $curTipo;
$this->contador = 0;
$this->result = false;
$this->curTipo = $tipo;
$cuantos = $cuantos * 4;
$conn = db_connect();
if($conn) {
$query = 'SELECT ocasion_id, ocasion_categoria, ocasion_nombre, ocasion_estado, ocasion_pvp, ocasion_precio, ocasion_descripcion, ocasion_fab_id
$query = 'SELECT ocasion_id, ocasion_categoria, ocasion_nombre, ocasion_estado, ocasion_pvp, ocasion_precio, ocasion_descripcion, ocasion_fab_id, fab_nombre
FROM shoop_ocasion
WHERE ocasion_unidades > 0
ORDER BY RAND()';
// LIMIT ' . $cuantos;
LEFT JOIN shoop_fabricantes on (ocasion_fab_id=fab_id)
WHERE (ocasion_unidades > 0)
ORDER BY RAND() LIMIT '. $cuantos;
$this->result = mysql_query($query, $conn);
$this->numOcasiones = mysql_num_rows($this->result);
}
@ -159,18 +154,19 @@ var $curTipo;
if($this->contador < $this->numOcasiones) {
$row = mysql_fetch_array($this->result);
$this->contador ++;
if(file_exists('_ocs/' . $row['ocasion_id'] . ($this->curTipo != 2 ? '_168.jpg' : '_247.jpg'))) {
// if(file_exists('_ocs/' . $row['ocasion_id'] . ($this->curTipo != 2 ? '_168.jpg' : '_247.jpg'))) {
$ocasion = array ( 'categoria_id' => $row['ocasion_categoria'],
'nombre' => $row['ocasion_nombre'],
'id' => $row['ocasion_id'],
'fab_id' => $row['ocasion_fab_id'],
'fab_nombre' => $row['fab_nombre'],
'estado' => $row['ocasion_estado'],
'precio' => $row['ocasion_precio'],
'pvp' => $row['ocasion_pvp'],
'descripcion' => $row['ocasion_descripcion']);
} else {
$ocasion = $this->getNextOcasion();
}
// } else {
// $ocasion = $this->getNextOcasion();
// }
}
return $ocasion; // es un array
}

View File

@ -55,6 +55,7 @@ $conn = db_connect();
if ($operacion != "del") {
// modifico la imagen.
uploadImagenOferta($id, 247, 95, 168, 102);
uploadPDFOferta($id);
// y vuelvo a la pantalla correspondiente
header('Location: oferta_edit.php?op=edit&id=' . $id);
}

View File

@ -70,11 +70,7 @@ define("MAX_SIZE", $max_size);
</table>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class= "lbl">Categor&iacute;a</td>
<td class= "lbl">&nbsp;Imagen</td>
</tr>
<tr>
<td>
<td><span class="lbl">Categor&iacute;a</span><br/>
<select name="oferta_categoria" id="oferta_categoria" style="width:250px">
<option value="1">Altavoces</option>
<option value="2">Electr&oacute;nicas</option>
@ -87,7 +83,17 @@ define("MAX_SIZE", $max_size);
<td rowspan="16" valign="top">
<table width="250" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><input name="ofr_imagen" type="file" style="width:250px" class="data"></td>
<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>

View File

@ -168,4 +168,44 @@
}
}
function uploadPDFOferta($prodID) {
$path = "../../_ofr/"; // este directorio tiene que tener chmod 777
$upload_file_name = "ofr_pdf"; // el nombre del campo tipo file de nuestro formulario
$acceptable_file_types = ""; // acepta GIF et JPEG
$default_extension = "";
$mode = 1; // OPTIONS:
// 1 = overwrite mode
// 2 = create new with incremental extention
// 3 = do nothing if exists, highest protection
// un poco de limpieza previa
// este es el temporal
$glob = glob($path . $prodID. '_tmp');
limpia($glob);
limpia($path . '_' . $prodID . '.pdf');
// fin de la limpia
if(strlen($_FILES['ofr_pdf']['name'])) {
$my_uploader = new uploader('es'); // Create a new instance of the class
$my_uploader->max_filesize(5000000); // OPTIONAL: set the max filesize of uploadable files in bytes
// $my_uploader->max_image_size(1600, 1600); // OPTIONAL: if you're uploading images, you can set the max pixel dimensions
// UPLOAD the file
if ($my_uploader->upload($upload_file_name, $acceptable_file_types, $default_extension)) {
$my_uploader->save_file($path, $prodID . '.pdf', $mode);
if (!$my_uploader->error) {
$my_uploader->delete_file;
}
}
if ($my_uploader->error) {
echo $my_uploader->error;
}
$glob = glob($path . $proid. '_tmp');
limpia($glob);
}
// else
// limpia($path . $prodID . '.pdf');
}
?>

View File

@ -1,4 +1,4 @@
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
<table width="100%" height="100%" border="1" cellpadding="0" cellspacing="0">
<tr><td width="160">
<div class="oferta_foto">
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0"><tr><td valign="middle" align="center">

View File

@ -18,7 +18,7 @@
?>
<img src="_imgs/d.gif" height="6"><br>
<a href="oferta_ficha.php?id=<?php echo $arrayOcasion['id']; ?>"><img src="_ocs/<?php echo $arrayOcasion['id']; ?>_247.jpg" border="0" alt=""></a>
<a href="ocasion_ficha.php?id=<?php echo $arrayOcasion['id']; ?>"><img src="_ocs/<?php echo $arrayOcasion['id']; ?>_247.jpg" border="0" alt=""></a>
</div>
<div class="destacado_precio"><?php echo ($arrayOcasion['precio'] == '-1' ? 'Consultar' : 'Ocasi&oacute;n ' . miNumberFormat($arrayOcasion['precio']) . '<span class="euro">&euro;</span>'); ?></div>
</td>

View File

@ -31,6 +31,15 @@
<div class="oferta_texto"><?php if(strlen($arrayOferta['descripcion'])) { echo substr($arrayOferta['descripcion'], 0, 150) . '...'; } ?></div>
<div class="producto_ocasion1"><br />Precio PVP: <?php echo $arrayOferta['pvp'];?> &euro;</div>
<?php
//FOLLETO PDF
$path = '_ofr/' . $arrayOferta['id'] . '.pdf';
if (file_exists($path)) {
echo "<br/><a href='". $path ."'>Ver folleto PDF </a>";
}
?>
</td>
</tr>

18
bann_ocasion_home.php Normal file
View File

@ -0,0 +1,18 @@
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="160">
<div class="oferta_foto">
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
<tr><td valign="middle" align="center">
<a href="ocasion_ficha.php?id=<?php echo $arrayOcasion['id']; ?>"><img src="_ocs/<?php echo $arrayOcasion['id']; ?>_168.jpg" width="160" border="0"></a>
</td></tr></table>
</div>
</td>
<td width="8"></td>
<td width="152" valign="top">
<div class="oferta_marca"><?php echo $arrayOcasion['fab_nombre']; ?><br><span class="azul"><?php echo $arrayOcasion['nombre']; ?></span></div>
<div class="oferta_precio"><?php echo ($arrayOcasion['precio'] == '-1' ? 'Consultar' : miNumberFormat($arrayOcasion['precio']) . '<span class="euro">&euro;</span>'); ?></div>
<div class="oferta_texto"><?php if(strlen($arrayOcasion['descripcion'])) { echo substr($arrayOcasion['descripcion'], 0, 150) . '...'; } ?></div>
<div class="producto_ocasion1"><br />Precio PVP: <?php echo $arrayOcasion['pvp'];?> &euro;</div>
</td></tr>
</table>

26
bann_oferta_home.php Normal file
View File

@ -0,0 +1,26 @@
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="160">
<div class="oferta_foto">
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
<tr><td valign="middle" align="center">
<a href="oferta_ficha.php?id=<?php echo $arrayOfertas['id']; ?>"><img src="_ofr/<?php echo $arrayOfertas['id']; ?>_168.jpg" width="160" border="0"></a>
</td></tr></table>
</div>
</td>
<td width="8"></td>
<td width="152" valign="top">
<div class="oferta_marca"><?php echo $arrayOfertas['fab_nombre']; ?><br><span class="azul"><?php echo $arrayOfertas['nombre']; ?></span></div>
<div class="oferta_precio"><?php echo ($arrayOfertas['pvp'] == '-1' ? 'Consultar' : miNumberFormat($arrayOfertas['pvp']) . '<span class="euro">&euro;</span>'); ?></div>
<div class="oferta_texto"><?php if(strlen($arrayOfertas['descripcion'])) { echo substr($arrayOfertas['descripcion'], 0, 150) . '...'; } ?></div>
<!--div class="producto_ocasion1"><br />Precio PVP: <?php echo $arrayOfertas['pvp'];?> &euro;</div-->
<?php
//FOLLETO PDF
$path = '_ofr/' . $arrayOfertas['id'] . '.pdf';
if (file_exists($path)) {
echo "<br/><a href='". $path ."'>Ver folleto PDF </a>";
}
?>
</td></tr>
</table>

125
index.php
View File

@ -64,7 +64,9 @@ ini_set ('display_errors', '0');
?>
<table width="708" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<!--Banners cabecera-->
<tr>
<td colspan="3">
<table id="banner" width="708" border="0" cellpadding="0" cellspacing="0">
<tr>
@ -78,11 +80,17 @@ ini_set ('display_errors', '0');
</tr>
<tr><td colspan="2" class="sombra" height="10"></td></tr>
</table>
</td></tr>
</td>
</tr>
<!-- Separacion cuerpo -->
<tr>
<td><img src="_imgs/d.gif" width="348" height="1"></td>
<td><img src="_imgs/d.gif" width="12" height="1"></td>
<td><img src="_imgs/d.gif" width="348" height="1"></td></tr>
<td><img src="_imgs/d.gif" width="348" height="1"></td>
</tr>
<!-- Cuerpo -->
<tr>
<td valign="top">
@ -96,7 +104,62 @@ ini_set ('display_errors', '0');
</tr>
</table>
<table id="zona" width="348" border="0" cellpadding="0" cellspacing="0">
<!--NUEVA ESTRUCTURA-->
<table id="zona" width="348" border="1" cellpadding="0" cellspacing="0">
<tr><td height="29"><img src="_imgs/zonatit.gif" style="margin-left:8px" /></td></tr>
</table>
<table id="ofertas" width="348" border="0" cellpadding="0" cellspacing="0">
<tr><td height="50">OFERTAS</td></tr>
<tr><td height="5" colspan="3"><div class="sepa"></div></td></tr>
<?php
$miOfertas = new shoopOfertaNueva(3, '');
for ($i=0; $i < $miOfertas->getNum(); $i++){
$arrayOfertas = $miOfertas->getNextOferta();
if(!empty($arrayOfertas)){
?>
<tr><td bgcolor="#FFFFFF"><?php include('bann_oferta_home.php');?></td></tr>
<tr><td height="5"><div class="sepa"></div></td></tr>
<?php
}
}
?>
</td></tr>
<tr><td>
<p align="right" style="margin:0;padding:0"><a href="ofertas.php" class="pielink">Ver todo el material de Oferta >></a></p>
</td></tr>
</table>
<table id="ocasion" width="348" border="0" cellpadding="0" cellspacing="0">
<tr><td height="50">OCASI&Oacute;N</td></tr>
<tr><td height="5" colspan="3"><div class="sepa"></div></td></tr>
<?php
$miOcasion = new shoopOcasion(3, '');
for ($i=0; $i < $miOcasion->getNum(); $i++){
$arrayOcasion = $miOcasion->getNextOcasion();
if(!empty($arrayOcasion)){
?>
<tr><td bgcolor="#FFFFFF"><?php include('bann_ocasion_home.php');?></td></tr>
<tr><td height="5"><div class="sepa"></div></td></tr>
<?php
}
}
?>
</td></tr>
<tr><td>
<p align="right" style="margin:0;padding:0"><a href="ocasion.php" class="pielink">Ver todo el material de Ocasi&oacute;n >></a></p>
</td></tr>
</table>
<!--FIN NUEVA ESTRUCTURA-->
<!--ZONA-->
<!--table id="zona" width="348" border="0" cellpadding="0" cellspacing="0">
<tr><td height="29"><img src="_imgs/zonatit.gif" style="margin-left:8px" /></td></tr>
<tr>
<td>
@ -197,34 +260,37 @@ ini_set ('display_errors', '0');
</td>
</tr>
</table>
</table-->
</td>
<!--SEPARACION-->
<td></td>
<!--LATERAL DERECHO-->
<td valign="top">
<table id="novedades" width="348" border="0" cellpadding="0" cellspacing="0">
<!--NOVEDADES-->
<table id="novedades" width="348" border="0" cellpadding="0" cellspacing="0">
<tr><td colspan="3" height="25"><img src="_imgs/novetit.gif" alt="novedades" width="129" height="13"></td></tr>
<?php
if($conn) {
$query = 'SELECT articulo_id, articulo_titular, articulo_entradilla FROM edito_articulos ORDER BY articulo_id DESC LIMIT 1';
$query = 'SELECT articulo_id, articulo_titular, articulo_entradilla FROM edito_articulos ORDER BY articulo_id DESC LIMIT 4';
$result = mysql_query($query, $conn);
if($result && mysql_num_rows($result)) {
$row = mysql_fetch_array($result);
if($result && (mysql_num_rows($result)>0)) {
while ($row = mysql_fetch_array($result)){
?>
<tr>
<td width="168" valign="top">
<span class="tit azul"><?= $row['articulo_titular']; ?></span><br />
<?= $row['articulo_entradilla']; ?> <a href="articulos.php?t=1&id=<?= $row['articulo_id']; ?>" class="mas">[+]</a></td>
<td><img src="_imgs/d.gif" width="11" height="1" alt=""></td>
<td valign="top">
<tr>
<td width="168" valign="top">
<span class="tit azul"><?= $row['articulo_titular']; ?></span><br />
<?= $row['articulo_entradilla']; ?> <a href="articulos.php?t=1&id=<?= $row['articulo_id']; ?>" class="mas">[+]</a></td>
<td><img src="_imgs/d.gif" width="11" height="1" alt=""></td>
<td valign="top">
<?php
$query = 'SELECT galeria_imagen_name FROM edito_galeria_imagenes WHERE galeria_articulo_id = ' . $row['articulo_id'] . ' ORDER BY galeria_imagen_name';
$result = mysql_query($query, $conn);
if($result){
while($row_img = mysql_fetch_array($result)) {
$result2 = mysql_query($query, $conn);
if($result2){
while($row_img = mysql_fetch_array($result2)) {
$path_108 = '_pics/' . $row_img['galeria_imagen_name'] . '_348.jpg';
if(file_exists($path_108)) {
?>
@ -237,15 +303,15 @@ ini_set ('display_errors', '0');
?>
</td>
</tr>
<tr><td height="25" colspan="3"><div class="sepa"></div></td></tr>
<?php
}
}
}
?>
</table>
</table>
<!--BANNERS-->
<table id="right" width="348" border="0" cellpadding="0" cellspacing="0">
<tr>
@ -265,14 +331,15 @@ ini_set ('display_errors', '0');
</tr>
</table>
<div class="banner01">
<?php
// el par‡metro que paso es el nœmero de baners de tipo 1 que quiero
$miBanner = new shoopBanners(1, 348);
if($miBanner->getNum())
echo $miBanner->getNextBanner();
?>
</div>
$miBanner = new shoopBanners(2, 348);
for ($i=0; $i < $miBanner->getNum(); $i++){
?>
<div class="banner01"><?php echo $miBanner->getNextBanner();?></div>
<?php
}
?>
</td></tr></table>

View File

@ -132,6 +132,14 @@ switch($oferta_categoria_id) {
<span class="producto_modelo">Oferta PVP:</span> <span class="producto_precio_ocasion2"><?php echo $oferta_pvp; ?><span class="euro">&euro;</span><br>
<img src="_imgs/d.gif" width="170" height="6"><br>
<?php
//FOLLETO PDF
$path = '_ofr/' . $oferta_id . '.pdf';
if (file_exists($path)) {
echo "<a href='". $path ."'>Ver folleto PDF </a>";
}
?>
<a href="oferta_add.php?id=<?= $oferta_id; ?>&precio=<?= $oferta_pvp; ?>&modelo=<?= $oferta_nombre; ?>" onMouseOver="MM_swapImage('comprar','','_imgs/comprb.gif',1)" onMouseOut="MM_swapImgRestore()"><img src="_imgs/compra.gif" name="comprar" width="61" height="13" border="0" id="comprar"></a>
</td>