Subversion-Projekte lars-tiefland.prado

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?php
2
 
3
class ProjectReport extends TComponent
4
{
5
	public $ProjectName = '';
6
	public $EstimateHours = 0;
7
	public $EstimateCompletion = 0;
8
	public $Categories;
9
 
10
	public function __construct()
11
	{
12
		$this->Categories = new TList;
13
	}
14
 
15
	public function getActualHours()
16
	{
17
		$total = 0;
18
		foreach($this->Categories as $cat)
19
			$total += $cat->getActualHours();
20
		return $total;
21
	}
22
}
23
 
24
class CategoryReport extends TComponent
25
{
26
	public $CategoryName = '';
27
	public $EstimateHours = 0;
28
	public $members = array();
29
 
30
	public function getActualHours()
31
	{
32
		$total = 0;
33
		foreach($this->members as $member)
34
			$total += $member['hours'];
35
		return $total;
36
	}
37
}
38
 
39
class UserReport extends TComponent
40
{
41
	public $Username;
42
	public $Projects = array();
43
 
44
	public function getTotalHours()
45
	{
46
		$hours = 0;
47
		foreach($this->Projects as $project)
48
			$hours += $project->Duration;
49
		return $hours;
50
	}
51
}
52
 
53
class UserProjectReport
54
{
55
	public $ProjectName = '';
56
	public $CategoryName = '';
57
	public $Duration = 0;
58
	public $Description='';
59
	public $ReportDate=0;
60
}
61
 
62
class ReportsDao extends BaseDao
63
{
64
	public function getTimeReportsByProjectIDs($projects)
65
	{
66
		$ids = implode(',', array_map('intval', $projects));
67
		$sqlmap = $this->getSqlMap();
68
		return $sqlmap->queryForList('GetTimeReportByProjectIDs', $ids);
69
	}
70
 
71
	public function getUserProjectTimeReports($users, $projects, $startDate, $endDate)
72
	{
73
		$sqlmap = $this->getSqlMap();
74
		$ids = implode(',', array_map('intval', $projects));
75
		$sqlmap->getDbConnection()->setActive(true); //db connection needs to be open for quoteString
76
		$usernames = implode(',', array_map(array($sqlmap->getDbConnection(), 'quoteString'), $users));
77
 
78
		$param['projects'] = $ids;
79
		$param['members'] = $usernames;
80
		$param['startDate'] = intval($startDate);
81
		$param['endDate'] = intval($endDate);
82
 
83
		return $sqlmap->queryForList('GetTimeReportByUsername', $param);
84
	}
85
}
86
 
87
?>