From 5fc75a5f53fa07971b604c5318da5bf07379ef89 Mon Sep 17 00:00:00 2001 From: wei <> Date: Fri, 28 Jul 2006 06:06:32 +0000 Subject: Complete Time-Tracker demo app. --- .../time-tracker/protected/App_Code/ReportsDao.php | 99 ++++++++++++++++++++++ .../time-tracker/protected/App_Code/UserReport.php | 10 --- .../protected/App_Code/UserReportsDao.php | 26 ------ demos/time-tracker/protected/application.xml | 4 +- .../protected/pages/TimeTracker/Login.php | 16 ---- .../protected/pages/TimeTracker/ReportProject.page | 75 +++++++++++++++- .../pages/TimeTracker/ReportResource.page | 81 ++++++++++++++++++ 7 files changed, 255 insertions(+), 56 deletions(-) create mode 100644 demos/time-tracker/protected/App_Code/ReportsDao.php delete mode 100644 demos/time-tracker/protected/App_Code/UserReport.php delete mode 100644 demos/time-tracker/protected/App_Code/UserReportsDao.php (limited to 'demos') 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 @@ +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 @@ - \ 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 @@ -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 diff --git a/demos/time-tracker/protected/application.xml b/demos/time-tracker/protected/application.xml index 97e26ae8..1622073e 100644 --- a/demos/time-tracker/protected/application.xml +++ b/demos/time-tracker/protected/application.xml @@ -1,5 +1,5 @@ - + @@ -18,7 +18,7 @@ - + diff --git a/demos/time-tracker/protected/pages/TimeTracker/Login.php b/demos/time-tracker/protected/pages/TimeTracker/Login.php index d8c5182f..aa12e716 100644 --- a/demos/time-tracker/protected/pages/TimeTracker/Login.php +++ b/demos/time-tracker/protected/pages/TimeTracker/Login.php @@ -1,7 +1,4 @@ Application->Modules['ezpdo']->getConnection(); - //$cats = $ezpdo->find('from TimeEntryCategory'); - $category = $ezpdo->create('TimeEntryCategory'); - //$category->Name = "Category 1"; - //$category->Abbreviation = "CAT1"; - var_dump($category); - //$ezpdo->commit($category); - } - /** * Validates the username and password. * @param TControl custom validator that created the event. diff --git a/demos/time-tracker/protected/pages/TimeTracker/ReportProject.page b/demos/time-tracker/protected/pages/TimeTracker/ReportProject.page index 50345afa..38c8d86d 100644 --- a/demos/time-tracker/protected/pages/TimeTracker/ReportProject.page +++ b/demos/time-tracker/protected/pages/TimeTracker/ReportProject.page @@ -1,15 +1,86 @@

Project Reports

-
+
Project Report + Text="Select a project. Use ctrl+click to select multiple projects at once: "/> + + + + + + + + + + + + + + + + + + + + + + + + + +
Project NameEst. HoursActual HoursEst. Completion
<%# $this->DataItem->ProjectName %><%# $this->DataItem->EstimateHours %><%# $this->DataItem->ActualHours %> + DataItem->EstimateCompletion %> /> +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + +
CategoryEst. HoursActual Hours
<%# $this->DataItem->CategoryName %><%# $this->DataItem->EstimateHours %><%# $this->DataItem->ActualHours %>
+ <%# $this->DataItem['username'] %> + + <%# $this->DataItem['hours'] %> +
+ + +
+
+ + + + + +
diff --git a/demos/time-tracker/protected/pages/TimeTracker/ReportResource.page b/demos/time-tracker/protected/pages/TimeTracker/ReportResource.page index 4d8b7b17..5e112505 100644 --- a/demos/time-tracker/protected/pages/TimeTracker/ReportResource.page +++ b/demos/time-tracker/protected/pages/TimeTracker/ReportResource.page @@ -1,4 +1,85 @@

Resource Report

+
+ Resource Report + + +

STEP 1 - Select project(s)

+ + +

STEP 2 - Select resource(s)

+ + +

STEP 3 - Select a date range

+
+ + + InputMode="DropDownList" /> +
+
+ + +
+
+ +
+
+ + +

Beginning Date

+

<%= $this->dateFrom->Date %>

+

Ending Date

+

<%= $this->dateTo->Date %>

+ + + + + + + + + + + + +
ConsultantTotal Hours
<%# $this->DataItem->Username %><%# $this->DataItem->TotalHours %>
+ + + + + + + + + + + + + +
Reported DateProject NameCategory NameDurationDescription
+ + + + DataItem->ReportDate %> /> + + <%# $this->DataItem->ProjectName %> + <%# $this->DataItem->CategoryName %> + <%# $this->DataItem->Duration %> + <%# $this->DataItem->Description %> + + +
+
+
+ +
+ +
+
\ No newline at end of file -- cgit v1.2.3