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
dotproject
timesheet
Commits
f8c72aef
Commit
f8c72aef
authored
Apr 20, 2007
by
Jean-Paul Saman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added GPLv2 header and copyright statements.
parent
07d054c5
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
398 additions
and
13 deletions
+398
-13
addedit.php
addedit.php
+20
-0
do_timesheet_aed.php
do_timesheet_aed.php
+19
-8
index.php
index.php
+19
-3
setup.php
setup.php
+20
-0
timesheet.class.php
timesheet.class.php
+218
-0
vw_idx_approved.php
vw_idx_approved.php
+20
-0
vw_idx_inc.php
vw_idx_inc.php
+20
-0
vw_idx_open.php
vw_idx_open.php
+20
-0
vw_idx_submitted.php
vw_idx_submitted.php
+21
-1
vw_idx_timesheets.php
vw_idx_timesheets.php
+21
-1
No files found.
addedit.php
View file @
f8c72aef
<?php
/*
* Copyright (C) 2007, M2X
*
* Authors: Jean-Paul Saman
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
$perms
=&
$AppUI
->
acl
();
// Create new timesheet or edit an existing one.
...
...
do_timesheet_aed.php
View file @
f8c72aef
<?php
// this doSQL script is called from the addedit.php script
// its purpose is to use the CTimesheet class to interoperate with the database (store, edit, delete)
/* the following variables can be retreived via POST from timesheet/addedit.php:
** int timesheet_id is '0' if a new database object has to be stored or the id of an existing quote that should be overwritten or deleted in the db
** int timesheet_period the period of the timesheet that should be stored
** int del bool flag, in case of presence the row with the given timesheet_id has to be dropped from db
*/
/*
* Copyright (C) 2007, M2X
*
* Authors: Jean-Paul Saman
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* 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
();
...
...
index.php
View file @
f8c72aef
<?php
// this is the index site for our timesheet module
// it is automatically appended on the applications main ./index.php
// by the dPframework
/*
* Copyright (C) 2007, M2X
*
* Authors: Jean-Paul Saman
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
$perms
=&
$AppUI
->
acl
();
...
...
setup.php
View file @
f8c72aef
...
...
@@ -7,6 +7,26 @@
* UI Name: Timesheet
* UI Icon:
*/
/*
* Copyright (C) 2007, M2X
*
* Authors: Jean-Paul Saman
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* 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
();
...
...
timesheet.class.php
0 → 100644
View file @
f8c72aef
<?php
/*
* Copyright (C) 2007, M2X
*
* Authors: Jean-Paul Saman
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* 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
{
// 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
;
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
()
{
$this
->
CDpObject
(
'timesheet'
,
'timesheet_id'
);
$this
->
timesheet_id
=
$_POST
[
"timesheet_id"
];
}
function
check
()
{
if
(
$this
->
timesheet_id
==
"0"
)
{
$this
->
init
();
}
return
NULL
;
}
function
init
()
{
$q
=
new
DBQuery
();
$q
->
addTable
(
'timesheet'
);
$q
->
addInsert
(
'timesheet_period,timesheet_status,timesheet_date,timesheet_creator,timesheet_worked'
,
$_POST
[
'timesheet_period'
]
.
','
.
$_POST
[
'timesheet_status'
]
.
','
.
$_POST
[
'timesheet_date'
]
.
','
.
$_POST
[
'timesheet_creator'
]
.
','
.
$_POST
[
'timesheet_worked'
],
true
);
$q
->
exec
();
$this
->
timesheet_id
=
db_insert_id
();
}
function
project_purge
()
{
$q
=
new
DBQuery
();
$q
->
setDelete
(
'timesheet_project'
);
$q
->
addWhere
(
'timesheet_id = '
.
$this
->
timesheet_id
);
if
(
!
$q
->
exec
())
return
db_error
();
}
function
project_store
()
{
// Get the current timesheet period
if
(
intval
(
$_POST
[
'timesheet_period'
]))
{
$period
=
new
CDate
();
$period
->
setMonth
(
$_POST
[
'timesheet_period'
]);
}
else
$period
=
new
CDate
();
$q
=
new
DBQuery
();
$q
->
addQuery
(
'project_id'
);
$q
->
addQuery
(
'project_name'
);
$q
->
addQuery
(
'project_status'
);
$q
->
addTable
(
'projects'
);
$q
->
addOrder
(
'project_name ASC'
);
$projects
=
$q
->
LoadList
();
foreach
(
$projects
as
$row
)
{
$t
=
new
DBQuery
;
$t
->
addQuery
(
'task_id'
);
$t
->
addQuery
(
'task_name'
);
$t
->
addQuery
(
'task_owner'
);
$t
->
addQuery
(
'task_start_date'
);
$t
->
addQuery
(
'task_hours_worked'
);
$t
->
addTable
(
'tasks'
);
$t
->
addWhere
(
'task_project = '
.
$row
[
"project_id"
]);
$t
->
addOrder
(
'task_start_date DESC'
);
$tasks
=
$t
->
LoadList
();
$t
->
Clear
();
$amount
=
0
;
foreach
(
$tasks
as
$item
)
{
// Query the task_log table for actual start dates.
$t
->
addQuery
(
'task_log_id'
);
$t
->
addQuery
(
'task_log_name'
);
$t
->
addQuery
(
'task_log_creator'
);
$t
->
addQuery
(
'task_log_date'
);
$t
->
addQuery
(
'task_log_hours'
);
$t
->
addTable
(
'task_log'
);
$t
->
addWhere
(
'task_log_task = '
.
$item
[
"task_id"
]);
// What if this is different then current user?
$t
->
addWhere
(
'task_log_creator = '
.
$this
->
timesheet_creator
);
$t
->
addOrder
(
'task_log_date DESC'
);
// TODO: select on user and date
$log
=
$t
->
LoadList
();
foreach
(
$log
as
$logitem
)
{
if
(
intval
(
$logitem
[
'task_log_date'
]))
{
$taskDate
=
new
CDate
(
$logitem
[
'task_log_date'
]);
if
(
$period
->
GetMonth
()
==
$taskDate
->
GetMonth
())
{
$amount
=
$amount
+
$logitem
[
"task_log_hours"
];
}
// else do not account the worked hours to the project for this month
}
}
}
$sheet
=
new
DBQuery
();
$sheet
->
addTable
(
'timesheet_project'
);
$sheet
->
addInsert
(
'timesheet_id,timesheet_project,timesheet_project_amount'
,
$this
->
timesheet_id
.
','
.
$row
[
"project_id"
]
.
','
.
$amount
,
true
);
if
(
!
$sheet
->
exec
())
{
echo
db_error
();
}
}
}
function
store
()
{
if
(
$this
->
timesheet_id
!=
0
)
{
$this
->
_action
=
'updated'
;
$q
=
new
DBQuery
();
$q
->
addTable
(
'timesheet'
);
$q
->
addUpdate
(
'timesheet_worked'
,
$this
->
timesheet_worked
);
$q
->
addWhere
(
'timesheet_id = '
.
$this
->
timesheet_id
);
if
(
!
$q
->
exec
())
{
echo
db_error
();
}
}
else
{
$q
=
new
DBQuery
;
$q
->
addTable
(
'timesheet'
);
$q
->
addInsert
(
'timesheet_period,timesheet_status,timesheet_date,timesheet_creator,timesheet_worked'
,
$this
->
timesheet_period
.
','
.
$this
->
timesheet_status
.
','
.
$this
->
timesheet_date
.
','
.
$this
->
timesheet_creator
.
','
.
$this
->
timesheet_worked
,
true
);
if
(
!
$q
->
exec
())
echo
db_error
();
}
}
// 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
();
$q
->
setDelete
(
'timesheet'
);
$q
->
addWhere
(
'timesheet_id = '
.
$this
->
timesheet_id
);
if
(
!
$q
->
exec
())
{
return
db_error
();
}
else
{
return
NULL
;
}
}
function
change_status
(
$stat
)
{
$msg
=
$this
->
check
();
$this
->
_action
=
'updated'
;
$q
=
new
DBQuery
();
$q
->
addTable
(
'timesheet'
);
$q
->
addUpdate
(
'timesheet_status'
,
$stat
);
$q
->
addWhere
(
'timesheet_id = '
.
$this
->
timesheet_id
);
if
(
!
$q
->
exec
())
{
return
db_error
();
}
if
(
$stat
>
0
)
{
$this
->
project_purge
();
$this
->
project_store
();
}
}
function
change_period
(
$period
)
{
$msg
=
$this
->
check
();
$this
->
_action
=
'updated'
;
$q
=
new
DBQuery
();
$q
->
addTable
(
'timesheet'
);
$q
->
addUpdate
(
'timesheet_period'
,
$period
);
$q
->
addWhere
(
'timesheet_id = '
.
$this
->
timesheet_id
);
if
(
!
$q
->
exec
())
{
return
db_error
();
}
}
}
?>
vw_idx_approved.php
View file @
f8c72aef
<?php
/*
* Copyright (C) 2007, M2X
*
* Authors: Jean-Paul Saman
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* 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
(
2
);
...
...
vw_idx_inc.php
View file @
f8c72aef
<?php
/*
* Copyright (C) 2007, M2X
*
* Authors: Jean-Paul Saman
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
function
timesheets
(
$type
)
{
GLOBAL
$AppUI
,
$canRead
,
$canEdit
,
$canDelete
;
...
...
vw_idx_open.php
View file @
f8c72aef
<?php
/*
* Copyright (C) 2007, M2X
*
* Authors: Jean-Paul Saman
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* 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
(
0
);
...
...
vw_idx_submitted.php
View file @
f8c72aef
<?php
<?php
/*
* Copyright (C) 2007, M2X
*
* Authors: Jean-Paul Saman
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* 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
);
...
...
vw_idx_timesheets.php
View file @
f8c72aef
<?php
<?php
/*
* Copyright (C) 2007, M2X
*
* Authors: Jean-Paul Saman
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* 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
);
...
...
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