mirror of
https://github.com/rmontanana/inventario2.git
synced 2025-08-15 23:45:58 +00:00
Añadido que visualice tanto en la pantalla de consulta como en la de edición y baja la imagen almacenada.
Falta hacer que se inserte el dato de la imagen y se guarde la imagen subida, que admita modificaciones y eliminaciones de imagen y que elimine la imagen en la baja.
This commit is contained in:
@@ -206,6 +206,11 @@ class Mantenimiento {
|
||||
$this->campoBusca = $dato[1];
|
||||
$valor = '<a title="Inventario de ' . $valor . '" $target="_blank" href="index.php?informeInventario&opc=listar' . $datoEnlace . '&id=' . $id . '">' . $valor;
|
||||
}
|
||||
if (strstr($this->campos[$clave]['Comment'], "imagen") && isset($valor)) {
|
||||
$msj = '<button type="button" data-toggle="modal" data-target="#mensajeModal' . $id .'">'.$valor.'</button>';
|
||||
$msj .= $this->creaModal($valor, $id);
|
||||
$valor = $msj;
|
||||
}
|
||||
if ($this->campos[$clave]['Type'] == "Boolean(1)") {
|
||||
$checked = $valor == '1' ? 'checked' : '';
|
||||
$valor = '<input type="checkbox" disabled ' . $checked . '>';
|
||||
@@ -594,6 +599,10 @@ class Mantenimiento {
|
||||
$salida .= '</div></div>';
|
||||
continue;
|
||||
}
|
||||
if ($tipoCampo == "imagen(".$tamano.")") {
|
||||
$salida .= $this->creaCampoImagen($campo, $valorDato);
|
||||
continue;
|
||||
}
|
||||
//Si no es una clave foránea añade un campo de texto normal
|
||||
$salida.='<input class="form-control" type="' . $tipo_campo . '" name="' . $campo . '" value="' . $valorDato .
|
||||
'" maxlength="' . $tamano . '" size="' . (string) (intval($tamano) + 5) . '" ' . $modoEfectivo . " ><br><br>\n";
|
||||
@@ -614,6 +623,56 @@ class Mantenimiento {
|
||||
$salida .= '<br></center></div>';
|
||||
return $salida;
|
||||
}
|
||||
|
||||
protected function creaCampoImagen($campo, $valor)
|
||||
{
|
||||
|
||||
if (file_exists($valor)) {
|
||||
//El fichero existe.
|
||||
$existe = true;
|
||||
$tipo = "fileinput-exists";
|
||||
} else {
|
||||
$tipo = "fileinput-new";
|
||||
$existe = false;
|
||||
}
|
||||
$mensaje = '
|
||||
<div class="fileinput ' . $tipo . '" data-provides="fileinput">
|
||||
<div class="fileinput-new thumbnail" style="width: 200px; height: 150px;"><img src="img/sinImagen.gif" /></div>
|
||||
<div class="fileinput-preview fileinput-exists thumbnail" style="max-width: 200px; max-height: 150px; line-height: 20px;">';
|
||||
|
||||
if ($existe) {
|
||||
$mensaje .= '<img src="' . $valor . '" onclick="$('."'#mensajeModal1'".').modal();">';
|
||||
}
|
||||
$mensaje .= '
|
||||
</div>
|
||||
<div>
|
||||
<span class="btn btn-default btn-file"><span class="fileinput-new">Añadir</span><span class="fileinput-exists">Cambiar</span><input type="file" name="imagen" /></span>
|
||||
<a href="#" class="btn btn-default fileinput-exists" data-dismiss="fileinput">Eliminar</a>';
|
||||
|
||||
if ($existe) {
|
||||
$mensaje .='<input type="hidden" name="' . $campo . '" value="' . $valor . '">';
|
||||
}
|
||||
|
||||
$mensaje .='
|
||||
</div>
|
||||
</div>';
|
||||
$mensaje .= $this->creaModal($valor, 1);
|
||||
return $mensaje;
|
||||
|
||||
}
|
||||
|
||||
private function creaModal($valor, $id)
|
||||
{
|
||||
$mensaje .= '
|
||||
<div id="mensajeModal'.$id.'" class="modal fade " tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog text-center">
|
||||
<div class="modal-content text-center">
|
||||
<img src="' . $valor . '">
|
||||
</div>
|
||||
</div>
|
||||
</div>';
|
||||
return $mensaje;
|
||||
}
|
||||
|
||||
protected function errorBD($comando, $texto = "", $tipo = "danger", $cabecera = "¡Atención!")
|
||||
{
|
||||
|
7
css/jasny-bootstrap.min.css
vendored
Normal file
7
css/jasny-bootstrap.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
6
css/jasny-bootstrap.min.js
vendored
Normal file
6
css/jasny-bootstrap.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
BIN
img.data/1424.jpg
Executable file
BIN
img.data/1424.jpg
Executable file
Binary file not shown.
After Width: | Height: | Size: 210 KiB |
BIN
img/sinImagen.gif
Normal file
BIN
img/sinImagen.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 661 B |
@@ -16,6 +16,7 @@
|
||||
<link href="css/bootstrap-datetimepicker.min.css" rel="stylesheet">
|
||||
<link rel="stylesheet" href="css/jquery.simplecolorpicker.css">
|
||||
<link rel="stylesheet" href="css/jquery.simplecolorpicker-glyphicons.css">
|
||||
<link rel="stylesheet" href="css/jasny-bootstrap.min.css">
|
||||
<style type="text/css"></style>
|
||||
|
||||
<script type="text/javascript" src="./css/jquery.min.js"></script>
|
||||
@@ -88,6 +89,7 @@
|
||||
<script type="text/javascript" src="./css/moment.min.js"></script>
|
||||
<script type="text/javascript" src="./css/bootstrap-datetimepicker.min.js"></script>
|
||||
<script type="text/javascript" src="./css/bootstrap-datetimepicker.es.js"></script>
|
||||
<script type="text/javascript" src="./css/jquery.simplecolorpicker.js"></script>
|
||||
<script type="text/javascript" src="./css/jquery.simplecolorpicker.js"></script>
|
||||
<script type="text/javascript" src="./css/jasny-bootstrap.min.js"></script>
|
||||
</body>
|
||||
</html>
|
@@ -3,7 +3,7 @@
|
||||
<Titulo>Mantenimiento de Elementos</Titulo>
|
||||
<Consulta>
|
||||
SELECT SQL_CALC_FOUND_ROWS E.id as id,U.Descripcion as ubicacion,A.Descripcion as articulo,A.Marca as marca,A.Modelo as modelo,E.numserie as numserie,
|
||||
DATE_FORMAT(E.fechacompra, '%d/%m/%Y') as fechaCompra,E.cantidad as cantidad
|
||||
DATE_FORMAT(E.fechacompra, '%d/%m/%Y') as fechaCompra,E.cantidad as cantidad, E.imagen as imagen
|
||||
FROM Elementos E inner join Articulos A on E.id_articulo=A.id inner join
|
||||
Ubicaciones U on E.id_ubicacion=U.id {buscar} {orden} limit {inferior},{superior};
|
||||
</Consulta>
|
||||
@@ -16,5 +16,6 @@
|
||||
<Col Campo="numserie" Nombre="numserie" Ancho="30" Ajuste="L" Titulo="Nº Serie" Varios="ordenable" Editable="si"/>
|
||||
<Col Campo="fechaCompra" Nombre="fechaCompra" Ancho="25" Ajuste="L" Titulo="Compra" Varios="ordenable" Tipo="fecha" Editable="si"/>
|
||||
<Col Campo="cantidad" Nombre="cantidad" Ancho="15" Ajuste="D" Titulo="Cant." Tipo="Int(11)" Editable="si"/>
|
||||
<Col Campo="imagen" Nombre="imagen" Ancho="10" Titulo="Imagen" Tipo="imagen" Editable="si" Varios="imagen"/>
|
||||
</Campos>
|
||||
</Mantenimiento>
|
||||
|
Reference in New Issue
Block a user