Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
timesheet
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
web2project
timesheet
Commits
8c173145
Commit
8c173145
authored
Mar 25, 2008
by
Jean-Paul Saman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup vw_idx_inc.php and add some debugging.
parent
d77d2183
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
155 additions
and
143 deletions
+155
-143
vw_idx_inc.php
vw_idx_inc.php
+155
-143
No files found.
vw_idx_inc.php
View file @
8c173145
<?php
/*
* Copyright (C) 2007, M2X
* Copyright (C) 2007
-2008
, M2X
*
* Authors: Jean-Paul Saman
*
...
...
@@ -19,133 +19,150 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
function
getMonthByName
(
$month
)
{
if
(
$month
==
1
)
$name
=
dPformSafe
(
'January'
);
else
if
(
$month
==
2
)
$name
=
dPformSafe
(
'February'
);
else
if
(
$month
==
3
)
$name
=
dPformSafe
(
'March'
);
else
if
(
$month
==
4
)
$name
=
dPformSafe
(
'April'
);
else
if
(
$month
==
5
)
$name
=
dPformSafe
(
'May'
);
else
if
(
$month
==
6
)
$name
=
dPformSafe
(
'June'
);
else
if
(
$month
==
7
)
$name
=
dPformSafe
(
'July'
);
else
if
(
$month
==
8
)
$name
=
dPformSafe
(
'August'
);
else
if
(
$month
==
9
)
$name
=
dPformSafe
(
'September'
);
else
if
(
$month
==
10
)
$name
=
dPformSafe
(
'October'
);
else
if
(
$month
==
11
)
$name
=
dPformSafe
(
'November'
);
else
if
(
$month
==
12
)
$name
=
dPformSafe
(
'December'
);
return
$name
;
}
function
printTableHeader
()
{
GLOBAL
$AppUI
;
//prepare an html table with a head section
echo
"<table width=
\"
100%
\"
border=
\"
0
\"
cellpadding=
\"
2
\"
cellspacing=
\"
1
\"
class=
\"
tbl
\"
>"
;
echo
"<tr>"
;
echo
"<th nowrap=
\"
nowrap
\"
> </th>"
;
echo
"<th nowrap=
\"
nowrap
\"
>"
.
$AppUI
->
_
(
'Date'
)
.
"</th>"
;
echo
"<th nowrap=
\"
nowrap
\"
>"
.
$AppUI
->
_
(
'Period'
)
.
"</th>"
;
echo
"<th nowrap=
\"
nowrap
\"
>"
.
$AppUI
->
_
(
'Year'
)
.
"</th>"
;
echo
"<th nowrap=
\"
nowrap
\"
>"
.
$AppUI
->
_
(
'Worked'
)
.
"</th>"
;
echo
"<th nowrap=
\"
nowrap
\"
>"
.
$AppUI
->
_
(
'Submitter'
)
.
"</th>"
;
echo
"<th nowrap=
\"
nowrap
\"
>"
.
$AppUI
->
_
(
'Status'
)
.
"</th>"
;
echo
"<th nowrap=
\"
nowrap
\"
> </th>"
;
echo
"</tr>"
;
}
function
timesheets
(
$type
)
{
GLOBAL
$AppUI
,
$canRead
,
$canEdit
,
$canDelete
;
GLOBAL
$AppUI
,
$canRead
,
$canEdit
,
$canDelete
;
if
(
!
$canRead
)
{
// lock out users that do not have at least readPermission on this module
// lock out users that do not have at least readPermission on this module
if
(
!
$canRead
)
{
$AppUI
->
redirect
(
"m=public&a=access_denied"
);
}
//prepare an html table with a head section
?>
<table
width=
"100%"
border=
"0"
cellpadding=
"2"
cellspacing=
"1"
class=
"tbl"
>
<tr>
<th
nowrap=
"nowrap"
>
</th>
<th
nowrap=
"nowrap"
>
<?php
echo
$AppUI
->
_
(
'Date'
);
?>
</th>
<th
nowrap=
"nowrap"
>
<?php
echo
$AppUI
->
_
(
'Month'
);
?>
</th>
<th
nowrap=
"nowrap"
>
<?php
echo
$AppUI
->
_
(
'Worked'
);
?>
</th>
<th
nowrap=
"nowrap"
>
<?php
echo
$AppUI
->
_
(
'Submitter'
);
?>
</th>
<th
nowrap=
"nowrap"
>
<?php
echo
$AppUI
->
_
(
'Status'
);
?>
</th>
<th
nowrap=
"nowrap"
>
</th>
</tr>
<?php
// Retrieve the list of users that may access this module.
if
(
isset
(
$_REQUEST
[
"user_filter_id"
])){
}
printTableHeader
();
// 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"
];
}
else
{
}
else
{
$user_filter_id
=
$AppUI
->
getState
(
'user_filter_id'
);
if
(
!
isset
(
$user_filter_id
))
{
$user_filter_id
=
$AppUI
->
user_id
;
$AppUI
->
setState
(
'user_filter_id'
,
$user_filter_id
);
}
}
}
$perms
=&
$AppUI
->
acl
();
if
(
$canDelete
)
{
$perms
=&
$AppUI
->
acl
();
if
(
$canDelete
)
{
$user_list
=
array
(
0
=>
$AppUI
->
_
(
"All"
,
UI_OUTPUT_RAW
))
+
$perms
->
getPermittedUsers
(
"timesheet"
);
}
else
{
}
else
{
$user_list
=
array
(
)
+
$perms
->
getPermittedUsers
(
"timesheet"
);
}
$user_combo
=
arraySelect
(
$user_list
,
"user_filter_id"
,
"class='text' onchange='javascript:document.searchform.submit()'"
,
$user_filter_id
,
false
);
}
$user_combo
=
arraySelect
(
$user_list
,
"user_filter_id"
,
"class='text' onchange='javascript:document.searchform.submit()'"
,
$user_filter_id
,
false
);
echo
"<tr><form name='searchform' action='?m=timesheet' method='post'>
"
.
$AppUI
->
_
(
"Show timesheets for "
)
.
":
$user_combo
</form></tr>"
;
echo
"<tr><form name='searchform' action='?m=timesheet' method='post'>
"
.
$AppUI
->
_
(
"Show timesheets for "
)
.
":
$user_combo
</form></tr>"
;
// Pull all users
$q
=
new
DBQuery
;
$q
->
addQuery
(
'user_id, contact_first_name, contact_last_name'
);
$q
->
addTable
(
'users'
);
$q
->
addTable
(
'contacts'
);
$q
->
addWhere
(
'user_contact = contact_id'
);
$q
->
addOrder
(
'contact_last_name, contact_first_name'
);
$q
->
exec
();
$users
=
array
();
while
(
$row
=
$q
->
fetchRow
())
{
// Pull all users
$q
=
new
DBQuery
();
$q
->
addQuery
(
'user_id, contact_first_name, contact_last_name'
);
$q
->
addTable
(
'users'
);
$q
->
addTable
(
'contacts'
);
$q
->
addWhere
(
'user_contact = contact_id'
);
$q
->
addOrder
(
'contact_last_name, contact_first_name'
);
if
(
!
$q
->
exec
())
db_error
();
$users
=
array
();
while
(
$row
=
$q
->
fetchRow
())
{
$users
[
$row
[
'user_id'
]]
=
$row
[
'contact_last_name'
]
.
', '
.
$row
[
'contact_first_name'
];
}
}
$q
->
Clear
();
$q
->
addQuery
(
'timesheet_id, timesheet_date, timesheet_status, timesheet_period, timesheet_creator, timesheet_worked'
);
$q
->
addTable
(
'timesheet'
);
if
(
$user_filter_id
>
0
)
{
$q
->
Clear
();
$q
->
addQuery
(
'timesheet_id, timesheet_date, timesheet_status, timesheet_period, timesheet_creator, timesheet_worked'
);
$q
->
addTable
(
'timesheet'
);
if
(
$user_filter_id
>
0
)
{
$q
->
addWhere
(
'timesheet_creator = '
.
$user_filter_id
);
}
else
{
}
else
{
$q
->
addOrder
(
'timesheet_creator'
);
}
$q
->
addOrder
(
'timesheet_period'
);
}
$q
->
addOrder
(
'timesheet_period'
);
if
(
$type
>=
0
)
if
(
$type
>=
0
)
$q
->
addWhere
(
'timesheet_status = '
.
$type
);
$month
=
$q
->
loadList
();
$month
=
$q
->
loadList
();
// add/show now gradually the timesheet
foreach
(
$month
as
$row
)
{
?>
<tr>
<td
nowrap=
"nowrap"
width=
"20"
>
<?php
if
((
$canEdit
)
&&
(
$row
[
"timesheet_status"
])
<
1
)
{
// add/show now gradually the timesheet
foreach
(
$month
as
$row
)
{
echo
"<tr>"
;
echo
"<td nowrap=
\"
nowrap
\"
width=
\"
20
\"
>"
;
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×heet_id='
.
$row
[
"timesheet_id"
]
.
'">'
;
echo
dPshowImage
(
'./images/icons/stock_edit-16.png'
,
'16'
,
'16'
);
echo
"
\n
</a>"
;
}
?>
</td>
<td>
<?php
echo
"</td>"
;
echo
"<td>"
;
$date
=
new
CDate
();
$date
->
setDate
(
$row
[
"timesheet_date"
],
DATE_FORMAT_UNIXTIME
);
echo
'<a href="?m=timesheet&a=addedit×heet_id='
.
$row
[
"timesheet_id"
]
.
'">'
;
echo
$date
->
format
(
FMT_TIMESTAMP_DATE
);
echo
"</a>"
;
?>
</td>
<td>
<?php
echo
"</td>"
;
echo
"<td>"
;
echo
"
\n
"
.
'<a href="?m=timesheet&a=addedit×heet_id='
.
$row
[
"timesheet_id"
]
.
'">'
;
$month
=
new
CDate
();
$month
->
setMonth
(
$row
[
"timesheet_period"
]);
if
(
$month
->
GetMonth
()
==
1
)
echo
dPformSafe
(
'January'
);
else
if
(
$month
->
getMonth
()
==
2
)
echo
dPformSafe
(
'February'
);
else
if
(
$month
->
getMonth
()
==
3
)
echo
dPformSafe
(
'March'
);
else
if
(
$month
->
getMonth
()
==
4
)
echo
dPformSafe
(
'April'
);
else
if
(
$month
->
getMonth
()
==
5
)
echo
dPformSafe
(
'May'
);
else
if
(
$month
->
getMonth
()
==
6
)
echo
dPformSafe
(
'June'
);
else
if
(
$month
->
getMonth
()
==
7
)
echo
dPformSafe
(
'July'
);
else
if
(
$month
->
getMonth
()
==
8
)
echo
dPformSafe
(
'August'
);
else
if
(
$month
->
getMonth
()
==
9
)
echo
dPformSafe
(
'September'
);
else
if
(
$month
->
getMonth
()
==
10
)
echo
dPformSafe
(
'October'
);
else
if
(
$month
->
getMonth
()
==
11
)
echo
dPformSafe
(
'November'
);
else
if
(
$month
->
getMonth
()
==
12
)
echo
dPformSafe
(
'December'
);
$period
=
new
CDate
();
if
(
intval
(
$row
[
"timesheet_period"
])
<=
12
)
{
$period
->
setMonth
(
$row
[
"timesheet_period"
]);
$period
->
setYear
(
2007
);
}
else
$period
->
setDate
(
$row
[
"timesheet_period"
],
DATE_FORMAT_UNIXTIME
);
/*debug >>*/
echo
"("
.
$row
[
"timesheet_period"
]
.
","
.
$period
->
getMonth
()
.
") "
;
//<< debug
echo
getMonthByName
(
$period
->
getMonth
());
echo
"
\n
</a>"
;
?>
</td>
<td>
<?php
echo
$row
[
"timesheet_worked"
];
?>
</td>
<td>
<?php
echo
$users
[
$row
[
"timesheet_creator"
]];
?>
</td>
<td>
<?php
echo
"</td>"
;
echo
"<td>"
.
$period
->
getYear
()
.
"</td>"
;
echo
"<td>"
.
$row
[
"timesheet_worked"
]
.
"</td>"
;
echo
"<td>"
.
$users
[
$row
[
"timesheet_creator"
]]
.
"</td>"
;
echo
"<td>"
;
$status
=
$row
[
"timesheet_status"
];
if
(
$status
==
0
)
echo
dPformSafe
(
"Open for Editing"
);
...
...
@@ -153,22 +170,17 @@ foreach ($month as $row) {
echo
dPformSafe
(
"Submitted"
);
// closed for normal users
else
if
(
$status
==
2
)
echo
dPformSafe
(
"Approved"
);
?>
</td>
<td
nowrap=
"nowrap"
width=
"20"
>
<?php
echo
"</td>"
;
echo
"<td nowrap=
\"
nowrap
\"
width=
\"
20
\"
>"
;
if
(
$canDelete
)
{
// call the edit site with the unique id of the timesheet item
echo
"
\n
"
.
'<a href="?m=timesheet&a=addedit×heet_id='
.
$row
[
"timesheet_id"
]
.
'">'
;
echo
dPshowImage
(
'./images/icons/stock_delete-16.png'
,
'16'
,
'16'
);
echo
"
\n
</a>"
;
}
?>
</td>
</tr>
<?php
}
?>
</table>
<?php
echo
"</td>"
;
echo
"</tr>"
;
}
echo
"</table>"
;
}
// end of function
?>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment