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();
}
}
function
changeIt
()
{
function
changeIt
()
{
var
f
=
document
.
editFrm
;
f
.
stat
.
value
=
'
1
'
;
f
.
submit
();
...
...
@@ -124,7 +124,7 @@ else
if
(
intval
(
$obj
->
timesheet_status
))
$status
=
$obj
->
timesheet_status
;
else
$status
=
0
;
$status
=
0
;
// Get the current timesheet creation date
if
(
intval
(
$obj
->
timesheet_date
))
{
...
...
@@ -234,10 +234,10 @@ else {
<?php
if
(
(
$canEdit
)
&&
(
$status
==
0
)
)
{
?>
<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
==
1
)
echo
"selected"
;
?>
value=
"1"
>
<?
echo
dPformSafe
(
'Submitted'
);
?>
</option>
<option
<?php
if
(
$status
==
2
)
echo
"selected"
;
?>
value=
"2"
>
<?
echo
dPformSafe
(
'Approved'
);
?>
</option>
<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
==
1
)
echo
"selected"
;
?>
value=
"1"
>
<?
echo
dPformSafe
(
'Submitted'
);
?>
</option>
<option
<?php
if
(
$status
==
2
)
echo
"selected"
;
?>
value=
"2"
>
<?
echo
dPformSafe
(
'Approved'
);
?>
</option>
</select>
<?php
}
...
...
@@ -281,10 +281,10 @@ function showproject()
{
global
$AppUI
,
$period
,
$obj
;
$q
=
new
DBQuery
();
$q
=
new
DBQuery
();
$q
->
addQuery
(
'project_id'
);
$q
->
addQuery
(
'project_name'
);
$q
->
addQuery
(
'project_status'
);
$q
->
addQuery
(
'project_status'
);
$q
->
addTable
(
'projects'
);
$q
->
addOrder
(
'project_name ASC'
);
$projects
=
$q
->
LoadList
();
...
...
@@ -292,7 +292,7 @@ function showproject()
foreach
(
$projects
as
$row
)
{
echo
'<tr>'
;
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>'
;
$project_id
=
$row
[
"project_id"
];
...
...
@@ -347,20 +347,20 @@ function showtimesheetproject()
{
global
$timesheet_id
;
$q
=
new
DBQuery
();
$q
=
new
DBQuery
();
$q
->
addQuery
(
'timesheet_id'
);
$q
->
addQuery
(
'timesheet_project'
);
$q
->
addQuery
(
'timesheet_project_amount'
);
$q
->
addQuery
(
'timesheet_project_amount'
);
$q
->
addTable
(
'timesheet_project'
);
$q
->
addWhere
(
'timesheet_id = '
.
$timesheet_id
);
$q
->
addOrder
(
'timesheet_project ASC'
);
$timesheet
=
$q
->
LoadList
();
foreach
(
$timesheet
as
$row
)
{
$p
=
new
DBQuery
();
$p
=
new
DBQuery
();
$p
->
addQuery
(
'project_id'
);
$p
->
addQuery
(
'project_name'
);
$p
->
addQuery
(
'project_status'
);
$p
->
addQuery
(
'project_status'
);
$p
->
addTable
(
'projects'
);
$p
->
addWhere
(
'project_id = '
.
$row
[
"timesheet_project"
]);
$p
->
addOrder
(
'project_name ASC'
);
...
...
@@ -368,7 +368,7 @@ function showtimesheetproject()
foreach
(
$projects
as
$project
)
{
echo
'<tr>'
;
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>'
.
$row
[
"timesheet_project_amount"
]
.
'</td>'
;
echo
'<td>'
.
$project
[
"project_status"
]
.
'</td>'
;
...
...
@@ -379,13 +379,13 @@ function showtimesheetproject()
?>
<table
width=
"100%"
border=
"0"
cellpadding=
"2"
cellspacing=
"1"
class=
"tbl"
>
<tr>
<th
nowrap=
"nowrap"
>
</th>
<tr>
<th
nowrap=
"nowrap"
>
</th>
<th
nowrap=
"nowrap"
>
<?php
echo
$AppUI
->
_
(
'Project'
);
?>
</th>
<th
nowrap=
"nowrap"
>
<?php
echo
$AppUI
->
_
(
'Worked hours'
);
?>
</th>
<th
nowrap=
"nowrap"
>
<?php
echo
$AppUI
->
_
(
'Project status'
);
?>
</th>
</tr>
<form
name=
"projectFrm"
action=
"./index.php?m=timesheet"
method=
"post"
>
<th
nowrap=
"nowrap"
>
<?php
echo
$AppUI
->
_
(
'Project status'
);
?>
</th>
</tr>
<form
name=
"projectFrm"
action=
"./index.php?m=timesheet"
method=
"post"
>
<input
type=
"hidden"
name=
"dosql"
value=
"do_timesheet_aed"
/>
<input
type=
"hidden"
name=
"projects"
value=
"0"
/>
...
...
do_timesheet_aed.php
View file @
023283c4
<?php
<?php
/*
* Copyright (C) 2007, M2X
*
...
...
@@ -18,22 +18,22 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
// create a new instance of the timesheet class
$obj
=
new
CTimesheet
();
$msg
=
''
;
// reset the message string
// bind the informations (variables) retrieved via post to the timesheet object
if
(
!
$obj
->
bind
(
$_POST
))
{
$AppUI
->
setMsg
(
$obj
->
getError
(),
UI_MSG_ERROR
);
$AppUI
->
redirect
();
}
// create a new instance of the timesheet class
$obj
=
new
CTimesheet
();
$msg
=
''
;
// reset the message string
// bind the informations (variables) retrieved via post to the timesheet object
if
(
!
$obj
->
bind
(
$_POST
))
{
$AppUI
->
setMsg
(
$obj
->
getError
(),
UI_MSG_ERROR
);
$AppUI
->
redirect
();
}
// detect if a deleete operation has to be processed
$period
=
dPgetParam
(
$_POST
,
'period'
,
0
);
$stat
=
dPgetParam
(
$_POST
,
'stat'
,
0
);
$stat
=
dPgetParam
(
$_POST
,
'stat'
,
0
);
$del
=
dPgetParam
(
$_POST
,
'del'
,
0
);
$obj
->
timesheet_id
=
$_POST
[
"timesheet_id"
];
$obj
->
timesheet_status
=
$_POST
[
"timesheet_status"
];
$obj
->
timesheet_period
=
$_POST
[
"timesheet_period"
];
...
...
@@ -41,49 +41,49 @@ $obj->timesheet_date = $_POST["timesheet_date"];
$obj
->
timesheet_creator
=
$_POST
[
"timesheet_creator"
];
$obj
->
timesheet_worked
=
$_POST
[
"timesheet_worked"
];
$AppUI
->
setMsg
(
'Timesheet'
);
if
(
$del
)
{
// check if there are dependencies on this object
if
(
!
$obj
->
canDelete
(
$msg
))
{
$AppUI
->
setMsg
(
$msg
,
UI_MSG_ERROR
);
$AppUI
->
redirect
();
}
// 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
if
(
$msg
=
$obj
->
delete
())
{
$AppUI
->
setMsg
(
$msg
,
UI_MSG_ERROR
);
$AppUI
->
redirect
();
}
else
{
$AppUI
->
setMsg
(
"Timesheet deleted"
,
UI_MSG_ALERT
);
$AppUI
->
redirect
(
"m=timesheet"
);
$AppUI
->
setMsg
(
'Timesheet'
);
if
(
$del
)
{
// check if there are dependencies on this object
if
(
!
$obj
->
canDelete
(
$msg
))
{
$AppUI
->
setMsg
(
$msg
,
UI_MSG_ERROR
);
$AppUI
->
redirect
();
}
// 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
if
(
$msg
=
$obj
->
delete
())
{
$AppUI
->
setMsg
(
$msg
,
UI_MSG_ERROR
);
$AppUI
->
redirect
();
}
else
{
$AppUI
->
setMsg
(
"Timesheet deleted"
,
UI_MSG_ALERT
);
$AppUI
->
redirect
(
"m=timesheet"
);
}
}
else
if
(
$stat
)
{
if
(
$msg
=
$obj
->
change_status
(
$obj
->
timesheet_status
))
{
$AppUI
->
setMsg
(
$msg
,
UI_MSG_ERROR
);
$AppUI
->
redirect
();
}
else
{
$AppUI
->
setMsg
(
"Timesheet status updated"
,
UI_MSG_ALERT
);
$AppUI
->
redirect
(
"m=timesheet&a=addedit×heet_id="
.
$obj
->
timesheet_id
);
}
else
{
$AppUI
->
setMsg
(
"Timesheet status updated"
,
UI_MSG_ALERT
);
$AppUI
->
redirect
(
"m=timesheet&a=addedit×heet_id="
.
$obj
->
timesheet_id
);
}
}
else
if
(
$period
)
{
if
(
$msg
=
$obj
->
change_period
(
$obj
->
timesheet_period
))
{
$AppUI
->
setMsg
(
$msg
,
UI_MSG_ERROR
);
$AppUI
->
redirect
();
}
else
{
$AppUI
->
setMsg
(
"Timesheet period changed"
,
UI_MSG_ALERT
);
}
else
{
$AppUI
->
setMsg
(
"Timesheet period changed"
,
UI_MSG_ALERT
);
$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
// child class of the CDpObject provided ba the dPFramework
if
((
$msg
=
$obj
->
store
()))
{
$AppUI
->
setMsg
(
$msg
,
UI_MSG_ERROR
);
}
else
{
$isNotNew
=
@
$_POST
[
'timesheet_id'
];
$AppUI
->
setMsg
(
$isNotNew
?
'Timesheet updated'
:
'Timesheet inserted'
,
UI_MSG_OK
);
// child class of the CDpObject provided ba the dPFramework
if
((
$msg
=
$obj
->
store
()))
{
$AppUI
->
setMsg
(
$msg
,
UI_MSG_ERROR
);
}
else
{
$isNotNew
=
@
$_POST
[
'timesheet_id'
];
$AppUI
->
setMsg
(
$isNotNew
?
'Timesheet updated'
:
'Timesheet inserted'
,
UI_MSG_OK
);
}
$AppUI
->
redirect
(
"m=timesheet"
);
}
}
?>
...
...
index.php
View file @
023283c4
<?php
<?php
/*
* Copyright (C) 2007, M2X
*
...
...
@@ -20,28 +20,28 @@
*****************************************************************************/
$perms
=&
$AppUI
->
acl
();
// we check for permissions on this module
$canRead
=
!
getDenyRead
(
$m
);
// we check for permissions on this module
$canRead
=
!
getDenyRead
(
$m
);
$canEdit
=
!
getDenyEdit
(
$m
);
$canDelete
=
$perms
->
checkModule
(
$m
,
'delete'
);
// lock out users that do not have at least readPermission on this module
if
(
!
$canRead
)
{
$AppUI
->
redirect
(
"m=public&a=access_denied"
);
}
//save the workplace state (have a footprint on this site)
$AppUI
->
savePlace
();
// saves the current tab box state
if
(
isset
(
$_GET
[
'tab'
]
))
{
$AppUI
->
setState
(
'TimesheetIdxTab'
,
$_GET
[
'tab'
]
);
}
$tab
=
$AppUI
->
getState
(
'TimesheetIdxTab'
)
!==
NULL
?
$AppUI
->
getState
(
'TimesheetIdxTab'
)
:
0
;
// lock out users that do not have at least readPermission on this module
if
(
!
$canRead
)
{
$AppUI
->
redirect
(
"m=public&a=access_denied"
);
}
//save the workplace state (have a footprint on this site)
$AppUI
->
savePlace
();
// saves the current tab box state
if
(
isset
(
$_GET
[
'tab'
]
))
{
$AppUI
->
setState
(
'TimesheetIdxTab'
,
$_GET
[
'tab'
]
);
}
$tab
=
$AppUI
->
getState
(
'TimesheetIdxTab'
)
!==
NULL
?
$AppUI
->
getState
(
'TimesheetIdxTab'
)
:
0
;
$active
=
intval
(
!
$AppUI
->
getState
(
'TimesheetIdxTab'
)
);
// we prepare the User Interface Design with the dPFramework
// setup the title block with Name, Icon and Help
// we prepare the User Interface Design with the dPFramework
// setup the title block with Name, Icon and Help
$titleBlock
=
new
CTitleBlock
(
'Timesheet'
,
'timesheet.png'
,
$m
,
"
$m
.
$a
"
);
$titleBlock
->
addCell
();
...
...
@@ -56,7 +56,7 @@ $titleBlock->show();
// 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');
// build new tab box object
...
...
@@ -66,5 +66,5 @@ $tabBox->add( 'vw_idx_open', 'Open timesheets' );
$tabBox
->
add
(
'vw_idx_submitted'
,
'Submitted timesheets'
);
$tabBox
->
add
(
'vw_idx_approved'
,
'Approved timesheets'
);
$tabBox
->
show
();
?>
setup.php
View file @
023283c4
<?php
/*
* Name: Timesheet
* Directory: timesheet
* Version: 1.0.0
* Type: user
* UI Name: Timesheet
* UI Icon:
*/
<?php
/*
* Name: Timesheet
* Directory: timesheet
* Version: 1.0.0
* Type: user
* UI Name: Timesheet
* UI Icon:
*/
/*
* Copyright (C) 2007, M2X
...
...
@@ -27,95 +27,95 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
// MODULE CONFIGURATION DEFINITION
$config
=
array
();
$config
[
'mod_name'
]
=
'Timesheet'
;
// name the module
$config
[
'mod_version'
]
=
'1.0.0'
;
// add a version number
$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_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_icon'
]
=
'communicate.gif'
;
// name of a related icon
$config
[
'mod_description'
]
=
'Timesheet module for hour registrations'
;
// some description of the module
$config
[
'mod_config'
]
=
true
;
// show 'configure' link in viewmods
// show module configuration with the dPframework (if requested via http)
if
(
@
$a
==
'setup'
)
{
echo
dPshowModuleConfig
(
$config
);
}
class
CSetupTimesheet
{
// function configure() { // configure this module
// global $AppUI;
// $AppUI->redirect( 'm=timesheet&a=configure' ); // load module specific configuration page
// return true;
// }
function
remove
()
{
$q
=
new
DBQuery
;
$q
->
dropTable
(
'timesheet'
);
$q
->
exec
();
$q
->
clear
();
$q
->
dropTable
(
'timesheet_project'
);
$q
->
exec
();
return
null
;
}
// MODULE CONFIGURATION DEFINITION
$config
=
array
();
$config
[
'mod_name'
]
=
'Timesheet'
;
// name the module
$config
[
'mod_version'
]
=
'1.0.0'
;
// add a version number
$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_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_icon'
]
=
'communicate.gif'
;
// name of a related icon
$config
[
'mod_description'
]
=
'Timesheet module for hour registrations'
;
// some description of the module
$config
[
'mod_config'
]
=
true
;
// show 'configure' link in viewmods
// show module configuration with the dPframework (if requested via http)
if
(
@
$a
==
'setup'
)
{
echo
dPshowModuleConfig
(
$config
);
}
class
CSetupTimesheet
{
// function configure() { // configure this module
// global $AppUI;
// $AppUI->redirect( 'm=timesheet&a=configure' ); // load module specific configuration page
// return true;
// }
function
remove
()
{
$q
=
new
DBQuery
;
$q
->
dropTable
(
'timesheet'
);
$q
->
exec
();
$q
->
clear
();
$q
->
dropTable
(
'timesheet_project'
);
$q
->
exec
();
return
null
;
}
function
upgrade
(
$old_version
)
{
// use this to provide upgrade functionality between different versions; not relevant here
switch
(
$old_version
)
{
case
"all"
:
// upgrade from scratch (called from install)
case
"0.9"
:
//do some alter table commands
case
"1.0"
:
return
true
;
default
:
return
false
;
}
return
false
;
}
// use this to provide upgrade functionality between different versions; not relevant here
switch
(
$old_version
)
{
case
"all"
:
// upgrade from scratch (called from install)
case
"0.9"
:
//do some alter table commands
case
"1.0"
:
return
true
;
default
:
return
false
;
}
return
false
;
}
function
install
()
{
// prepare the creation of a dbTable
$sql
=
"( "
.
// prepare the creation of a dbTable
$sql
=
"( "
.
" `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_date` int(11) NOT NULL default '0', "
.
" `timesheet_creator` int(11) NOT NULL default '0', "
.
" `timesheet_worked` int(11) NOT NULL default '0', "
.
" PRIMARY KEY (`timesheet_id`), "
.
" UNIQUE KEY `timesheet_id` (`timesheet_id`) "
.
") TYPE=MyISAM"
;
$q
=
new
DBQuery
;
$q
->
createTable
(
'timesheet'
);
$q
->
createDefinition
(
$sql
);
" `timesheet_worked` int(11) NOT NULL default '0', "
.
" PRIMARY KEY (`timesheet_id`), "
.
" UNIQUE KEY `timesheet_id` (`timesheet_id`) "
.
") TYPE=MyISAM"
;
$q
=
new
DBQuery
;
$q
->
createTable
(
'timesheet'
);
$q
->
createDefinition
(
$sql
);
$q
->
exec
();
db_error
();
$sql
=
"( "
.
db_error
();
$sql
=
"( "
.
" `timesheet_queue_id` int(11) NOT NULL auto_increment, "
.
" `timesheet_id` int(11) unsigned NOT NULL, "
.
" `timesheet_project` int(11) NOT NULL default '0', "
.
" `timesheet_project_amount` bigint(20) NOT NULL default '0', "
.
" PRIMARY KEY (`timesheet_queue_id`) "
.
") TYPE=MyISAM"
;
$q
->
clear
();
$q
->
createTable
(
'timesheet_project'
);
$q
->
createDefinition
(
$sql
);
$q
->
exec
();
db_error
();
return
null
;
}
}
" `timesheet_project` int(11) NOT NULL default '0', "
.
" `timesheet_project_amount` bigint(20) NOT NULL default '0', "
.
" PRIMARY KEY (`timesheet_queue_id`) "
.
") TYPE=MyISAM"
;
$q
->
clear
();
$q
->
createTable
(
'timesheet_project'
);
$q
->
createDefinition
(
$sql
);
$q
->
exec
();
db_error
();
return
null
;
}
}
?>
timesheet.class.php
View file @
023283c4
<?php
<?php
/*
* Copyright (C) 2007, M2X
*
...
...
@@ -19,37 +19,37 @@
* 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
// 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
/**
* @package dotProject
* @subpackage modules
* @version $Revision: 1.0 $
*/
// 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
/**
* The Timesheet Class
*/
class
CTimesheet
extends
CDpObject
{
// 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
// a class named (like this) in the form: module/module.class.php is automatically loaded by the dPFramework
/**
* @package dotProject
* @subpackage modules
* @version $Revision: 1.0 $
*/
// 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
/**
* The Timesheet Class
*/
class
CTimesheet
extends
CDpObject
{
// 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
var
$timesheet_id
=
NULL
;
var
$timesheet_period
=
NULL
;
//use NULL for a NEW object, so the database automatically assigns an unique id by 'NOT NULL'-functionality
var
$timesheet_id
=
NULL
;
var
$timesheet_period
=
NULL
;
var
$timesheet_status
=
NULL
;
var
$timesheet_date
=
NULL
;
var
$timesheet_creator
=
NULL
;
var
$timesheet_worked
=
NULL
;
// the constructor of the CTimesheet class, always combined with the table name and the unique key of the table
function
CTimesheet
()
{
// the constructor of the CTimesheet class, always combined with the table name and the unique key of the table
function
CTimesheet
()
{
$this
->
CDpObject
(
'timesheet'
,
'timesheet_id'
);
$this
->
timesheet_id
=
$_POST
[
"timesheet_id"
];
$this
->
timesheet_id
=
$_POST
[
"timesheet_id"
];
}
function
check
()
{
...
...
@@ -76,7 +76,7 @@ class CTimesheet extends CDpObject {
$q
->
setDelete
(
'timesheet_project'
);
$q
->
addWhere
(
'timesheet_id = '
.
$this
->
timesheet_id
);
if
(
!
$q
->
exec
())
return
db_error
();
return
db_error
();
}
function
project_store
()
...
...
@@ -89,10 +89,10 @@ class CTimesheet extends CDpObject {
else
$period
=
new
CDate
();
$q
=
new
DBQuery
();
$q
=
new
DBQuery
();
$q
->
addQuery
(
'project_id'
);
$q
->
addQuery
(
'project_name'
);
$q
->
addQuery
(
'project_status'
);
$q
->
addQuery
(
'project_status'
);
$q
->
addTable
(
'projects'
);
$q
->
addOrder
(
'project_name ASC'
);
$projects
=
$q
->
LoadList
();
...
...
@@ -167,22 +167,22 @@ class CTimesheet extends CDpObject {
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
()
{
$q
=
new
DBQuery
();
$q
->
setDelete
(
'timesheet_project'
);
$q
->
addWhere
(
'timesheet_id = '
.
$this
->
timesheet_id
);
$q
->
exec
();
echo
db_error
();
$q
->
clear
();
echo
db_error
();
$q
->
clear
();
$q
->
setDelete
(
'timesheet'
);
$q
->
addWhere
(
'timesheet_id = '
.
$this
->
timesheet_id
);
if
(
!
$q
->
exec
())
{
return
db_error
();
}
else
{
return
NULL
;
}
$q
->
addWhere
(
'timesheet_id = '
.
$this
->
timesheet_id
);
if
(
!
$q
->
exec
())
{
return
db_error
();
}
else
{
return
NULL
;
}
}
function
change_status
(
$stat
)
...
...
@@ -213,6 +213,6 @@ class CTimesheet extends CDpObject {
if
(
!
$q
->
exec
())
{
return
db_error
();
}
}
}
}
}
?>
vw_idx_approved.php
View file @
023283c4
<?php
<?php
/*
* Copyright (C) 2007, M2X
*
...
...
@@ -19,7 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
include
(
"vw_idx_inc.php"
);
echo
timesheets
(
2
);
include
(
"vw_idx_inc.php"
);
echo
timesheets
(
2
);
?>
vw_idx_inc.php
View file @
023283c4
...
...
@@ -19,27 +19,27 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
function
timesheets
(
$type
)
function
timesheets
(
$type
)
{
GLOBAL
$AppUI
,
$canRead
,
$canEdit
,
$canDelete
;
if
(
!
$canRead
)
{
// lock out users that do not have at least readPermission on this module
$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>
GLOBAL
$AppUI
,
$canRead
,
$canEdit
,
$canDelete
;
if
(
!
$canRead
)
{
// lock out users that do not have at least readPermission on this module
$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.
<th
nowrap=
"nowrap"
>
</th>
</tr>
<?php
// 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"
];
...
...
@@ -91,20 +91,20 @@ $q->addOrder('timesheet_period');
if
(
$type
>=
0
)
$q
->
addWhere
(
'timesheet_status = '
.
$type
);
$month
=
$q
->
loadList
();
// add/show now gradually the timesheet
foreach
(
$month
as
$row
)
{
?>
<tr>
<td
nowrap=
"nowrap"
width=
"20"
>
// add/show now gradually the timesheet
foreach
(
$month
as
$row
)
{
?>
<tr>
<td
nowrap=
"nowrap"
width=
"20"
>
<?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
dPshowImage
(
'./images/icons/stock_edit-16.png'
,
'16'
,
'16'
);
echo
"
\n
</a>"
;
echo
dPshowImage
(
'./images/icons/stock_edit-16.png'
,
'16'
,
'16'
);
echo
"
\n
</a>"
;
}
?>
</td>
?>
</td>
<td>
<?php
$date
=
new
CDate
();
$date
->
setDate
(
$row
[
"timesheet_date"
],
DATE_FORMAT_UNIXTIME
);
...
...
@@ -150,24 +150,24 @@ foreach ($month as $row) {
if
(
$status
==
0
)
echo
dPformSafe
(
"Open for Editing"
);
else
if
(
$status
==
1
)
echo
dPformSafe
(
"Submitted"
);
// closed
echo
dPformSafe
(
"Submitted"
);
// closed
else
if
(
$status
==
2
)
echo
dPformSafe
(
"Approved"
);
?>
</td>
<td
nowrap=
"nowrap"
width=
"20"
>
<?php
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
dPshowImage
(
'./images/icons/stock_delete-16.png'
,
'16'
,
'16'
);
echo
"
\n
</a>"
;
echo
dPshowImage
(
'./images/icons/stock_delete-16.png'
,
'16'
,
'16'
);
echo
"
\n
</a>"
;
}
?>
</td>
</tr>
<?php
}
?>
</tr>
<?php
}
?>
</table>
<?php
}
// end of function
...
...
vw_idx_open.php
View file @
023283c4
<?php
<?php
/*
* Copyright (C) 2007, M2X
*
...
...
@@ -19,7 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
include
(
"vw_idx_inc.php"
);
echo
timesheets
(
0
);
include
(
"vw_idx_inc.php"
);
echo
timesheets
(
0
);
?>
vw_idx_submitted.php
View file @
023283c4
...
...
@@ -18,8 +18,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
include
(
"vw_idx_inc.php"
);
echo
timesheets
(
1
);
include
(
"vw_idx_inc.php"
);
echo
timesheets
(
1
);
?>
vw_idx_timesheets.php
View file @
023283c4
...
...
@@ -18,8 +18,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
include
(
"vw_idx_inc.php"
);
echo
timesheets
(
-
1
);
include
(
"vw_idx_inc.php"
);
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