Skip to content

Instantly share code, notes, and snippets.

@eddpascoal
Created May 30, 2014 10:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eddpascoal/6551100d1f8d1e8428a9 to your computer and use it in GitHub Desktop.
Save eddpascoal/6551100d1f8d1e8428a9 to your computer and use it in GitHub Desktop.
<!-- BackOffice -->
<?php
$this->Paginator->options(
array('update' => '#lista_clientes',
'url'=>array('controller'=>'Users', 'action'=>'myclients'),
'evalScripts' => true
)
);
?>
<div id="lista_clientes">
<div class="row">
<div class="page page_text">
<h3>Os meus clientes</h3>
<div style="display:inline-block; width:100%" id="conta">
<div class="three columns">
<div class="medium default btn">
<?php echo $this->Html->link("Adicionar Novo", '/Users/add_bk'); ?>
</div>
</div>
<div class="nine columns">
<h5>Clientes</h5>
<div class="datagrid">
<table>
<thead>
<tr>
<th>Id</th>
<th>Nome</th>
<th>Apelido</th>
<th>Editar</th>
<th>Remover</th>
</tr>
</thead>
<tbody>
<?php if ($this->Paginator->param('pageCount') == 0) { // Se for vazio coloco um warning a seguir à tabela.
echo "</tbody>
</table>
<div class='warning alert' >".__("Não foram encontrados conteúdos.")."</div>";
}else{ ?>
<?php $a=0;
foreach ($Users as $u):
if($a==0){$a=1;
?>
<tr>
<?php }else{?>
<tr class="alt">
<?php $a=0;}?>
<td><?php echo $this->Html->link($u['User']['id'], '/Users/view'); ?></td>
<td><?php echo $u['User']['nome']; ?></td>
<td><?php echo $u['User']['apelidos']; ?></td>
<td><?php echo $this->Html->link('Editar', '/Users/edit/'.$u['User']['id']); ?></td>
<td>
<?php echo $this->Js->link(
'Remover',
'/Users/remove/'.$u['User']['id'].'/page:'.$this->Paginator->counter(array('format' => '%page%')),
array('target' => '_self', 'update' => '#lista_clientes', 'escape' => false, 'confirm' => 'Tem a certeza que quer apagar o conteúdo?'));
?>
</td>
</tr>
<?php endforeach;
}
?>
</tbody>
</table>
</div>
<div class="pagination clearfix">
<?php if ($this->Paginator->counter(array('format' => '%pages%')) > 1) { ?>
<!--<?php echo $this->Paginator->first("|<", array('escape' => false), null, array()); ?>-->
<?php echo $this->Paginator->prev("«", array('escape' => false), null, array()); ?>
<?php } ?>
<?php echo $this->Paginator->numbers(array('currentTag' =>'strong', 'separator' => '', 'class' => '')); ?>
<?php if ($this->Paginator->counter(array('format' => '%pages%')) > 1 && $this->Paginator->counter(array('format' => '%page%')) < $this->Paginator->counter(array('format' => '%pages%'))) { ?>
<?php echo $this->Paginator->next("»", array('escape' => false), null,array()); ?>
<!--<?php echo $this->Paginator->last(">|", array('escape' => false), null); ?>-->
<?php } ?>
</div>
</div>
</div>
</div>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment