summaryrefslogtreecommitdiff
path: root/demos/time-tracker/protected/pages/TimeTracker/ReportProject.php
blob: fea372be8192b01f3c200ad3f8220064b7c0208f (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 ReportProject extends TPage
{
	protected function getProjects()
	{
		$projectDao = $this->Application->Modules['daos']->getDao('ProjectDao');
		$projects = array();
		foreach($projectDao->getAllProjects() as $project)
				$projects[$project->ID] = $project->Name;
		return $projects;
	}
	
	public function onLoad($param)
	{
		if(!$this->IsPostBack)
		{
			$this->projectList->DataSource = $this->getProjects();
			$this->dataBind();	
		}
	}
	
	public function generateReport_Clicked($sender, $param)
	{
		$reportDao = $this->Application->Modules['daos']->getDao('ReportDao');
		$reports = $reportDao->getTimeReportsByProjectIDs($this->projectList->SelectedValues);
		$this->views->ActiveViewIndex = 1;
		$this->projects->DataSource = $reports;
		$this->projects->dataBind();
	}
	
	public function project_itemCreated($sender, $param)
	{
		$item = $param->Item;
		if($item->ItemType==='Item' || $item->ItemType==='AlternatingItem')
			$item->category->DataSource = $item->DataItem->Categories;
	}
	
	public function category_itemCreated($sender, $param)
	{
		$item = $param->Item;
		if($item->ItemType==='Item' || $item->ItemType==='AlternatingItem')
			$item->members->DataSource = $item->DataItem->members;
	}
}

?>