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
023283c4
Commit
023283c4
authored
Aug 21, 2007
by
Jean-Paul Saman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve working of tabs and fix some small problems from release v1.0
parent
f8c72aef
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
264 additions
and
264 deletions
+264
-264
addedit.php
addedit.php
+19
-19
do_timesheet_aed.php
do_timesheet_aed.php
+42
-42
index.php
index.php
+21
-21
setup.php
setup.php
+91
-91
timesheet.class.php
timesheet.class.php
+41
-41
vw_idx_approved.php
vw_idx_approved.php
+4
-4
vw_idx_inc.php
vw_idx_inc.php
+34
-34
vw_idx_open.php
vw_idx_open.php
+4
-4
vw_idx_submitted.php
vw_idx_submitted.php
+4
-4
vw_idx_timesheets.php
vw_idx_timesheets.php
+4
-4
No files found.
addedit.php
View file @
023283c4
...
@@ -68,7 +68,7 @@ $titleBlock->show();
...
@@ -68,7 +68,7 @@ $titleBlock->show();
}
}
}
}
function
changeIt
()
{
function
changeIt
()
{
var
f
=
document
.
editFrm
;
var
f
=
document
.
editFrm
;
f
.
stat
.
value
=
'
1
'
;
f
.
stat
.
value
=
'
1
'
;
f
.
submit
();
f
.
submit
();
...
@@ -124,7 +124,7 @@ else
...
@@ -124,7 +124,7 @@ else
if
(
intval
(
$obj
->
timesheet_status
))
if
(
intval
(
$obj
->
timesheet_status
))
$status
=
$obj
->
timesheet_status
;
$status
=
$obj
->
timesheet_status
;
else
else
$status
=
0
;
$status
=
0
;
// Get the current timesheet creation date
// Get the current timesheet creation date
if
(
intval
(
$obj
->
timesheet_date
))
{
if
(
intval
(
$obj
->
timesheet_date
))
{
...
@@ -234,10 +234,10 @@ else {
...
@@ -234,10 +234,10 @@ else {
<?php
<?php
if
(
(
$canEdit
)
&&
(
$status
==
0
)
)
{
if
(
(
$canEdit
)
&&
(
$status
==
0
)
)
{
?>
?>
<select
name=
"timesheet_status"
size=
"1"
class=
"text"
onChange=
"changeIt()"
>
<select
name=
"timesheet_status"
size=
"1"
class=
"text"
onChange=
"changeIt()"
>
<option
<?php
if
(
$status
==
0
)
echo
"selected"
;
?>
value=
"0"
>
<?
echo
dPformSafe
(
'Open for Editing'
);
?>
</option>
<option
<?php
if
(
$status
==
0
)
echo
"selected"
;
?>
value=
"0"
>
<?
echo
dPformSafe
(
'Open for Editing'
);
?>
</option>
<option
<?php
if
(
$status
==
1
)
echo
"selected"
;
?>
value=
"1"
>
<?
echo
dPformSafe
(
'Submitted'
);
?>
</option>
<option
<?php
if
(
$status
==
1
)
echo
"selected"
;
?>
value=
"1"
>
<?
echo
dPformSafe
(
'Submitted'
);
?>
</option>
<option
<?php
if
(
$status
==
2
)
echo
"selected"
;
?>
value=
"2"
>
<?
echo
dPformSafe
(
'Approved'
);
?>
</option>
<option
<?php
if
(
$status
==
2
)
echo
"selected"
;
?>
value=
"2"
>
<?
echo
dPformSafe
(
'Approved'
);
?>
</option>
</select>
</select>
<?php
<?php
}
}
...
@@ -281,10 +281,10 @@ function showproject()
...
@@ -281,10 +281,10 @@ function showproject()
{
{
global
$AppUI
,
$period
,
$obj
;
global
$AppUI
,
$period
,
$obj
;
$q
=
new
DBQuery
();
$q
=
new
DBQuery
();
$q
->
addQuery
(
'project_id'
);
$q
->
addQuery
(
'project_id'
);
$q
->
addQuery
(
'project_name'
);
$q
->
addQuery
(
'project_name'
);
$q
->
addQuery
(
'project_status'
);
$q
->
addQuery
(
'project_status'
);
$q
->
addTable
(
'projects'
);
$q
->
addTable
(
'projects'
);
$q
->
addOrder
(
'project_name ASC'
);
$q
->
addOrder
(
'project_name ASC'
);
$projects
=
$q
->
LoadList
();
$projects
=
$q
->
LoadList
();
...
@@ -292,7 +292,7 @@ function showproject()
...
@@ -292,7 +292,7 @@ function showproject()
foreach
(
$projects
as
$row
)
{
foreach
(
$projects
as
$row
)
{
echo
'<tr>'
;
echo
'<tr>'
;
echo
'<td> </td>'
;
echo
'<td> </td>'
;
echo
'<td><a href="?m=projects&a=view&project_id=
"'
.
$row
[
"project_id"
]
.
'
>'
.
$row
[
"project_name"
]
.
'</a>'
;
echo
'<td><a href="?m=projects&a=view&project_id=
'
.
$row
[
"project_id"
]
.
'"
>'
.
$row
[
"project_name"
]
.
'</a>'
;
echo
'</td>'
;
echo
'</td>'
;
echo
'<td>'
;
echo
'<td>'
;
$project_id
=
$row
[
"project_id"
];
$project_id
=
$row
[
"project_id"
];
...
@@ -347,20 +347,20 @@ function showtimesheetproject()
...
@@ -347,20 +347,20 @@ function showtimesheetproject()
{
{
global
$timesheet_id
;
global
$timesheet_id
;
$q
=
new
DBQuery
();
$q
=
new
DBQuery
();
$q
->
addQuery
(
'timesheet_id'
);
$q
->
addQuery
(
'timesheet_id'
);
$q
->
addQuery
(
'timesheet_project'
);
$q
->
addQuery
(
'timesheet_project'
);
$q
->
addQuery
(
'timesheet_project_amount'
);
$q
->
addQuery
(
'timesheet_project_amount'
);
$q
->
addTable
(
'timesheet_project'
);
$q
->
addTable
(
'timesheet_project'
);
$q
->
addWhere
(
'timesheet_id = '
.
$timesheet_id
);
$q
->
addWhere
(
'timesheet_id = '
.
$timesheet_id
);
$q
->
addOrder
(
'timesheet_project ASC'
);
$q
->
addOrder
(
'timesheet_project ASC'
);
$timesheet
=
$q
->
LoadList
();
$timesheet
=
$q
->
LoadList
();
foreach
(
$timesheet
as
$row
)
{
foreach
(
$timesheet
as
$row
)
{
$p
=
new
DBQuery
();
$p
=
new
DBQuery
();
$p
->
addQuery
(
'project_id'
);
$p
->
addQuery
(
'project_id'
);
$p
->
addQuery
(
'project_name'
);
$p
->
addQuery
(
'project_name'
);
$p
->
addQuery
(
'project_status'
);
$p
->
addQuery
(
'project_status'
);
$p
->
addTable
(
'projects'
);
$p
->
addTable
(
'projects'
);
$p
->
addWhere
(
'project_id = '
.
$row
[
"timesheet_project"
]);
$p
->
addWhere
(
'project_id = '
.
$row
[
"timesheet_project"
]);
$p
->
addOrder
(
'project_name ASC'
);
$p
->
addOrder
(
'project_name ASC'
);
...
@@ -368,7 +368,7 @@ function showtimesheetproject()
...
@@ -368,7 +368,7 @@ function showtimesheetproject()
foreach
(
$projects
as
$project
)
{
foreach
(
$projects
as
$project
)
{
echo
'<tr>'
;
echo
'<tr>'
;
echo
'<td> </td>'
;
echo
'<td> </td>'
;
echo
'<td><a href="?m=projects&a=view&project_id=
"'
.
$row
[
"timesheet_project"
]
.
'
>'
.
$project
[
"project_name"
]
.
'</a>'
;
echo
'<td><a href="?m=projects&a=view&project_id=
'
.
$project
[
"project_id"
]
.
'i"
>'
.
$project
[
"project_name"
]
.
'</a>'
;
echo
'</td>'
;
echo
'</td>'
;
echo
'<td>'
.
$row
[
"timesheet_project_amount"
]
.
'</td>'
;
echo
'<td>'
.
$row
[
"timesheet_project_amount"
]
.
'</td>'
;
echo
'<td>'
.
$project
[
"project_status"
]
.
'</td>'
;
echo
'<td>'
.
$project
[
"project_status"
]
.
'</td>'
;
...
@@ -379,13 +379,13 @@ function showtimesheetproject()
...
@@ -379,13 +379,13 @@ function showtimesheetproject()
?>
?>
<table
width=
"100%"
border=
"0"
cellpadding=
"2"
cellspacing=
"1"
class=
"tbl"
>
<table
width=
"100%"
border=
"0"
cellpadding=
"2"
cellspacing=
"1"
class=
"tbl"
>
<tr>
<tr>
<th
nowrap=
"nowrap"
>
</th>
<th
nowrap=
"nowrap"
>
</th>
<th
nowrap=
"nowrap"
>
<?php
echo
$AppUI
->
_
(
'Project'
);
?>
</th>
<th
nowrap=
"nowrap"
>
<?php
echo
$AppUI
->
_
(
'Project'
);
?>
</th>
<th
nowrap=
"nowrap"
>
<?php
echo
$AppUI
->
_
(
'Worked hours'
);
?>
</th>
<th
nowrap=
"nowrap"
>
<?php
echo
$AppUI
->
_
(
'Worked hours'
);
?>
</th>
<th
nowrap=
"nowrap"
>
<?php
echo
$AppUI
->
_
(
'Project status'
);
?>
</th>
<th
nowrap=
"nowrap"
>
<?php
echo
$AppUI
->
_
(
'Project status'
);
?>
</th>
</tr>
</tr>
<form
name=
"projectFrm"
action=
"./index.php?m=timesheet"
method=
"post"
>
<form
name=
"projectFrm"
action=
"./index.php?m=timesheet"
method=
"post"
>
<input
type=
"hidden"
name=
"dosql"
value=
"do_timesheet_aed"
/>
<input
type=
"hidden"
name=
"dosql"
value=
"do_timesheet_aed"
/>
<input
type=
"hidden"
name=
"projects"
value=
"0"
/>
<input
type=
"hidden"
name=
"projects"
value=
"0"
/>
...
...
do_timesheet_aed.php
View file @
023283c4
<?php
<?php
/*
/*
* Copyright (C) 2007, M2X
* Copyright (C) 2007, M2X
*
*
...
@@ -18,22 +18,22 @@
...
@@ -18,22 +18,22 @@
* along with this program; if not, write to the Free Software
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
*****************************************************************************/
// create a new instance of the timesheet class
// create a new instance of the timesheet class
$obj
=
new
CTimesheet
();
$obj
=
new
CTimesheet
();
$msg
=
''
;
// reset the message string
$msg
=
''
;
// reset the message string
// bind the informations (variables) retrieved via post to the timesheet object
// bind the informations (variables) retrieved via post to the timesheet object
if
(
!
$obj
->
bind
(
$_POST
))
{
if
(
!
$obj
->
bind
(
$_POST
))
{
$AppUI
->
setMsg
(
$obj
->
getError
(),
UI_MSG_ERROR
);
$AppUI
->
setMsg
(
$obj
->
getError
(),
UI_MSG_ERROR
);
$AppUI
->
redirect
();
$AppUI
->
redirect
();
}
}
// detect if a deleete operation has to be processed
// detect if a deleete operation has to be processed
$period
=
dPgetParam
(
$_POST
,
'period'
,
0
);
$period
=
dPgetParam
(
$_POST
,
'period'
,
0
);
$stat
=
dPgetParam
(
$_POST
,
'stat'
,
0
);
$stat
=
dPgetParam
(
$_POST
,
'stat'
,
0
);
$del
=
dPgetParam
(
$_POST
,
'del'
,
0
);
$del
=
dPgetParam
(
$_POST
,
'del'
,
0
);
$obj
->
timesheet_id
=
$_POST
[
"timesheet_id"
];
$obj
->
timesheet_id
=
$_POST
[
"timesheet_id"
];
$obj
->
timesheet_status
=
$_POST
[
"timesheet_status"
];
$obj
->
timesheet_status
=
$_POST
[
"timesheet_status"
];
$obj
->
timesheet_period
=
$_POST
[
"timesheet_period"
];
$obj
->
timesheet_period
=
$_POST
[
"timesheet_period"
];
...
@@ -41,49 +41,49 @@ $obj->timesheet_date = $_POST["timesheet_date"];
...
@@ -41,49 +41,49 @@ $obj->timesheet_date = $_POST["timesheet_date"];
$obj
->
timesheet_creator
=
$_POST
[
"timesheet_creator"
];
$obj
->
timesheet_creator
=
$_POST
[
"timesheet_creator"
];
$obj
->
timesheet_worked
=
$_POST
[
"timesheet_worked"
];
$obj
->
timesheet_worked
=
$_POST
[
"timesheet_worked"
];
$AppUI
->
setMsg
(
'Timesheet'
);
$AppUI
->
setMsg
(
'Timesheet'
);
if
(
$del
)
{
if
(
$del
)
{
// check if there are dependencies on this object
// check if there are dependencies on this object
if
(
!
$obj
->
canDelete
(
$msg
))
{
if
(
!
$obj
->
canDelete
(
$msg
))
{
$AppUI
->
setMsg
(
$msg
,
UI_MSG_ERROR
);
$AppUI
->
setMsg
(
$msg
,
UI_MSG_ERROR
);
$AppUI
->
redirect
();
$AppUI
->
redirect
();
}
}
// see how easy it is to run database commands with the object oriented architecture !
// see how easy it is to run database commands with the object oriented architecture !
// simply delete a quote from db and have detailed error or success report
// simply delete a quote from db and have detailed error or success report
if
(
$msg
=
$obj
->
delete
())
{
if
(
$msg
=
$obj
->
delete
())
{
$AppUI
->
setMsg
(
$msg
,
UI_MSG_ERROR
);
$AppUI
->
setMsg
(
$msg
,
UI_MSG_ERROR
);
$AppUI
->
redirect
();
$AppUI
->
redirect
();
}
else
{
}
else
{
$AppUI
->
setMsg
(
"Timesheet deleted"
,
UI_MSG_ALERT
);
$AppUI
->
setMsg
(
"Timesheet deleted"
,
UI_MSG_ALERT
);
$AppUI
->
redirect
(
"m=timesheet"
);
$AppUI
->
redirect
(
"m=timesheet"
);
}
}
}
}
else
if
(
$stat
)
{
else
if
(
$stat
)
{
if
(
$msg
=
$obj
->
change_status
(
$obj
->
timesheet_status
))
{
if
(
$msg
=
$obj
->
change_status
(
$obj
->
timesheet_status
))
{
$AppUI
->
setMsg
(
$msg
,
UI_MSG_ERROR
);
$AppUI
->
setMsg
(
$msg
,
UI_MSG_ERROR
);
$AppUI
->
redirect
();
$AppUI
->
redirect
();
}
else
{
}
else
{
$AppUI
->
setMsg
(
"Timesheet status updated"
,
UI_MSG_ALERT
);
$AppUI
->
setMsg
(
"Timesheet status updated"
,
UI_MSG_ALERT
);
$AppUI
->
redirect
(
"m=timesheet&a=addedit×heet_id="
.
$obj
->
timesheet_id
);
$AppUI
->
redirect
(
"m=timesheet&a=addedit×heet_id="
.
$obj
->
timesheet_id
);
}
}
}
}
else
if
(
$period
)
{
else
if
(
$period
)
{
if
(
$msg
=
$obj
->
change_period
(
$obj
->
timesheet_period
))
{
if
(
$msg
=
$obj
->
change_period
(
$obj
->
timesheet_period
))
{
$AppUI
->
setMsg
(
$msg
,
UI_MSG_ERROR
);
$AppUI
->
setMsg
(
$msg
,
UI_MSG_ERROR
);
$AppUI
->
redirect
();
$AppUI
->
redirect
();
}
else
{
}
else
{
$AppUI
->
setMsg
(
"Timesheet period changed"
,
UI_MSG_ALERT
);
$AppUI
->
setMsg
(
"Timesheet period changed"
,
UI_MSG_ALERT
);
$AppUI
->
redirect
(
"m=timesheet&a=addedit×heet_id="
.
$obj
->
timesheet_id
);
$AppUI
->
redirect
(
"m=timesheet&a=addedit×heet_id="
.
$obj
->
timesheet_id
);
}
}
}
}
else
{
else
{
// simply store the added/edited quote in database via the store method of the timesheet
// simply store the added/edited quote in database via the store method of the timesheet
// child class of the CDpObject provided ba the dPFramework
// child class of the CDpObject provided ba the dPFramework
if
((
$msg
=
$obj
->
store
()))
{
if
((
$msg
=
$obj
->
store
()))
{
$AppUI
->
setMsg
(
$msg
,
UI_MSG_ERROR
);
$AppUI
->
setMsg
(
$msg
,
UI_MSG_ERROR
);
}
else
{
}
else
{
$isNotNew
=
@
$_POST
[
'timesheet_id'
];
$isNotNew
=
@
$_POST
[
'timesheet_id'
];
$AppUI
->
setMsg
(
$isNotNew
?
'Timesheet updated'
:
'Timesheet inserted'
,
UI_MSG_OK
);
$AppUI
->
setMsg
(
$isNotNew
?
'Timesheet updated'
:
'Timesheet inserted'
,
UI_MSG_OK
);
}
$AppUI
->
redirect
(
"m=timesheet"
);
}
$AppUI
->
redirect
(
"m=timesheet"
);
}
}
?>
?>
...
...
index.php
View file @
023283c4
<?php
<?php
/*
/*
* Copyright (C) 2007, M2X
* Copyright (C) 2007, M2X
*
*
...
@@ -20,28 +20,28 @@
...
@@ -20,28 +20,28 @@
*****************************************************************************/
*****************************************************************************/
$perms
=&
$AppUI
->
acl
();
$perms
=&
$AppUI
->
acl
();
// we check for permissions on this module
// we check for permissions on this module
$canRead
=
!
getDenyRead
(
$m
);
$canRead
=
!
getDenyRead
(
$m
);
$canEdit
=
!
getDenyEdit
(
$m
);
$canEdit
=
!
getDenyEdit
(
$m
);
$canDelete
=
$perms
->
checkModule
(
$m
,
'delete'
);
$canDelete
=
$perms
->
checkModule
(
$m
,
'delete'
);
// 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
)
{
if
(
!
$canRead
)
{
$AppUI
->
redirect
(
"m=public&a=access_denied"
);
$AppUI
->
redirect
(
"m=public&a=access_denied"
);
}
}
//save the workplace state (have a footprint on this site)
//save the workplace state (have a footprint on this site)
$AppUI
->
savePlace
();
$AppUI
->
savePlace
();
// saves the current tab box state
// saves the current tab box state
if
(
isset
(
$_GET
[
'tab'
]
))
{
if
(
isset
(
$_GET
[
'tab'
]
))
{
$AppUI
->
setState
(
'TimesheetIdxTab'
,
$_GET
[
'tab'
]
);
$AppUI
->
setState
(
'TimesheetIdxTab'
,
$_GET
[
'tab'
]
);
}
}
$tab
=
$AppUI
->
getState
(
'TimesheetIdxTab'
)
!==
NULL
?
$AppUI
->
getState
(
'TimesheetIdxTab'
)
:
0
;
$tab
=
$AppUI
->
getState
(
'TimesheetIdxTab'
)
!==
NULL
?
$AppUI
->
getState
(
'TimesheetIdxTab'
)
:
0
;
$active
=
intval
(
!
$AppUI
->
getState
(
'TimesheetIdxTab'
)
);
$active
=
intval
(
!
$AppUI
->
getState
(
'TimesheetIdxTab'
)
);
// we prepare the User Interface Design with the dPFramework
// we prepare the User Interface Design with the dPFramework
// setup the title block with Name, Icon and Help
// setup the title block with Name, Icon and Help
$titleBlock
=
new
CTitleBlock
(
'Timesheet'
,
'timesheet.png'
,
$m
,
"
$m
.
$a
"
);
$titleBlock
=
new
CTitleBlock
(
'Timesheet'
,
'timesheet.png'
,
$m
,
"
$m
.
$a
"
);
$titleBlock
->
addCell
();
$titleBlock
->
addCell
();
...
@@ -56,7 +56,7 @@ $titleBlock->show();
...
@@ -56,7 +56,7 @@ $titleBlock->show();
// now prepare and show the tabbed information boxes with the dPFramework
// now prepare and show the tabbed information boxes with the dPFramework
// The Period default for the timesheets (month,week)
// The Period default for the timesheets (month,week)
// $period = $AppUI->getPref('TIMESHEET_PERIOD');
// $period = $AppUI->getPref('TIMESHEET_PERIOD');
// build new tab box object
// build new tab box object
...
@@ -66,5 +66,5 @@ $tabBox->add( 'vw_idx_open', 'Open timesheets' );
...
@@ -66,5 +66,5 @@ $tabBox->add( 'vw_idx_open', 'Open timesheets' );
$tabBox
->
add
(
'vw_idx_submitted'
,
'Submitted timesheets'
);
$tabBox
->
add
(
'vw_idx_submitted'
,
'Submitted timesheets'
);
$tabBox
->
add
(
'vw_idx_approved'
,
'Approved timesheets'
);
$tabBox
->
add
(
'vw_idx_approved'
,
'Approved timesheets'
);
$tabBox
->
show
();
$tabBox
->
show
();
?>
?>
setup.php
View file @
023283c4
<?php
<?php
/*
/*
* Name: Timesheet
* Name: Timesheet
* Directory: timesheet
* Directory: timesheet
* Version: 1.0.0
* Version: 1.0.0
* Type: user
* Type: user
* UI Name: Timesheet
* UI Name: Timesheet
* UI Icon:
* UI Icon:
*/
*/
/*
/*
* Copyright (C) 2007, M2X
* Copyright (C) 2007, M2X
...
@@ -27,95 +27,95 @@
...
@@ -27,95 +27,95 @@
* along with this program; if not, write to the Free Software
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
*****************************************************************************/
// MODULE CONFIGURATION DEFINITION
// MODULE CONFIGURATION DEFINITION
$config
=
array
();
$config
=
array
();
$config
[
'mod_name'
]
=
'Timesheet'
;
// name the module
$config
[
'mod_name'
]
=
'Timesheet'
;
// name the module
$config
[
'mod_version'
]
=
'1.0.0'
;
// add a version number
$config
[
'mod_version'
]
=
'1.0.0'
;
// add a version number
$config
[
'mod_directory'
]
=
'timesheet'
;
// tell dotProject where to find this module
$config
[
'mod_directory'
]
=
'timesheet'
;
// tell dotProject where to find this module
$config
[
'mod_setup_class'
]
=
'CSetupTimesheet'
;
// the name of the PHP setup class (used below)
$config
[
'mod_setup_class'
]
=
'CSetupTimesheet'
;
// the name of the PHP setup class (used below)
$config
[
'mod_type'
]
=
'user'
;
// 'core' for modules distributed with dP by standard, 'user' for additional modules from dotmods
$config
[
'mod_type'
]
=
'user'
;
// 'core' for modules distributed with dP by standard, 'user' for additional modules from dotmods
$config
[
'mod_ui_name'
]
=
'Timesheet'
;
// the name that is shown in the main menu of the User Interface
$config
[
'mod_ui_name'
]
=
'Timesheet'
;
// the name that is shown in the main menu of the User Interface
$config
[
'mod_ui_icon'
]
=
'communicate.gif'
;
// name of a related icon
$config
[
'mod_ui_icon'
]
=
'communicate.gif'
;
// name of a related icon
$config
[
'mod_description'
]
=
'Timesheet module for hour registrations'
;
// some description of the module
$config
[
'mod_description'
]
=
'Timesheet module for hour registrations'
;
// some description of the module
$config
[
'mod_config'
]
=
true
;
// show 'configure' link in viewmods
$config
[
'mod_config'
]
=
true
;
// show 'configure' link in viewmods
// show module configuration with the dPframework (if requested via http)
// show module configuration with the dPframework (if requested via http)
if
(
@
$a
==
'setup'
)
{
if
(
@
$a
==
'setup'
)
{
echo
dPshowModuleConfig
(
$config
);
echo
dPshowModuleConfig
(
$config
);
}
}
class
CSetupTimesheet
{
class
CSetupTimesheet
{
// function configure() { // configure this module
// function configure() { // configure this module
// global $AppUI;
// global $AppUI;
// $AppUI->redirect( 'm=timesheet&a=configure' ); // load module specific configuration page
// $AppUI->redirect( 'm=timesheet&a=configure' ); // load module specific configuration page
// return true;
// return true;
// }
// }
function
remove
()
{
function
remove
()
{
$q
=
new
DBQuery
;
$q
=
new
DBQuery
;
$q
->
dropTable
(
'timesheet'
);
$q
->
dropTable
(
'timesheet'
);
$q
->
exec
();
$q
->
exec
();
$q
->
clear
();
$q
->
clear
();
$q
->
dropTable
(
'timesheet_project'
);
$q
->
dropTable
(
'timesheet_project'
);
$q
->
exec
();
$q
->
exec
();
return
null
;
return
null
;
}
}
function
upgrade
(
$old_version
)
{
function
upgrade
(
$old_version
)
{
// use this to provide upgrade functionality between different versions; not relevant here
// use this to provide upgrade functionality between different versions; not relevant here
switch
(
$old_version
)
switch
(
$old_version
)
{
{
case
"all"
:
// upgrade from scratch (called from install)
case
"all"
:
// upgrade from scratch (called from install)
case
"0.9"
:
case
"0.9"
:
//do some alter table commands
//do some alter table commands
case
"1.0"
:
case
"1.0"
:
return
true
;
return
true
;
default
:
default
:
return
false
;
return
false
;
}
}
return
false
;
return
false
;
}
}
function
install
()
{
function
install
()
{
// prepare the creation of a dbTable
// prepare the creation of a dbTable
$sql
=
"( "
.
$sql
=
"( "
.
" `timesheet_id` int(11) unsigned NOT NULL auto_increment,"
.
" `timesheet_id` int(11) unsigned NOT NULL auto_increment,"
.
" `timesheet_period` int(11), "
.
" `timesheet_period` int(11), "
.
" `timesheet_status` int(4) NOT NULL default '0', "
.
" `timesheet_status` int(4) NOT NULL default '0', "
.
" `timesheet_date` int(11) NOT NULL default '0', "
.
" `timesheet_date` int(11) NOT NULL default '0', "
.
" `timesheet_creator` int(11) NOT NULL default '0', "
.
" `timesheet_creator` int(11) NOT NULL default '0', "
.
" `timesheet_worked` int(11) NOT NULL default '0', "
.
" `timesheet_worked` int(11) NOT NULL default '0', "
.
" PRIMARY KEY (`timesheet_id`), "
.
" PRIMARY KEY (`timesheet_id`), "
.
" UNIQUE KEY `timesheet_id` (`timesheet_id`) "
.
" UNIQUE KEY `timesheet_id` (`timesheet_id`) "
.
") TYPE=MyISAM"
;
") TYPE=MyISAM"
;
$q
=
new
DBQuery
;
$q
=
new
DBQuery
;
$q
->
createTable
(
'timesheet'
);
$q
->
createTable
(
'timesheet'
);
$q
->
createDefinition
(
$sql
);
$q
->
createDefinition
(
$sql
);
$q
->
exec
();
$q
->
exec
();
db_error
();
db_error
();
$sql
=
"( "
.
$sql
=
"( "
.
" `timesheet_queue_id` int(11) NOT NULL auto_increment, "
.
" `timesheet_queue_id` int(11) NOT NULL auto_increment, "
.
" `timesheet_id` int(11) unsigned NOT NULL, "
.
" `timesheet_id` int(11) unsigned NOT NULL, "
.
" `timesheet_project` int(11) NOT NULL default '0', "
.
" `timesheet_project` int(11) NOT NULL default '0', "
.
" `timesheet_project_amount` bigint(20) NOT NULL default '0', "
.
" `timesheet_project_amount` bigint(20) NOT NULL default '0', "
.
" PRIMARY KEY (`timesheet_queue_id`) "
.
" PRIMARY KEY (`timesheet_queue_id`) "
.
") TYPE=MyISAM"
;
") TYPE=MyISAM"
;
$q
->
clear
();
$q
->
clear
();
$q
->
createTable
(
'timesheet_project'
);
$q
->
createTable
(
'timesheet_project'
);
$q
->
createDefinition
(
$sql
);
$q
->
createDefinition
(
$sql
);
$q
->
exec
();
$q
->
exec
();
db_error
();
db_error
();
return
null
;
return
null
;
}
}
}
}
?>
?>
timesheet.class.php
View file @
023283c4
<?php
<?php
/*
/*
* Copyright (C) 2007, M2X
* Copyright (C) 2007, M2X
*
*
...
@@ -19,37 +19,37 @@
...
@@ -19,37 +19,37 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
*****************************************************************************/
// use the dPFramework to have easy database operations (store, delete etc.) by using its ObjectOrientedDesign
// use the dPFramework to have easy database operations (store, delete etc.) by using its ObjectOrientedDesign
// therefore we have to create a child class for the module timesheet
// therefore we have to create a child class for the module timesheet
// a class named (like this) in the form: module/module.class.php is automatically loaded by the dPFramework
// a class named (like this) in the form: module/module.class.php is automatically loaded by the dPFramework
/**
/**
* @package dotProject
* @package dotProject
* @subpackage modules
* @subpackage modules
* @version $Revision: 1.0 $
* @version $Revision: 1.0 $
*/
*/
// include the powerful parent class that we want to extend for timesheet
// include the powerful parent class that we want to extend for timesheet
require_once
(
$AppUI
->
getSystemClass
(
'dp'
)
);
// use the dPFramework for easy inclusion of this class here
require_once
(
$AppUI
->
getSystemClass
(
'dp'
)
);
// use the dPFramework for easy inclusion of this class here
/**
/**
* The Timesheet Class
* The Timesheet Class
*/
*/
class
CTimesheet
extends
CDpObject
{
class
CTimesheet
extends
CDpObject
{
// link variables to the timesheet object (according to the existing columns in the database table timesheet)
// link variables to the timesheet object (according to the existing columns in the database table timesheet)
//use NULL for a NEW object, so the database automatically assigns an unique id by 'NOT NULL'-functionality
//use NULL for a NEW object, so the database automatically assigns an unique id by 'NOT NULL'-functionality
var
$timesheet_id
=
NULL
;
var
$timesheet_id
=
NULL
;
var
$timesheet_period
=
NULL
;
var
$timesheet_period
=
NULL
;
var
$timesheet_status
=
NULL
;
var
$timesheet_status
=
NULL
;
var
$timesheet_date
=
NULL
;
var
$timesheet_date
=
NULL
;
var
$timesheet_creator
=
NULL
;
var
$timesheet_creator
=
NULL
;
var
$timesheet_worked
=
NULL
;
var
$timesheet_worked
=
NULL
;
// the constructor of the CTimesheet class, always combined with the table name and the unique key of the table
// the constructor of the CTimesheet class, always combined with the table name and the unique key of the table
function
CTimesheet
()
{
function
CTimesheet
()
{
$this
->
CDpObject
(
'timesheet'
,
'timesheet_id'
);
$this
->
CDpObject
(
'timesheet'
,
'timesheet_id'
);
$this
->
timesheet_id
=
$_POST
[
"timesheet_id"
];
$this
->
timesheet_id
=
$_POST
[
"timesheet_id"
];
}
}
function
check
()
{
function
check
()
{
...
@@ -76,7 +76,7 @@ class CTimesheet extends CDpObject {
...
@@ -76,7 +76,7 @@ class CTimesheet extends CDpObject {
$q
->
setDelete
(
'timesheet_project'
);
$q
->
setDelete
(
'timesheet_project'
);
$q
->
addWhere
(
'timesheet_id = '
.
$this
->
timesheet_id
);
$q
->
addWhere
(
'timesheet_id = '
.
$this
->
timesheet_id
);
if
(
!
$q
->
exec
())
if
(
!
$q
->
exec
())
return
db_error
();
return
db_error
();
}
}
function
project_store
()
function
project_store
()
...
@@ -89,10 +89,10 @@ class CTimesheet extends CDpObject {
...
@@ -89,10 +89,10 @@ class CTimesheet extends CDpObject {
else
else
$period
=
new
CDate
();
$period
=
new
CDate
();
$q
=
new
DBQuery
();
$q
=
new
DBQuery
();
$q
->
addQuery
(
'project_id'
);
$q
->
addQuery
(
'project_id'
);
$q
->
addQuery
(
'project_name'
);
$q
->
addQuery
(
'project_name'
);
$q
->
addQuery
(
'project_status'
);
$q
->
addQuery
(
'project_status'
);
$q
->
addTable
(
'projects'
);
$q
->
addTable
(
'projects'
);
$q
->
addOrder
(
'project_name ASC'
);
$q
->
addOrder
(
'project_name ASC'
);
$projects
=
$q
->
LoadList
();
$projects
=
$q
->
LoadList
();
...
@@ -167,22 +167,22 @@ class CTimesheet extends CDpObject {
...
@@ -167,22 +167,22 @@ class CTimesheet extends CDpObject {
echo
db_error
();
echo
db_error
();
}
}
}
}
// overload the delete method of the parent class for adaptation for timesheet's needs
// overload the delete method of the parent class for adaptation for timesheet's needs
function
delete
()
{
function
delete
()
{
$q
=
new
DBQuery
();
$q
=
new
DBQuery
();
$q
->
setDelete
(
'timesheet_project'
);
$q
->
setDelete
(
'timesheet_project'
);
$q
->
addWhere
(
'timesheet_id = '
.
$this
->
timesheet_id
);
$q
->
addWhere
(
'timesheet_id = '
.
$this
->
timesheet_id
);
$q
->
exec
();
$q
->
exec
();
echo
db_error
();
echo
db_error
();
$q
->
clear
();
$q
->
clear
();
$q
->
setDelete
(
'timesheet'
);
$q
->
setDelete
(
'timesheet'
);
$q
->
addWhere
(
'timesheet_id = '
.
$this
->
timesheet_id
);
$q
->
addWhere
(
'timesheet_id = '
.
$this
->
timesheet_id
);
if
(
!
$q
->
exec
())
{
if
(
!
$q
->
exec
())
{
return
db_error
();
return
db_error
();
}
else
{
}
else
{
return
NULL
;
return
NULL
;
}
}
}
}
function
change_status
(
$stat
)
function
change_status
(
$stat
)
...
@@ -213,6 +213,6 @@ class CTimesheet extends CDpObject {
...
@@ -213,6 +213,6 @@ class CTimesheet extends CDpObject {
if
(
!
$q
->
exec
())
{
if
(
!
$q
->
exec
())
{
return
db_error
();
return
db_error
();
}
}
}
}
}
}
?>
?>
vw_idx_approved.php
View file @
023283c4
<?php
<?php
/*
/*
* Copyright (C) 2007, M2X
* Copyright (C) 2007, M2X
*
*
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
*****************************************************************************/
include
(
"vw_idx_inc.php"
);
include
(
"vw_idx_inc.php"
);
echo
timesheets
(
2
);
echo
timesheets
(
2
);
?>
?>
vw_idx_inc.php
View file @
023283c4
...
@@ -19,27 +19,27 @@
...
@@ -19,27 +19,27 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
*****************************************************************************/
function
timesheets
(
$type
)
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
if
(
!
$canRead
)
{
// lock out users that do not have at least readPermission on this module
$AppUI
->
redirect
(
"m=public&a=access_denied"
);
$AppUI
->
redirect
(
"m=public&a=access_denied"
);
}
}
//prepare an html table with a head section
//prepare an html table with a head section
?>
?>
<table
width=
"100%"
border=
"0"
cellpadding=
"2"
cellspacing=
"1"
class=
"tbl"
>
<table
width=
"100%"
border=
"0"
cellpadding=
"2"
cellspacing=
"1"
class=
"tbl"
>
<tr>
<tr>
<th
nowrap=
"nowrap"
>
</th>
<th
nowrap=
"nowrap"
>
</th>
<th
nowrap=
"nowrap"
>
<?php
echo
$AppUI
->
_
(
'Date'
);
?>
</th>
<th
nowrap=
"nowrap"
>
<?php
echo
$AppUI
->
_
(
'Date'
);
?>
</th>
<th
nowrap=
"nowrap"
>
<?php
echo
$AppUI
->
_
(
'Month'
);
?>
</th>
<th
nowrap=
"nowrap"
>
<?php
echo
$AppUI
->
_
(
'Month'
);
?>
</th>
<th
nowrap=
"nowrap"
>
<?php
echo
$AppUI
->
_
(
'Worked'
);
?>
</th>
<th
nowrap=
"nowrap"
>
<?php
echo
$AppUI
->
_
(
'Worked'
);
?>
</th>
<th
nowrap=
"nowrap"
>
<?php
echo
$AppUI
->
_
(
'Submitter'
);
?>
</th>
<th
nowrap=
"nowrap"
>
<?php
echo
$AppUI
->
_
(
'Submitter'
);
?>
</th>
<th
nowrap=
"nowrap"
>
<?php
echo
$AppUI
->
_
(
'Status'
);
?>
</th>
<th
nowrap=
"nowrap"
>
<?php
echo
$AppUI
->
_
(
'Status'
);
?>
</th>
<th
nowrap=
"nowrap"
>
</th>
<th
nowrap=
"nowrap"
>
</th>
</tr>
</tr>
<?php
<?php
// Retrieve the list of users that may access this module.
// Retrieve the list of users that may access this module.
if
(
isset
(
$_REQUEST
[
"user_filter_id"
])){
if
(
isset
(
$_REQUEST
[
"user_filter_id"
])){
$AppUI
->
setState
(
"user_filter_id"
,
$_REQUEST
[
"user_filter_id"
]);
$AppUI
->
setState
(
"user_filter_id"
,
$_REQUEST
[
"user_filter_id"
]);
$user_filter_id
=
$_REQUEST
[
"user_filter_id"
];
$user_filter_id
=
$_REQUEST
[
"user_filter_id"
];
...
@@ -91,20 +91,20 @@ $q->addOrder('timesheet_period');
...
@@ -91,20 +91,20 @@ $q->addOrder('timesheet_period');
if
(
$type
>=
0
)
if
(
$type
>=
0
)
$q
->
addWhere
(
'timesheet_status = '
.
$type
);
$q
->
addWhere
(
'timesheet_status = '
.
$type
);
$month
=
$q
->
loadList
();
$month
=
$q
->
loadList
();
// add/show now gradually the timesheet
// add/show now gradually the timesheet
foreach
(
$month
as
$row
)
{
foreach
(
$month
as
$row
)
{
?>
?>
<tr>
<tr>
<td
nowrap=
"nowrap"
width=
"20"
>
<td
nowrap=
"nowrap"
width=
"20"
>
<?php
if
((
$canEdit
)
&&
(
$row
[
"timesheet_status"
])
<
1
)
{
<?php
if
((
$canEdit
)
&&
(
$row
[
"timesheet_status"
])
<
1
)
{
// call the edit site with the unique id of the timesheet item
// 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
"
\n
"
.
'<a href="?m=timesheet&a=addedit×heet_id='
.
$row
[
"timesheet_id"
]
.
'">'
;
echo
dPshowImage
(
'./images/icons/stock_edit-16.png'
,
'16'
,
'16'
);
echo
dPshowImage
(
'./images/icons/stock_edit-16.png'
,
'16'
,
'16'
);
echo
"
\n
</a>"
;
echo
"
\n
</a>"
;
}
}
?>
?>
</td>
</td>
<td>
<?php
<td>
<?php
$date
=
new
CDate
();
$date
=
new
CDate
();
$date
->
setDate
(
$row
[
"timesheet_date"
],
DATE_FORMAT_UNIXTIME
);
$date
->
setDate
(
$row
[
"timesheet_date"
],
DATE_FORMAT_UNIXTIME
);
...
@@ -150,24 +150,24 @@ foreach ($month as $row) {
...
@@ -150,24 +150,24 @@ foreach ($month as $row) {
if
(
$status
==
0
)
if
(
$status
==
0
)
echo
dPformSafe
(
"Open for Editing"
);
echo
dPformSafe
(
"Open for Editing"
);
else
if
(
$status
==
1
)
else
if
(
$status
==
1
)
echo
dPformSafe
(
"Submitted"
);
// closed
echo
dPformSafe
(
"Submitted"
);
// closed
else
if
(
$status
==
2
)
else
if
(
$status
==
2
)
echo
dPformSafe
(
"Approved"
);
echo
dPformSafe
(
"Approved"
);
?>
?>
</td>
</td>
<td
nowrap=
"nowrap"
width=
"20"
>
<?php
<td
nowrap=
"nowrap"
width=
"20"
>
<?php
if
(
$canDelete
)
{
if
(
$canDelete
)
{
// call the edit site with the unique id of the timesheet item
// 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
"
\n
"
.
'<a href="?m=timesheet&a=addedit×heet_id='
.
$row
[
"timesheet_id"
]
.
'">'
;
echo
dPshowImage
(
'./images/icons/stock_delete-16.png'
,
'16'
,
'16'
);
echo
dPshowImage
(
'./images/icons/stock_delete-16.png'
,
'16'
,
'16'
);
echo
"
\n
</a>"
;
echo
"
\n
</a>"
;
}
}
?>
?>
</td>
</td>
</tr>
</tr>
<?php
<?php
}
}
?>
?>
</table>
</table>
<?php
<?php
}
// end of function
}
// end of function
...
...
vw_idx_open.php
View file @
023283c4
<?php
<?php
/*
/*
* Copyright (C) 2007, M2X
* Copyright (C) 2007, M2X
*
*
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
*****************************************************************************/
include
(
"vw_idx_inc.php"
);
include
(
"vw_idx_inc.php"
);
echo
timesheets
(
0
);
echo
timesheets
(
0
);
?>
?>
vw_idx_submitted.php
View file @
023283c4
...
@@ -18,8 +18,8 @@
...
@@ -18,8 +18,8 @@
* along with this program; if not, write to the Free Software
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
*****************************************************************************/
include
(
"vw_idx_inc.php"
);
include
(
"vw_idx_inc.php"
);
echo
timesheets
(
1
);
echo
timesheets
(
1
);
?>
?>
vw_idx_timesheets.php
View file @
023283c4
...
@@ -18,8 +18,8 @@
...
@@ -18,8 +18,8 @@
* along with this program; if not, write to the Free Software
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
*****************************************************************************/
include
(
"vw_idx_inc.php"
);
include
(
"vw_idx_inc.php"
);
echo
timesheets
(
-
1
);
echo
timesheets
(
-
1
);
?>
?>
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