diff options
author | wei <> | 2006-07-28 06:06:32 +0000 |
---|---|---|
committer | wei <> | 2006-07-28 06:06:32 +0000 |
commit | 5fc75a5f53fa07971b604c5318da5bf07379ef89 (patch) | |
tree | 2a88f91df64f0182e245e3b87ee3c2658fdc06aa /demos/time-tracker/protected/App_Code | |
parent | caa348ceabba58447bf8deddb8c6316ff3dc88ce (diff) |
Complete Time-Tracker demo app.
Diffstat (limited to 'demos/time-tracker/protected/App_Code')
-rw-r--r-- | demos/time-tracker/protected/App_Code/ReportsDao.php | 99 | ||||
-rw-r--r-- | demos/time-tracker/protected/App_Code/UserReport.php | 10 | ||||
-rw-r--r-- | demos/time-tracker/protected/App_Code/UserReportsDao.php | 26 |
3 files changed, 99 insertions, 36 deletions
diff --git a/demos/time-tracker/protected/App_Code/ReportsDao.php b/demos/time-tracker/protected/App_Code/ReportsDao.php new file mode 100644 index 00000000..8d2e2627 --- /dev/null +++ b/demos/time-tracker/protected/App_Code/ReportsDao.php @@ -0,0 +1,99 @@ +<?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 getUserTimeReport($username)
+ {
+ $sqlmap = $this->getConnection();
+ return $sqlmap->queryForObject('GetTimeReportByUsername', $username);
+ }
+
+ public function getTimeReportsByCategoryID($categoryID)
+ {
+ $sqlmap = $this->getConnection();
+ return $sqlmap->queryForList('GetTimeReportByCategoryID', $categoryID);
+ }
+
+ 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 diff --git a/demos/time-tracker/protected/App_Code/UserReport.php b/demos/time-tracker/protected/App_Code/UserReport.php deleted file mode 100644 index d37de934..00000000 --- a/demos/time-tracker/protected/App_Code/UserReport.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php
-
-class UserReport
-{
- public $CategoryName = '';
- public $users = array();
- public $ProjectName = '';
-}
-
-?>
\ No newline at end of file diff --git a/demos/time-tracker/protected/App_Code/UserReportsDao.php b/demos/time-tracker/protected/App_Code/UserReportsDao.php deleted file mode 100644 index c6eab660..00000000 --- a/demos/time-tracker/protected/App_Code/UserReportsDao.php +++ /dev/null @@ -1,26 +0,0 @@ -<?php
-
-class UserReportsDao extends BaseDao
-{
- public function getUserTimeReport($username)
- {
- $sqlmap = $this->getConnection();
- return $sqlmap->queryForObject('GetTimeReportByUsername', $username);
- }
-
- public function getTimeReportsByCategoryID($categoryID)
- {
- $sqlmap = $this->getConnection();
- return $sqlmap->queryForList('GetTimeReportByCategoryID', $categoryID);
- }
-
- public function getTimeReportsByProjectIDs($projects)
- {
- $ids = implode(',', array_map('intval', $projects));
- $sqlmap = $this->getConnection();
- return $sqlmap->queryForList('GetTimeReportByProjectIDs', $ids);
- }
-
-}
-
-?>
\ No newline at end of file |