Commit 38b27e9d authored by Jean-Paul Saman's avatar Jean-Paul Saman

Update views on data.

parent aec085e4
......@@ -25,29 +25,29 @@ if (!defined('W2P_BASE_DIR')) {
function getMonthByName($month)
{
if ($month == 1)
$name = dPformSafe('January');
$name = w2PformSafe('January');
else if ($month == 2)
$name = dPformSafe('February');
$name = w2PformSafe('February');
else if ($month == 3)
$name = dPformSafe('March');
$name = w2PformSafe('March');
else if ($month == 4)
$name = dPformSafe('April');
$name = w2PformSafe('April');
else if ($month == 5)
$name = dPformSafe('May');
$name = w2PformSafe('May');
else if ($month == 6)
$name = dPformSafe('June');
$name = w2PformSafe('June');
else if ($month == 7)
$name = dPformSafe('July');
$name = w2PformSafe('July');
else if ($month == 8)
$name = dPformSafe('August');
$name = w2PformSafe('August');
else if ($month == 9)
$name = dPformSafe('September');
$name = w2PformSafe('September');
else if ($month == 10)
$name = dPformSafe('October');
$name = w2PformSafe('October');
else if ($month == 11)
$name = dPformSafe('November');
$name = w2PformSafe('November');
else if ($month == 12)
$name = dPformSafe('December');
$name = w2PformSafe('December');
return $name;
}
......@@ -69,18 +69,18 @@ function printTableHeader()
echo "</tr>";
}
function timesheets($type, $type)
function timesheets($type, $order)
{
GLOBAL $AppUI, $canRead, $canEdit, $canDelete;
// lock out users that do not have at least readPermission on this module
// FIXME: lock out users that do not have at least readPermission on this module
if (!$canRead) {
$AppUI->redirect( "m=public&a=access_denied" );
}
printTableHeader();
// Retrieve the list of users that may access this module.
// FIXME: Retrieve the list of users that may access this module.
if(isset($_REQUEST["user_filter_id"])){
$AppUI->setState("user_filter_id", $_REQUEST["user_filter_id"]);
$user_filter_id = $_REQUEST["user_filter_id"];
......@@ -104,7 +104,7 @@ function timesheets($type, $type)
".$AppUI->_("Show timesheets for ").": $user_combo </form></tr>";
// Pull all users
$q = new DBQuery();
$q = new w2p_Database_Query();
$q->addQuery('user_id, contact_first_name, contact_last_name');
$q->addTable('users');
$q->addTable('contacts');
......@@ -127,9 +127,9 @@ function timesheets($type, $type)
$q->addOrder('timesheet_creator');
}
if ($sort == "Ascending")
$q->addOrder('timesheet_period ASC');
$q->addOrder('timesheet_period ' . $order);
else
$q->addOrder('timesheet_period DESC');
$q->addOrder('timesheet_period ' . $order);
if ($type >= 0)
$q->addWhere('timesheet_status = '. $type );
......@@ -142,12 +142,12 @@ function timesheets($type, $type)
if (($canEdit) && ($row["timesheet_status"]) < 1) {
// call the edit site with the unique id of the timesheet item
echo "\n".'<a href="?m=timesheet&a=addedit&timesheet_id=' . $row["timesheet_id"] . '">';
echo dPshowImage( './images/icons/stock_edit-16.png', '16', '16' );
echo w2PshowImage( './images/icons/stock_edit-16.png', '16', '16' );
echo "\n</a>";
}
echo "</td>";
echo "<td>";
$date = new CDate();
$date = new w2p_Utilities_Date();
$date->setDate($row["timesheet_date"],DATE_FORMAT_UNIXTIME);
echo '<a href="?m=timesheet&a=addedit&timesheet_id=' . $row["timesheet_id"] . '">';
echo $date->format( FMT_TIMESTAMP_DATE );
......@@ -155,7 +155,7 @@ function timesheets($type, $type)
echo "</td>";
echo "<td>";
echo "\n".'<a href="?m=timesheet&a=addedit&timesheet_id=' . $row["timesheet_id"] . '">';
$period = new CDate();
$period = new w2p_Utilities_Date();
if (intval($row["timesheet_period"])<=12) { // << hack for previouse timesheet versions
$period->setMonth($row["timesheet_period"]);
$period->setYear(2007);
......@@ -172,11 +172,11 @@ function timesheets($type, $type)
echo "<td>";
$status = $row["timesheet_status"];
if ($status == 0)
echo dPformSafe("Open for Editing");
echo w2PformSafe("Open for Editing");
else if ($status == 1)
echo dPformSafe("Submitted"); // closed for normal users
echo w2PformSafe("Submitted"); // closed for normal users
else if ($status == 2)
echo dPformSafe("Approved");
echo w2PformSafe("Approved");
echo "</td>";
echo "<td nowrap=\"nowrap\" width=\"20\">";
/* if ($canDelete) {
......
......@@ -24,5 +24,5 @@ if (!defined('W2P_BASE_DIR')) {
include("vw_idx_inc.php");
echo timesheets(0, "Descending");
echo timesheets(0, "DESC");
?>
......@@ -21,5 +21,5 @@
include("vw_idx_inc.php");
echo timesheets(1, "Descending");
echo timesheets(1, "DESC");
?>
......@@ -25,5 +25,5 @@ if (!defined('W2P_BASE_DIR')) {
include("vw_idx_inc.php");
echo timesheets(-1, "Descending");
echo timesheets(-1, "DESC");
?>
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