Changed how tables are layed out (since I was repeatedly duplicating code in many places) by adding a table element to be used wherever we need a table. This could probably have been a helper instead of an element, but it's not clear to me why one should be chosen over the other, and I already know how to quickly add an element (I think the real choice resides in whether you need a collection of helper functions, or you just want to drop in a chunk of html, i.e. a helper element). Also, a major revamp to the style sheets as well, although more work is clearly needed.
git-svn-id: file:///svn-source/pmgr/branches/initial_20090526@42 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -4,53 +4,48 @@ if (isset($heading))
|
||||
echo $heading;
|
||||
else
|
||||
echo '<h2>'.__('Units',true).'</h2>';
|
||||
?>
|
||||
|
||||
<table cellpadding="0" cellspacing="0">
|
||||
$headers_manual = array('Id', 'Unit', 'Size', 'Status', 'Comment');
|
||||
if (isset($paginator)) {
|
||||
echo $paginator->counter(array(
|
||||
'format' => __('Page %page% of %pages%, showing %current% records (%start% - %end%) of %count% total', true)));
|
||||
|
||||
<?php
|
||||
{
|
||||
if (isset($paginator)) {
|
||||
echo $paginator->counter(array(
|
||||
'format' => __('Page %page% of %pages%, showing %current% records (%start% - %end%) of %count% total', true)));
|
||||
|
||||
$rows = array($paginator->sort('id'),
|
||||
$headers = array($paginator->sort('id'),
|
||||
$paginator->sort('Unit', 'name'),
|
||||
$paginator->sort('unit_size_id'),
|
||||
$paginator->sort('status'),
|
||||
$paginator->sort('comment'));
|
||||
} else {
|
||||
$rows = array('Id', 'Unit', 'Size', 'Status', 'Comment');
|
||||
}
|
||||
echo $html->tableHeaders($rows);
|
||||
} else {
|
||||
$headers = $headers_manual;
|
||||
}
|
||||
|
||||
$rows = array();
|
||||
foreach ($units as $unit) {
|
||||
$rows[] = array($html->link($unit['Unit']['id'],
|
||||
array('controller' => 'units',
|
||||
'action' => 'view',
|
||||
$unit['Unit']['id'])),
|
||||
$html->link($unit['Unit']['name'],
|
||||
array('controller' => 'units',
|
||||
'action' => 'view',
|
||||
$unit['Unit']['id'])),
|
||||
$unit['UnitSize']['name'],
|
||||
$unit['Unit']['status'],
|
||||
$unit['Unit']['comment']);
|
||||
}
|
||||
echo $html->tableCells($rows, null, array('class' => "altrow"), false, false);
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
$rows = array();
|
||||
foreach ($units as $unit) {
|
||||
$rows[] = array($html->link($unit['Unit']['id'],
|
||||
array('controller' => 'units',
|
||||
'action' => 'view',
|
||||
$unit['Unit']['id'])),
|
||||
$html->link($unit['Unit']['name'],
|
||||
array('controller' => 'units',
|
||||
'action' => 'view',
|
||||
$unit['Unit']['id'])),
|
||||
$unit['UnitSize']['name'],
|
||||
$unit['Unit']['status'],
|
||||
$unit['Unit']['comment']);
|
||||
}
|
||||
|
||||
<?php
|
||||
if (isset($paginator)) {
|
||||
echo('<div class="paging">' . "\n");
|
||||
echo $paginator->prev('<< '.__('previous', true), array(), null, array('class'=>'disabled'));
|
||||
echo(' | ');
|
||||
echo $paginator->numbers();
|
||||
echo(' | ');
|
||||
echo $paginator->next(__('next', true).' >>', array(), null, array('class'=>'disabled'));
|
||||
echo('</div>' . "\n");
|
||||
}
|
||||
?>
|
||||
echo $this->element('table',
|
||||
array('class' => 'item unit list',
|
||||
'headers' => $headers,
|
||||
'rows' => $rows,
|
||||
'column_class' => $headers_manual));
|
||||
|
||||
if (isset($paginator)) {
|
||||
echo('<div class="paging">' . "\n");
|
||||
echo $paginator->prev('<< '.__('previous', true), array(), null, array('class'=>'disabled'));
|
||||
echo(' | ');
|
||||
echo $paginator->numbers();
|
||||
echo(' | ');
|
||||
echo $paginator->next(__('next', true).' >>', array(), null, array('class'=>'disabled'));
|
||||
echo('</div>' . "\n");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user