Skip to content

Commit

Permalink
Add sort UI to admin/reports ushahidi#220
Browse files Browse the repository at this point in the history
  • Loading branch information
rjmackay committed Sep 17, 2012
1 parent 74e5b5d commit 3f7e49a
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
13 changes: 13 additions & 0 deletions application/controllers/admin/reports.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,16 @@ public function index($page = 1)
{
$keyword_raw = "";
}

$order_field = 'date'; $sort = 'DESC';
if (isset($_GET['order']))
{
$order_field = htmlentities($_GET['order']);
}
if (isset($_GET['sort']))
{
$sort = (strtoupper($_GET['sort']) == 'ASC') ? 'ASC' : 'DESC';
}

// Check, has the form been submitted?
$form_error = FALSE;
Expand Down Expand Up @@ -283,6 +293,9 @@ public function index($page = 1)

// Status Tab
$this->template->content->status = $status;
$this->template->content->order_field = $order_field;
$this->template->content->sort = $sort;


// Javascript Header
$this->template->js = new View('admin/reports/reports_js');
Expand Down
19 changes: 19 additions & 0 deletions application/views/admin/reports/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,25 @@
</li>
<?php endif; ?>
</ul>

<div class="sort_by">
<?php print form::open(NULL, array('method' => 'get')); ?>
<?php echo Kohana::lang('ui_main.sort_by'); ?>
<?php echo form::dropdown('order', array(
'date' => Kohana::lang('ui_admin.report_date'),
'id' => Kohana::lang('ui_main.id'),
'datemodify' => Kohana::lang('ui_admin.date_modified'),
'dateadd' => Kohana::lang('ui_admin.date_added'),
'title' => Kohana::lang('ui_admin.report_title'),
), $order_field);
echo form::dropdown('sort', array(
'ASC' => Kohana::lang('ui_main.ascending'),
'DESC' => Kohana::lang('ui_main.descending'),
), $sort);
echo form::hidden('status', $status);
echo form::submit('submit', Kohana::lang('ui_main.sort'));
echo form::close(); ?>
</div>
</div>
</div>
<?php if ($form_error): ?>
Expand Down
6 changes: 6 additions & 0 deletions media/css/admin/all.css
Original file line number Diff line number Diff line change
Expand Up @@ -2535,3 +2535,9 @@ div.dp-popup td.disabled {
height: 30px;
display: inline-block;
}

.sort_by {
float: right;
margin: 0;
padding: 9px 10px 0;
}

0 comments on commit 3f7e49a

Please sign in to comment.