diff options
author | wei <> | 2006-07-28 12:32:01 +0000 |
---|---|---|
committer | wei <> | 2006-07-28 12:32:01 +0000 |
commit | 623447ffea7a49359c773a0bc3a851397885f319 (patch) | |
tree | 93676acdeea5697dd00fb10d0eb70948901b549e /demos/time-tracker/protected/App_Code/Dao/ReportsDao.php | |
parent | fbf05a159bc1a688940c16dc304eaaf140188b01 (diff) |
Add sqlite support for time-tracker.
Diffstat (limited to 'demos/time-tracker/protected/App_Code/Dao/ReportsDao.php')
-rw-r--r-- | demos/time-tracker/protected/App_Code/Dao/ReportsDao.php | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/demos/time-tracker/protected/App_Code/Dao/ReportsDao.php b/demos/time-tracker/protected/App_Code/Dao/ReportsDao.php new file mode 100644 index 00000000..50005d06 --- /dev/null +++ b/demos/time-tracker/protected/App_Code/Dao/ReportsDao.php @@ -0,0 +1,87 @@ +<?php
+
+class ProjectReport extends TComponent
+{
+ public $ProjectName = '';
+ public $EstimateHours = 0;
+ public $EstimateCompletion = 0;
+ public $Categories;
+
+ public function __construct()
+ {
+ $this->Categories = new TList;
+ }
+
+ public function getActualHours()
+ {
+ $total = 0;
+ foreach($this->Categories as $cat)
+ $total += $cat->getActualHours();
+ return $total;
+ }
+}
+
+class CategoryReport extends TComponent
+{
+ public $CategoryName = '';
+ public $EstimateHours = 0;
+ public $members = array();
+
+ public function getActualHours()
+ {
+ $total = 0;
+ foreach($this->members as $member)
+ $total += $member['hours'];
+ return $total;
+ }
+}
+
+class UserReport extends TComponent
+{
+ public $Username;
+ public $Projects = array();
+
+ public function getTotalHours()
+ {
+ $hours = 0;
+ foreach($this->Projects as $project)
+ $hours += $project->Duration;
+ return $hours;
+ }
+}
+
+class UserProjectReport
+{
+ public $ProjectName = '';
+ public $CategoryName = '';
+ public $Duration = 0;
+ public $Description='';
+ public $ReportDate=0;
+}
+
+class ReportsDao extends BaseDao
+{
+ public function getTimeReportsByProjectIDs($projects)
+ {
+ $ids = implode(',', array_map('intval', $projects));
+ $sqlmap = $this->getConnection();
+ return $sqlmap->queryForList('GetTimeReportByProjectIDs', $ids);
+ }
+
+ public function getUserProjectTimeReports($users, $projects, $startDate, $endDate)
+ {
+ $sqlmap = $this->getConnection();
+ $driver = $sqlmap->openConnection();
+ $ids = implode(',', array_map('intval', $projects));
+ $usernames = implode(',', array_map(array($driver, 'quote'), $users));
+
+ $param['projects'] = $ids;
+ $param['members'] = $usernames;
+ $param['startDate'] = intval($startDate);
+ $param['endDate'] = intval($endDate);
+
+ return $sqlmap->queryForList('GetTimeReportByUsername', $param);
+ }
+}
+
+?>
\ No newline at end of file |