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.php27
1 files changed, 13 insertions, 14 deletions
diff --git a/demos/time-tracker/protected/App_Code/Dao/ReportsDao.php b/demos/time-tracker/protected/App_Code/Dao/ReportsDao.php
index 50005d06..3e5b6456 100644
--- a/demos/time-tracker/protected/App_Code/Dao/ReportsDao.php
+++ b/demos/time-tracker/protected/App_Code/Dao/ReportsDao.php
@@ -6,12 +6,12 @@ class ProjectReport extends TComponent
public $EstimateHours = 0;
public $EstimateCompletion = 0;
public $Categories;
-
+
public function __construct()
{
$this->Categories = new TList;
}
-
+
public function getActualHours()
{
$total = 0;
@@ -26,21 +26,21 @@ 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;
@@ -64,24 +64,23 @@ class ReportsDao extends BaseDao
public function getTimeReportsByProjectIDs($projects)
{
$ids = implode(',', array_map('intval', $projects));
- $sqlmap = $this->getConnection();
- return $sqlmap->queryForList('GetTimeReportByProjectIDs', $ids);
+ $sqlmap = $this->getSqlMap();
+ return $sqlmap->queryForList('GetTimeReportByProjectIDs', $ids);
}
-
+
public function getUserProjectTimeReports($users, $projects, $startDate, $endDate)
{
- $sqlmap = $this->getConnection();
- $driver = $sqlmap->openConnection();
+ $sqlmap = $this->getSqlMap();
$ids = implode(',', array_map('intval', $projects));
- $usernames = implode(',', array_map(array($driver, 'quote'), $users));
-
+ $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