4 * Class to show an overview of a user's maintainership, including apps maintained
12 function maintainerView($iUserId = null)
15 $this->iUserId
= $_SESSION['current']->iUserId
;
17 $this->iUserId
= $iUserId;
19 if(!$iUserId ||
$this->iUserId
== $_SESSION['current']->iUserId
)
20 $this->bViewingSelf
= true;
22 $this->bViewingSelf
= false;
25 function objectGetId()
27 return $this->iUserId
;
30 function addVersionRatingInfo($oTableRow, $oVersion)
32 $oTableRow->AddTextCell($oVersion->objectMakeLink());
35 $oTableCell = new TableCell($oVersion->sTestedRating
);
36 $oTableCell->SetClass($oVersion->sTestedRating
);
37 $oTableRow->AddCell($oTableCell);
38 $oTableCell = new TableCell($oVersion->sTestedRelease
);
39 $oTableCell->SetClass($oVersion->sTestedRating
);
40 $oTableRow->AddCell($oTableCell);
42 /* Get test reports submitted by the user */
43 $aTestData = testData
::getTestResultsForUser($this->iUserId
,
44 $oVersion->iVersionId
);
46 if(sizeof($aTestData))
48 $oTest = $aTestData[0];
49 $sUserRating = $oTest->sTestedRating
;
50 $sUserRelease = $oTest->sTestedRelease
;
57 $oTableCell = new TableCell($sUserRating);
58 $oTableCell->SetClass($sUserRating);
59 $oTableRow->AddCell($oTableCell);
60 $oTableCell = new TableCell($sUserRelease);
61 $oTableCell->SetClass($sUserRating);
62 $oTableRow->AddCell($oTableCell);
67 /* Shows a detailed vis of the user's maintained applications,
68 including last tested release & rating */
71 $oUser = new user($this->iUserId
);
73 $aMaintainedApps = maintainer
::getAppsMaintained($oUser);
74 if(!$aMaintainedApps ||
!sizeof($aMaintainedApps))
76 if($this->bViewingSelf
)
77 echo '<p>You do not maintain any apps</p>';
79 echo "<p>{$oUser->sRealname} does not maintain any apps</p>";
83 if($this->bViewingSelf
)
84 echo '<p>Viewing your maintained apps</p>';
86 echo "<p>Viewing {$oUser->sRealname}'s maintained apps</p>";
88 $oTable = new Table();
89 $oTableRow = new TableRow();
90 $oTableRow->setClass('color4');
91 $oTable->setCellSpacing(0);
92 $oTable->setCellPadding(3);
93 $oTableRow->AddTextCell('Application');
94 $oTableRow->AddTextCell('Version');
95 $oTableRow->AddTextCell('Current Rating');
96 $oTableRow->AddTextCell('Current Version');
97 $oTableRow->AddTextCell($this->bViewingSelf ?
'Your Rating' : "User's Rating");
98 $oTableRow->AddTextCell($this->bViewingSelf ?
'Your Version' : "User's Version");
99 $oTable->AddRow($oTableRow);
102 while(list($iIndex, list($iAppId, $iVersionId, $bSuperMaintainer)) = each($aMaintainedApps))
104 $oApp = new application($iAppId);
105 $aVersions = array();
107 $oTableRow = new TableRow();
108 $oTableRow->AddTextCell($oApp->objectMakeLink());
110 $oTableRow->SetClass(($i %
2) ?
'color0' : 'color1');
115 $oVersion = new version($iVersionId);
116 $oTableRow = maintainerView
::addVersionRatingInfo($oTableRow, $oVersion);
117 $oTable->AddRow($oTableRow);
120 $aVersions = $oApp->getVersions(true);
121 $oTableRow->AddTextCell('*');
122 $oTableRow->AddTextCell('');
123 $oTableRow->AddTextCell('');
124 $oTableRow->AddTextCell('');
125 $oTableRow->AddTextCell('');
126 $oTable->AddRow($oTableRow);
129 foreach($aVersions as $oVersion)
131 $oTableRow = new TableRow($oTableRow);
132 $oTableRow->AddTextCell('');
133 $oTableRow = maintainerView
::addVersionRatingInfo($oTableRow, $oVersion);
135 $oTableRow->SetClass(($i %
2) ?
'color0' : 'color1');
138 $oTable->AddRow($oTableRow);
141 echo $oTable->GetString();