Commit 620d5a39 authored by Jean-Paul Saman's avatar Jean-Paul Saman

Add sorting on date

parent 1e74fe2d
...@@ -39,7 +39,8 @@ require_once( $CONFIG_FILE ); ...@@ -39,7 +39,8 @@ require_once( $CONFIG_FILE );
//Read the current config values from the config file and update the array. //Read the current config values from the config file and update the array.
$config_options = array( $config_options = array(
"approval_by" => array( "value" => '' ), "approval_by" => array( "value" => '' ),
"book_year" => array( "value" => '' ) "book_year" => array( "value" => '' ),
"sort_order" => array( "value" => '' )
); );
foreach ($config_options as $key=>$value){ foreach ($config_options as $key=>$value){
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
/* /*
* Name: Timesheet * Name: Timesheet
* Directory: timesheet * Directory: timesheet
* Version: 1.0.2 * Version: 1.0.3
* Type: user * Type: user
* UI Name: Timesheet * UI Name: Timesheet
* UI Icon: timesheet.png * UI Icon: timesheet.png
...@@ -54,6 +54,11 @@ while ( $row = $q->fetchRow()) { ...@@ -54,6 +54,11 @@ while ( $row = $q->fetchRow()) {
$users[$row['user_id']] = $row['contact_last_name'] . ', ' . $row['contact_first_name']; $users[$row['user_id']] = $row['contact_last_name'] . ', ' . $row['contact_first_name'];
} }
/* Sort order */
$order = array();
$order[0] = "Ascending";
$order[1] = "Descending";
/* All config options, their descriptions and their default values are defined /* All config options, their descriptions and their default values are defined
* here. Add new config options here. Type can be "checkbox", "text", "radio" or * here. Add new config options here. Type can be "checkbox", "text", "radio" or
* "select". If the type is "radio," it must include a set of buttons. If it's * "select". If the type is "radio," it must include a set of buttons. If it's
...@@ -73,6 +78,12 @@ $config_options = array( ...@@ -73,6 +78,12 @@ $config_options = array(
"description" => $AppUI->_('Book year'), "description" => $AppUI->_('Book year'),
"value" => '', "value" => '',
"type" => 'text' "type" => 'text'
),
"sort_order" => array(
"description" => $AppUI->_('Sort order'),
"value" => '',
'type' => 'select',
'list' => $order
) )
); );
......
...@@ -21,5 +21,5 @@ ...@@ -21,5 +21,5 @@
include("vw_idx_inc.php"); include("vw_idx_inc.php");
echo timesheets(2); echo timesheets(2, "Descending");
?> ?>
...@@ -66,7 +66,7 @@ function printTableHeader() ...@@ -66,7 +66,7 @@ function printTableHeader()
echo "</tr>"; echo "</tr>";
} }
function timesheets($type) function timesheets($type, $type)
{ {
GLOBAL $AppUI, $canRead, $canEdit, $canDelete; GLOBAL $AppUI, $canRead, $canEdit, $canDelete;
...@@ -123,7 +123,10 @@ function timesheets($type) ...@@ -123,7 +123,10 @@ function timesheets($type)
} else { } else {
$q->addOrder('timesheet_creator'); $q->addOrder('timesheet_creator');
} }
$q->addOrder('timesheet_period'); if ($sort == "Ascending")
$q->addOrder('timesheet_period ASC');
else
$q->addOrder('timesheet_period DESC');
if ($type >= 0) if ($type >= 0)
$q->addWhere('timesheet_status = '. $type ); $q->addWhere('timesheet_status = '. $type );
......
...@@ -21,5 +21,5 @@ ...@@ -21,5 +21,5 @@
include("vw_idx_inc.php"); include("vw_idx_inc.php");
echo timesheets(0); echo timesheets(0, "Descending");
?> ?>
...@@ -21,5 +21,5 @@ ...@@ -21,5 +21,5 @@
include("vw_idx_inc.php"); include("vw_idx_inc.php");
echo timesheets(1); echo timesheets(1, "Descending");
?> ?>
...@@ -21,5 +21,5 @@ ...@@ -21,5 +21,5 @@
include("vw_idx_inc.php"); include("vw_idx_inc.php");
echo timesheets(-1); echo timesheets(-1, "Descending");
?> ?>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment