summaryrefslogtreecommitdiff
path: root/demos/time-tracker/protected/App_Code/Dao/ReportsDao.php
diff options
context:
space:
mode:
Diffstat (limited to 'demos/time-tracker/protected/App_Code/Dao/ReportsDao.php')
-rw-r--r--demos/time-tracker/protected/App_Code/Dao/ReportsDao.php172
1 files changed, 86 insertions, 86 deletions
diff --git a/demos/time-tracker/protected/App_Code/Dao/ReportsDao.php b/demos/time-tracker/protected/App_Code/Dao/ReportsDao.php
index 15d0c2a3..c03dd81d 100644
--- a/demos/time-tracker/protected/App_Code/Dao/ReportsDao.php
+++ b/demos/time-tracker/protected/App_Code/Dao/ReportsDao.php
@@ -1,87 +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->getSqlMap();
- return $sqlmap->queryForList('GetTimeReportByProjectIDs', $ids);
- }
-
- public function getUserProjectTimeReports($users, $projects, $startDate, $endDate)
- {
- $sqlmap = $this->getSqlMap();
- $ids = implode(',', array_map('intval', $projects));
- $sqlmap->getDbConnection()->setActive(true); //db connection needs to be open for quoteString
- $usernames = implode(',', array_map(array($sqlmap->getDbConnection(), 'quoteString'), $users));
-
- $param['projects'] = $ids;
- $param['members'] = $usernames;
- $param['startDate'] = intval($startDate);
- $param['endDate'] = intval($endDate);
-
- return $sqlmap->queryForList('GetTimeReportByUsername', $param);
- }
-}
-
+<?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->getSqlMap();
+ return $sqlmap->queryForList('GetTimeReportByProjectIDs', $ids);
+ }
+
+ public function getUserProjectTimeReports($users, $projects, $startDate, $endDate)
+ {
+ $sqlmap = $this->getSqlMap();
+ $ids = implode(',', array_map('intval', $projects));
+ $sqlmap->getDbConnection()->setActive(true); //db connection needs to be open for quoteString
+ $usernames = implode(',', array_map(array($sqlmap->getDbConnection(), 'quoteString'), $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