Skip to content

Commit

Permalink
updated css and added pagination
Browse files Browse the repository at this point in the history
  • Loading branch information
phpboyscout committed Jul 18, 2013
1 parent 3c0c034 commit 00cd5d4
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 6 deletions.
9 changes: 9 additions & 0 deletions public/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,20 @@ body {
margin: 10px;
}

#admin th:hover {
background-color: #ff781e;
}

footer {
margin-top: 3px;
}


.well.pagination-container {
padding: 0px;
text-align: center;
}

/* css for timepicker */
.ui-timepicker-div .ui-widget-header { margin-bottom: 8px; }
.ui-timepicker-div dl { text-align: left; }
Expand Down
17 changes: 15 additions & 2 deletions src/ZucchiAdmin/Crud/ControllerTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,28 @@ public function listAction()

$where = $this->parseWhere($this->getRequest());
$order = $this->params()->fromQuery('order', array());

$perPage = $service::INDEX_LIMIT;

$page = ($this->params()->fromQuery('page', 1) -1) * $perPage;

$list = $service->getList($where, $order);
$list = $service->getList($where, $order, $page, $perPage);

$count = $service->getCount($where);

$this->trigger(CrudEvent::EVENT_LIST_POST, $list);


$currentQuery = $this->params()->fromQuery();
unset($currentQuery['page']);

return $this->loadView(
'zucchi-admin/crud/list',
array(
'list' => $list,
'count' => $count,
'page' => $page+1,
'currentQuery' => http_build_query($currentQuery),
'pages' => ceil($count/$perPage),
'listFields' => $this->listFields,
'metadata' => $service->getMetaData(),
'where' => $where,
Expand Down
29 changes: 26 additions & 3 deletions view/zucchi-admin/crud/list.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
</select>
<button type="button" class="btn btn-info input-mini" id="filter-add">Add</button>
</div>

</div>
<div class="row-fluid">
<div class="span9">
Expand Down Expand Up @@ -136,8 +137,30 @@
<?php endif; ?>
</table>
</div>
<div class="span3 well">
<?=$this->crudBulkActions('module:ZucchiUser')?>
<div class="span3">
<div class="well">
<?=$this->crudBulkActions('module:ZucchiUser')?>
</div>
<?php if ($pages > 1): ?>
<div class="well pagination-container">
<div class="pagination">
<ul>
<li class="<?=($page == 1) ? 'disabled':null;?>"><a href="?page=1&<?=$currentQuery?>">&laquo;</a></li>
<li class="<?=($page == 1) ? 'disabled':null;?>"><a href="?page=<?=($page>1)? $page-1:1?>&<?=$currentQuery?>">&lt;</a></li>
<li class="disabled"><span><?=$page?> of <?=$pages?></span></li>
<li class="<?=($page == $pages) ? 'disabled':null;?>"><a href="?page=<?=($page<$pages)? $page+1:$pages?>&<?=$currentQuery?>">&gt;</a></li>
<li class="<?=($page == $pages) ? 'disabled':null;?>"><a href="?page=<?=$pages?>&<?=$currentQuery?>">&raquo;</a></li>
</ul>
</div>
<form class="form-inline" method="get">
<label>Jump to page:</label><input type="text" class="input-small" name="page" placeholder="page #" value="<?=$page?>"/>
<?php foreach (explode('&', $currentQuery) as $part): ?>
<?php list($key, $value) = explode('=',$part);?>
<input type='hidden' name='<?=urldecode($key)?>' value='<?=$value?>'/>
<?php endforeach;?>
</form>
</div>
<?php endif;?>
</div>
</div>
</div>
</div>
2 changes: 1 addition & 1 deletion view/zucchi-admin/layout.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@

<footer>
<div class="container">
<p>&copy; 2011- <?=date('Y')?> by Zucchi Ltd. <?php echo $this->translate('All rights reserved.') ?></p>
<p>2011- <?=date('Y')?> by Zucchi Ltd.</p>
</div>
</footer>

Expand Down

0 comments on commit 00cd5d4

Please sign in to comment.