-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlistfoto.php
49 lines (44 loc) · 1.63 KB
/
listfoto.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
//Chama uma função PHP que permite informar a classe e o Método que será acionado
if(isset($_GET['tipo'])){
$imoveis = call_user_func(array('fotocontoller','listarTipo'),$_GET['tipo']);
}else{
$imoveis = call_user_func(array('fotocontoller','listar'));
}
?>
<div class="container">
<h1>Imóveis</h1>
<hr>
<table class="table" style="top:40px;">
<tbody>
<?php
$cont=0;
//Verifica se houve algum retorno
if (isset($imoveis) && !empty($imoveis)) {
foreach ($imoveis as $imovel) {
if($cont==0){
echo '<tr>';
}
echo '<td>';
echo '<p align="center"><img class="img-thumbnail" style="width: 25%;" src="data:'.$imovel->getFotoTipo().';base64,'.base64_encode($imovel->getFoto()).'"></p><br>';;
echo substr($imovel->getDescricao(),0,70).'...<br>';
echo '<strong>Valor: </strong>'.$imovel->getValor().'<br>';
$tipo = $imovel->getTipo()=='A'?'Aluguel':'Venda';
echo '<strong>Tipo: </strong>'.$tipo.'<br>';
echo '<a href="index.php?action=editar&id='.$imovel->getId().'&page=imovel" class="btn btn-primary btn-sm">Editar</a> ';
echo '<a href="index.php?action=excluir&id='.$imovel->getId().'&page=imovel" class="btn btn-danger btn-sm">Excluir</a>';
$cont++;
if($cont==4)
$cont=0;
}
}else{
?>
<tr>
<td colspan="3">Nenhum registro encontrado</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>