1: 2: 3:
4:
5: <?php
6:
7: require_once('../../qcubed.inc.php');
8:
9: class RecordsSummary extends QPanel {
10: public $dtgRecordsSummary;
11:
12: protected $objParentObject;
13:
14:
15: protected $objProject;
16:
17:
18: public function __construct($objParentObject, Project $objProject, $strControlId = null) {
19: try {
20: parent::__construct($objParentObject, $strControlId);
21:
22:
23:
24:
25:
26:
27: $this->Template = 'records.summary.tpl.php';
28:
29:
30:
31: $this->objParentObject = $objParentObject;
32: $this->objProject = $objProject;
33:
34:
35: $this->dtgRecordsSummary = new QDataGrid($this);
36:
37: $this->dtgRecordsSummary->Paginator = new QPaginator($this->dtgRecordsSummary);
38:
39: $this->dtgRecordsSummary->ItemsPerPage = 5;
40:
41: $this->dtgRecordsSummary->SetDataBinder('dtgRecordsSummary_Bind', $this);
42:
43:
44:
45: $this->dtgRecordsSummary->CreateCallableColumn ('Person', [$this, 'render_PersonColumn']);
46: $col = $this->dtgRecordsSummary->CreateNodeColumn('Id', QQN::Person()->Id);
47: $col->CellStyler->Width = 120;
48:
49: } catch (QCallerException $objExc) {
50: $objExc->IncrementOffset();
51: throw $objExc;
52: }
53: }
54:
55: public function render_PersonColumn(Person $objPerson) {
56: return $objPerson->FirstName . ' ' . $objPerson->LastName;
57: }
58:
59: public function dtgRecordsSummary_Bind() {
60:
61:
62:
63: $objClauses = array();
64:
65:
66:
67: if ($objClause = $this->dtgRecordsSummary->OrderByClause) {
68: array_push($objClauses, $objClause);
69: }
70:
71:
72:
73: if ($objClause = $this->dtgRecordsSummary->LimitClause)
74: array_push($objClauses, $objClause);
75:
76:
77: $team_array = $this->objProject->GetPersonAsTeamMemberArray
78: (QQ::Clause($this->dtgRecordsSummary->OrderByClause));
79: $this->dtgRecordsSummary->TotalItemCount = count($team_array);
80:
81: $this->dtgRecordsSummary->DataSource = $this->objProject->GetPersonAsTeamMemberArray
82: (QQ::Clause($this->dtgRecordsSummary->OrderByClause), $objClauses);
83:
84: }
85:
86: }
87: ?>
88: