summaryrefslogtreecommitdiff
path: root/demos/time-tracker
diff options
context:
space:
mode:
Diffstat (limited to 'demos/time-tracker')
-rw-r--r--demos/time-tracker/protected/App_Code/ReportsDao.php99
-rw-r--r--demos/time-tracker/protected/App_Code/UserReport.php10
-rw-r--r--demos/time-tracker/protected/App_Code/UserReportsDao.php26
-rw-r--r--demos/time-tracker/protected/application.xml4
-rw-r--r--demos/time-tracker/protected/pages/TimeTracker/Login.php16
-rw-r--r--demos/time-tracker/protected/pages/TimeTracker/ReportProject.page75
-rw-r--r--demos/time-tracker/protected/pages/TimeTracker/ReportResource.page81
7 files changed, 255 insertions, 56 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
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 @@
<?xml version="1.0" encoding="utf-8"?>
-<application id="Database" Mode="Performance">
+<application id="Database" Mode="Debug">
<!-- configure to use Quickstart theme directory -->
<paths>
@@ -18,7 +18,7 @@
<dao id="ProjectDao" class="Application.App_Code.ProjectDao" />
<dao id="TimeEntryDao" class="Application.App_Code.TimeEntryDao" />
<dao id="CategoryDao" class="Application.App_Code.CategoryDao" />
- <dao id="ReportDao" class="Application.App_Code.UserReportsDao" />
+ <dao id="ReportDao" class="Application.App_Code.ReportsDao" />
</module>
</modules>
<services>
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 @@
<?php
-
-Prado::using('Application.App_Data.ezpdo.Models.*');
-
/**
* Login Page class file.
*
@@ -26,19 +23,6 @@ Prado::using('Application.App_Data.ezpdo.Models.*');
*/
class Login extends TPage
{
-
- function onLoad($param)
- {
- //$category = new TimeEntryCategory();
- $ezpdo = $this->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 @@
<com:TContent ID="Main">
<h2>Project Reports</h2>
-<fieldset>
+<fieldset class="project-report">
<legend>Project Report</legend>
<com:TMultiView ID="views" ActiveViewIndex="0">
<com:TView>
<com:TLabel ForControl="projectList"
- Text="Select a project. Use ctrl+click to select multiple resources at once: "/>
+ Text="Select a project. Use ctrl+click to select multiple projects at once: "/>
<com:TListBox ID="projectList" CssClass="projects" SelectionMode="Multiple" />
<com:TButton Text="Generate Report" OnClick="generateReport_Clicked"/>
</com:TView>
+ <com:TView>
+ <com:TRepeater ID="projects" onItemCreated="project_itemCreated" EnableViewState="false">
+ <prop:ItemTemplate>
+ <!-- project -->
+ <table class="project">
+ <tr>
+ <th>Project Name</th>
+ <th>Est. Hours</th>
+ <th>Actual Hours</th>
+ <th>Est. Completion</th>
+ </tr>
+ <tr>
+ <td><%# $this->DataItem->ProjectName %></td>
+ <td><%# $this->DataItem->EstimateHours %></td>
+ <td><%# $this->DataItem->ActualHours %></td>
+ <td>
+ <com:System.I18N.TDateFormat
+ Pattern="dd/MM/yyyy"
+ Value=<%# $this->DataItem->EstimateCompletion %> />
+ </td>
+ </tr>
+
+ <com:TRepeater ID="category" onItemCreated="Page.category_itemCreated" EnableViewState="false">
+ <prop:HeaderTemplate>
+ <tr><td></td><td colspan="2">
+ </prop:HeaderTemplate>
+ <prop:FooterTemplate>
+ </tr></td><td></td>
+ </prop:FooterTemplate>
+ <prop:ItemTemplate>
+
+ <!-- category -->
+ <table class="category">
+ <tr>
+ <th>Category</th>
+ <th>Est. Hours</th>
+ <th>Actual Hours</th>
+ </tr>
+ <tr>
+ <td><%# $this->DataItem->CategoryName %></td>
+ <td><%# $this->DataItem->EstimateHours %></td>
+ <td><%# $this->DataItem->ActualHours %></td>
+ </tr>
+
+
+ <com:TRepeater ID="members" EnableViewState="false">
+ <prop:ItemTemplate>
+ <!-- member -->
+ <tr>
+ <td colspan="2">
+ <%# $this->DataItem['username'] %>
+ </td>
+ <td>
+ <%# $this->DataItem['hours'] %>
+ </td>
+ </tr>
+ <!-- //member -->
+ </prop:ItemTemplate>
+ </com:TRepeater>
+
+ </table>
+ <!-- //category -->
+
+ </prop:ItemTemplate>
+ </com:TRepeater>
+
+ </table>
+ <!-- //project -->
+ </prop:ItemTemplate>
+ </com:TRepeater>
+ </com:TView>
</com:TMultiView>
</fieldset>
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 @@
<com:TContent ID="Main">
<h1>Resource Report</h1>
+<fieldset class="resource-report">
+ <legend>Resource Report</legend>
+ <com:TMultiView ID="views" ActiveViewIndex="0">
+ <com:TView>
+ <h2>STEP 1 - Select project(s)</h2>
+ <com:TLabel ForControl="projectList"
+ Text="Select a project. Use ctrl+click to select multiple projects at once: "/>
+ <com:TListBox ID="projectList" CssClass="projects" SelectionMode="Multiple" />
+ <h2>STEP 2 - Select resource(s)</h2>
+ <com:TLabel ForControl="resourceList"
+ Text="Select a resource. Use ctrl+click to select multiple resources at once: "/>
+ <com:TListBox ID="resourceList" CssClass="resource" SelectionMode="Multiple" />
+ <h2>STEP 3 - Select a date range</h2>
+ <div class="date-from">
+ <com:TLabel ForControl="dateFrom" Text="Dates from:"/>
+ <com:TDatePicker id="dateFrom"
+ TimeStamp=<%= strtotime("-1 year") %>
+ InputMode="DropDownList" />
+ </div>
+ <div class="date-to">
+ <com:TLabel ForControl="dateTo" Text="to:"/>
+ <com:TDatePicker id="dateTo" InputMode="DropDownList"/>
+ </div>
+ <div class="buttons">
+ <com:TButton Text="Generate Report" Onclick="generateReport_Clicked"/>
+ </div>
+ </com:TView>
+
+ <com:TView>
+ <h3>Beginning Date</h3>
+ <h4><%= $this->dateFrom->Date %></h4>
+ <h3>Ending Date</h3>
+ <h4><%= $this->dateTo->Date %></h4>
+
+ <com:TRepeater ID="resource_report" OnItemCreated="resource_report_itemCreated" EnableViewState="false">
+ <prop:ItemTemplate>
+ <table class="resource">
+ <tr>
+ <th>Consultant</th>
+ <th>Total Hours</th>
+ </tr>
+ <tr>
+ <td><%# $this->DataItem->Username %></td>
+ <td><%# $this->DataItem->TotalHours %></td>
+ </tr>
+ </table>
+
+ <com:TRepeater ID="time_entries">
+ <prop:HeaderTemplate>
+ <table>
+ <tr>
+ <th>Reported Date</th>
+ <th>Project Name</th>
+ <th>Category Name</th>
+ <th>Duration</th>
+ <th>Description</th>
+ </tr>
+ </prop:HeaderTemplate>
+ <prop:FooterTemplate>
+ </table>
+ </prop:FooterTemplate>
+ <prop:ItemTemplate>
+ <tr>
+ <td><com:System.I18N.TDateFormat
+ Pattern="dd/MM/yyyy"
+ Value=<%# $this->DataItem->ReportDate %> />
+ </td>
+ <td><%# $this->DataItem->ProjectName %></td>
+ <td><%# $this->DataItem->CategoryName %></td>
+ <td><%# $this->DataItem->Duration %></td>
+ <td><%# $this->DataItem->Description %></td>
+ </tr>
+ </prop:ItemTemplate>
+ </com:TRepeater>
+ </prop:ItemTemplate>
+ </com:TRepeater>
+
+ </com:TView>
+
+ </com:TMultiView>
+</fieldset>
</com:TContent> \ No newline at end of file