-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
70 lines (64 loc) · 2.08 KB
/
index.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
require_once 'menu.php';
require_once 'src/AG/Cliente/Utils/config.php';
$clientes = preencheArray();
?>
<div class="container principal">
<div class="col-md-offset-2 col-md-8">
<table class="table">
<thead>
<tr>
<td colspan="2" class="text-center">
<a href="?crescente=true" class="btn btn-primary" name="enviar"
<?php if (!isset($_GET['decrescente'])) echo "disabled" ?>>Ordem Crescente</a>
<a href="?decrescente=true" class="btn btn-warning"
<?php if (isset($_GET['decrescente'])) echo "disabled" ?>>Ordem Descrescente</a>
</td>
</tr>
<tr>
<td class="col-md-6">Nome</td>
<td class="col-md-6">Tipo Pessoa</td>
<td class="col-md-2">Ação</td>
</tr>
</thead>
<tbody>
<?php
if (!isset($_GET['decrescente'])){
ksort($clientes);
$ordem = "&crescente=true";
} elseif (isset($_GET['decrescente'])){
krsort($clientes);
$ordem = "&decrescente=true";
}
$i = 0;
foreach ($clientes as $cliente){
echo "<tr>";
if (isset($_GET['id']) && $_GET['id']==$i){
echo "<td>";
$cliente->toString();
echo "</td>";
if ($cliente instanceof AG\Cliente\Types\ClienteFisica){
echo "<td>Pessoa Física</td>";
} elseif ($cliente instanceof AG\Cliente\Types\ClienteJuridica) {
echo "<td>Pessoa Jurídica</td>";
}
echo '<td><a class="btn btn-primary" href="?id=-1'.$ordem.'">'."Esconder</a>";
} else {
echo "<td>".$cliente->getNome()."</td>";
if ($cliente instanceof AG\Cliente\Types\ClienteFisica){
echo "<td>Pessoa Física</td>";
} elseif ($cliente instanceof AG\Cliente\Types\ClienteJuridica) {
echo "<td>Pessoa Jurídica</td>";
}
echo '<td><a class="btn btn-primary" href="?id='.$i.$ordem.'">'."Detalhes</a>";
}
echo "</tr>";
$i++;
}
?>
</table>
</div>
</div>
<?php
require_once 'footer.php';
?>