summaryrefslogtreecommitdiff
path: root/demos/time-tracker/protected/App_Code/TimeEntryDao.php
blob: 60301f3bab63a48f618f02e7c2f0f94d33acb6b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php

class TimeEntryDao extends BaseDao
{
	public function addNewTimeEntry($entry)
	{
		$sqlmap = $this->getConnection();
		$sqlmap->insert('AddNewTimeEntry', $entry);	
	}
	
	public function getTimeEntryByID($entryID)
	{
		$sqlmap = $this->getConnection();
		return $sqlmap->queryForObject('GetTimeEntryByID', $entryID);	
	}
	
	public function deleteTimeEntry($entryID)
	{
		$sqlmap = $this->getConnection();
		$sqlmap->delete('DeleteTimeEntry', $entryID);
	}
	
	public function getTimeEntriesInProject($username, $projectID)
	{
		$sqlmap = $this->getConnection();
		$param['username'] = $username;
		$param['project'] = $projectID;
		return $sqlmap->queryForList('GetAllTimeEntriesByProjectIdAndUser', $param);
	}
	
	public function updateTimeEntry($entry)
	{
		$sqlmap = $this->getConnection();
		$sqlmap->update('UpdateTimeEntry', $entry);
	}
	
	public function getTimeEntriesByDate($username, $start, $end)
	{
		$sqlmap = $this->getConnection();
		$param['username'] = $username;
		$param['startDate'] = $start;
		$param['endDate'] = $end;
		return $sqlmap->queryForList('GetTimeEntriesByDate', $param);	
	}
}

?>